diff options
| author | Jim Blandy | 1992-02-20 04:15:20 +0000 |
|---|---|---|
| committer | Jim Blandy | 1992-02-20 04:15:20 +0000 |
| commit | a41f8bed219bb3f7f4aa438e60532d2789dfb067 (patch) | |
| tree | dcf6739e4e1c129c3f23a74e82bf4707209468c2 | |
| parent | 0c29c32c50d121ce39b36209f22dc26f15589eb2 (diff) | |
| download | emacs-a41f8bed219bb3f7f4aa438e60532d2789dfb067.tar.gz emacs-a41f8bed219bb3f7f4aa438e60532d2789dfb067.zip | |
*** empty log message ***
| -rw-r--r-- | src/dispnew.c | 95 | ||||
| -rw-r--r-- | src/emacs.c | 11 |
2 files changed, 26 insertions, 80 deletions
diff --git a/src/dispnew.c b/src/dispnew.c index 71253511546..f55189d87eb 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -24,37 +24,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |||
| 24 | #include <stdio.h> | 24 | #include <stdio.h> |
| 25 | #include <ctype.h> | 25 | #include <ctype.h> |
| 26 | 26 | ||
| 27 | #ifdef NEED_TIME_H | ||
| 28 | #include <time.h> | ||
| 29 | #else /* not NEED_TIME_H */ | ||
| 30 | #ifdef HAVE_TIMEVAL | ||
| 31 | #include <sys/time.h> | ||
| 32 | #endif /* HAVE_TIMEVAL */ | ||
| 33 | #endif /* not NEED_TIME_H */ | ||
| 34 | |||
| 35 | #ifdef HAVE_TERMIO | ||
| 36 | #include <termio.h> | ||
| 37 | #ifdef TCOUTQ | ||
| 38 | #undef TIOCOUTQ | ||
| 39 | #define TIOCOUTQ TCOUTQ | ||
| 40 | #endif /* TCOUTQ defined */ | ||
| 41 | #include <fcntl.h> | ||
| 42 | #else | ||
| 43 | #ifndef VMS | ||
| 44 | #include <sys/ioctl.h> | ||
| 45 | #endif /* not VMS */ | ||
| 46 | #endif /* not HAVE_TERMIO */ | ||
| 47 | |||
| 48 | /* Allow m- file to inhibit use of FIONREAD. */ | ||
| 49 | #ifdef BROKEN_FIONREAD | ||
| 50 | #undef FIONREAD | ||
| 51 | #endif | ||
| 52 | |||
| 53 | /* Interupt input is not used if there is no FIONREAD. */ | ||
| 54 | #ifndef FIONREAD | ||
| 55 | #undef SIGIO | ||
| 56 | #endif | ||
| 57 | |||
| 58 | #include "termchar.h" | 27 | #include "termchar.h" |
| 59 | #include "termopts.h" | 28 | #include "termopts.h" |
| 60 | #include "cm.h" | 29 | #include "cm.h" |
| @@ -67,6 +36,9 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |||
| 67 | #include "disptab.h" | 36 | #include "disptab.h" |
| 68 | #include "indent.h" | 37 | #include "indent.h" |
| 69 | 38 | ||
| 39 | #include "systerm.h" | ||
| 40 | #include "systime.h" | ||
| 41 | |||
| 70 | #ifdef HAVE_X_WINDOWS | 42 | #ifdef HAVE_X_WINDOWS |
| 71 | #include "xterm.h" | 43 | #include "xterm.h" |
| 72 | #endif /* HAVE_X_WINDOWS */ | 44 | #endif /* HAVE_X_WINDOWS */ |
| @@ -81,8 +53,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |||
| 81 | #define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_ptr - (FILE)->_base) | 53 | #define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_ptr - (FILE)->_base) |
| 82 | #endif | 54 | #endif |
| 83 | 55 | ||
| 84 | /* Nonzero means do not assume anything about current | 56 | /* Nonzero upon entry to redisplay means do not assume anything about |
| 85 | contents of actual terminal screen */ | 57 | current contents of actual terminal screen; clear and redraw it. */ |
| 86 | 58 | ||
| 87 | int screen_garbaged; | 59 | int screen_garbaged; |
| 88 | 60 | ||
| @@ -1052,8 +1024,8 @@ update_screen (s, force, inhibit_hairy_id) | |||
| 1052 | fflush (stdout); | 1024 | fflush (stdout); |
| 1053 | if (preempt_count == 1) | 1025 | if (preempt_count == 1) |
| 1054 | { | 1026 | { |
| 1055 | #ifdef TIOCOUTQ | 1027 | #ifdef EMACS_OUTQSIZE |
| 1056 | if (ioctl (0, TIOCOUTQ, &outq) < 0) | 1028 | if (EMACS_OUTQSIZE (0, &outq) < 0) |
| 1057 | /* Probably not a tty. Ignore the error and reset | 1029 | /* Probably not a tty. Ignore the error and reset |
| 1058 | * the outq count. */ | 1030 | * the outq count. */ |
| 1059 | outq = PENDING_OUTPUT_COUNT (stdout); | 1031 | outq = PENDING_OUTPUT_COUNT (stdout); |
| @@ -1809,9 +1781,7 @@ Optional second arg non-nil means ARG is measured in milliseconds.\n\ | |||
| 1809 | Lisp_Object n, millisec; | 1781 | Lisp_Object n, millisec; |
| 1810 | { | 1782 | { |
| 1811 | #ifndef subprocesses | 1783 | #ifndef subprocesses |
| 1812 | #ifdef HAVE_TIMEVAL | 1784 | EMACS_TIME timeout, end_time; |
| 1813 | struct timeval timeout, end_time, garbage1; | ||
| 1814 | #endif /* HAVE_TIMEVAL */ | ||
| 1815 | #endif /* no subprocesses */ | 1785 | #endif /* no subprocesses */ |
| 1816 | int usec = 0; | 1786 | int usec = 0; |
| 1817 | int sec; | 1787 | int sec; |
| @@ -1823,7 +1793,7 @@ Optional second arg non-nil means ARG is measured in milliseconds.\n\ | |||
| 1823 | 1793 | ||
| 1824 | if (!NILP (millisec)) | 1794 | if (!NILP (millisec)) |
| 1825 | { | 1795 | { |
| 1826 | #ifndef HAVE_TIMEVAL | 1796 | #ifndef EMACS_HAS_USECS |
| 1827 | error ("millisecond sit-for not supported on %s", SYSTEM_TYPE); | 1797 | error ("millisecond sit-for not supported on %s", SYSTEM_TYPE); |
| 1828 | #else | 1798 | #else |
| 1829 | usec = sec % 1000 * 1000; | 1799 | usec = sec % 1000 * 1000; |
| @@ -1844,29 +1814,18 @@ Optional second arg non-nil means ARG is measured in milliseconds.\n\ | |||
| 1844 | (rather than defined (H_S) && defined (H_T)) | 1814 | (rather than defined (H_S) && defined (H_T)) |
| 1845 | is because the VMS preprocessor doesn't grok `defined' */ | 1815 | is because the VMS preprocessor doesn't grok `defined' */ |
| 1846 | #ifdef HAVE_SELECT | 1816 | #ifdef HAVE_SELECT |
| 1847 | #ifdef HAVE_TIMEVAL | 1817 | EMACS_GET_TIME (end_time); |
| 1848 | gettimeofday (&end_time, &garbage1); | 1818 | EMACS_SET_SECS_USECS (timeout, sec, usec); |
| 1849 | end_time.tv_sec += sec; | 1819 | EMACS_ADD_TIME (end_time, timeout); |
| 1850 | end_time.tv_usec += usec; | 1820 | |
| 1851 | if (end_time.tv_usec >= 1000000) | ||
| 1852 | end_time.tv_sec++, end_time.tv_usec -= 1000000; | ||
| 1853 | |||
| 1854 | while (1) | 1821 | while (1) |
| 1855 | { | 1822 | { |
| 1856 | gettimeofday (&timeout, &garbage1); | 1823 | EMACS_GET_TIME (timeout); |
| 1857 | timeout.tv_sec = end_time.tv_sec - timeout.tv_sec; | 1824 | EMACS_SUB_TIME (timeout, end_time, timeout); |
| 1858 | timeout.tv_usec = end_time.tv_usec - timeout.tv_usec; | 1825 | if (EMACS_TIME_NEG_P (timeout) |
| 1859 | if (timeout.tv_usec < 0) | 1826 | || !select (1, 0, 0, 0, &timeout)) |
| 1860 | timeout.tv_usec += 1000000, timeout.tv_sec--; | ||
| 1861 | if (timeout.tv_sec < 0) | ||
| 1862 | break; | ||
| 1863 | if (!select (1, 0, 0, 0, &timeout)) | ||
| 1864 | break; | 1827 | break; |
| 1865 | } | 1828 | } |
| 1866 | #else /* not HAVE_TIMEVAL */ | ||
| 1867 | /* Is it safe to quit out of `sleep'? I'm afraid to trust it. */ | ||
| 1868 | sleep (sec); | ||
| 1869 | #endif /* HAVE_TIMEVAL */ | ||
| 1870 | #else /* not HAVE_SELECT */ | 1829 | #else /* not HAVE_SELECT */ |
| 1871 | sleep (sec); | 1830 | sleep (sec); |
| 1872 | #endif /* HAVE_SELECT */ | 1831 | #endif /* HAVE_SELECT */ |
| @@ -1889,11 +1848,7 @@ Value is t if waited the full time with no input arriving.") | |||
| 1889 | Lisp_Object n, millisec, nodisp; | 1848 | Lisp_Object n, millisec, nodisp; |
| 1890 | { | 1849 | { |
| 1891 | #ifndef subprocesses | 1850 | #ifndef subprocesses |
| 1892 | #ifdef HAVE_TIMEVAL | 1851 | EMACS_TIME timeout; |
| 1893 | struct timeval timeout; | ||
| 1894 | #else | ||
| 1895 | int timeout_sec; | ||
| 1896 | #endif | ||
| 1897 | int waitchannels; | 1852 | int waitchannels; |
| 1898 | #endif /* no subprocesses */ | 1853 | #endif /* no subprocesses */ |
| 1899 | int usec = 0; | 1854 | int usec = 0; |
| @@ -1913,7 +1868,7 @@ Value is t if waited the full time with no input arriving.") | |||
| 1913 | 1868 | ||
| 1914 | if (!NILP (millisec)) | 1869 | if (!NILP (millisec)) |
| 1915 | { | 1870 | { |
| 1916 | #ifndef HAVE_TIMEVAL | 1871 | #ifndef EMACS_HAS_USECS |
| 1917 | error ("millisecond sleep-for not supported on %s", SYSTEM_TYPE); | 1872 | error ("millisecond sleep-for not supported on %s", SYSTEM_TYPE); |
| 1918 | #else | 1873 | #else |
| 1919 | usec = sec % 1000 * 1000; | 1874 | usec = sec % 1000 * 1000; |
| @@ -1934,14 +1889,8 @@ Value is t if waited the full time with no input arriving.") | |||
| 1934 | #ifdef VMS | 1889 | #ifdef VMS |
| 1935 | input_wait_timeout (XINT (n)); | 1890 | input_wait_timeout (XINT (n)); |
| 1936 | #else /* not VMS */ | 1891 | #else /* not VMS */ |
| 1937 | #ifndef HAVE_TIMEVAL | 1892 | EMACS_SET_SECS_USECS (timeout, sec, usec); |
| 1938 | timeout_sec = sec; | ||
| 1939 | select (1, &waitchannels, 0, 0, &timeout_sec); | ||
| 1940 | #else /* HAVE_TIMEVAL */ | ||
| 1941 | timeout.tv_sec = sec; | ||
| 1942 | timeout.tv_usec = usec; | ||
| 1943 | select (1, &waitchannels, 0, 0, &timeout); | 1893 | select (1, &waitchannels, 0, 0, &timeout); |
| 1944 | #endif /* HAVE_TIMEVAL */ | ||
| 1945 | #endif /* not VMS */ | 1894 | #endif /* not VMS */ |
| 1946 | 1895 | ||
| 1947 | immediate_quit = 0; | 1896 | immediate_quit = 0; |
| @@ -1956,14 +1905,14 @@ DEFUN ("sleep-for-millisecs", Fsleep_for_millisecs, Ssleep_for_millisecs, | |||
| 1956 | (n) | 1905 | (n) |
| 1957 | Lisp_Object n; | 1906 | Lisp_Object n; |
| 1958 | { | 1907 | { |
| 1959 | #ifndef HAVE_TIMEVAL | 1908 | #ifndef EMACS_HAS_USECS |
| 1960 | error ("sleep-for-millisecs not supported on %s", SYSTEM_TYPE); | 1909 | error ("sleep-for-millisecs not supported on %s", SYSTEM_TYPE); |
| 1961 | #else | 1910 | #else |
| 1962 | CHECK_NUMBER (n, 0); | 1911 | CHECK_NUMBER (n, 0); |
| 1963 | wait_reading_process_input (XINT (n) / 1000, XINT (n) % 1000 * 1000, | 1912 | wait_reading_process_input (XINT (n) / 1000, XINT (n) % 1000 * 1000, |
| 1964 | 0, 0); | 1913 | 0, 0); |
| 1965 | return Qnil; | 1914 | return Qnil; |
| 1966 | #endif /* HAVE_TIMEVAL */ | 1915 | #endif /* EMACS_HAS_USECS */ |
| 1967 | } | 1916 | } |
| 1968 | 1917 | ||
| 1969 | char *terminal_type; | 1918 | char *terminal_type; |
diff --git a/src/emacs.c b/src/emacs.c index d615e7fdf14..b3f17306e4f 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -52,6 +52,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |||
| 52 | #include "lisp.h" | 52 | #include "lisp.h" |
| 53 | #include "commands.h" | 53 | #include "commands.h" |
| 54 | 54 | ||
| 55 | #include "systerm.h" | ||
| 56 | |||
| 55 | #ifndef O_RDWR | 57 | #ifndef O_RDWR |
| 56 | #define O_RDWR 2 | 58 | #define O_RDWR 2 |
| 57 | #endif | 59 | #endif |
| @@ -124,15 +126,10 @@ fatal_error_signal (sig) | |||
| 124 | fatal_error_in_progress = 1; | 126 | fatal_error_in_progress = 1; |
| 125 | 127 | ||
| 126 | /* If we are controlling the terminal, reset terminal modes */ | 128 | /* If we are controlling the terminal, reset terminal modes */ |
| 127 | #if defined(TIOCGPGRP) || defined(HAVE_TERMIOS) | 129 | #ifdef EMACS_HAVE_TTY_PGRP |
| 128 | { | 130 | { |
| 129 | int tpgrp; | 131 | int tpgrp; |
| 130 | if ( | 132 | if (EMACS_GET_TTY_PGRP (0, &tpgrp) != -1 |
| 131 | #ifdef HAVE_TERMIOS | ||
| 132 | (tpgrp = tcgetpgrp (0)) != -1 | ||
| 133 | #else | ||
| 134 | ioctl(0, TIOCGPGRP, &tpgrp) == 0 | ||
| 135 | #endif | ||
| 136 | && tpgrp == getpgrp (0)) | 133 | && tpgrp == getpgrp (0)) |
| 137 | { | 134 | { |
| 138 | reset_sys_modes (); | 135 | reset_sys_modes (); |