diff options
| author | Karoly Lorentey | 2005-12-29 18:20:26 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2005-12-29 18:20:26 +0000 |
| commit | 6ed8eeffb3a2c5cbbd8622a7ccd0726c3bf92946 (patch) | |
| tree | c50fd5553226312df72cc55fd1167beaaede651b /src/terminal.c | |
| parent | 17ccbd91f620a84e7524b99b74077b4ddb736283 (diff) | |
| download | emacs-6ed8eeffb3a2c5cbbd8622a7ccd0726c3bf92946.tar.gz emacs-6ed8eeffb3a2c5cbbd8622a7ccd0726c3bf92946.zip | |
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
* src/termhooks.h (struct device): Rename to `terminal'. Rename member
`next_device' to `next_terminal'.
(device_list): Rename to `terminal_list'.
(FRAME_DEVICE): Rename to `FRAME_TERMINAL'.
(DEVICE_TERMINAL_CODING): Rename to `TERMINAL_TERMINAL_CODING'.
(TERMINAL_KEYBOARD_CODING): Rename to `TERMINAL_KEYBOARD_CODING'.
(DEVICE_ACTIVE_P): Rename to `TERMINAL_ACTIVE_P'.
Update declarations and macro definitions.
* src/termchar.h (tty_display_info): Rename member `device' to `terminal'.
(FRAME_TTY): Update for renames.
* src/xterm.h (x_display_info): Rename member `device' to `terminal'.
* src/frame.h (frame): Rename `device' member to `terminal'.
(FRAME_KBOARD, FRAME_LIVE_P, Qdevice, Qdisplay_live_p):
Update for renames.
* src/lisp.h (set_process_environment): Rename to `set_global_environment'.
(device): Rename to `terminal'.
* src/dispextern.h: Update declarations and macro definitions.
* src/terminal.c (device_list): Rename to `terminal_list'.
(next_device_id): Rename to `next_terminal_id'.
(initial_device): Rename to `initial_terminal'.
(get_device): Rename to `get_terminal'.
(create_device): Rename to `create_terminal'.
(mark_devices): Rename to `mark_terminals'.
(delete_device): Rename to `delete_terminal'.
(Fdelete_display): Rename to `Fdelete_terminal'.
(Fframe_terminal): Move here from frame.c.
(Fdisplay_live_p): Rename to `Fterminal_live_p'.
(Fdisplay_list): Rename to `Fterminal_list'.
(Fdisplay_name): Rename to `Fterminal_name'.
(init_initial_device): Rename to `init_initial_terminal'.
(delete_initial_device): Rename to `delete_initial_terminal'.
(ring_bell, update_begin, update_end, set_terminal_window)
(cursor_to, raw_cursor_to, clear_to_end, clear_frame)
(clear_end_of_line, write_glyphs, insert_glyphs, delete_glyphs)
(ins_del_lines, get_terminal_param, store_terminal_param)
(Fterminal_parameters, Fterminal_parameter)
(Fmodify_terminal_parameters, Fset_terminal_parameter)
(syms_of_terminal): Update for renames.
* src/term.c (get_tty_device): Rename to `get_tty_terminal'. Update.
(Fdisplay_tty_type): Rename to `Ftty_type'.
(Fdisplay_controlling_tty_p): Rename to `Fcontrolling_tty_p'.
(delete_tty, tty_set_terminal_modes, tty_reset_terminal_modes)
(Ftty_display_color_p, Ftty_display_color_cells, get_named_tty)
(Ftty_no_underline, Fsuspend_tty, Fresume_tty, create_tty_output)
(init_tty, maybe_fatal, delete_tty, syms_of_term): Update for rename.
* src/frame.c (Qdevice): Rename to `Qterminal'.
(Qdisplay_live_p): Rename to `Qterminal_live_p'.
(terminal_frame_count): Rename to `tty_frame_count'.
(Fframe_display): Move to terminal.c, rename to `Fframe_terminal'.
(make_frame_without_minibuffer, make_initial_frame)
(make_terminal_frame, Fmodify_frame_parameters)
(do_switch_frame, Fdelete_frame, Fmouse_position)
(Fmouse_pixel_position, Fraise_frame, Flower_frame)
(Fredirect_frame_focus, set_term_frame_name, syms_of_frame):
Update for renames.
* src/xdisp.c (message2_nolog, message3_nolog, redisplay_internal)
(set_vertical_scroll_bar, redisplay_window, check_x_display_info)
(x_set_scroll_bar_foreground, x_set_scroll_bar_background)
(Fx_create_frame, Fxw_display_color_p, Fx_display_grayscale_p)
(Fx_display_pixel_width, Fx_display_pixel_height)
(Fx_display_planes, Fx_display_color_cells)
(Fx_server_max_request_size, Fx_server_vendor, Fx_server_version)
(Fx_display_screens, Fx_display_mm_height, Fx_display_mm_width)
(Fx_display_backing_store, Fx_display_visual_class)
(Fx_display_save_under, Fx_close_connection, x_create_tip_frame):
Update for renames.
* xterm.c (handle_one_xevent): Initialize `f' to NULL.
(x_delete_device): Rename to `x_delete_terminal'.
(x_create_device): Rename to `x_create_terminal'.
(XTset_terminal_modes, XTreset_terminal_modes)
(XTread_socket, x_connection_closed, x_term_init)
(x_term_init, x_delete_display): Update for renames.
* src/dispnew.c (Fredraw_frame, Fsend_string_to_terminal)
(Fsend_string_to_terminal, init_display): Update for renames.
* src/keyboard.c (push_frame_kboard, pop_kboard, pop_kboard)
(kbd_buffer_get_event, read_avail_input, tty_read_avail_input)
(interrupt_signal, Fset_output_flow_control)
(Fset_input_meta_mode, Fset_quit_char, delete_kboard)
(syms_of_keyboard): Update for renames.
* src/alloc.c (mark_devices): Update declaration.
(Fgarbage_collect): Update for renames.
* src/coding.c (Fset_terminal_coding_system_internal)
(Fterminal_coding_system4)
(Fset_keyboard_coding_system_internal)
(Fkeyboard_coding_system): Update for renames.
* src/data.c (Fterminal_local_value, Fset_terminal_local_value):
Update for renames.
* src/minibuf.c (read_minibuf): Update for renames.
* src/sysdep.c (init_sys_modes, reset_sys_modes): Update for renames.
* xselect.c (x_handle_selection_clear): Update for renames.
* lisp/files.el (save-buffers-kill-display): Rename to `save-buffers-kill-terminal'.
(save-buffers-kill-terminal, ctl-x-map): Update for renames.
* frame.el (make-frame): Rename 'device frame parameter to 'terminal. Update.
(frames-on-display-list, framep-on-display, suspend-frame): Update for renames.
(selected-display): Rename to `selected-terminal'.
* server.el (server-save-buffers-kill-display): Rename to
`server-save-buffers-kill-terminal'.
(server-delete-client, server-handle-delete-frame)
(server-handle-suspend-tty, server-process-filter)
(server-switch-buffer): Update for renames.
* startup.el (normal-splash-screen, normal-splash-screen): Update for renames.
* talk.el (talk): Update for renames.
* termdev.el (terminal-id): Update for renames.
* xt-mouse.el (turn-on-xterm-mouse-tracking-on-terminal)
(turn-off-xterm-mouse-tracking-on-terminal)
(xterm-mouse-handle-delete-frame): Update for renames.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-471
Diffstat (limited to 'src/terminal.c')
| -rw-r--r-- | src/terminal.c | 367 |
1 files changed, 196 insertions, 171 deletions
diff --git a/src/terminal.c b/src/terminal.c index 83879a43afa..084318b893f 100644 --- a/src/terminal.c +++ b/src/terminal.c | |||
| @@ -28,19 +28,19 @@ Boston, MA 02110-1301, USA. */ | |||
| 28 | #include "coding.h" | 28 | #include "coding.h" |
| 29 | #include "keyboard.h" | 29 | #include "keyboard.h" |
| 30 | 30 | ||
| 31 | /* Chain of all displays currently in use. */ | 31 | /* Chain of all terminals currently in use. */ |
| 32 | struct device *device_list; | 32 | struct terminal *terminal_list; |
| 33 | 33 | ||
| 34 | /* The first unallocated display id. */ | 34 | /* The first unallocated terminal id. */ |
| 35 | static int next_device_id; | 35 | static int next_terminal_id; |
| 36 | 36 | ||
| 37 | /* The initial display device, created by initial_term_init. */ | 37 | /* The initial terminal device, created by initial_term_init. */ |
| 38 | struct device *initial_device; | 38 | struct terminal *initial_terminal; |
| 39 | 39 | ||
| 40 | /* Function to use to ring the bell. */ | 40 | /* Function to use to ring the bell. */ |
| 41 | Lisp_Object Vring_bell_function; | 41 | Lisp_Object Vring_bell_function; |
| 42 | 42 | ||
| 43 | void delete_initial_device P_ ((struct device *)); | 43 | static void delete_initial_terminal P_ ((struct terminal *)); |
| 44 | 44 | ||
| 45 | 45 | ||
| 46 | 46 | ||
| @@ -66,22 +66,22 @@ ring_bell (struct frame *f) | |||
| 66 | 66 | ||
| 67 | Vring_bell_function = function; | 67 | Vring_bell_function = function; |
| 68 | } | 68 | } |
| 69 | else if (FRAME_DEVICE (f)->ring_bell_hook) | 69 | else if (FRAME_TERMINAL (f)->ring_bell_hook) |
| 70 | (*FRAME_DEVICE (f)->ring_bell_hook) (f); | 70 | (*FRAME_TERMINAL (f)->ring_bell_hook) (f); |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | void | 73 | void |
| 74 | update_begin (struct frame *f) | 74 | update_begin (struct frame *f) |
| 75 | { | 75 | { |
| 76 | if (FRAME_DEVICE (f)->update_begin_hook) | 76 | if (FRAME_TERMINAL (f)->update_begin_hook) |
| 77 | (*FRAME_DEVICE (f)->update_begin_hook) (f); | 77 | (*FRAME_TERMINAL (f)->update_begin_hook) (f); |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | void | 80 | void |
| 81 | update_end (struct frame *f) | 81 | update_end (struct frame *f) |
| 82 | { | 82 | { |
| 83 | if (FRAME_DEVICE (f)->update_end_hook) | 83 | if (FRAME_TERMINAL (f)->update_end_hook) |
| 84 | (*FRAME_DEVICE (f)->update_end_hook) (f); | 84 | (*FRAME_TERMINAL (f)->update_end_hook) (f); |
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | /* Specify how many text lines, from the top of the window, | 87 | /* Specify how many text lines, from the top of the window, |
| @@ -92,8 +92,8 @@ update_end (struct frame *f) | |||
| 92 | void | 92 | void |
| 93 | set_terminal_window (struct frame *f, int size) | 93 | set_terminal_window (struct frame *f, int size) |
| 94 | { | 94 | { |
| 95 | if (FRAME_DEVICE (f)->set_terminal_window_hook) | 95 | if (FRAME_TERMINAL (f)->set_terminal_window_hook) |
| 96 | (*FRAME_DEVICE (f)->set_terminal_window_hook) (f, size); | 96 | (*FRAME_TERMINAL (f)->set_terminal_window_hook) (f, size); |
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | /* Move cursor to row/column position VPOS/HPOS. HPOS/VPOS are | 99 | /* Move cursor to row/column position VPOS/HPOS. HPOS/VPOS are |
| @@ -102,8 +102,8 @@ set_terminal_window (struct frame *f, int size) | |||
| 102 | void | 102 | void |
| 103 | cursor_to (struct frame *f, int vpos, int hpos) | 103 | cursor_to (struct frame *f, int vpos, int hpos) |
| 104 | { | 104 | { |
| 105 | if (FRAME_DEVICE (f)->cursor_to_hook) | 105 | if (FRAME_TERMINAL (f)->cursor_to_hook) |
| 106 | (*FRAME_DEVICE (f)->cursor_to_hook) (f, vpos, hpos); | 106 | (*FRAME_TERMINAL (f)->cursor_to_hook) (f, vpos, hpos); |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | /* Similar but don't take any account of the wasted characters. */ | 109 | /* Similar but don't take any account of the wasted characters. */ |
| @@ -111,8 +111,8 @@ cursor_to (struct frame *f, int vpos, int hpos) | |||
| 111 | void | 111 | void |
| 112 | raw_cursor_to (struct frame *f, int row, int col) | 112 | raw_cursor_to (struct frame *f, int row, int col) |
| 113 | { | 113 | { |
| 114 | if (FRAME_DEVICE (f)->raw_cursor_to_hook) | 114 | if (FRAME_TERMINAL (f)->raw_cursor_to_hook) |
| 115 | (*FRAME_DEVICE (f)->raw_cursor_to_hook) (f, row, col); | 115 | (*FRAME_TERMINAL (f)->raw_cursor_to_hook) (f, row, col); |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | /* Erase operations */ | 118 | /* Erase operations */ |
| @@ -121,8 +121,8 @@ raw_cursor_to (struct frame *f, int row, int col) | |||
| 121 | void | 121 | void |
| 122 | clear_to_end (struct frame *f) | 122 | clear_to_end (struct frame *f) |
| 123 | { | 123 | { |
| 124 | if (FRAME_DEVICE (f)->clear_to_end_hook) | 124 | if (FRAME_TERMINAL (f)->clear_to_end_hook) |
| 125 | (*FRAME_DEVICE (f)->clear_to_end_hook) (f); | 125 | (*FRAME_TERMINAL (f)->clear_to_end_hook) (f); |
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | /* Clear entire frame */ | 128 | /* Clear entire frame */ |
| @@ -130,8 +130,8 @@ clear_to_end (struct frame *f) | |||
| 130 | void | 130 | void |
| 131 | clear_frame (struct frame *f) | 131 | clear_frame (struct frame *f) |
| 132 | { | 132 | { |
| 133 | if (FRAME_DEVICE (f)->clear_frame_hook) | 133 | if (FRAME_TERMINAL (f)->clear_frame_hook) |
| 134 | (*FRAME_DEVICE (f)->clear_frame_hook) (f); | 134 | (*FRAME_TERMINAL (f)->clear_frame_hook) (f); |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | /* Clear from cursor to end of line. | 137 | /* Clear from cursor to end of line. |
| @@ -142,8 +142,8 @@ clear_frame (struct frame *f) | |||
| 142 | void | 142 | void |
| 143 | clear_end_of_line (struct frame *f, int first_unused_hpos) | 143 | clear_end_of_line (struct frame *f, int first_unused_hpos) |
| 144 | { | 144 | { |
| 145 | if (FRAME_DEVICE (f)->clear_end_of_line_hook) | 145 | if (FRAME_TERMINAL (f)->clear_end_of_line_hook) |
| 146 | (*FRAME_DEVICE (f)->clear_end_of_line_hook) (f, first_unused_hpos); | 146 | (*FRAME_TERMINAL (f)->clear_end_of_line_hook) (f, first_unused_hpos); |
| 147 | } | 147 | } |
| 148 | 148 | ||
| 149 | /* Output LEN glyphs starting at STRING at the nominal cursor position. | 149 | /* Output LEN glyphs starting at STRING at the nominal cursor position. |
| @@ -152,8 +152,8 @@ clear_end_of_line (struct frame *f, int first_unused_hpos) | |||
| 152 | void | 152 | void |
| 153 | write_glyphs (struct frame *f, struct glyph *string, int len) | 153 | write_glyphs (struct frame *f, struct glyph *string, int len) |
| 154 | { | 154 | { |
| 155 | if (FRAME_DEVICE (f)->write_glyphs_hook) | 155 | if (FRAME_TERMINAL (f)->write_glyphs_hook) |
| 156 | (*FRAME_DEVICE (f)->write_glyphs_hook) (f, string, len); | 156 | (*FRAME_TERMINAL (f)->write_glyphs_hook) (f, string, len); |
| 157 | } | 157 | } |
| 158 | 158 | ||
| 159 | /* Insert LEN glyphs from START at the nominal cursor position. | 159 | /* Insert LEN glyphs from START at the nominal cursor position. |
| @@ -166,8 +166,8 @@ insert_glyphs (struct frame *f, struct glyph *start, int len) | |||
| 166 | if (len <= 0) | 166 | if (len <= 0) |
| 167 | return; | 167 | return; |
| 168 | 168 | ||
| 169 | if (FRAME_DEVICE (f)->insert_glyphs_hook) | 169 | if (FRAME_TERMINAL (f)->insert_glyphs_hook) |
| 170 | (*FRAME_DEVICE (f)->insert_glyphs_hook) (f, start, len); | 170 | (*FRAME_TERMINAL (f)->insert_glyphs_hook) (f, start, len); |
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | /* Delete N glyphs at the nominal cursor position. */ | 173 | /* Delete N glyphs at the nominal cursor position. */ |
| @@ -175,8 +175,8 @@ insert_glyphs (struct frame *f, struct glyph *start, int len) | |||
| 175 | void | 175 | void |
| 176 | delete_glyphs (struct frame *f, int n) | 176 | delete_glyphs (struct frame *f, int n) |
| 177 | { | 177 | { |
| 178 | if (FRAME_DEVICE (f)->delete_glyphs_hook) | 178 | if (FRAME_TERMINAL (f)->delete_glyphs_hook) |
| 179 | (*FRAME_DEVICE (f)->delete_glyphs_hook) (f, n); | 179 | (*FRAME_TERMINAL (f)->delete_glyphs_hook) (f, n); |
| 180 | } | 180 | } |
| 181 | 181 | ||
| 182 | /* Insert N lines at vpos VPOS. If N is negative, delete -N lines. */ | 182 | /* Insert N lines at vpos VPOS. If N is negative, delete -N lines. */ |
| @@ -184,185 +184,209 @@ delete_glyphs (struct frame *f, int n) | |||
| 184 | void | 184 | void |
| 185 | ins_del_lines (struct frame *f, int vpos, int n) | 185 | ins_del_lines (struct frame *f, int vpos, int n) |
| 186 | { | 186 | { |
| 187 | if (FRAME_DEVICE (f)->ins_del_lines_hook) | 187 | if (FRAME_TERMINAL (f)->ins_del_lines_hook) |
| 188 | (*FRAME_DEVICE (f)->ins_del_lines_hook) (f, vpos, n); | 188 | (*FRAME_TERMINAL (f)->ins_del_lines_hook) (f, vpos, n); |
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | 191 | ||
| 192 | 192 | ||
| 193 | 193 | ||
| 194 | /* Return the display object specified by DEVICE. DEVICE may be a | 194 | /* Return the terminal object specified by TERMINAL. TERMINAL may be a |
| 195 | display id, a frame, or nil for the display device of the current | 195 | terminal id, a frame, or nil for the terminal device of the current |
| 196 | frame. If THROW is zero, return NULL for failure, otherwise throw | 196 | frame. If THROW is zero, return NULL for failure, otherwise throw |
| 197 | an error. */ | 197 | an error. */ |
| 198 | 198 | ||
| 199 | struct device * | 199 | struct terminal * |
| 200 | get_device (Lisp_Object device, int throw) | 200 | get_terminal (Lisp_Object terminal, int throw) |
| 201 | { | 201 | { |
| 202 | struct device *result = NULL; | 202 | struct terminal *result = NULL; |
| 203 | 203 | ||
| 204 | if (NILP (device)) | 204 | if (NILP (terminal)) |
| 205 | device = selected_frame; | 205 | terminal = selected_frame; |
| 206 | 206 | ||
| 207 | if (INTEGERP (device)) | 207 | if (INTEGERP (terminal)) |
| 208 | { | 208 | { |
| 209 | struct device *d; | 209 | struct terminal *t; |
| 210 | 210 | ||
| 211 | for (d = device_list; d; d = d->next_device) | 211 | for (t = terminal_list; t; t = t->next_terminal) |
| 212 | { | 212 | { |
| 213 | if (d->id == XINT (device)) | 213 | if (t->id == XINT (terminal)) |
| 214 | { | 214 | { |
| 215 | result = d; | 215 | result = t; |
| 216 | break; | 216 | break; |
| 217 | } | 217 | } |
| 218 | } | 218 | } |
| 219 | } | 219 | } |
| 220 | else if (FRAMEP (device)) | 220 | else if (FRAMEP (terminal)) |
| 221 | { | 221 | { |
| 222 | result = FRAME_DEVICE (XFRAME (device)); | 222 | result = FRAME_TERMINAL (XFRAME (terminal)); |
| 223 | } | 223 | } |
| 224 | 224 | ||
| 225 | if (result == NULL && throw) | 225 | if (result == NULL && throw) |
| 226 | wrong_type_argument (Qdisplay_live_p, device); | 226 | wrong_type_argument (Qterminal_live_p, terminal); |
| 227 | 227 | ||
| 228 | return result; | 228 | return result; |
| 229 | } | 229 | } |
| 230 | 230 | ||
| 231 | 231 | ||
| 232 | 232 | ||
| 233 | /* Create a new device object and add it to the device list. */ | 233 | /* Create a new terminal object and add it to the terminal list. */ |
| 234 | 234 | ||
| 235 | struct device * | 235 | struct terminal * |
| 236 | create_device (void) | 236 | create_terminal (void) |
| 237 | { | 237 | { |
| 238 | struct device *device = (struct device *) xmalloc (sizeof (struct device)); | 238 | struct terminal *terminal = (struct terminal *) xmalloc (sizeof (struct terminal)); |
| 239 | 239 | ||
| 240 | bzero (device, sizeof (struct device)); | 240 | bzero (terminal, sizeof (struct terminal)); |
| 241 | device->next_device = device_list; | 241 | terminal->next_terminal = terminal_list; |
| 242 | device_list = device; | 242 | terminal_list = terminal; |
| 243 | 243 | ||
| 244 | device->id = next_device_id++; | 244 | terminal->id = next_terminal_id++; |
| 245 | 245 | ||
| 246 | device->keyboard_coding = | 246 | terminal->keyboard_coding = |
| 247 | (struct coding_system *) xmalloc (sizeof (struct coding_system)); | 247 | (struct coding_system *) xmalloc (sizeof (struct coding_system)); |
| 248 | device->terminal_coding = | 248 | terminal->terminal_coding = |
| 249 | (struct coding_system *) xmalloc (sizeof (struct coding_system)); | 249 | (struct coding_system *) xmalloc (sizeof (struct coding_system)); |
| 250 | 250 | ||
| 251 | setup_coding_system (Qnil, device->keyboard_coding); | 251 | setup_coding_system (Qnil, terminal->keyboard_coding); |
| 252 | setup_coding_system (Qnil, device->terminal_coding); | 252 | setup_coding_system (Qnil, terminal->terminal_coding); |
| 253 | 253 | ||
| 254 | device->param_alist = Qnil; | 254 | terminal->param_alist = Qnil; |
| 255 | return device; | 255 | return terminal; |
| 256 | } | 256 | } |
| 257 | 257 | ||
| 258 | /* Mark the Lisp pointers in the terminal objects. | 258 | /* Mark the Lisp pointers in the terminal objects. |
| 259 | Called by the Fgarbage_collector. */ | 259 | Called by the Fgarbage_collector. */ |
| 260 | 260 | ||
| 261 | void | 261 | void |
| 262 | mark_devices (void) | 262 | mark_terminals (void) |
| 263 | { | 263 | { |
| 264 | struct device *d; | 264 | struct terminal *t; |
| 265 | for (d = device_list; d; d = d->next_device) | 265 | for (t = terminal_list; t; t = t->next_terminal) |
| 266 | { | 266 | { |
| 267 | mark_object (d->param_alist); | 267 | mark_object (t->param_alist); |
| 268 | } | 268 | } |
| 269 | } | 269 | } |
| 270 | 270 | ||
| 271 | 271 | ||
| 272 | /* Remove a device from the device list and free its memory. */ | 272 | /* Remove a terminal from the terminal list and free its memory. */ |
| 273 | 273 | ||
| 274 | void | 274 | void |
| 275 | delete_device (struct device *device) | 275 | delete_terminal (struct terminal *terminal) |
| 276 | { | 276 | { |
| 277 | struct device **dp; | 277 | struct terminal **tp; |
| 278 | Lisp_Object tail, frame; | 278 | Lisp_Object tail, frame; |
| 279 | 279 | ||
| 280 | /* Check for and close live frames that are still on this | 280 | /* Check for and close live frames that are still on this |
| 281 | device. */ | 281 | terminal. */ |
| 282 | FOR_EACH_FRAME (tail, frame) | 282 | FOR_EACH_FRAME (tail, frame) |
| 283 | { | 283 | { |
| 284 | struct frame *f = XFRAME (frame); | 284 | struct frame *f = XFRAME (frame); |
| 285 | if (FRAME_LIVE_P (f) && f->device == device) | 285 | if (FRAME_LIVE_P (f) && f->terminal == terminal) |
| 286 | { | 286 | { |
| 287 | Fdelete_frame (frame, Qt); | 287 | Fdelete_frame (frame, Qt); |
| 288 | } | 288 | } |
| 289 | } | 289 | } |
| 290 | 290 | ||
| 291 | for (dp = &device_list; *dp != device; dp = &(*dp)->next_device) | 291 | for (tp = &terminal_list; *tp != terminal; tp = &(*tp)->next_terminal) |
| 292 | if (! *dp) | 292 | if (! *tp) |
| 293 | abort (); | 293 | abort (); |
| 294 | *dp = device->next_device; | 294 | *tp = terminal->next_terminal; |
| 295 | 295 | ||
| 296 | if (device->keyboard_coding) | 296 | if (terminal->keyboard_coding) |
| 297 | xfree (device->keyboard_coding); | 297 | xfree (terminal->keyboard_coding); |
| 298 | if (device->terminal_coding) | 298 | if (terminal->terminal_coding) |
| 299 | xfree (device->terminal_coding); | 299 | xfree (terminal->terminal_coding); |
| 300 | if (device->name) | 300 | if (terminal->name) |
| 301 | xfree (device->name); | 301 | xfree (terminal->name); |
| 302 | 302 | ||
| 303 | #ifdef MULTI_KBOARD | 303 | #ifdef MULTI_KBOARD |
| 304 | if (device->kboard && --device->kboard->reference_count == 0) | 304 | if (terminal->kboard && --terminal->kboard->reference_count == 0) |
| 305 | delete_kboard (device->kboard); | 305 | delete_kboard (terminal->kboard); |
| 306 | #endif | 306 | #endif |
| 307 | 307 | ||
| 308 | bzero (device, sizeof (struct device)); | 308 | bzero (terminal, sizeof (struct terminal)); |
| 309 | xfree (device); | 309 | xfree (terminal); |
| 310 | } | 310 | } |
| 311 | 311 | ||
| 312 | DEFUN ("delete-display", Fdelete_display, Sdelete_display, 0, 2, 0, | 312 | DEFUN ("delete-terminal", Fdelete_terminal, Sdelete_terminal, 0, 2, 0, |
| 313 | doc: /* Delete DEVICE by deleting all frames on it and closing the device. | 313 | doc: /* Delete TERMINAL by deleting all frames on it and closing the terminal. |
| 314 | DEVICE may be a display device id, a frame, or nil (meaning the | 314 | TERMINAL may be a terminal id, a frame, or nil (meaning the selected |
| 315 | selected frame's display device). | 315 | frame's terminal). |
| 316 | 316 | ||
| 317 | Normally, you may not delete a display if all other displays are suspended, | 317 | Normally, you may not delete a display if all other displays are suspended, |
| 318 | but if the second argument FORCE is non-nil, you may do so. */) | 318 | but if the second argument FORCE is non-nil, you may do so. */) |
| 319 | (device, force) | 319 | (terminal, force) |
| 320 | Lisp_Object device, force; | 320 | Lisp_Object terminal, force; |
| 321 | { | 321 | { |
| 322 | struct device *d, *p; | 322 | struct terminal *t, *p; |
| 323 | 323 | ||
| 324 | d = get_device (device, 0); | 324 | t = get_terminal (terminal, 0); |
| 325 | 325 | ||
| 326 | if (!d) | 326 | if (!t) |
| 327 | return Qnil; | 327 | return Qnil; |
| 328 | 328 | ||
| 329 | p = device_list; | 329 | p = terminal_list; |
| 330 | while (p && (p == d || !DEVICE_ACTIVE_P (p))) | 330 | while (p && (p == t || !TERMINAL_ACTIVE_P (p))) |
| 331 | p = p->next_device; | 331 | p = p->next_terminal; |
| 332 | 332 | ||
| 333 | if (NILP (force) && !p) | 333 | if (NILP (force) && !p) |
| 334 | error ("Attempt to delete the sole active display device"); | 334 | error ("Attempt to delete the sole active display terminal"); |
| 335 | 335 | ||
| 336 | if (d->delete_device_hook) | 336 | if (t->delete_terminal_hook) |
| 337 | (*d->delete_device_hook) (d); | 337 | (*t->delete_terminal_hook) (t); |
| 338 | else | 338 | else |
| 339 | delete_device (d); | 339 | delete_terminal (t); |
| 340 | 340 | ||
| 341 | return Qnil; | 341 | return Qnil; |
| 342 | } | 342 | } |
| 343 | 343 | ||
| 344 | DEFUN ("display-live-p", Fdisplay_live_p, Sdisplay_live_p, 1, 1, 0, | 344 | |
| 345 | doc: /* Return non-nil if OBJECT is a device which has not been deleted. | 345 | DEFUN ("frame-terminal", Fframe_terminal, Sframe_terminal, 0, 1, 0, |
| 346 | Value is nil if OBJECT is not a live display device. | 346 | doc: /* Return the terminal that FRAME is displayed on. |
| 347 | If object is a live display device, the return value indicates what | 347 | If FRAME is nil, the selected frame is used. |
| 348 | sort of output device it uses. See the documentation of `framep' for | 348 | |
| 349 | The terminal device is represented by its integer identifier. */) | ||
| 350 | (frame) | ||
| 351 | Lisp_Object frame; | ||
| 352 | { | ||
| 353 | struct terminal *t; | ||
| 354 | |||
| 355 | if (NILP (frame)) | ||
| 356 | frame = selected_frame; | ||
| 357 | |||
| 358 | CHECK_LIVE_FRAME (frame); | ||
| 359 | |||
| 360 | t = get_terminal (frame, 0); | ||
| 361 | |||
| 362 | if (!t) | ||
| 363 | return Qnil; | ||
| 364 | else | ||
| 365 | return make_number (t->id); | ||
| 366 | } | ||
| 367 | |||
| 368 | DEFUN ("terminal-live-p", Fterminal_live_p, Sterminal_live_p, 1, 1, 0, | ||
| 369 | doc: /* Return non-nil if OBJECT is a terminal which has not been deleted. | ||
| 370 | Value is nil if OBJECT is not a live display terminal. | ||
| 371 | If object is a live display terminal, the return value indicates what | ||
| 372 | sort of output terminal it uses. See the documentation of `framep' for | ||
| 349 | possible return values. | 373 | possible return values. |
| 350 | 374 | ||
| 351 | Display devices are represented by their integer identifiers. */) | 375 | Display terminals are represented by their integer identifiers. */) |
| 352 | (object) | 376 | (object) |
| 353 | Lisp_Object object; | 377 | Lisp_Object object; |
| 354 | { | 378 | { |
| 355 | struct device *d; | 379 | struct terminal *t; |
| 356 | 380 | ||
| 357 | if (!INTEGERP (object)) | 381 | if (!INTEGERP (object)) |
| 358 | return Qnil; | 382 | return Qnil; |
| 359 | 383 | ||
| 360 | d = get_device (object, 0); | 384 | t = get_terminal (object, 0); |
| 361 | 385 | ||
| 362 | if (!d) | 386 | if (!t) |
| 363 | return Qnil; | 387 | return Qnil; |
| 364 | 388 | ||
| 365 | switch (d->type) | 389 | switch (t->type) |
| 366 | { | 390 | { |
| 367 | case output_initial: /* The initial frame is like a termcap frame. */ | 391 | case output_initial: /* The initial frame is like a termcap frame. */ |
| 368 | case output_termcap: | 392 | case output_termcap: |
| @@ -380,64 +404,64 @@ Display devices are represented by their integer identifiers. */) | |||
| 380 | } | 404 | } |
| 381 | } | 405 | } |
| 382 | 406 | ||
| 383 | DEFUN ("display-list", Fdisplay_list, Sdisplay_list, 0, 0, 0, | 407 | DEFUN ("terminal-list", Fterminal_list, Sterminal_list, 0, 0, 0, |
| 384 | doc: /* Return a list of all display devices. | 408 | doc: /* Return a list of all terminal devices. |
| 385 | Display devices are represented by their integer identifiers. */) | 409 | Terminal devices are represented by their integer identifiers. */) |
| 386 | () | 410 | () |
| 387 | { | 411 | { |
| 388 | Lisp_Object devices = Qnil; | 412 | Lisp_Object terminals = Qnil; |
| 389 | struct device *d; | 413 | struct terminal *t; |
| 390 | 414 | ||
| 391 | for (d = device_list; d; d = d->next_device) | 415 | for (t = terminal_list; t; t = t->next_terminal) |
| 392 | devices = Fcons (make_number (d->id), devices); | 416 | terminals = Fcons (make_number (t->id), terminals); |
| 393 | 417 | ||
| 394 | return devices; | 418 | return terminals; |
| 395 | } | 419 | } |
| 396 | 420 | ||
| 397 | DEFUN ("display-name", Fdisplay_name, Sdisplay_name, 0, 1, 0, | 421 | DEFUN ("terminal-name", Fterminal_name, Sterminal_name, 0, 1, 0, |
| 398 | doc: /* Return the name of the display device DEVICE. | 422 | doc: /* Return the name of the terminal device TERMINAL. |
| 399 | It is not guaranteed that the returned value is unique among opened devices. | 423 | It is not guaranteed that the returned value is unique among opened devices. |
| 400 | 424 | ||
| 401 | DEVICE may be a display device id, a frame, or nil (meaning the | 425 | TERMINAL may be a terminal id, a frame, or nil (meaning the |
| 402 | selected frame's display device). */) | 426 | selected frame's terminal). */) |
| 403 | (device) | 427 | (terminal) |
| 404 | Lisp_Object device; | 428 | Lisp_Object terminal; |
| 405 | { | 429 | { |
| 406 | struct device *d = get_device (device, 1); | 430 | struct terminal *t = get_terminal (terminal, 1); |
| 407 | 431 | ||
| 408 | if (d->name) | 432 | if (t->name) |
| 409 | return build_string (d->name); | 433 | return build_string (t->name); |
| 410 | else | 434 | else |
| 411 | return Qnil; | 435 | return Qnil; |
| 412 | } | 436 | } |
| 413 | 437 | ||
| 414 | 438 | ||
| 415 | 439 | ||
| 416 | /* Return the value of terminal parameter PARAM in device D. */ | 440 | /* Return the value of terminal parameter PARAM in terminal T. */ |
| 417 | Lisp_Object | 441 | Lisp_Object |
| 418 | get_terminal_param (d, param) | 442 | get_terminal_param (t, param) |
| 419 | struct device *d; | 443 | struct terminal *t; |
| 420 | Lisp_Object param; | 444 | Lisp_Object param; |
| 421 | { | 445 | { |
| 422 | Lisp_Object tem = Fassq (param, d->param_alist); | 446 | Lisp_Object tem = Fassq (param, t->param_alist); |
| 423 | if (EQ (tem, Qnil)) | 447 | if (EQ (tem, Qnil)) |
| 424 | return tem; | 448 | return tem; |
| 425 | return Fcdr (tem); | 449 | return Fcdr (tem); |
| 426 | } | 450 | } |
| 427 | 451 | ||
| 428 | /* Set the value of terminal parameter PARAMETER in device D to VALUE. | 452 | /* Set the value of terminal parameter PARAMETER in terminal D to VALUE. |
| 429 | Return the previous value. */ | 453 | Return the previous value. */ |
| 430 | 454 | ||
| 431 | Lisp_Object | 455 | Lisp_Object |
| 432 | store_terminal_param (d, parameter, value) | 456 | store_terminal_param (t, parameter, value) |
| 433 | struct device *d; | 457 | struct terminal *t; |
| 434 | Lisp_Object parameter; | 458 | Lisp_Object parameter; |
| 435 | Lisp_Object value; | 459 | Lisp_Object value; |
| 436 | { | 460 | { |
| 437 | Lisp_Object old_alist_elt = Fassq (parameter, d->param_alist); | 461 | Lisp_Object old_alist_elt = Fassq (parameter, t->param_alist); |
| 438 | if (EQ (old_alist_elt, Qnil)) | 462 | if (EQ (old_alist_elt, Qnil)) |
| 439 | { | 463 | { |
| 440 | d->param_alist = Fcons (Fcons (parameter, value), d->param_alist); | 464 | t->param_alist = Fcons (Fcons (parameter, value), t->param_alist); |
| 441 | return Qnil; | 465 | return Qnil; |
| 442 | } | 466 | } |
| 443 | else | 467 | else |
| @@ -454,27 +478,27 @@ DEFUN ("terminal-parameters", Fterminal_parameters, Sterminal_parameters, 0, 1, | |||
| 454 | The value is a list of elements of the form (PARM . VALUE), where PARM | 478 | The value is a list of elements of the form (PARM . VALUE), where PARM |
| 455 | is a symbol. | 479 | is a symbol. |
| 456 | 480 | ||
| 457 | TERMINAL can be a terminal if, a frame or nil (meaning the selected | 481 | TERMINAL can be a terminal id, a frame or nil (meaning the selected |
| 458 | frame's terminal). */) | 482 | frame's terminal). */) |
| 459 | (terminal) | 483 | (terminal) |
| 460 | Lisp_Object terminal; | 484 | Lisp_Object terminal; |
| 461 | { | 485 | { |
| 462 | struct device *d = get_device (terminal, 1); | 486 | struct terminal *t = get_terminal (terminal, 1); |
| 463 | return Fcopy_alist (d->param_alist); | 487 | return Fcopy_alist (t->param_alist); |
| 464 | } | 488 | } |
| 465 | 489 | ||
| 466 | DEFUN ("terminal-parameter", Fterminal_parameter, Sterminal_parameter, 2, 2, 0, | 490 | DEFUN ("terminal-parameter", Fterminal_parameter, Sterminal_parameter, 2, 2, 0, |
| 467 | doc: /* Return TERMINAL's value for parameter PARAMETER. | 491 | doc: /* Return TERMINAL's value for parameter PARAMETER. |
| 468 | TERMINAL can be a terminal if, a frame or nil (meaning the selected | 492 | TERMINAL can be a terminal id, a frame or nil (meaning the selected |
| 469 | frame's terminal). */) | 493 | frame's terminal). */) |
| 470 | (terminal, parameter) | 494 | (terminal, parameter) |
| 471 | Lisp_Object terminal; | 495 | Lisp_Object terminal; |
| 472 | Lisp_Object parameter; | 496 | Lisp_Object parameter; |
| 473 | { | 497 | { |
| 474 | Lisp_Object value; | 498 | Lisp_Object value; |
| 475 | struct device *d = get_device (terminal, 1); | 499 | struct terminal *t = get_terminal (terminal, 1); |
| 476 | CHECK_SYMBOL (parameter); | 500 | CHECK_SYMBOL (parameter); |
| 477 | value = Fcdr (Fassq (parameter, d->param_alist)); | 501 | value = Fcdr (Fassq (parameter, t->param_alist)); |
| 478 | return value; | 502 | return value; |
| 479 | } | 503 | } |
| 480 | 504 | ||
| @@ -484,14 +508,14 @@ DEFUN ("modify-terminal-parameters", Fmodify_terminal_parameters, | |||
| 484 | ALIST is an alist of parameters to change and their new values. | 508 | ALIST is an alist of parameters to change and their new values. |
| 485 | Each element of ALIST has the form (PARM . VALUE), where PARM is a symbol. | 509 | Each element of ALIST has the form (PARM . VALUE), where PARM is a symbol. |
| 486 | 510 | ||
| 487 | TERMINAL can be a terminal if, a frame or nil (meaning the selected | 511 | TERMINAL can be a terminal id, a frame or nil (meaning the selected |
| 488 | frame's terminal). */) | 512 | frame's terminal). */) |
| 489 | (terminal, alist) | 513 | (terminal, alist) |
| 490 | Lisp_Object terminal; | 514 | Lisp_Object terminal; |
| 491 | Lisp_Object alist; | 515 | Lisp_Object alist; |
| 492 | { | 516 | { |
| 493 | Lisp_Object tail, prop, val; | 517 | Lisp_Object tail, prop, val; |
| 494 | struct device *d = get_device (terminal, 1); | 518 | struct terminal *t = get_terminal (terminal, 1); |
| 495 | int length = XINT (Fsafe_length (alist)); | 519 | int length = XINT (Fsafe_length (alist)); |
| 496 | int i; | 520 | int i; |
| 497 | Lisp_Object *parms = (Lisp_Object *) alloca (length * sizeof (Lisp_Object)); | 521 | Lisp_Object *parms = (Lisp_Object *) alloca (length * sizeof (Lisp_Object)); |
| @@ -515,7 +539,7 @@ frame's terminal). */) | |||
| 515 | { | 539 | { |
| 516 | prop = parms[i]; | 540 | prop = parms[i]; |
| 517 | val = values[i]; | 541 | val = values[i]; |
| 518 | store_terminal_param (d, prop, val); | 542 | store_terminal_param (t, prop, val); |
| 519 | } | 543 | } |
| 520 | return Qnil; | 544 | return Qnil; |
| 521 | } | 545 | } |
| @@ -525,50 +549,50 @@ DEFUN ("set-terminal-parameter", Fset_terminal_parameter, | |||
| 525 | doc: /* Set TERMINAL's value for parameter PARAMETER to VALUE. | 549 | doc: /* Set TERMINAL's value for parameter PARAMETER to VALUE. |
| 526 | Return the previous value of PARAMETER. | 550 | Return the previous value of PARAMETER. |
| 527 | 551 | ||
| 528 | TERMINAL can be a terminal if, a frame or nil (meaning the selected | 552 | TERMINAL can be a terminal id, a frame or nil (meaning the selected |
| 529 | frame's terminal). */) | 553 | frame's terminal). */) |
| 530 | (terminal, parameter, value) | 554 | (terminal, parameter, value) |
| 531 | Lisp_Object terminal; | 555 | Lisp_Object terminal; |
| 532 | Lisp_Object parameter; | 556 | Lisp_Object parameter; |
| 533 | Lisp_Object value; | 557 | Lisp_Object value; |
| 534 | { | 558 | { |
| 535 | struct device *d = get_device (terminal, 1); | 559 | struct terminal *t = get_terminal (terminal, 1); |
| 536 | return store_terminal_param (d, parameter, value); | 560 | return store_terminal_param (t, parameter, value); |
| 537 | } | 561 | } |
| 538 | 562 | ||
| 539 | 563 | ||
| 540 | 564 | ||
| 541 | /* Create the bootstrap display device for the initial frame. | 565 | /* Create the bootstrap display terminal for the initial frame. |
| 542 | Returns a device of type output_initial. */ | 566 | Returns a terminal of type output_initial. */ |
| 543 | 567 | ||
| 544 | struct device * | 568 | struct terminal * |
| 545 | init_initial_device (void) | 569 | init_initial_terminal (void) |
| 546 | { | 570 | { |
| 547 | if (initialized || device_list || tty_list) | 571 | if (initialized || terminal_list || tty_list) |
| 548 | abort (); | 572 | abort (); |
| 549 | 573 | ||
| 550 | initial_device = create_device (); | 574 | initial_terminal = create_terminal (); |
| 551 | initial_device->type = output_initial; | 575 | initial_terminal->type = output_initial; |
| 552 | initial_device->name = xstrdup ("initial_device"); | 576 | initial_terminal->name = xstrdup ("initial_terminal"); |
| 553 | initial_device->kboard = initial_kboard; | 577 | initial_terminal->kboard = initial_kboard; |
| 554 | 578 | ||
| 555 | initial_device->delete_device_hook = &delete_initial_device; | 579 | initial_terminal->delete_terminal_hook = &delete_initial_terminal; |
| 556 | /* All other hooks are NULL. */ | 580 | /* All other hooks are NULL. */ |
| 557 | 581 | ||
| 558 | return initial_device; | 582 | return initial_terminal; |
| 559 | } | 583 | } |
| 560 | 584 | ||
| 561 | /* Deletes the bootstrap display device. | 585 | /* Deletes the bootstrap terminal device. |
| 562 | Called through delete_device_hook. */ | 586 | Called through delete_terminal_hook. */ |
| 563 | 587 | ||
| 564 | void | 588 | static void |
| 565 | delete_initial_device (struct device *device) | 589 | delete_initial_terminal (struct terminal *terminal) |
| 566 | { | 590 | { |
| 567 | if (device != initial_device) | 591 | if (terminal != initial_terminal) |
| 568 | abort (); | 592 | abort (); |
| 569 | 593 | ||
| 570 | delete_device (device); | 594 | delete_terminal (terminal); |
| 571 | initial_device = NULL; | 595 | initial_terminal = NULL; |
| 572 | } | 596 | } |
| 573 | 597 | ||
| 574 | void | 598 | void |
| @@ -580,10 +604,11 @@ syms_of_terminal () | |||
| 580 | The function should accept no arguments. */); | 604 | The function should accept no arguments. */); |
| 581 | Vring_bell_function = Qnil; | 605 | Vring_bell_function = Qnil; |
| 582 | 606 | ||
| 583 | defsubr (&Sdelete_display); | 607 | defsubr (&Sdelete_terminal); |
| 584 | defsubr (&Sdisplay_live_p); | 608 | defsubr (&Sframe_terminal); |
| 585 | defsubr (&Sdisplay_list); | 609 | defsubr (&Sterminal_live_p); |
| 586 | defsubr (&Sdisplay_name); | 610 | defsubr (&Sterminal_list); |
| 611 | defsubr (&Sterminal_name); | ||
| 587 | defsubr (&Sterminal_parameters); | 612 | defsubr (&Sterminal_parameters); |
| 588 | defsubr (&Sterminal_parameter); | 613 | defsubr (&Sterminal_parameter); |
| 589 | defsubr (&Smodify_terminal_parameters); | 614 | defsubr (&Smodify_terminal_parameters); |