diff src/dispnew.c @ 554:e14686fb979e

*** empty log message ***
author Jim Blandy <jimb@redhat.com>
date Thu, 20 Feb 1992 04:15:20 +0000
parents 937bccff8155
children 1c2d1836941a
line wrap: on
line diff
--- a/src/dispnew.c	Wed Feb 19 20:21:27 1992 +0000
+++ b/src/dispnew.c	Thu Feb 20 04:15:20 1992 +0000
@@ -24,37 +24,6 @@
 #include <stdio.h>
 #include <ctype.h>
 
-#ifdef NEED_TIME_H
-#include <time.h>
-#else /* not NEED_TIME_H */
-#ifdef HAVE_TIMEVAL
-#include <sys/time.h>
-#endif /* HAVE_TIMEVAL */
-#endif /* not NEED_TIME_H */
-
-#ifdef HAVE_TERMIO
-#include <termio.h>
-#ifdef TCOUTQ
-#undef TIOCOUTQ
-#define TIOCOUTQ TCOUTQ
-#endif /* TCOUTQ defined */
-#include <fcntl.h>
-#else
-#ifndef VMS
-#include <sys/ioctl.h>
-#endif /* not VMS */
-#endif /* not HAVE_TERMIO */
-
-/* Allow m- file to inhibit use of FIONREAD.  */
-#ifdef BROKEN_FIONREAD
-#undef FIONREAD
-#endif
-
-/* Interupt input is not used if there is no FIONREAD.  */
-#ifndef FIONREAD
-#undef SIGIO
-#endif
-
 #include "termchar.h"
 #include "termopts.h"
 #include "cm.h"
@@ -67,6 +36,9 @@
 #include "disptab.h"
 #include "indent.h"
 
+#include "systerm.h"
+#include "systime.h"
+
 #ifdef HAVE_X_WINDOWS
 #include "xterm.h"
 #endif	/* HAVE_X_WINDOWS */
@@ -81,8 +53,8 @@
 #define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_ptr - (FILE)->_base)
 #endif
 
-/* Nonzero means do not assume anything about current
-   contents of actual terminal screen */
+/* Nonzero upon entry to redisplay means do not assume anything about
+   current contents of actual terminal screen; clear and redraw it.  */
 
 int screen_garbaged;
 
@@ -1052,8 +1024,8 @@
 		  fflush (stdout);
 		  if (preempt_count == 1)
 		    {
-#ifdef TIOCOUTQ
-		      if (ioctl (0, TIOCOUTQ, &outq) < 0)
+#ifdef EMACS_OUTQSIZE
+		      if (EMACS_OUTQSIZE (0, &outq) < 0)
 			/* Probably not a tty.  Ignore the error and reset
 			 * the outq count. */
 			outq = PENDING_OUTPUT_COUNT (stdout);
@@ -1809,9 +1781,7 @@
      Lisp_Object n, millisec;
 {
 #ifndef subprocesses
-#ifdef HAVE_TIMEVAL
-  struct timeval timeout, end_time, garbage1;
-#endif /* HAVE_TIMEVAL */
+  EMACS_TIME timeout, end_time;
 #endif /* no subprocesses */
   int usec = 0;
   int sec;
@@ -1823,7 +1793,7 @@
 
   if (!NILP (millisec))
     {
-#ifndef HAVE_TIMEVAL
+#ifndef EMACS_HAS_USECS
       error ("millisecond sit-for not supported on %s", SYSTEM_TYPE);
 #else
       usec = sec % 1000 * 1000;
@@ -1844,29 +1814,18 @@
     (rather than defined (H_S) && defined (H_T))
    is because the VMS preprocessor doesn't grok `defined' */
 #ifdef HAVE_SELECT
-#ifdef HAVE_TIMEVAL
-  gettimeofday (&end_time, &garbage1);
-  end_time.tv_sec += sec;
-  end_time.tv_usec += usec;
-  if (end_time.tv_usec >= 1000000)
-    end_time.tv_sec++, end_time.tv_usec -= 1000000;
-
+  EMACS_GET_TIME (end_time);
+  EMACS_SET_SECS_USECS (timeout, sec, usec);
+  EMACS_ADD_TIME (end_time, timeout);
+ 
   while (1)
     {
-      gettimeofday (&timeout, &garbage1);
-      timeout.tv_sec = end_time.tv_sec - timeout.tv_sec;
-      timeout.tv_usec = end_time.tv_usec - timeout.tv_usec;
-      if (timeout.tv_usec < 0)
-	timeout.tv_usec += 1000000, timeout.tv_sec--;
-      if (timeout.tv_sec < 0)
-	break;
-      if (!select (1, 0, 0, 0, &timeout))
+      EMACS_GET_TIME (timeout);
+      EMACS_SUB_TIME (timeout, end_time, timeout);
+      if (EMACS_TIME_NEG_P (timeout)
+	  || !select (1, 0, 0, 0, &timeout))
 	break;
     }
-#else /* not HAVE_TIMEVAL */
-  /* Is it safe to quit out of `sleep'?  I'm afraid to trust it.  */
-  sleep (sec);
-#endif /* HAVE_TIMEVAL */
 #else /* not HAVE_SELECT */
   sleep (sec);
 #endif /* HAVE_SELECT */
@@ -1889,11 +1848,7 @@
      Lisp_Object n, millisec, nodisp;
 {
 #ifndef subprocesses
-#ifdef HAVE_TIMEVAL
-  struct timeval timeout;
-#else
-  int timeout_sec;
-#endif
+  EMACS_TIME timeout;
   int waitchannels;
 #endif /* no subprocesses */
   int usec = 0;
@@ -1913,7 +1868,7 @@
 
   if (!NILP (millisec))
     {
-#ifndef HAVE_TIMEVAL
+#ifndef EMACS_HAS_USECS
       error ("millisecond sleep-for not supported on %s", SYSTEM_TYPE);
 #else
       usec = sec % 1000 * 1000;
@@ -1934,14 +1889,8 @@
 #ifdef VMS
   input_wait_timeout (XINT (n));
 #else				/* not VMS */
-#ifndef HAVE_TIMEVAL
-  timeout_sec = sec;
-  select (1, &waitchannels, 0, 0, &timeout_sec);
-#else /* HAVE_TIMEVAL */
-  timeout.tv_sec = sec;  
-  timeout.tv_usec = usec;
+  EMACS_SET_SECS_USECS (timeout, sec, usec);
   select (1, &waitchannels, 0, 0, &timeout);
-#endif /* HAVE_TIMEVAL */
 #endif /* not VMS */
 
   immediate_quit = 0;
@@ -1956,14 +1905,14 @@
   (n)
      Lisp_Object n;
 {
-#ifndef HAVE_TIMEVAL
+#ifndef EMACS_HAS_USECS
   error ("sleep-for-millisecs not supported on %s", SYSTEM_TYPE);
 #else
   CHECK_NUMBER (n, 0);
   wait_reading_process_input (XINT (n) / 1000, XINT (n) % 1000 * 1000,
 			      0, 0);
   return Qnil;
-#endif /* HAVE_TIMEVAL */
+#endif /* EMACS_HAS_USECS */
 }
 
 char *terminal_type;