diff options
Diffstat (limited to 'src/term.c')
| -rw-r--r-- | src/term.c | 395 |
1 files changed, 202 insertions, 193 deletions
diff --git a/src/term.c b/src/term.c index b599e1b97fe..49356348545 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -87,7 +87,7 @@ static void tty_show_cursor P_ ((struct tty_display_info *)); | |||
| 87 | static void tty_hide_cursor P_ ((struct tty_display_info *)); | 87 | static void tty_hide_cursor P_ ((struct tty_display_info *)); |
| 88 | static void tty_background_highlight P_ ((struct tty_display_info *tty)); | 88 | static void tty_background_highlight P_ ((struct tty_display_info *tty)); |
| 89 | static void dissociate_if_controlling_tty P_ ((int fd)); | 89 | static void dissociate_if_controlling_tty P_ ((int fd)); |
| 90 | static void delete_tty P_ ((struct device *)); | 90 | static void delete_tty P_ ((struct terminal *)); |
| 91 | 91 | ||
| 92 | #define OUTPUT(tty, a) \ | 92 | #define OUTPUT(tty, a) \ |
| 93 | emacs_tputs ((tty), a, \ | 93 | emacs_tputs ((tty), a, \ |
| @@ -198,9 +198,9 @@ tty_ring_bell (struct frame *f) | |||
| 198 | /* Set up termcap modes for Emacs. */ | 198 | /* Set up termcap modes for Emacs. */ |
| 199 | 199 | ||
| 200 | void | 200 | void |
| 201 | tty_set_terminal_modes (struct device *display) | 201 | tty_set_terminal_modes (struct terminal *terminal) |
| 202 | { | 202 | { |
| 203 | struct tty_display_info *tty = display->display_info.tty; | 203 | struct tty_display_info *tty = terminal->display_info.tty; |
| 204 | 204 | ||
| 205 | if (tty->output) | 205 | if (tty->output) |
| 206 | { | 206 | { |
| @@ -227,9 +227,9 @@ tty_set_terminal_modes (struct device *display) | |||
| 227 | /* Reset termcap modes before exiting Emacs. */ | 227 | /* Reset termcap modes before exiting Emacs. */ |
| 228 | 228 | ||
| 229 | void | 229 | void |
| 230 | tty_reset_terminal_modes (struct device *display) | 230 | tty_reset_terminal_modes (struct terminal *terminal) |
| 231 | { | 231 | { |
| 232 | struct tty_display_info *tty = display->display_info.tty; | 232 | struct tty_display_info *tty = terminal->display_info.tty; |
| 233 | 233 | ||
| 234 | if (tty->output) | 234 | if (tty->output) |
| 235 | { | 235 | { |
| @@ -246,7 +246,7 @@ tty_reset_terminal_modes (struct device *display) | |||
| 246 | } | 246 | } |
| 247 | } | 247 | } |
| 248 | 248 | ||
| 249 | /* Flag the end of a display update on a termcap display. */ | 249 | /* Flag the end of a display update on a termcap terminal. */ |
| 250 | 250 | ||
| 251 | static void | 251 | static void |
| 252 | tty_update_end (struct frame *f) | 252 | tty_update_end (struct frame *f) |
| @@ -1809,30 +1809,37 @@ tty_capable_p (tty, caps, fg, bg) | |||
| 1809 | 1809 | ||
| 1810 | DEFUN ("tty-display-color-p", Ftty_display_color_p, Stty_display_color_p, | 1810 | DEFUN ("tty-display-color-p", Ftty_display_color_p, Stty_display_color_p, |
| 1811 | 0, 1, 0, | 1811 | 0, 1, 0, |
| 1812 | doc: /* Return non-nil if the display device DEVICE can display colors. | 1812 | doc: /* Return non-nil if the tty device TERMINAL can display colors. |
| 1813 | DEVICE must be a tty device. */) | 1813 | |
| 1814 | (device) | 1814 | TERMINAL can be a terminal id, a frame or nil (meaning the selected |
| 1815 | Lisp_Object device; | 1815 | frame's terminal). This function always returns nil if TERMINAL |
| 1816 | is not on a tty device. */) | ||
| 1817 | (terminal) | ||
| 1818 | Lisp_Object terminal; | ||
| 1816 | { | 1819 | { |
| 1817 | struct device *d = get_tty_device (device); | 1820 | struct terminal *t = get_tty_terminal (terminal); |
| 1818 | if (!d) | 1821 | if (!t) |
| 1819 | return Qnil; | 1822 | return Qnil; |
| 1820 | else | 1823 | else |
| 1821 | return d->display_info.tty->TN_max_colors > 0 ? Qt : Qnil; | 1824 | return t->display_info.tty->TN_max_colors > 0 ? Qt : Qnil; |
| 1822 | } | 1825 | } |
| 1823 | 1826 | ||
| 1824 | /* Return the number of supported colors. */ | 1827 | /* Return the number of supported colors. */ |
| 1825 | DEFUN ("tty-display-color-cells", Ftty_display_color_cells, | 1828 | DEFUN ("tty-display-color-cells", Ftty_display_color_cells, |
| 1826 | Stty_display_color_cells, 0, 1, 0, | 1829 | Stty_display_color_cells, 0, 1, 0, |
| 1827 | doc: /* Return the number of colors supported by the tty device DEVICE. */) | 1830 | doc: /* Return the number of colors supported by the tty device TERMINAL. |
| 1828 | (device) | 1831 | |
| 1829 | Lisp_Object device; | 1832 | TERMINAL can be a terminal id, a frame or nil (meaning the selected |
| 1833 | frame's terminal). This function always returns nil if TERMINAL | ||
| 1834 | is not on a tty device. */) | ||
| 1835 | (terminal) | ||
| 1836 | Lisp_Object terminal; | ||
| 1830 | { | 1837 | { |
| 1831 | struct device *d = get_tty_device (device); | 1838 | struct terminal *t = get_tty_terminal (terminal); |
| 1832 | if (!d) | 1839 | if (!t) |
| 1833 | return make_number (0); | 1840 | return make_number (0); |
| 1834 | else | 1841 | else |
| 1835 | return make_number (d->display_info.tty->TN_max_colors); | 1842 | return make_number (t->display_info.tty->TN_max_colors); |
| 1836 | } | 1843 | } |
| 1837 | 1844 | ||
| 1838 | #ifndef WINDOWSNT | 1845 | #ifndef WINDOWSNT |
| @@ -1974,20 +1981,20 @@ set_tty_color_mode (f, val) | |||
| 1974 | 1981 | ||
| 1975 | 1982 | ||
| 1976 | 1983 | ||
| 1977 | /* Return the tty display object specified by DEVICE. */ | 1984 | /* Return the tty display object specified by TERMINAL. */ |
| 1978 | 1985 | ||
| 1979 | struct device * | 1986 | struct terminal * |
| 1980 | get_tty_device (Lisp_Object terminal) | 1987 | get_tty_terminal (Lisp_Object terminal) |
| 1981 | { | 1988 | { |
| 1982 | struct device *d = get_device (terminal, 0); | 1989 | struct terminal *t = get_terminal (terminal, 0); |
| 1983 | 1990 | ||
| 1984 | if (d && d->type == output_initial) | 1991 | if (t && t->type == output_initial) |
| 1985 | d = NULL; | 1992 | t = NULL; |
| 1986 | 1993 | ||
| 1987 | if (d && d->type != output_termcap) | 1994 | if (t && t->type != output_termcap) |
| 1988 | error ("Device %d is not a termcap display device", d->id); | 1995 | error ("Device %d is not a termcap terminal device", t->id); |
| 1989 | 1996 | ||
| 1990 | return d; | 1997 | return t; |
| 1991 | } | 1998 | } |
| 1992 | 1999 | ||
| 1993 | /* Return the active termcap device that uses the tty device with the | 2000 | /* Return the active termcap device that uses the tty device with the |
| @@ -1998,75 +2005,77 @@ get_tty_device (Lisp_Object terminal) | |||
| 1998 | 2005 | ||
| 1999 | Returns NULL if the named terminal device is not opened. */ | 2006 | Returns NULL if the named terminal device is not opened. */ |
| 2000 | 2007 | ||
| 2001 | struct device * | 2008 | struct terminal * |
| 2002 | get_named_tty (name) | 2009 | get_named_tty (name) |
| 2003 | char *name; | 2010 | char *name; |
| 2004 | { | 2011 | { |
| 2005 | struct device *d; | 2012 | struct terminal *t; |
| 2006 | 2013 | ||
| 2007 | for (d = device_list; d; d = d->next_device) { | 2014 | for (t = terminal_list; t; t = t->next_terminal) { |
| 2008 | if (d->type == output_termcap | 2015 | if (t->type == output_termcap |
| 2009 | && ((d->display_info.tty->name == 0 && name == 0) | 2016 | && ((t->display_info.tty->name == 0 && name == 0) |
| 2010 | || (name && d->display_info.tty->name | 2017 | || (name && t->display_info.tty->name |
| 2011 | && !strcmp (d->display_info.tty->name, name))) | 2018 | && !strcmp (t->display_info.tty->name, name))) |
| 2012 | && DEVICE_ACTIVE_P (d)) | 2019 | && TERMINAL_ACTIVE_P (t)) |
| 2013 | return d; | 2020 | return t; |
| 2014 | }; | 2021 | }; |
| 2015 | 2022 | ||
| 2016 | return 0; | 2023 | return 0; |
| 2017 | } | 2024 | } |
| 2018 | 2025 | ||
| 2019 | 2026 | ||
| 2020 | DEFUN ("display-tty-type", Fdisplay_tty_type, Sdisplay_tty_type, 0, 1, 0, | 2027 | DEFUN ("tty-type", Ftty_type, Stty_type, 0, 1, 0, |
| 2021 | doc: /* Return the type of the tty device that DEVICE uses. | 2028 | doc: /* Return the type of the tty device that TERMINAL uses. |
| 2022 | 2029 | ||
| 2023 | DEVICE may be a display device id, a frame, or nil (meaning the | 2030 | TERMINAL can be a terminal id, a frame or nil (meaning the selected |
| 2024 | selected frame's display device). */) | 2031 | frame's terminal). */) |
| 2025 | (device) | 2032 | (terminal) |
| 2026 | Lisp_Object device; | 2033 | Lisp_Object terminal; |
| 2027 | { | 2034 | { |
| 2028 | struct device *d = get_device (device, 1); | 2035 | struct terminal *t = get_terminal (terminal, 1); |
| 2029 | 2036 | ||
| 2030 | if (d->type != output_termcap) | 2037 | if (t->type != output_termcap) |
| 2031 | error ("Display %d is not a termcap display", d->id); | 2038 | error ("Terminal %d is not a termcap terminal", t->id); |
| 2032 | 2039 | ||
| 2033 | if (d->display_info.tty->type) | 2040 | if (t->display_info.tty->type) |
| 2034 | return build_string (d->display_info.tty->type); | 2041 | return build_string (t->display_info.tty->type); |
| 2035 | else | 2042 | else |
| 2036 | return Qnil; | 2043 | return Qnil; |
| 2037 | } | 2044 | } |
| 2038 | 2045 | ||
| 2039 | DEFUN ("display-controlling-tty-p", Fdisplay_controlling_tty_p, Sdisplay_controlling_tty_p, 0, 1, 0, | 2046 | DEFUN ("controlling-tty-p", Fcontrolling_tty_p, Scontrolling_tty_p, 0, 1, 0, |
| 2040 | doc: /* Return non-nil if DEVICE is on the controlling tty of the Emacs process. | 2047 | doc: /* Return non-nil if TERMINAL is on the controlling tty of the Emacs process. |
| 2041 | 2048 | ||
| 2042 | DEVICE may be a display device id, a frame, or nil (meaning the | 2049 | TERMINAL can be a terminal id, a frame or nil (meaning the selected |
| 2043 | selected frame's display device). */) | 2050 | frame's terminal). This function always returns nil if TERMINAL |
| 2044 | (device) | 2051 | is not on a tty device. */) |
| 2045 | Lisp_Object device; | 2052 | (terminal) |
| 2053 | Lisp_Object terminal; | ||
| 2046 | { | 2054 | { |
| 2047 | struct device *d = get_device (device, 1); | 2055 | struct terminal *t = get_terminal (terminal, 1); |
| 2048 | 2056 | ||
| 2049 | if (d->type != output_termcap || d->display_info.tty->name) | 2057 | if (t->type != output_termcap || t->display_info.tty->name) |
| 2050 | return Qnil; | 2058 | return Qnil; |
| 2051 | else | 2059 | else |
| 2052 | return Qt; | 2060 | return Qt; |
| 2053 | } | 2061 | } |
| 2054 | 2062 | ||
| 2055 | DEFUN ("tty-no-underline", Ftty_no_underline, Stty_no_underline, 0, 1, 0, | 2063 | DEFUN ("tty-no-underline", Ftty_no_underline, Stty_no_underline, 0, 1, 0, |
| 2056 | doc: /* Declare that the tty used by DEVICE does not handle underlining. | 2064 | doc: /* Declare that the tty used by TERMINAL does not handle underlining. |
| 2057 | This is used to override the terminfo data, for certain terminals that | 2065 | This is used to override the terminfo data, for certain terminals that |
| 2058 | do not really do underlining, but say that they do. This function has | 2066 | do not really do underlining, but say that they do. This function has |
| 2059 | no effect if used on a non-tty display. | 2067 | no effect if used on a non-tty terminal. |
| 2060 | 2068 | ||
| 2061 | DEVICE may be a display device id, a frame, or nil (meaning the | 2069 | TERMINAL can be a terminal id, a frame or nil (meaning the selected |
| 2062 | selected frame's display device). */) | 2070 | frame's terminal). This function always returns nil if TERMINAL |
| 2063 | (device) | 2071 | is not on a tty device. */) |
| 2064 | Lisp_Object device; | 2072 | (terminal) |
| 2073 | Lisp_Object terminal; | ||
| 2065 | { | 2074 | { |
| 2066 | struct device *d = get_device (device, 1); | 2075 | struct terminal *t = get_terminal (terminal, 1); |
| 2067 | 2076 | ||
| 2068 | if (d->type == output_termcap) | 2077 | if (t->type == output_termcap) |
| 2069 | d->display_info.tty->TS_enter_underline_mode = 0; | 2078 | t->display_info.tty->TS_enter_underline_mode = 0; |
| 2070 | return Qnil; | 2079 | return Qnil; |
| 2071 | } | 2080 | } |
| 2072 | 2081 | ||
| @@ -2094,36 +2103,36 @@ A suspended tty may be resumed by calling `resume-tty' on it. */) | |||
| 2094 | (tty) | 2103 | (tty) |
| 2095 | Lisp_Object tty; | 2104 | Lisp_Object tty; |
| 2096 | { | 2105 | { |
| 2097 | struct device *d = get_tty_device (tty); | 2106 | struct terminal *t = get_tty_terminal (tty); |
| 2098 | FILE *f; | 2107 | FILE *f; |
| 2099 | 2108 | ||
| 2100 | if (!d) | 2109 | if (!t) |
| 2101 | error ("Unknown tty device"); | 2110 | error ("Unknown tty device"); |
| 2102 | 2111 | ||
| 2103 | f = d->display_info.tty->input; | 2112 | f = t->display_info.tty->input; |
| 2104 | 2113 | ||
| 2105 | if (f) | 2114 | if (f) |
| 2106 | { | 2115 | { |
| 2107 | reset_sys_modes (d->display_info.tty); | 2116 | reset_sys_modes (t->display_info.tty); |
| 2108 | 2117 | ||
| 2109 | delete_keyboard_wait_descriptor (fileno (f)); | 2118 | delete_keyboard_wait_descriptor (fileno (f)); |
| 2110 | 2119 | ||
| 2111 | fclose (f); | 2120 | fclose (f); |
| 2112 | if (f != d->display_info.tty->output) | 2121 | if (f != t->display_info.tty->output) |
| 2113 | fclose (d->display_info.tty->output); | 2122 | fclose (t->display_info.tty->output); |
| 2114 | 2123 | ||
| 2115 | d->display_info.tty->input = 0; | 2124 | t->display_info.tty->input = 0; |
| 2116 | d->display_info.tty->output = 0; | 2125 | t->display_info.tty->output = 0; |
| 2117 | 2126 | ||
| 2118 | if (FRAMEP (d->display_info.tty->top_frame)) | 2127 | if (FRAMEP (t->display_info.tty->top_frame)) |
| 2119 | FRAME_SET_VISIBLE (XFRAME (d->display_info.tty->top_frame), 0); | 2128 | FRAME_SET_VISIBLE (XFRAME (t->display_info.tty->top_frame), 0); |
| 2120 | 2129 | ||
| 2121 | /* Run `suspend-tty-functions'. */ | 2130 | /* Run `suspend-tty-functions'. */ |
| 2122 | if (!NILP (Vrun_hooks)) | 2131 | if (!NILP (Vrun_hooks)) |
| 2123 | { | 2132 | { |
| 2124 | Lisp_Object args[2]; | 2133 | Lisp_Object args[2]; |
| 2125 | args[0] = intern ("suspend-tty-functions"); | 2134 | args[0] = intern ("suspend-tty-functions"); |
| 2126 | args[1] = make_number (d->id); | 2135 | args[1] = make_number (t->id); |
| 2127 | Frun_hook_with_args (2, args); | 2136 | Frun_hook_with_args (2, args); |
| 2128 | } | 2137 | } |
| 2129 | } | 2138 | } |
| @@ -2134,56 +2143,56 @@ A suspended tty may be resumed by calling `resume-tty' on it. */) | |||
| 2134 | DEFUN ("resume-tty", Fresume_tty, Sresume_tty, 0, 1, 0, | 2143 | DEFUN ("resume-tty", Fresume_tty, Sresume_tty, 0, 1, 0, |
| 2135 | doc: /* Resume the previously suspended terminal device TTY. | 2144 | doc: /* Resume the previously suspended terminal device TTY. |
| 2136 | The terminal is opened and reinitialized. Frames that are on the | 2145 | The terminal is opened and reinitialized. Frames that are on the |
| 2137 | suspended display are revived. | 2146 | suspended terminal are revived. |
| 2138 | 2147 | ||
| 2139 | It is an error to resume a display while another display is active on | 2148 | It is an error to resume a terminal while another terminal is active |
| 2140 | the same device. | 2149 | on the same device. |
| 2141 | 2150 | ||
| 2142 | This function runs `resume-tty-functions' after resuming the device. | 2151 | This function runs `resume-tty-functions' after resuming the terminal. |
| 2143 | The functions are run with one arg, the id of the resumed display | 2152 | The functions are run with one arg, the id of the resumed terminal |
| 2144 | device. | 2153 | device. |
| 2145 | 2154 | ||
| 2146 | `resume-tty' does nothing if it is called on a device that is not | 2155 | `resume-tty' does nothing if it is called on a device that is not |
| 2147 | suspended. | 2156 | suspended. |
| 2148 | 2157 | ||
| 2149 | TTY may be a display device id, a frame, or nil for the display device | 2158 | TTY may be a terminal id, a frame, or nil for the terminal device of |
| 2150 | of the currently selected frame. */) | 2159 | the currently selected frame. */) |
| 2151 | (tty) | 2160 | (tty) |
| 2152 | Lisp_Object tty; | 2161 | Lisp_Object tty; |
| 2153 | { | 2162 | { |
| 2154 | struct device *d = get_tty_device (tty); | 2163 | struct terminal *t = get_tty_terminal (tty); |
| 2155 | int fd; | 2164 | int fd; |
| 2156 | 2165 | ||
| 2157 | if (!d) | 2166 | if (!t) |
| 2158 | error ("Unknown tty device"); | 2167 | error ("Unknown tty device"); |
| 2159 | 2168 | ||
| 2160 | if (!d->display_info.tty->input) | 2169 | if (!t->display_info.tty->input) |
| 2161 | { | 2170 | { |
| 2162 | if (get_named_tty (d->display_info.tty->name)) | 2171 | if (get_named_tty (t->display_info.tty->name)) |
| 2163 | error ("Cannot resume display while another display is active on the same device"); | 2172 | error ("Cannot resume display while another display is active on the same device"); |
| 2164 | 2173 | ||
| 2165 | fd = emacs_open (d->display_info.tty->name, O_RDWR | O_NOCTTY, 0); | 2174 | fd = emacs_open (t->display_info.tty->name, O_RDWR | O_NOCTTY, 0); |
| 2166 | 2175 | ||
| 2167 | /* XXX What if open fails? */ | 2176 | /* XXX What if open fails? */ |
| 2168 | 2177 | ||
| 2169 | dissociate_if_controlling_tty (fd); | 2178 | dissociate_if_controlling_tty (fd); |
| 2170 | 2179 | ||
| 2171 | d->display_info.tty->output = fdopen (fd, "w+"); | 2180 | t->display_info.tty->output = fdopen (fd, "w+"); |
| 2172 | d->display_info.tty->input = d->display_info.tty->output; | 2181 | t->display_info.tty->input = t->display_info.tty->output; |
| 2173 | 2182 | ||
| 2174 | add_keyboard_wait_descriptor (fd); | 2183 | add_keyboard_wait_descriptor (fd); |
| 2175 | 2184 | ||
| 2176 | if (FRAMEP (d->display_info.tty->top_frame)) | 2185 | if (FRAMEP (t->display_info.tty->top_frame)) |
| 2177 | FRAME_SET_VISIBLE (XFRAME (d->display_info.tty->top_frame), 1); | 2186 | FRAME_SET_VISIBLE (XFRAME (t->display_info.tty->top_frame), 1); |
| 2178 | 2187 | ||
| 2179 | init_sys_modes (d->display_info.tty); | 2188 | init_sys_modes (t->display_info.tty); |
| 2180 | 2189 | ||
| 2181 | /* Run `suspend-tty-functions'. */ | 2190 | /* Run `suspend-tty-functions'. */ |
| 2182 | if (!NILP (Vrun_hooks)) | 2191 | if (!NILP (Vrun_hooks)) |
| 2183 | { | 2192 | { |
| 2184 | Lisp_Object args[2]; | 2193 | Lisp_Object args[2]; |
| 2185 | args[0] = intern ("resume-tty-functions"); | 2194 | args[0] = intern ("resume-tty-functions"); |
| 2186 | args[1] = make_number (d->id); | 2195 | args[1] = make_number (t->id); |
| 2187 | Frun_hook_with_args (2, args); | 2196 | Frun_hook_with_args (2, args); |
| 2188 | } | 2197 | } |
| 2189 | } | 2198 | } |
| @@ -2210,7 +2219,7 @@ create_tty_output (struct frame *f) | |||
| 2210 | t = xmalloc (sizeof (struct tty_output)); | 2219 | t = xmalloc (sizeof (struct tty_output)); |
| 2211 | bzero (t, sizeof (struct tty_output)); | 2220 | bzero (t, sizeof (struct tty_output)); |
| 2212 | 2221 | ||
| 2213 | t->display_info = FRAME_DEVICE (f)->display_info.tty; | 2222 | t->display_info = FRAME_TERMINAL (f)->display_info.tty; |
| 2214 | 2223 | ||
| 2215 | f->output_data.tty = t; | 2224 | f->output_data.tty = t; |
| 2216 | } | 2225 | } |
| @@ -2271,7 +2280,7 @@ static void maybe_fatal(); | |||
| 2271 | 2280 | ||
| 2272 | If MUST_SUCCEED is true, then all errors are fatal. */ | 2281 | If MUST_SUCCEED is true, then all errors are fatal. */ |
| 2273 | 2282 | ||
| 2274 | struct device * | 2283 | struct terminal * |
| 2275 | init_tty (char *name, char *terminal_type, int must_succeed) | 2284 | init_tty (char *name, char *terminal_type, int must_succeed) |
| 2276 | { | 2285 | { |
| 2277 | char *area; | 2286 | char *area; |
| @@ -2281,72 +2290,72 @@ init_tty (char *name, char *terminal_type, int must_succeed) | |||
| 2281 | register char *p; | 2290 | register char *p; |
| 2282 | int status; | 2291 | int status; |
| 2283 | struct tty_display_info *tty; | 2292 | struct tty_display_info *tty; |
| 2284 | struct device *device; | 2293 | struct terminal *terminal; |
| 2285 | 2294 | ||
| 2286 | if (!terminal_type) | 2295 | if (!terminal_type) |
| 2287 | maybe_fatal (must_succeed, 0, 0, | 2296 | maybe_fatal (must_succeed, 0, 0, |
| 2288 | "Unknown terminal type", | 2297 | "Unknown terminal type", |
| 2289 | "Unknown terminal type"); | 2298 | "Unknown terminal type"); |
| 2290 | 2299 | ||
| 2291 | /* If we already have a display on the given device, use that. If | 2300 | /* If we already have a terminal on the given device, use that. If |
| 2292 | all such displays are suspended, create a new one instead. */ | 2301 | all such terminals are suspended, create a new one instead. */ |
| 2293 | /* XXX Perhaps this should be made explicit by having init_tty | 2302 | /* XXX Perhaps this should be made explicit by having init_tty |
| 2294 | always create a new display and separating device and frame | 2303 | always create a new terminal and separating terminal and frame |
| 2295 | creation on Lisp level. */ | 2304 | creation on Lisp level. */ |
| 2296 | device = get_named_tty (name); | 2305 | terminal = get_named_tty (name); |
| 2297 | if (device) | 2306 | if (terminal) |
| 2298 | return device; | 2307 | return terminal; |
| 2299 | 2308 | ||
| 2300 | device = create_device (); | 2309 | terminal = create_terminal (); |
| 2301 | tty = (struct tty_display_info *) xmalloc (sizeof (struct tty_display_info)); | 2310 | tty = (struct tty_display_info *) xmalloc (sizeof (struct tty_display_info)); |
| 2302 | bzero (tty, sizeof (struct tty_display_info)); | 2311 | bzero (tty, sizeof (struct tty_display_info)); |
| 2303 | tty->next = tty_list; | 2312 | tty->next = tty_list; |
| 2304 | tty_list = tty; | 2313 | tty_list = tty; |
| 2305 | 2314 | ||
| 2306 | device->type = output_termcap; | 2315 | terminal->type = output_termcap; |
| 2307 | device->display_info.tty = tty; | 2316 | terminal->display_info.tty = tty; |
| 2308 | tty->device = device; | 2317 | tty->terminal = terminal; |
| 2309 | 2318 | ||
| 2310 | tty->Wcm = (struct cm *) xmalloc (sizeof (struct cm)); | 2319 | tty->Wcm = (struct cm *) xmalloc (sizeof (struct cm)); |
| 2311 | Wcm_clear (tty); | 2320 | Wcm_clear (tty); |
| 2312 | 2321 | ||
| 2313 | device->rif = 0; /* ttys don't support window-based redisplay. */ | 2322 | terminal->rif = 0; /* ttys don't support window-based redisplay. */ |
| 2314 | 2323 | ||
| 2315 | device->cursor_to_hook = &tty_cursor_to; | 2324 | terminal->cursor_to_hook = &tty_cursor_to; |
| 2316 | device->raw_cursor_to_hook = &tty_raw_cursor_to; | 2325 | terminal->raw_cursor_to_hook = &tty_raw_cursor_to; |
| 2317 | 2326 | ||
| 2318 | device->clear_to_end_hook = &tty_clear_to_end; | 2327 | terminal->clear_to_end_hook = &tty_clear_to_end; |
| 2319 | device->clear_frame_hook = &tty_clear_frame; | 2328 | terminal->clear_frame_hook = &tty_clear_frame; |
| 2320 | device->clear_end_of_line_hook = &tty_clear_end_of_line; | 2329 | terminal->clear_end_of_line_hook = &tty_clear_end_of_line; |
| 2321 | 2330 | ||
| 2322 | device->ins_del_lines_hook = &tty_ins_del_lines; | 2331 | terminal->ins_del_lines_hook = &tty_ins_del_lines; |
| 2323 | 2332 | ||
| 2324 | device->insert_glyphs_hook = &tty_insert_glyphs; | 2333 | terminal->insert_glyphs_hook = &tty_insert_glyphs; |
| 2325 | device->write_glyphs_hook = &tty_write_glyphs; | 2334 | terminal->write_glyphs_hook = &tty_write_glyphs; |
| 2326 | device->delete_glyphs_hook = &tty_delete_glyphs; | 2335 | terminal->delete_glyphs_hook = &tty_delete_glyphs; |
| 2327 | 2336 | ||
| 2328 | device->ring_bell_hook = &tty_ring_bell; | 2337 | terminal->ring_bell_hook = &tty_ring_bell; |
| 2329 | 2338 | ||
| 2330 | device->reset_terminal_modes_hook = &tty_reset_terminal_modes; | 2339 | terminal->reset_terminal_modes_hook = &tty_reset_terminal_modes; |
| 2331 | device->set_terminal_modes_hook = &tty_set_terminal_modes; | 2340 | terminal->set_terminal_modes_hook = &tty_set_terminal_modes; |
| 2332 | device->update_begin_hook = 0; /* Not needed. */ | 2341 | terminal->update_begin_hook = 0; /* Not needed. */ |
| 2333 | device->update_end_hook = &tty_update_end; | 2342 | terminal->update_end_hook = &tty_update_end; |
| 2334 | device->set_terminal_window_hook = &tty_set_terminal_window; | 2343 | terminal->set_terminal_window_hook = &tty_set_terminal_window; |
| 2335 | 2344 | ||
| 2336 | device->mouse_position_hook = 0; /* Not needed. */ | 2345 | terminal->mouse_position_hook = 0; /* Not needed. */ |
| 2337 | device->frame_rehighlight_hook = 0; /* Not needed. */ | 2346 | terminal->frame_rehighlight_hook = 0; /* Not needed. */ |
| 2338 | device->frame_raise_lower_hook = 0; /* Not needed. */ | 2347 | terminal->frame_raise_lower_hook = 0; /* Not needed. */ |
| 2339 | 2348 | ||
| 2340 | device->set_vertical_scroll_bar_hook = 0; /* Not needed. */ | 2349 | terminal->set_vertical_scroll_bar_hook = 0; /* Not needed. */ |
| 2341 | device->condemn_scroll_bars_hook = 0; /* Not needed. */ | 2350 | terminal->condemn_scroll_bars_hook = 0; /* Not needed. */ |
| 2342 | device->redeem_scroll_bar_hook = 0; /* Not needed. */ | 2351 | terminal->redeem_scroll_bar_hook = 0; /* Not needed. */ |
| 2343 | device->judge_scroll_bars_hook = 0; /* Not needed. */ | 2352 | terminal->judge_scroll_bars_hook = 0; /* Not needed. */ |
| 2344 | 2353 | ||
| 2345 | device->read_socket_hook = &tty_read_avail_input; /* keyboard.c */ | 2354 | terminal->read_socket_hook = &tty_read_avail_input; /* keyboard.c */ |
| 2346 | device->frame_up_to_date_hook = 0; /* Not needed. */ | 2355 | terminal->frame_up_to_date_hook = 0; /* Not needed. */ |
| 2347 | 2356 | ||
| 2348 | device->delete_frame_hook = &delete_tty_output; | 2357 | terminal->delete_frame_hook = &delete_tty_output; |
| 2349 | device->delete_device_hook = &delete_tty; | 2358 | terminal->delete_terminal_hook = &delete_tty; |
| 2350 | 2359 | ||
| 2351 | if (name) | 2360 | if (name) |
| 2352 | { | 2361 | { |
| @@ -2370,7 +2379,7 @@ init_tty (char *name, char *terminal_type, int must_succeed) | |||
| 2370 | 2379 | ||
| 2371 | if (fd < 0) | 2380 | if (fd < 0) |
| 2372 | { | 2381 | { |
| 2373 | delete_tty (device); | 2382 | delete_tty (terminal); |
| 2374 | error ("Could not open file: %s", name); | 2383 | error ("Could not open file: %s", name); |
| 2375 | } | 2384 | } |
| 2376 | if (!isatty (fd)) | 2385 | if (!isatty (fd)) |
| @@ -2383,7 +2392,7 @@ init_tty (char *name, char *terminal_type, int must_succeed) | |||
| 2383 | 2392 | ||
| 2384 | file = fdopen (fd, "w+"); | 2393 | file = fdopen (fd, "w+"); |
| 2385 | tty->name = xstrdup (name); | 2394 | tty->name = xstrdup (name); |
| 2386 | device->name = xstrdup (name); | 2395 | terminal->name = xstrdup (name); |
| 2387 | tty->input = file; | 2396 | tty->input = file; |
| 2388 | tty->output = file; | 2397 | tty->output = file; |
| 2389 | } | 2398 | } |
| @@ -2396,7 +2405,7 @@ init_tty (char *name, char *terminal_type, int must_succeed) | |||
| 2396 | error ("There is no controlling terminal any more"); | 2405 | error ("There is no controlling terminal any more"); |
| 2397 | } | 2406 | } |
| 2398 | tty->name = 0; | 2407 | tty->name = 0; |
| 2399 | device->name = xstrdup (ttyname (0)); | 2408 | terminal->name = xstrdup (ttyname (0)); |
| 2400 | tty->input = stdin; | 2409 | tty->input = stdin; |
| 2401 | tty->output = stdout; | 2410 | tty->output = stdout; |
| 2402 | } | 2411 | } |
| @@ -2418,16 +2427,16 @@ init_tty (char *name, char *terminal_type, int must_succeed) | |||
| 2418 | FrameCols (tty) = FRAME_COLS (f); /* XXX */ | 2427 | FrameCols (tty) = FRAME_COLS (f); /* XXX */ |
| 2419 | tty->specified_window = FRAME_LINES (f); /* XXX */ | 2428 | tty->specified_window = FRAME_LINES (f); /* XXX */ |
| 2420 | 2429 | ||
| 2421 | tty->device->delete_in_insert_mode = 1; | 2430 | tty->terminal->delete_in_insert_mode = 1; |
| 2422 | 2431 | ||
| 2423 | UseTabs (tty) = 0; | 2432 | UseTabs (tty) = 0; |
| 2424 | device->scroll_region_ok = 0; | 2433 | terminal->scroll_region_ok = 0; |
| 2425 | 2434 | ||
| 2426 | /* Seems to insert lines when it's not supposed to, messing up the | 2435 | /* Seems to insert lines when it's not supposed to, messing up the |
| 2427 | device. In doing a trace, it didn't seem to be called much, so I | 2436 | display. In doing a trace, it didn't seem to be called much, so I |
| 2428 | don't think we're losing anything by turning it off. */ | 2437 | don't think we're losing anything by turning it off. */ |
| 2429 | device->line_ins_del_ok = 0; | 2438 | terminal->line_ins_del_ok = 0; |
| 2430 | device->char_ins_del_ok = 1; | 2439 | terminal->char_ins_del_ok = 1; |
| 2431 | 2440 | ||
| 2432 | baud_rate = 19200; | 2441 | baud_rate = 19200; |
| 2433 | 2442 | ||
| @@ -2435,7 +2444,7 @@ init_tty (char *name, char *terminal_type, int must_succeed) | |||
| 2435 | FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none; /* XXX */ | 2444 | FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none; /* XXX */ |
| 2436 | TN_max_colors = 16; /* Required to be non-zero for tty-display-color-p */ | 2445 | TN_max_colors = 16; /* Required to be non-zero for tty-display-color-p */ |
| 2437 | 2446 | ||
| 2438 | return device; | 2447 | return terminal; |
| 2439 | #else /* not WINDOWSNT */ | 2448 | #else /* not WINDOWSNT */ |
| 2440 | 2449 | ||
| 2441 | Wcm_clear (tty); | 2450 | Wcm_clear (tty); |
| @@ -2451,11 +2460,11 @@ init_tty (char *name, char *terminal_type, int must_succeed) | |||
| 2451 | if (status < 0) | 2460 | if (status < 0) |
| 2452 | { | 2461 | { |
| 2453 | #ifdef TERMINFO | 2462 | #ifdef TERMINFO |
| 2454 | maybe_fatal (must_succeed, buffer, device, | 2463 | maybe_fatal (must_succeed, buffer, terminal, |
| 2455 | "Cannot open terminfo database file", | 2464 | "Cannot open terminfo database file", |
| 2456 | "Cannot open terminfo database file"); | 2465 | "Cannot open terminfo database file"); |
| 2457 | #else | 2466 | #else |
| 2458 | maybe_fatal (must_succeed, buffer, device, | 2467 | maybe_fatal (must_succeed, buffer, terminal, |
| 2459 | "Cannot open termcap database file", | 2468 | "Cannot open termcap database file", |
| 2460 | "Cannot open termcap database file"); | 2469 | "Cannot open termcap database file"); |
| 2461 | #endif | 2470 | #endif |
| @@ -2463,7 +2472,7 @@ init_tty (char *name, char *terminal_type, int must_succeed) | |||
| 2463 | if (status == 0) | 2472 | if (status == 0) |
| 2464 | { | 2473 | { |
| 2465 | #ifdef TERMINFO | 2474 | #ifdef TERMINFO |
| 2466 | maybe_fatal (must_succeed, buffer, device, | 2475 | maybe_fatal (must_succeed, buffer, terminal, |
| 2467 | "Terminal type %s is not defined", | 2476 | "Terminal type %s is not defined", |
| 2468 | "Terminal type %s is not defined.\n\ | 2477 | "Terminal type %s is not defined.\n\ |
| 2469 | If that is not the actual type of terminal you have,\n\ | 2478 | If that is not the actual type of terminal you have,\n\ |
| @@ -2472,7 +2481,7 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\ | |||
| 2472 | to do `unset TERMINFO' (C-shell: `unsetenv TERMINFO') as well.", | 2481 | to do `unset TERMINFO' (C-shell: `unsetenv TERMINFO') as well.", |
| 2473 | terminal_type); | 2482 | terminal_type); |
| 2474 | #else | 2483 | #else |
| 2475 | maybe_fatal (must_succeed, buffer, device, | 2484 | maybe_fatal (must_succeed, buffer, terminal, |
| 2476 | "Terminal type %s is not defined", | 2485 | "Terminal type %s is not defined", |
| 2477 | "Terminal type %s is not defined.\n\ | 2486 | "Terminal type %s is not defined.\n\ |
| 2478 | If that is not the actual type of terminal you have,\n\ | 2487 | If that is not the actual type of terminal you have,\n\ |
| @@ -2594,9 +2603,9 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", | |||
| 2594 | /* Since we make MagicWrap terminals look like AutoWrap, we need to have | 2603 | /* Since we make MagicWrap terminals look like AutoWrap, we need to have |
| 2595 | the former flag imply the latter. */ | 2604 | the former flag imply the latter. */ |
| 2596 | AutoWrap (tty) = MagicWrap (tty) || tgetflag ("am"); | 2605 | AutoWrap (tty) = MagicWrap (tty) || tgetflag ("am"); |
| 2597 | device->memory_below_frame = tgetflag ("db"); | 2606 | terminal->memory_below_frame = tgetflag ("db"); |
| 2598 | tty->TF_hazeltine = tgetflag ("hz"); | 2607 | tty->TF_hazeltine = tgetflag ("hz"); |
| 2599 | device->must_write_spaces = tgetflag ("in"); | 2608 | terminal->must_write_spaces = tgetflag ("in"); |
| 2600 | tty->meta_key = tgetflag ("km") || tgetflag ("MT"); | 2609 | tty->meta_key = tgetflag ("km") || tgetflag ("MT"); |
| 2601 | tty->TF_insmode_motion = tgetflag ("mi"); | 2610 | tty->TF_insmode_motion = tgetflag ("mi"); |
| 2602 | tty->TF_standout_motion = tgetflag ("ms"); | 2611 | tty->TF_standout_motion = tgetflag ("ms"); |
| @@ -2604,19 +2613,19 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", | |||
| 2604 | tty->TF_teleray = tgetflag ("xt"); | 2613 | tty->TF_teleray = tgetflag ("xt"); |
| 2605 | 2614 | ||
| 2606 | #ifdef MULTI_KBOARD | 2615 | #ifdef MULTI_KBOARD |
| 2607 | device->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); | 2616 | terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); |
| 2608 | init_kboard (device->kboard); | 2617 | init_kboard (terminal->kboard); |
| 2609 | device->kboard->next_kboard = all_kboards; | 2618 | terminal->kboard->next_kboard = all_kboards; |
| 2610 | all_kboards = device->kboard; | 2619 | all_kboards = terminal->kboard; |
| 2611 | device->kboard->reference_count++; | 2620 | terminal->kboard->reference_count++; |
| 2612 | /* Don't let the initial kboard remain current longer than necessary. | 2621 | /* Don't let the initial kboard remain current longer than necessary. |
| 2613 | That would cause problems if a file loaded on startup tries to | 2622 | That would cause problems if a file loaded on startup tries to |
| 2614 | prompt in the mini-buffer. */ | 2623 | prompt in the mini-buffer. */ |
| 2615 | if (current_kboard == initial_kboard) | 2624 | if (current_kboard == initial_kboard) |
| 2616 | current_kboard = device->kboard; | 2625 | current_kboard = terminal->kboard; |
| 2617 | #endif | 2626 | #endif |
| 2618 | 2627 | ||
| 2619 | term_get_fkeys (address, device->kboard); | 2628 | term_get_fkeys (address, terminal->kboard); |
| 2620 | 2629 | ||
| 2621 | /* Get frame size from system, or else from termcap. */ | 2630 | /* Get frame size from system, or else from termcap. */ |
| 2622 | { | 2631 | { |
| @@ -2632,13 +2641,13 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", | |||
| 2632 | FrameRows (tty) = tgetnum ("li"); | 2641 | FrameRows (tty) = tgetnum ("li"); |
| 2633 | 2642 | ||
| 2634 | if (FrameRows (tty) < 3 || FrameCols (tty) < 3) | 2643 | if (FrameRows (tty) < 3 || FrameCols (tty) < 3) |
| 2635 | maybe_fatal (must_succeed, NULL, device, | 2644 | maybe_fatal (must_succeed, NULL, terminal, |
| 2636 | "Screen size %dx%d is too small" | 2645 | "Screen size %dx%d is too small" |
| 2637 | "Screen size %dx%d is too small", | 2646 | "Screen size %dx%d is too small", |
| 2638 | FrameCols (tty), FrameRows (tty)); | 2647 | FrameCols (tty), FrameRows (tty)); |
| 2639 | 2648 | ||
| 2640 | #if 0 /* This is not used anywhere. */ | 2649 | #if 0 /* This is not used anywhere. */ |
| 2641 | tty->device->min_padding_speed = tgetnum ("pb"); | 2650 | tty->terminal->min_padding_speed = tgetnum ("pb"); |
| 2642 | #endif | 2651 | #endif |
| 2643 | 2652 | ||
| 2644 | TabWidth (tty) = tgetnum ("tw"); | 2653 | TabWidth (tty) = tgetnum ("tw"); |
| @@ -2716,7 +2725,7 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", | |||
| 2716 | 2725 | ||
| 2717 | if (!strcmp (terminal_type, "supdup")) | 2726 | if (!strcmp (terminal_type, "supdup")) |
| 2718 | { | 2727 | { |
| 2719 | device->memory_below_frame = 1; | 2728 | terminal->memory_below_frame = 1; |
| 2720 | tty->Wcm->cm_losewrap = 1; | 2729 | tty->Wcm->cm_losewrap = 1; |
| 2721 | } | 2730 | } |
| 2722 | if (!strncmp (terminal_type, "c10", 3) | 2731 | if (!strncmp (terminal_type, "c10", 3) |
| @@ -2743,7 +2752,7 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", | |||
| 2743 | tty->TS_set_window = "\033v%C %C %C %C "; | 2752 | tty->TS_set_window = "\033v%C %C %C %C "; |
| 2744 | } | 2753 | } |
| 2745 | /* Termcap entry often fails to have :in: flag */ | 2754 | /* Termcap entry often fails to have :in: flag */ |
| 2746 | device->must_write_spaces = 1; | 2755 | terminal->must_write_spaces = 1; |
| 2747 | /* :ti string typically fails to have \E^G! in it */ | 2756 | /* :ti string typically fails to have \E^G! in it */ |
| 2748 | /* This limits scope of insert-char to one line. */ | 2757 | /* This limits scope of insert-char to one line. */ |
| 2749 | strcpy (area, tty->TS_termcap_modes); | 2758 | strcpy (area, tty->TS_termcap_modes); |
| @@ -2765,7 +2774,7 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", | |||
| 2765 | 2774 | ||
| 2766 | if (Wcm_init (tty) == -1) /* can't do cursor motion */ | 2775 | if (Wcm_init (tty) == -1) /* can't do cursor motion */ |
| 2767 | { | 2776 | { |
| 2768 | maybe_fatal (must_succeed, NULL, device, | 2777 | maybe_fatal (must_succeed, NULL, terminal, |
| 2769 | "Terminal type \"%s\" is not powerful enough to run Emacs", | 2778 | "Terminal type \"%s\" is not powerful enough to run Emacs", |
| 2770 | #ifdef VMS | 2779 | #ifdef VMS |
| 2771 | "Terminal type \"%s\" is not powerful enough to run Emacs.\n\ | 2780 | "Terminal type \"%s\" is not powerful enough to run Emacs.\n\ |
| @@ -2794,7 +2803,7 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", | |||
| 2794 | } | 2803 | } |
| 2795 | 2804 | ||
| 2796 | if (FrameRows (tty) <= 0 || FrameCols (tty) <= 0) | 2805 | if (FrameRows (tty) <= 0 || FrameCols (tty) <= 0) |
| 2797 | maybe_fatal (must_succeed, NULL, device, | 2806 | maybe_fatal (must_succeed, NULL, terminal, |
| 2798 | "Could not determine the frame size", | 2807 | "Could not determine the frame size", |
| 2799 | "Could not determine the frame size"); | 2808 | "Could not determine the frame size"); |
| 2800 | 2809 | ||
| @@ -2808,30 +2817,30 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", | |||
| 2808 | 2817 | ||
| 2809 | UseTabs (tty) = tabs_safe_p (fileno (tty->input)) && TabWidth (tty) == 8; | 2818 | UseTabs (tty) = tabs_safe_p (fileno (tty->input)) && TabWidth (tty) == 8; |
| 2810 | 2819 | ||
| 2811 | device->scroll_region_ok | 2820 | terminal->scroll_region_ok |
| 2812 | = (tty->Wcm->cm_abs | 2821 | = (tty->Wcm->cm_abs |
| 2813 | && (tty->TS_set_window || tty->TS_set_scroll_region || tty->TS_set_scroll_region_1)); | 2822 | && (tty->TS_set_window || tty->TS_set_scroll_region || tty->TS_set_scroll_region_1)); |
| 2814 | 2823 | ||
| 2815 | device->line_ins_del_ok | 2824 | terminal->line_ins_del_ok |
| 2816 | = (((tty->TS_ins_line || tty->TS_ins_multi_lines) | 2825 | = (((tty->TS_ins_line || tty->TS_ins_multi_lines) |
| 2817 | && (tty->TS_del_line || tty->TS_del_multi_lines)) | 2826 | && (tty->TS_del_line || tty->TS_del_multi_lines)) |
| 2818 | || (device->scroll_region_ok | 2827 | || (terminal->scroll_region_ok |
| 2819 | && tty->TS_fwd_scroll && tty->TS_rev_scroll)); | 2828 | && tty->TS_fwd_scroll && tty->TS_rev_scroll)); |
| 2820 | 2829 | ||
| 2821 | device->char_ins_del_ok | 2830 | terminal->char_ins_del_ok |
| 2822 | = ((tty->TS_ins_char || tty->TS_insert_mode | 2831 | = ((tty->TS_ins_char || tty->TS_insert_mode |
| 2823 | || tty->TS_pad_inserted_char || tty->TS_ins_multi_chars) | 2832 | || tty->TS_pad_inserted_char || tty->TS_ins_multi_chars) |
| 2824 | && (tty->TS_del_char || tty->TS_del_multi_chars)); | 2833 | && (tty->TS_del_char || tty->TS_del_multi_chars)); |
| 2825 | 2834 | ||
| 2826 | device->fast_clear_end_of_line = tty->TS_clr_line != 0; | 2835 | terminal->fast_clear_end_of_line = tty->TS_clr_line != 0; |
| 2827 | 2836 | ||
| 2828 | init_baud_rate (fileno (tty->input)); | 2837 | init_baud_rate (fileno (tty->input)); |
| 2829 | 2838 | ||
| 2830 | #ifdef AIXHFT | 2839 | #ifdef AIXHFT |
| 2831 | /* The HFT system on AIX doesn't optimize for scrolling, so it's | 2840 | /* The HFT system on AIX doesn't optimize for scrolling, so it's |
| 2832 | really ugly at times. */ | 2841 | really ugly at times. */ |
| 2833 | device->line_ins_del_ok = 0; | 2842 | terminal->line_ins_del_ok = 0; |
| 2834 | device->char_ins_del_ok = 0; | 2843 | terminal->char_ins_del_ok = 0; |
| 2835 | #endif | 2844 | #endif |
| 2836 | 2845 | ||
| 2837 | /* Don't do this. I think termcap may still need the buffer. */ | 2846 | /* Don't do this. I think termcap may still need the buffer. */ |
| @@ -2840,26 +2849,26 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", | |||
| 2840 | /* Init system terminal modes (RAW or CBREAK, etc.). */ | 2849 | /* Init system terminal modes (RAW or CBREAK, etc.). */ |
| 2841 | init_sys_modes (tty); | 2850 | init_sys_modes (tty); |
| 2842 | 2851 | ||
| 2843 | return device; | 2852 | return terminal; |
| 2844 | #endif /* not WINDOWSNT */ | 2853 | #endif /* not WINDOWSNT */ |
| 2845 | } | 2854 | } |
| 2846 | 2855 | ||
| 2847 | /* Auxiliary error-handling function for init_tty. | 2856 | /* Auxiliary error-handling function for init_tty. |
| 2848 | Free BUFFER and delete DEVICE, then call error or fatal | 2857 | Free BUFFER and delete TERMINAL, then call error or fatal |
| 2849 | with str1 or str2, respectively, according to MUST_SUCCEED. */ | 2858 | with str1 or str2, respectively, according to MUST_SUCCEED. */ |
| 2850 | 2859 | ||
| 2851 | static void | 2860 | static void |
| 2852 | maybe_fatal (must_succeed, buffer, device, str1, str2, arg1, arg2) | 2861 | maybe_fatal (must_succeed, buffer, terminal, str1, str2, arg1, arg2) |
| 2853 | int must_succeed; | 2862 | int must_succeed; |
| 2854 | char *buffer; | 2863 | char *buffer; |
| 2855 | struct device *device; | 2864 | struct terminal *terminal; |
| 2856 | char *str1, *str2, *arg1, *arg2; | 2865 | char *str1, *str2, *arg1, *arg2; |
| 2857 | { | 2866 | { |
| 2858 | if (buffer) | 2867 | if (buffer) |
| 2859 | xfree (buffer); | 2868 | xfree (buffer); |
| 2860 | 2869 | ||
| 2861 | if (device) | 2870 | if (terminal) |
| 2862 | delete_tty (device); | 2871 | delete_tty (terminal); |
| 2863 | 2872 | ||
| 2864 | if (must_succeed) | 2873 | if (must_succeed) |
| 2865 | fatal (str2, arg1, arg2); | 2874 | fatal (str2, arg1, arg2); |
| @@ -2886,38 +2895,38 @@ fatal (str, arg1, arg2) | |||
| 2886 | static int deleting_tty = 0; | 2895 | static int deleting_tty = 0; |
| 2887 | 2896 | ||
| 2888 | 2897 | ||
| 2889 | /* Delete the given terminal device, closing all frames on it. */ | 2898 | /* Delete the given tty terminal, closing all frames on it. */ |
| 2890 | 2899 | ||
| 2891 | static void | 2900 | static void |
| 2892 | delete_tty (struct device *device) | 2901 | delete_tty (struct terminal *terminal) |
| 2893 | { | 2902 | { |
| 2894 | struct tty_display_info *tty; | 2903 | struct tty_display_info *tty; |
| 2895 | Lisp_Object tail, frame; | 2904 | Lisp_Object tail, frame; |
| 2896 | char *tty_name; | 2905 | char *tty_name; |
| 2897 | int last_device; | 2906 | int last_terminal; |
| 2898 | 2907 | ||
| 2899 | if (deleting_tty) | 2908 | if (deleting_tty) |
| 2900 | /* We get a recursive call when we delete the last frame on this | 2909 | /* We get a recursive call when we delete the last frame on this |
| 2901 | device. */ | 2910 | terminal. */ |
| 2902 | return; | 2911 | return; |
| 2903 | 2912 | ||
| 2904 | if (device->type != output_termcap) | 2913 | if (terminal->type != output_termcap) |
| 2905 | abort (); | 2914 | abort (); |
| 2906 | 2915 | ||
| 2907 | tty = device->display_info.tty; | 2916 | tty = terminal->display_info.tty; |
| 2908 | 2917 | ||
| 2909 | last_device = 1; | 2918 | last_terminal = 1; |
| 2910 | FOR_EACH_FRAME (tail, frame) | 2919 | FOR_EACH_FRAME (tail, frame) |
| 2911 | { | 2920 | { |
| 2912 | struct frame *f = XFRAME (frame); | 2921 | struct frame *f = XFRAME (frame); |
| 2913 | if (FRAME_LIVE_P (f) && (!FRAME_TERMCAP_P (f) || FRAME_TTY (f) != tty)) | 2922 | if (FRAME_LIVE_P (f) && (!FRAME_TERMCAP_P (f) || FRAME_TTY (f) != tty)) |
| 2914 | { | 2923 | { |
| 2915 | last_device = 0; | 2924 | last_terminal = 0; |
| 2916 | break; | 2925 | break; |
| 2917 | } | 2926 | } |
| 2918 | } | 2927 | } |
| 2919 | if (last_device) | 2928 | if (last_terminal) |
| 2920 | error ("Attempt to delete the sole display device with live frames"); | 2929 | error ("Attempt to delete the sole terminal device with live frames"); |
| 2921 | 2930 | ||
| 2922 | if (tty == tty_list) | 2931 | if (tty == tty_list) |
| 2923 | tty_list = tty->next; | 2932 | tty_list = tty->next; |
| @@ -2947,10 +2956,10 @@ delete_tty (struct device *device) | |||
| 2947 | } | 2956 | } |
| 2948 | 2957 | ||
| 2949 | /* reset_sys_modes needs a valid device, so this call needs to be | 2958 | /* reset_sys_modes needs a valid device, so this call needs to be |
| 2950 | before delete_device. */ | 2959 | before delete_terminal. */ |
| 2951 | reset_sys_modes (tty); | 2960 | reset_sys_modes (tty); |
| 2952 | 2961 | ||
| 2953 | delete_device (device); | 2962 | delete_terminal (terminal); |
| 2954 | 2963 | ||
| 2955 | tty_name = tty->name; | 2964 | tty_name = tty->name; |
| 2956 | if (tty->type) | 2965 | if (tty->type) |
| @@ -3025,8 +3034,8 @@ See `resume-tty'. */); | |||
| 3025 | defsubr (&Stty_display_color_p); | 3034 | defsubr (&Stty_display_color_p); |
| 3026 | defsubr (&Stty_display_color_cells); | 3035 | defsubr (&Stty_display_color_cells); |
| 3027 | defsubr (&Stty_no_underline); | 3036 | defsubr (&Stty_no_underline); |
| 3028 | defsubr (&Sdisplay_tty_type); | 3037 | defsubr (&Stty_type); |
| 3029 | defsubr (&Sdisplay_controlling_tty_p); | 3038 | defsubr (&Scontrolling_tty_p); |
| 3030 | defsubr (&Ssuspend_tty); | 3039 | defsubr (&Ssuspend_tty); |
| 3031 | defsubr (&Sresume_tty); | 3040 | defsubr (&Sresume_tty); |
| 3032 | } | 3041 | } |