aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKaroly Lorentey2005-12-25 20:06:58 +0000
committerKaroly Lorentey2005-12-25 20:06:58 +0000
commited8dad6b616204b4dd4e853801f41da6f4c3b0a7 (patch)
treed260111171143cc889b7c801b911a07cf05da67c /src
parent4beb2d71ea5cbd7f451b8958c3cd21b3cd4d6edc (diff)
downloademacs-ed8dad6b616204b4dd4e853801f41da6f4c3b0a7.tar.gz
emacs-ed8dad6b616204b4dd4e853801f41da6f4c3b0a7.zip
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
* lisp/termdev.el (terminal-parameter-alist, terminal-parameters, terminal-parameter-p) (terminal-parameter, set-terminal-parameter, terminal-handle-delete-frame): Remove. * src/term.c (Vring_bell_function, device_list, initial_device) (next_device_id, 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_device, Fdisplay_name, create_device, delete_device) (Fdelete_display, Fdisplay_live_p, Fdisplay_list) Move to terminal.c. (syms_of_term): Move their initialization to terminal.c. * src/terminal.c: New file. (device_list, next_device_id, initial_device, Vring_bell_function) (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_device, create_device, delete_device) (Fdelete_display, Fdisplay_live_p, Fdisplay_list, Fdisplay_name): Move here. (mark_devices, get_terminal_param, store_terminal_param) (Fterminal_parameters, Fterminal_parameter) (Fmodify_terminal_parameters, Fset_terminal_parameter) (init_initial_device, delete_initial_device) (syms_of_terminal): New functions. * lisp/simple.el (normal-erase-is-backspace-setup-frame) (normal-erase-is-backspace-mode): Rephrase things without terminal-parameter-p. * lisp/termdev.el (terminal-getenv, terminal-setenv) (with-terminal-environment): Ditto. * mac/makefile.MPW (EmacsObjects): Add terminal.c.x. ({Src}terminal.c.x): Add dependencies. * src/Makefile.in (obj): Add terminal.o. (terminal.o): Add dependencies. [HAVE_CARBON]: Make terminal.o depend on macgui.h. * src/alloc.c (mark_devices): Declare. (Fgarbage_collect): Call `mark_devices'. * src/dispextern.h (set_scroll_region, turn_off_insert) (turn_off_highlight, background_highlight, clear_end_of_line_raw) (tty_clear_end_of_line, tty_setup_colors, delete_tty): Remove. (raw_cursor_to, clear_to_end, tty_turn_off_insert) (tty_turn_off_highlight): Add declaration. * src/emacs.c (main): Call `syms_of_terminal'. * src/frame.c (get_future_frame_param): New function. (Fmake_terminal_frame): Use it. * src/keyboard.c (pop_kboard): Remove unused variable. (Fset_output_flow_control): Return nil. * src/keymap.h (Fset_keymap_parent): Add EXFUN. * src/lisp.h (syms_of_terminal): Declare it. * src/sysdep.c (reset_sys_modes): Update for renames. * src/term.c (set_scroll_region): Rename to `tty_set_scroll_region'. (turn_on_insert): Rename to `tty_turn_on_insert'. (turn_off_insert): Rename to `tty_turn_off_insert'. (turn_off_highlight): Rename to `tty_turn_off_highlight'. (turn_on_highlight): Rename to `tty_turn_on_highlight'. (toggle_highligh): Rename to `tty_toggle_highlight'. (background_highlight): Rename to `tty_background_highlight'. (highlight_if_desired): Rename to `tty_highlight_if_desired'. (tty_ring_bell, tty_update_end, tty_set_terminal_window) (tty_set_scroll_region, tty_background_highlight) (tty_cursor_to, tty_raw_cursor_to, tty_clear_to_end) (tty_clear_frame, tty_clear_end_of_line, tty_write_glyphs) (tty_insert_glyphs, tty_delete_glyphs, tty_ins_del_lines) (term_get_fkeys, tty_setup_colors, dissociate_if_controlling_tty) (delete_tty): Add static modifier. (tty_reset_terminal_modes, tty_set_terminal_window) (tty_set_scroll_region, tty_background_highlight) (tty_highlight_if_desired, tty_cursor_to) (tty_raw_cursor_to, tty_clear_to_end, tty_clear_frame) (tty_clear_end_of_line, tty_write_glyphs, tty_insert_glyphs) (tty_delete_glyphs, tty_ins_del_lines, turn_on_face): Update for renames. * src/termhooks.h (param_alist): New member to struct device. * src/xterm.h (x_delete_device): Declare. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-460
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.in6
-rw-r--r--src/alloc.c2
-rw-r--r--src/dispextern.h45
-rw-r--r--src/emacs.c1
-rw-r--r--src/frame.c78
-rw-r--r--src/keyboard.c2
-rw-r--r--src/keymap.h1
-rw-r--r--src/lisp.h3
-rw-r--r--src/sysdep.c2
-rw-r--r--src/term.c814
-rw-r--r--src/termhooks.h3
-rw-r--r--src/terminal.c596
-rw-r--r--src/xterm.h1
13 files changed, 887 insertions, 667 deletions
diff --git a/src/Makefile.in b/src/Makefile.in
index e0ba8a25b66..f8029d5e246 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -577,7 +577,7 @@ emacsappsrc = ${srcdir}/../mac/Emacs.app/
577 whose initialized data areas should be dumped as pure by dump-emacs. */ 577 whose initialized data areas should be dumped as pure by dump-emacs. */
578obj= dispnew.o frame.o scroll.o xdisp.o $(XMENU_OBJ) window.o \ 578obj= dispnew.o frame.o scroll.o xdisp.o $(XMENU_OBJ) window.o \
579 charset.o coding.o category.o ccl.o \ 579 charset.o coding.o category.o ccl.o \
580 cm.o term.o xfaces.o $(XOBJ) $(GTK_OBJ)\ 580 cm.o term.o terminal.o xfaces.o $(XOBJ) $(GTK_OBJ)\
581 emacs.o keyboard.o macros.o keymap.o sysdep.o \ 581 emacs.o keyboard.o macros.o keymap.o sysdep.o \
582 buffer.o filelock.o insdel.o marker.o \ 582 buffer.o filelock.o insdel.o marker.o \
583 minibuf.o fileio.o dired.o filemode.o \ 583 minibuf.o fileio.o dired.o filemode.o \
@@ -1171,6 +1171,8 @@ term.o: term.c termchar.h termhooks.h termopts.h $(config_h) cm.h frame.h \
1171 disptab.h dispextern.h keyboard.h charset.h coding.h ccl.h msdos.h \ 1171 disptab.h dispextern.h keyboard.h charset.h coding.h ccl.h msdos.h \
1172 window.h keymap.h 1172 window.h keymap.h
1173termcap.o: termcap.c $(config_h) 1173termcap.o: termcap.c $(config_h)
1174terminal.o: terminal.c frame.h termchar.h termhooks.h charset.h coding.h \
1175 keyboard.h $(config_h)
1174terminfo.o: terminfo.c $(config_h) 1176terminfo.o: terminfo.c $(config_h)
1175tparam.o: tparam.c $(config_h) 1177tparam.o: tparam.c $(config_h)
1176undo.o: undo.c buffer.h commands.h $(config_h) 1178undo.o: undo.c buffer.h commands.h $(config_h)
@@ -1250,7 +1252,7 @@ sunfns.o: sunfns.c buffer.h window.h dispextern.h termhooks.h $(config_h)
1250#ifdef HAVE_CARBON 1252#ifdef HAVE_CARBON
1251abbrev.o buffer.o callint.o cmds.o dispnew.o editfns.o fileio.o frame.o \ 1253abbrev.o buffer.o callint.o cmds.o dispnew.o editfns.o fileio.o frame.o \
1252 fontset.o indent.o insdel.o keyboard.o macros.o minibuf.o msdos.o process.o \ 1254 fontset.o indent.o insdel.o keyboard.o macros.o minibuf.o msdos.o process.o \
1253 scroll.o sysdep.o term.o widget.o window.o xdisp.o xfaces.o xfns.o xmenu.o \ 1255 scroll.o sysdep.o term.o terminal.o widget.o window.o xdisp.o xfaces.o xfns.o xmenu.o \
1254 xterm.o xselect.o sound.o: macgui.h 1256 xterm.o xselect.o sound.o: macgui.h
1255mac.o: mac.c process.h sysselect.h blockinput.h atimer.h systime.h charset.h \ 1257mac.o: mac.c process.h sysselect.h blockinput.h atimer.h systime.h charset.h \
1256 coding.h ccl.h $(config_h) 1258 coding.h ccl.h $(config_h)
diff --git a/src/alloc.c b/src/alloc.c
index 83ba06277f1..f8ba5f480ab 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -324,6 +324,7 @@ Lisp_Object Vgc_elapsed; /* accumulated elapsed time in GC */
324EMACS_INT gcs_done; /* accumulated GCs */ 324EMACS_INT gcs_done; /* accumulated GCs */
325 325
326static void mark_buffer P_ ((Lisp_Object)); 326static void mark_buffer P_ ((Lisp_Object));
327extern void mark_devices P_ ((void));
327extern void mark_kboards P_ ((void)); 328extern void mark_kboards P_ ((void));
328extern void mark_ttys P_ ((void)); 329extern void mark_ttys P_ ((void));
329extern void mark_backtrace P_ ((void)); 330extern void mark_backtrace P_ ((void));
@@ -4937,6 +4938,7 @@ returns nil, because real GC can't be done. */)
4937 mark_object (bind->symbol); 4938 mark_object (bind->symbol);
4938 mark_object (bind->old_value); 4939 mark_object (bind->old_value);
4939 } 4940 }
4941 mark_devices ();
4940 mark_kboards (); 4942 mark_kboards ();
4941 mark_ttys (); 4943 mark_ttys ();
4942 4944
diff --git a/src/dispextern.h b/src/dispextern.h
index f5573efdcc4..b473f9cb16b 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2622,8 +2622,6 @@ void init_iterator_to_row_start P_ ((struct it *, struct window *,
2622 struct glyph_row *)); 2622 struct glyph_row *));
2623int get_next_display_element P_ ((struct it *)); 2623int get_next_display_element P_ ((struct it *));
2624void set_iterator_to_next P_ ((struct it *, int)); 2624void set_iterator_to_next P_ ((struct it *, int));
2625void produce_glyphs P_ ((struct it *));
2626void produce_special_glyphs P_ ((struct it *, enum display_element_type));
2627void start_display P_ ((struct it *, struct window *, struct text_pos)); 2625void start_display P_ ((struct it *, struct window *, struct text_pos));
2628void move_it_to P_ ((struct it *, int, int, int, int, int)); 2626void move_it_to P_ ((struct it *, int, int, int, int, int));
2629void move_it_vertically P_ ((struct it *, int)); 2627void move_it_vertically P_ ((struct it *, int));
@@ -2905,8 +2903,6 @@ void clear_glyph_row P_ ((struct glyph_row *));
2905void prepare_desired_row P_ ((struct glyph_row *)); 2903void prepare_desired_row P_ ((struct glyph_row *));
2906int line_hash_code P_ ((struct glyph_row *)); 2904int line_hash_code P_ ((struct glyph_row *));
2907void set_window_update_flags P_ ((struct window *, int)); 2905void set_window_update_flags P_ ((struct window *, int));
2908void write_glyphs P_ ((struct frame *, struct glyph *, int));
2909void insert_glyphs P_ ((struct frame *, struct glyph *, int));
2910void redraw_frame P_ ((struct frame *)); 2906void redraw_frame P_ ((struct frame *));
2911void redraw_garbaged_frames P_ ((void)); 2907void redraw_garbaged_frames P_ ((void));
2912int scroll_cost P_ ((struct frame *, int, int, int)); 2908int scroll_cost P_ ((struct frame *, int, int, int));
@@ -2924,39 +2920,48 @@ void syms_of_display P_ ((void));
2924extern Lisp_Object Qredisplay_dont_pause; 2920extern Lisp_Object Qredisplay_dont_pause;
2925GLYPH spec_glyph_lookup_face P_ ((struct window *, GLYPH)); 2921GLYPH spec_glyph_lookup_face P_ ((struct window *, GLYPH));
2926 2922
2927/* Defined in term.c */ 2923/* Defined in terminal.c */
2928 2924
2929extern void ring_bell P_ ((struct frame *)); 2925extern void ring_bell P_ ((struct frame *));
2930extern void update_begin P_ ((struct frame *)); 2926extern void update_begin P_ ((struct frame *));
2931extern void update_end P_ ((struct frame *)); 2927extern void update_end P_ ((struct frame *));
2932extern void set_terminal_window P_ ((struct frame *, int)); 2928extern void set_terminal_window P_ ((struct frame *, int));
2933extern void set_scroll_region P_ ((struct frame *, int, int)); 2929extern void cursor_to P_ ((struct frame *, int, int));
2934extern void turn_off_insert P_ ((struct tty_display_info *)); 2930
2935extern void turn_off_highlight P_ ((struct tty_display_info *)); 2931/* Was not declared before: */
2936extern void background_highlight P_ ((struct tty_display_info *)); 2932extern void raw_cursor_to P_ ((struct frame *, int, int));
2933extern void clear_to_end P_ ((struct frame *));
2934
2937extern void clear_frame P_ ((struct frame *)); 2935extern void clear_frame P_ ((struct frame *));
2938extern void clear_end_of_line P_ ((struct frame *, int)); 2936extern void clear_end_of_line P_ ((struct frame *, int));
2939extern void clear_end_of_line_raw P_ ((struct frame *, int)); 2937extern void write_glyphs P_ ((struct frame *, struct glyph *, int));
2940extern void tty_clear_end_of_line P_ ((struct frame *, int)); 2938extern void insert_glyphs P_ ((struct frame *, struct glyph *, int));
2941extern void delete_glyphs P_ ((struct frame *, int)); 2939extern void delete_glyphs P_ ((struct frame *, int));
2942extern void ins_del_lines P_ ((struct frame *, int, int)); 2940extern void ins_del_lines P_ ((struct frame *, int, int));
2941
2942extern struct device *get_device P_ ((Lisp_Object display, int));
2943
2944extern struct device *init_initial_device P_ ((void));
2945
2946
2947/* Defined in term.c */
2948
2949extern void tty_set_terminal_modes P_ ((struct device *));
2950extern void tty_reset_terminal_modes P_ ((struct device *));
2951extern void tty_turn_off_insert P_ ((struct tty_display_info *));
2952extern void tty_turn_off_highlight P_ ((struct tty_display_info *));
2943extern int string_cost P_ ((char *)); 2953extern int string_cost P_ ((char *));
2944extern int per_line_cost P_ ((char *)); 2954extern int per_line_cost P_ ((char *));
2945extern void calculate_costs P_ ((struct frame *)); 2955extern void calculate_costs P_ ((struct frame *));
2956extern void produce_glyphs P_ ((struct it *));
2957extern void produce_special_glyphs P_ ((struct it *, enum display_element_type));
2958extern int tty_capable_p P_ ((struct tty_display_info *, unsigned, unsigned long, unsigned long));
2946extern void set_tty_color_mode P_ ((struct frame *, Lisp_Object)); 2959extern void set_tty_color_mode P_ ((struct frame *, Lisp_Object));
2947extern void tty_setup_colors P_ ((struct tty_display_info *, int));
2948extern struct device *get_device P_ ((Lisp_Object display, int));
2949extern struct device *get_tty_device P_ ((Lisp_Object terminal)); 2960extern struct device *get_tty_device P_ ((Lisp_Object terminal));
2950extern struct device *get_named_tty P_ ((char *)); 2961extern struct device *get_named_tty P_ ((char *));
2951EXFUN (Fdisplay_tty_type, 1); 2962EXFUN (Fdisplay_tty_type, 1);
2952extern struct device *init_initial_device P_ ((void));
2953extern struct device *init_tty P_ ((char *, char *, int));
2954extern void delete_tty P_ ((struct device *));
2955extern void cursor_to P_ ((struct frame *, int, int));
2956extern int tty_capable_p P_ ((struct tty_display_info *, unsigned, unsigned long, unsigned long));
2957extern void tty_set_terminal_modes P_ ((struct device *));
2958extern void tty_reset_terminal_modes P_ ((struct device *));
2959extern void create_tty_output P_ ((struct frame *)); 2963extern void create_tty_output P_ ((struct frame *));
2964extern struct device *init_tty P_ ((char *, char *, int));
2960 2965
2961 2966
2962/* Defined in scroll.c */ 2967/* Defined in scroll.c */
diff --git a/src/emacs.c b/src/emacs.c
index ff1a40283fc..28b5f374ccd 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1600,6 +1600,7 @@ main (argc, argv
1600 syms_of_frame (); 1600 syms_of_frame ();
1601#endif 1601#endif
1602 syms_of_syntax (); 1602 syms_of_syntax ();
1603 syms_of_terminal ();
1603 syms_of_term (); 1604 syms_of_term ();
1604 syms_of_undo (); 1605 syms_of_undo ();
1605#ifdef HAVE_SOUND 1606#ifdef HAVE_SOUND
diff --git a/src/frame.c b/src/frame.c
index 9c83f961267..c3140628cec 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -638,6 +638,33 @@ make_terminal_frame (struct device *device)
638 return f; 638 return f;
639} 639}
640 640
641/* Get a suitable value for frame parameter PARAMETER for a newly
642 created frame, based on (1) the user-supplied frame parameter
643 alist SUPPLIED_PARMS, (2) CURRENT_VALUE, and finally, if all else
644 fails, (3) Vdefault_frame_alist. */
645
646static Lisp_Object
647get_future_frame_param (Lisp_Object parameter,
648 Lisp_Object supplied_parms,
649 char *current_value)
650{
651 Lisp_Object result;
652
653 result = Fassq (parameter, supplied_parms);
654 if (NILP (result))
655 result = Fassq (parameter, XFRAME (selected_frame)->param_alist);
656 if (NILP (result) && current_value != NULL)
657 result = build_string (current_value);
658 if (NILP (result))
659 result = Fassq (parameter, Vdefault_frame_alist);
660 if (!NILP (result) && !STRINGP (result))
661 result = XCDR (result);
662 if (NILP (result) || !STRINGP (result))
663 result = Qnil;
664
665 return result;
666}
667
641DEFUN ("make-terminal-frame", Fmake_terminal_frame, Smake_terminal_frame, 668DEFUN ("make-terminal-frame", Fmake_terminal_frame, Smake_terminal_frame,
642 1, 1, 0, 669 1, 1, 0,
643 doc: /* Create an additional terminal frame, possibly on another terminal. 670 doc: /* Create an additional terminal frame, possibly on another terminal.
@@ -662,8 +689,6 @@ affects all frames on the same terminal device. */)
662 struct device *d = NULL; 689 struct device *d = NULL;
663 Lisp_Object frame, tem; 690 Lisp_Object frame, tem;
664 struct frame *sf = SELECTED_FRAME (); 691 struct frame *sf = SELECTED_FRAME ();
665 Lisp_Object tty, tty_type;
666 struct gcpro gcpro1, gcpro2;
667 692
668#ifdef MSDOS 693#ifdef MSDOS
669 if (sf->output_method != output_msdos_raw 694 if (sf->output_method != output_msdos_raw
@@ -697,41 +722,24 @@ affects all frames on the same terminal device. */)
697 if (!d) 722 if (!d)
698 { 723 {
699 char *name = 0, *type = 0; 724 char *name = 0, *type = 0;
725 Lisp_Object tty, tty_type;
700 726
701 tty = Fassq (Qtty, parms); 727 tty = get_future_frame_param
702 if (EQ (tty, Qnil)) 728 (Qtty, parms, (FRAME_TERMCAP_P (XFRAME (selected_frame))
703 tty = Fassq (Qtty, XFRAME (selected_frame)->param_alist); 729 ? FRAME_TTY (XFRAME (selected_frame))->name
704 if (EQ (tty, Qnil) && FRAME_TERMCAP_P (XFRAME (selected_frame)) 730 : NULL));
705 && FRAME_TTY (XFRAME (selected_frame))->name) 731 if (!NILP (tty))
706 tty = build_string (FRAME_TTY (XFRAME (selected_frame))->name);
707 if (EQ (tty, Qnil))
708 tty = Fassq (Qtty, Vdefault_frame_alist);
709 if (! EQ (tty, Qnil) && ! STRINGP (tty))
710 tty = XCDR (tty);
711 if (EQ (tty, Qnil) || !STRINGP (tty))
712 tty = Qnil;
713
714 tty_type = Fassq (Qtty_type, parms);
715 if (EQ (tty_type, Qnil))
716 tty_type = Fassq (Qtty_type, XFRAME (selected_frame)->param_alist);
717 if (EQ (tty_type, Qnil) && FRAME_TERMCAP_P (XFRAME (selected_frame))
718 && FRAME_TTY (XFRAME (selected_frame))->type)
719 tty_type = build_string (FRAME_TTY (XFRAME (selected_frame))->type);
720 if (EQ (tty_type, Qnil))
721 tty_type = Fassq (Qtty_type, Vdefault_frame_alist);
722 if (! EQ (tty_type, Qnil) && ! STRINGP (tty_type))
723 tty_type = XCDR (tty_type);
724 if (EQ (tty_type, Qnil) || !STRINGP (tty_type))
725 tty_type = Qnil;
726
727 if (! EQ (tty, Qnil))
728 { 732 {
729 name = (char *) alloca (SBYTES (tty) + 1); 733 name = (char *) alloca (SBYTES (tty) + 1);
730 strncpy (name, SDATA (tty), SBYTES (tty)); 734 strncpy (name, SDATA (tty), SBYTES (tty));
731 name[SBYTES (tty)] = 0; 735 name[SBYTES (tty)] = 0;
732 } 736 }
733 737
734 if (! EQ (tty_type, Qnil)) 738 tty_type = get_future_frame_param
739 (Qtty_type, parms, (FRAME_TERMCAP_P (XFRAME (selected_frame))
740 ? FRAME_TTY (XFRAME (selected_frame))->type
741 : NULL));
742 if (!NILP (tty_type))
735 { 743 {
736 type = (char *) alloca (SBYTES (tty_type) + 1); 744 type = (char *) alloca (SBYTES (tty_type) + 1);
737 strncpy (type, SDATA (tty_type), SBYTES (tty_type)); 745 strncpy (type, SDATA (tty_type), SBYTES (tty_type));
@@ -752,13 +760,15 @@ affects all frames on the same terminal device. */)
752 adjust_glyphs (f); 760 adjust_glyphs (f);
753 calculate_costs (f); 761 calculate_costs (f);
754 XSETFRAME (frame, f); 762 XSETFRAME (frame, f);
755 GCPRO2 (tty_type, tty);
756 Fmodify_frame_parameters (frame, Vdefault_frame_alist); 763 Fmodify_frame_parameters (frame, Vdefault_frame_alist);
757 Fmodify_frame_parameters (frame, parms); 764 Fmodify_frame_parameters (frame, parms);
758 Fmodify_frame_parameters (frame, Fcons (Fcons (Qwindow_system, Qnil), Qnil)); 765 Fmodify_frame_parameters (frame, Fcons (Fcons (Qwindow_system, Qnil), Qnil));
759 Fmodify_frame_parameters (frame, Fcons (Fcons (Qtty_type, tty_type), Qnil)); 766 Fmodify_frame_parameters (frame, Fcons (Fcons (Qtty_type,
760 Fmodify_frame_parameters (frame, Fcons (Fcons (Qtty, tty), Qnil)); 767 build_string (d->display_info.tty->type)),
761 UNGCPRO; 768 Qnil));
769 Fmodify_frame_parameters (frame, Fcons (Fcons (Qtty,
770 build_string (d->display_info.tty->name)),
771 Qnil));
762 772
763 /* Make the frame face alist be frame-specific, so that each 773 /* Make the frame face alist be frame-specific, so that each
764 frame could change its face definitions independently. */ 774 frame could change its face definitions independently. */
diff --git a/src/keyboard.c b/src/keyboard.c
index edce75d774c..95f2daf78ac 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1136,7 +1136,6 @@ pop_kboard ()
1136#ifdef MULTI_KBOARD 1136#ifdef MULTI_KBOARD
1137 struct device *d; 1137 struct device *d;
1138 struct kboard_stack *p = kboard_stack; 1138 struct kboard_stack *p = kboard_stack;
1139 int ok = 0;
1140 current_kboard = NULL; 1139 current_kboard = NULL;
1141 for (d = device_list; d; d = d->next_device) 1140 for (d = device_list; d; d = d->next_device)
1142 { 1141 {
@@ -10739,6 +10738,7 @@ See also `current-input-mode'. */)
10739 init_sys_modes (tty); 10738 init_sys_modes (tty);
10740#endif 10739#endif
10741 } 10740 }
10741 return Qnil;
10742} 10742}
10743 10743
10744DEFUN ("set-input-meta-mode", Fset_input_meta_mode, Sset_input_meta_mode, 1, 2, 0, 10744DEFUN ("set-input-meta-mode", Fset_input_meta_mode, Sset_input_meta_mode, 1, 2, 0,
diff --git a/src/keymap.h b/src/keymap.h
index bcf14abcd89..a6598558a76 100644
--- a/src/keymap.h
+++ b/src/keymap.h
@@ -37,6 +37,7 @@ EXFUN (Fcurrent_active_maps, 1);
37extern Lisp_Object access_keymap P_ ((Lisp_Object, Lisp_Object, int, int, int)); 37extern Lisp_Object access_keymap P_ ((Lisp_Object, Lisp_Object, int, int, int));
38extern Lisp_Object get_keyelt P_ ((Lisp_Object, int)); 38extern Lisp_Object get_keyelt P_ ((Lisp_Object, int));
39extern Lisp_Object get_keymap P_ ((Lisp_Object, int, int)); 39extern Lisp_Object get_keymap P_ ((Lisp_Object, int, int));
40EXFUN (Fset_keymap_parent, 2);
40extern void describe_map_tree P_ ((Lisp_Object, int, Lisp_Object, Lisp_Object, 41extern void describe_map_tree P_ ((Lisp_Object, int, Lisp_Object, Lisp_Object,
41 char *, int, int, int, int)); 42 char *, int, int, int, int));
42extern int current_minor_maps P_ ((Lisp_Object **, Lisp_Object **)); 43extern int current_minor_maps P_ ((Lisp_Object **, Lisp_Object **));
diff --git a/src/lisp.h b/src/lisp.h
index a18408bd1a6..4b71cd67e98 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3184,6 +3184,9 @@ extern void syms_of_dired P_ ((void));
3184extern void syms_of_term P_ ((void)); 3184extern void syms_of_term P_ ((void));
3185extern void fatal () NO_RETURN; 3185extern void fatal () NO_RETURN;
3186 3186
3187/* Defined in terminal.c */
3188extern void syms_of_terminal P_ ((void));
3189
3187#ifdef HAVE_X_WINDOWS 3190#ifdef HAVE_X_WINDOWS
3188/* Defined in fontset.c */ 3191/* Defined in fontset.c */
3189extern void syms_of_fontset P_ ((void)); 3192extern void syms_of_fontset P_ ((void));
diff --git a/src/sysdep.c b/src/sysdep.c
index 0cf6ecb1f36..7f9d189d79a 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -1972,7 +1972,7 @@ reset_sys_modes (tty_out)
1972 else 1972 else
1973 { /* have to do it the hard way */ 1973 { /* have to do it the hard way */
1974 int i; 1974 int i;
1975 turn_off_insert (tty_out); 1975 tty_turn_off_insert (tty_out);
1976 1976
1977 for (i = curX (tty_out); i < FrameCols (tty_out) - 1; i++) 1977 for (i = curX (tty_out); i < FrameCols (tty_out) - 1; i++)
1978 { 1978 {
diff --git a/src/term.c b/src/term.c
index 679def93c72..b599e1b97fe 100644
--- a/src/term.c
+++ b/src/term.c
@@ -80,14 +80,14 @@ extern int tgetnum P_ ((char *id));
80#define O_NOCTTY 0 80#define O_NOCTTY 0
81#endif 81#endif
82 82
83static void tty_set_scroll_region P_ ((struct frame *f, int start, int stop));
83static void turn_on_face P_ ((struct frame *, int face_id)); 84static void turn_on_face P_ ((struct frame *, int face_id));
84static void turn_off_face P_ ((struct frame *, int face_id)); 85static void turn_off_face P_ ((struct frame *, int face_id));
85static void tty_show_cursor P_ ((struct tty_display_info *)); 86static void tty_show_cursor P_ ((struct tty_display_info *));
86static void tty_hide_cursor P_ ((struct tty_display_info *)); 87static void tty_hide_cursor P_ ((struct tty_display_info *));
87 88static void tty_background_highlight P_ ((struct tty_display_info *tty));
88void delete_initial_device P_ ((struct device *)); 89static void dissociate_if_controlling_tty P_ ((int fd));
89void create_tty_output P_ ((struct frame *)); 90static void delete_tty P_ ((struct device *));
90void delete_tty_output P_ ((struct frame *));
91 91
92#define OUTPUT(tty, a) \ 92#define OUTPUT(tty, a) \
93 emacs_tputs ((tty), a, \ 93 emacs_tputs ((tty), a, \
@@ -113,22 +113,12 @@ void delete_tty_output P_ ((struct frame *));
113 113
114extern Lisp_Object Qspace, QCalign_to, QCwidth; 114extern Lisp_Object Qspace, QCalign_to, QCwidth;
115 115
116/* Function to use to ring the bell. */
117
118Lisp_Object Vring_bell_function;
119
120/* Functions to call after suspending a tty. */ 116/* Functions to call after suspending a tty. */
121Lisp_Object Vsuspend_tty_functions; 117Lisp_Object Vsuspend_tty_functions;
122 118
123/* Functions to call after resuming a tty. */ 119/* Functions to call after resuming a tty. */
124Lisp_Object Vresume_tty_functions; 120Lisp_Object Vresume_tty_functions;
125 121
126/* Chain of all displays currently in use. */
127struct device *device_list;
128
129/* The initial display device, created by initial_term_init. */
130struct device *initial_device;
131
132/* Chain of all tty device parameters. */ 122/* Chain of all tty device parameters. */
133struct tty_display_info *tty_list; 123struct tty_display_info *tty_list;
134 124
@@ -138,7 +128,6 @@ struct tty_display_info *tty_list;
138 else. */ 128 else. */
139int no_redraw_on_reenter; 129int no_redraw_on_reenter;
140 130
141
142/* Meaning of bits in no_color_video. Each bit set means that the 131/* Meaning of bits in no_color_video. Each bit set means that the
143 corresponding attribute cannot be combined with colors. */ 132 corresponding attribute cannot be combined with colors. */
144 133
@@ -169,9 +158,6 @@ int max_frame_lines;
169 should not open a frame on stdout. */ 158 should not open a frame on stdout. */
170static int no_controlling_tty; 159static int no_controlling_tty;
171 160
172/* The first unallocated display id. */
173static int next_device_id;
174
175/* Provided for lisp packages. */ 161/* Provided for lisp packages. */
176 162
177static int system_uses_terminfo; 163static int system_uses_terminfo;
@@ -192,35 +178,10 @@ extern char *tgetstr ();
192#define FRAME_TERMCAP_P(_f_) 0 178#define FRAME_TERMCAP_P(_f_) 0
193#endif /* WINDOWSNT */ 179#endif /* WINDOWSNT */
194 180
195void
196ring_bell (struct frame *f)
197{
198 if (!NILP (Vring_bell_function))
199 {
200 Lisp_Object function;
201
202 /* Temporarily set the global variable to nil
203 so that if we get an error, it stays nil
204 and we don't call it over and over.
205
206 We don't specbind it, because that would carefully
207 restore the bad value if there's an error
208 and make the loop of errors happen anyway. */
209
210 function = Vring_bell_function;
211 Vring_bell_function = Qnil;
212
213 call0 (function);
214
215 Vring_bell_function = function;
216 }
217 else if (FRAME_DEVICE (f)->ring_bell_hook)
218 (*FRAME_DEVICE (f)->ring_bell_hook) (f);
219}
220 181
221/* Ring the bell on a tty. */ 182/* Ring the bell on a tty. */
222 183
223void 184static void
224tty_ring_bell (struct frame *f) 185tty_ring_bell (struct frame *f)
225{ 186{
226 struct tty_display_info *tty = FRAME_TTY (f); 187 struct tty_display_info *tty = FRAME_TTY (f);
@@ -272,8 +233,8 @@ tty_reset_terminal_modes (struct device *display)
272 233
273 if (tty->output) 234 if (tty->output)
274 { 235 {
275 turn_off_highlight (tty); 236 tty_turn_off_highlight (tty);
276 turn_off_insert (tty); 237 tty_turn_off_insert (tty);
277 OUTPUT_IF (tty, tty->TS_end_keypad_mode); 238 OUTPUT_IF (tty, tty->TS_end_keypad_mode);
278 OUTPUT_IF (tty, tty->TS_cursor_normal); 239 OUTPUT_IF (tty, tty->TS_cursor_normal);
279 OUTPUT_IF (tty, tty->TS_end_termcap_modes); 240 OUTPUT_IF (tty, tty->TS_end_termcap_modes);
@@ -285,59 +246,33 @@ tty_reset_terminal_modes (struct device *display)
285 } 246 }
286} 247}
287 248
288void
289update_begin (struct frame *f)
290{
291 if (FRAME_DEVICE (f)->update_begin_hook)
292 (*FRAME_DEVICE (f)->update_begin_hook) (f);
293}
294
295void
296update_end (struct frame *f)
297{
298 if (FRAME_DEVICE (f)->update_end_hook)
299 (*FRAME_DEVICE (f)->update_end_hook) (f);
300}
301
302/* Flag the end of a display update on a termcap display. */ 249/* Flag the end of a display update on a termcap display. */
303 250
304void 251static void
305tty_update_end (struct frame *f) 252tty_update_end (struct frame *f)
306{ 253{
307 struct tty_display_info *tty = FRAME_TTY (f); 254 struct tty_display_info *tty = FRAME_TTY (f);
308 255
309 if (!XWINDOW (selected_window)->cursor_off_p) 256 if (!XWINDOW (selected_window)->cursor_off_p)
310 tty_show_cursor (tty); 257 tty_show_cursor (tty);
311 turn_off_insert (tty); 258 tty_turn_off_insert (tty);
312 background_highlight (tty); 259 tty_background_highlight (tty);
313}
314
315/* Specify how many text lines, from the top of the window,
316 should be affected by insert-lines and delete-lines operations.
317 This, and those operations, are used only within an update
318 that is bounded by calls to update_begin and update_end. */
319
320void
321set_terminal_window (struct frame *f, int size)
322{
323 if (FRAME_DEVICE (f)->set_terminal_window_hook)
324 (*FRAME_DEVICE (f)->set_terminal_window_hook) (f, size);
325} 260}
326 261
327/* The implementation of set_terminal_window for termcap frames. */ 262/* The implementation of set_terminal_window for termcap frames. */
328 263
329void 264static void
330tty_set_terminal_window (struct frame *f, int size) 265tty_set_terminal_window (struct frame *f, int size)
331{ 266{
332 struct tty_display_info *tty = FRAME_TTY (f); 267 struct tty_display_info *tty = FRAME_TTY (f);
333 268
334 tty->specified_window = size ? size : FRAME_LINES (f); 269 tty->specified_window = size ? size : FRAME_LINES (f);
335 if (FRAME_SCROLL_REGION_OK (f)) 270 if (FRAME_SCROLL_REGION_OK (f))
336 set_scroll_region (f, 0, tty->specified_window); 271 tty_set_scroll_region (f, 0, tty->specified_window);
337} 272}
338 273
339void 274static void
340set_scroll_region (struct frame *f, int start, int stop) 275tty_set_scroll_region (struct frame *f, int start, int stop)
341{ 276{
342 char *buf; 277 char *buf;
343 struct tty_display_info *tty = FRAME_TTY (f); 278 struct tty_display_info *tty = FRAME_TTY (f);
@@ -359,7 +294,7 @@ set_scroll_region (struct frame *f, int start, int stop)
359 294
360 295
361static void 296static void
362turn_on_insert (struct tty_display_info *tty) 297tty_turn_on_insert (struct tty_display_info *tty)
363{ 298{
364 if (!tty->insert_mode) 299 if (!tty->insert_mode)
365 OUTPUT (tty, tty->TS_insert_mode); 300 OUTPUT (tty, tty->TS_insert_mode);
@@ -367,7 +302,7 @@ turn_on_insert (struct tty_display_info *tty)
367} 302}
368 303
369void 304void
370turn_off_insert (struct tty_display_info *tty) 305tty_turn_off_insert (struct tty_display_info *tty)
371{ 306{
372 if (tty->insert_mode) 307 if (tty->insert_mode)
373 OUTPUT (tty, tty->TS_end_insert_mode); 308 OUTPUT (tty, tty->TS_end_insert_mode);
@@ -377,7 +312,7 @@ turn_off_insert (struct tty_display_info *tty)
377/* Handle highlighting. */ 312/* Handle highlighting. */
378 313
379void 314void
380turn_off_highlight (struct tty_display_info *tty) 315tty_turn_off_highlight (struct tty_display_info *tty)
381{ 316{
382 if (tty->standout_mode) 317 if (tty->standout_mode)
383 OUTPUT_IF (tty, tty->TS_end_standout_mode); 318 OUTPUT_IF (tty, tty->TS_end_standout_mode);
@@ -385,7 +320,7 @@ turn_off_highlight (struct tty_display_info *tty)
385} 320}
386 321
387static void 322static void
388turn_on_highlight (struct tty_display_info *tty) 323tty_turn_on_highlight (struct tty_display_info *tty)
389{ 324{
390 if (!tty->standout_mode) 325 if (!tty->standout_mode)
391 OUTPUT_IF (tty, tty->TS_standout_mode); 326 OUTPUT_IF (tty, tty->TS_standout_mode);
@@ -393,12 +328,12 @@ turn_on_highlight (struct tty_display_info *tty)
393} 328}
394 329
395static void 330static void
396toggle_highlight (struct tty_display_info *tty) 331tty_toggle_highlight (struct tty_display_info *tty)
397{ 332{
398 if (tty->standout_mode) 333 if (tty->standout_mode)
399 turn_off_highlight (tty); 334 tty_turn_off_highlight (tty);
400 else 335 else
401 turn_on_highlight (tty); 336 tty_turn_on_highlight (tty);
402} 337}
403 338
404 339
@@ -433,38 +368,31 @@ tty_show_cursor (struct tty_display_info *tty)
433 empty space inside windows. What this is, 368 empty space inside windows. What this is,
434 depends on the user option inverse-video. */ 369 depends on the user option inverse-video. */
435 370
436void 371static void
437background_highlight (struct tty_display_info *tty) 372tty_background_highlight (struct tty_display_info *tty)
438{ 373{
439 if (inverse_video) 374 if (inverse_video)
440 turn_on_highlight (tty); 375 tty_turn_on_highlight (tty);
441 else 376 else
442 turn_off_highlight (tty); 377 tty_turn_off_highlight (tty);
443} 378}
444 379
445/* Set standout mode to the mode specified for the text to be output. */ 380/* Set standout mode to the mode specified for the text to be output. */
446 381
447static void 382static void
448highlight_if_desired (struct tty_display_info *tty) 383tty_highlight_if_desired (struct tty_display_info *tty)
449{ 384{
450 if (inverse_video) 385 if (inverse_video)
451 turn_on_highlight (tty); 386 tty_turn_on_highlight (tty);
452 else 387 else
453 turn_off_highlight (tty); 388 tty_turn_off_highlight (tty);
454} 389}
455 390
456 391
457/* Move cursor to row/column position VPOS/HPOS. HPOS/VPOS are 392/* Move cursor to row/column position VPOS/HPOS. HPOS/VPOS are
458 frame-relative coordinates. */ 393 frame-relative coordinates. */
459 394
460void 395static void
461cursor_to (struct frame *f, int vpos, int hpos)
462{
463 if (FRAME_DEVICE (f)->cursor_to_hook)
464 (*FRAME_DEVICE (f)->cursor_to_hook) (f, vpos, hpos);
465}
466
467void
468tty_cursor_to (struct frame *f, int vpos, int hpos) 396tty_cursor_to (struct frame *f, int vpos, int hpos)
469{ 397{
470 struct tty_display_info *tty = FRAME_TTY (f); 398 struct tty_display_info *tty = FRAME_TTY (f);
@@ -478,22 +406,15 @@ tty_cursor_to (struct frame *f, int vpos, int hpos)
478 && curX (tty) == hpos) 406 && curX (tty) == hpos)
479 return; 407 return;
480 if (!tty->TF_standout_motion) 408 if (!tty->TF_standout_motion)
481 background_highlight (tty); 409 tty_background_highlight (tty);
482 if (!tty->TF_insmode_motion) 410 if (!tty->TF_insmode_motion)
483 turn_off_insert (tty); 411 tty_turn_off_insert (tty);
484 cmgoto (tty, vpos, hpos); 412 cmgoto (tty, vpos, hpos);
485} 413}
486 414
487/* Similar but don't take any account of the wasted characters. */ 415/* Similar but don't take any account of the wasted characters. */
488 416
489void 417static void
490raw_cursor_to (struct frame *f, int row, int col)
491{
492 if (FRAME_DEVICE (f)->raw_cursor_to_hook)
493 (*FRAME_DEVICE (f)->raw_cursor_to_hook) (f, row, col);
494}
495
496void
497tty_raw_cursor_to (struct frame *f, int row, int col) 418tty_raw_cursor_to (struct frame *f, int row, int col)
498{ 419{
499 struct tty_display_info *tty = FRAME_TTY (f); 420 struct tty_display_info *tty = FRAME_TTY (f);
@@ -502,25 +423,17 @@ tty_raw_cursor_to (struct frame *f, int row, int col)
502 && curX (tty) == col) 423 && curX (tty) == col)
503 return; 424 return;
504 if (!tty->TF_standout_motion) 425 if (!tty->TF_standout_motion)
505 background_highlight (tty); 426 tty_background_highlight (tty);
506 if (!tty->TF_insmode_motion) 427 if (!tty->TF_insmode_motion)
507 turn_off_insert (tty); 428 tty_turn_off_insert (tty);
508 cmgoto (tty, row, col); 429 cmgoto (tty, row, col);
509} 430}
510 431
511/* Erase operations */ 432/* Erase operations */
512 433
513/* Clear from cursor to end of frame. */
514void
515clear_to_end (struct frame *f)
516{
517 if (FRAME_DEVICE (f)->clear_to_end_hook)
518 (*FRAME_DEVICE (f)->clear_to_end_hook) (f);
519}
520
521/* Clear from cursor to end of frame on a termcap device. */ 434/* Clear from cursor to end of frame on a termcap device. */
522 435
523void 436static void
524tty_clear_to_end (struct frame *f) 437tty_clear_to_end (struct frame *f)
525{ 438{
526 register int i; 439 register int i;
@@ -528,7 +441,7 @@ tty_clear_to_end (struct frame *f)
528 441
529 if (tty->TS_clr_to_bottom) 442 if (tty->TS_clr_to_bottom)
530 { 443 {
531 background_highlight (tty); 444 tty_background_highlight (tty);
532 OUTPUT (tty, tty->TS_clr_to_bottom); 445 OUTPUT (tty, tty->TS_clr_to_bottom);
533 } 446 }
534 else 447 else
@@ -541,25 +454,16 @@ tty_clear_to_end (struct frame *f)
541 } 454 }
542} 455}
543 456
544/* Clear entire frame */
545
546void
547clear_frame (struct frame *f)
548{
549 if (FRAME_DEVICE (f)->clear_frame_hook)
550 (*FRAME_DEVICE (f)->clear_frame_hook) (f);
551}
552
553/* Clear an entire termcap frame. */ 457/* Clear an entire termcap frame. */
554 458
555void 459static void
556tty_clear_frame (struct frame *f) 460tty_clear_frame (struct frame *f)
557{ 461{
558 struct tty_display_info *tty = FRAME_TTY (f); 462 struct tty_display_info *tty = FRAME_TTY (f);
559 463
560 if (tty->TS_clr_frame) 464 if (tty->TS_clr_frame)
561 { 465 {
562 background_highlight (tty); 466 tty_background_highlight (tty);
563 OUTPUT (tty, tty->TS_clr_frame); 467 OUTPUT (tty, tty->TS_clr_frame);
564 cmat (tty, 0, 0); 468 cmat (tty, 0, 0);
565 } 469 }
@@ -570,23 +474,11 @@ tty_clear_frame (struct frame *f)
570 } 474 }
571} 475}
572 476
573/* Clear from cursor to end of line.
574 Assume that the line is already clear starting at column first_unused_hpos.
575
576 Note that the cursor may be moved, on terminals lacking a `ce' string. */
577
578void
579clear_end_of_line (struct frame *f, int first_unused_hpos)
580{
581 if (FRAME_DEVICE (f)->clear_end_of_line_hook)
582 (*FRAME_DEVICE (f)->clear_end_of_line_hook) (f, first_unused_hpos);
583}
584
585/* An implementation of clear_end_of_line for termcap frames. 477/* An implementation of clear_end_of_line for termcap frames.
586 478
587 Note that the cursor may be moved, on terminals lacking a `ce' string. */ 479 Note that the cursor may be moved, on terminals lacking a `ce' string. */
588 480
589void 481static void
590tty_clear_end_of_line (struct frame *f, int first_unused_hpos) 482tty_clear_end_of_line (struct frame *f, int first_unused_hpos)
591{ 483{
592 register int i; 484 register int i;
@@ -599,14 +491,14 @@ tty_clear_end_of_line (struct frame *f, int first_unused_hpos)
599 491
600 if (curX (tty) >= first_unused_hpos) 492 if (curX (tty) >= first_unused_hpos)
601 return; 493 return;
602 background_highlight (tty); 494 tty_background_highlight (tty);
603 if (tty->TS_clr_line) 495 if (tty->TS_clr_line)
604 { 496 {
605 OUTPUT1 (tty, tty->TS_clr_line); 497 OUTPUT1 (tty, tty->TS_clr_line);
606 } 498 }
607 else 499 else
608 { /* have to do it the hard way */ 500 { /* have to do it the hard way */
609 turn_off_insert (tty); 501 tty_turn_off_insert (tty);
610 502
611 /* Do not write in last row last col with Auto-wrap on. */ 503 /* Do not write in last row last col with Auto-wrap on. */
612 if (AutoWrap (tty) 504 if (AutoWrap (tty)
@@ -743,19 +635,9 @@ encode_terminal_code (src, src_len, coding)
743} 635}
744 636
745 637
746/* Output LEN glyphs starting at STRING at the nominal cursor position.
747 Advance the nominal cursor over the text. */
748
749void
750write_glyphs (struct frame *f, struct glyph *string, int len)
751{
752 if (FRAME_DEVICE (f)->write_glyphs_hook)
753 (*FRAME_DEVICE (f)->write_glyphs_hook) (f, string, len);
754}
755
756/* An implementation of write_glyphs for termcap frames. */ 638/* An implementation of write_glyphs for termcap frames. */
757 639
758void 640static void
759tty_write_glyphs (struct frame *f, struct glyph *string, int len) 641tty_write_glyphs (struct frame *f, struct glyph *string, int len)
760{ 642{
761 unsigned char *conversion_buffer; 643 unsigned char *conversion_buffer;
@@ -763,7 +645,7 @@ tty_write_glyphs (struct frame *f, struct glyph *string, int len)
763 645
764 struct tty_display_info *tty = FRAME_TTY (f); 646 struct tty_display_info *tty = FRAME_TTY (f);
765 647
766 turn_off_insert (tty); 648 tty_turn_off_insert (tty);
767 tty_hide_cursor (tty); 649 tty_hide_cursor (tty);
768 650
769 /* Don't dare write in last column of bottom line, if Auto-Wrap, 651 /* Don't dare write in last column of bottom line, if Auto-Wrap,
@@ -798,7 +680,7 @@ tty_write_glyphs (struct frame *f, struct glyph *string, int len)
798 break; 680 break;
799 681
800 /* Turn appearance modes of the face of the run on. */ 682 /* Turn appearance modes of the face of the run on. */
801 highlight_if_desired (tty); 683 tty_highlight_if_desired (tty);
802 turn_on_face (f, face_id); 684 turn_on_face (f, face_id);
803 685
804 if (n == len) 686 if (n == len)
@@ -818,29 +700,15 @@ tty_write_glyphs (struct frame *f, struct glyph *string, int len)
818 700
819 /* Turn appearance modes off. */ 701 /* Turn appearance modes off. */
820 turn_off_face (f, face_id); 702 turn_off_face (f, face_id);
821 turn_off_highlight (tty); 703 tty_turn_off_highlight (tty);
822 } 704 }
823 705
824 cmcheckmagic (tty); 706 cmcheckmagic (tty);
825} 707}
826 708
827/* Insert LEN glyphs from START at the nominal cursor position.
828
829 If start is zero, insert blanks instead of a string at start */
830
831void
832insert_glyphs (struct frame *f, struct glyph *start, int len)
833{
834 if (len <= 0)
835 return;
836
837 if (FRAME_DEVICE (f)->insert_glyphs_hook)
838 (*FRAME_DEVICE (f)->insert_glyphs_hook) (f, start, len);
839}
840
841/* An implementation of insert_glyphs for termcap frames. */ 709/* An implementation of insert_glyphs for termcap frames. */
842 710
843void 711static void
844tty_insert_glyphs (struct frame *f, struct glyph *start, int len) 712tty_insert_glyphs (struct frame *f, struct glyph *start, int len)
845{ 713{
846 char *buf; 714 char *buf;
@@ -861,7 +729,7 @@ tty_insert_glyphs (struct frame *f, struct glyph *start, int len)
861 return; 729 return;
862 } 730 }
863 731
864 turn_on_insert (tty); 732 tty_turn_on_insert (tty);
865 cmplus (tty, len); 733 cmplus (tty, len);
866 734
867 if (! start) 735 if (! start)
@@ -886,7 +754,7 @@ tty_insert_glyphs (struct frame *f, struct glyph *start, int len)
886 } 754 }
887 else 755 else
888 { 756 {
889 highlight_if_desired (tty); 757 tty_highlight_if_desired (tty);
890 turn_on_face (f, start->face_id); 758 turn_on_face (f, start->face_id);
891 glyph = start; 759 glyph = start;
892 ++start; 760 ++start;
@@ -918,25 +786,16 @@ tty_insert_glyphs (struct frame *f, struct glyph *start, int len)
918 if (start) 786 if (start)
919 { 787 {
920 turn_off_face (f, glyph->face_id); 788 turn_off_face (f, glyph->face_id);
921 turn_off_highlight (tty); 789 tty_turn_off_highlight (tty);
922 } 790 }
923 } 791 }
924 792
925 cmcheckmagic (tty); 793 cmcheckmagic (tty);
926} 794}
927 795
928/* Delete N glyphs at the nominal cursor position. */
929
930void
931delete_glyphs (struct frame *f, int n)
932{
933 if (FRAME_DEVICE (f)->delete_glyphs_hook)
934 (*FRAME_DEVICE (f)->delete_glyphs_hook) (f, n);
935}
936
937/* An implementation of delete_glyphs for termcap frames. */ 796/* An implementation of delete_glyphs for termcap frames. */
938 797
939void 798static void
940tty_delete_glyphs (struct frame *f, int n) 799tty_delete_glyphs (struct frame *f, int n)
941{ 800{
942 char *buf; 801 char *buf;
@@ -946,11 +805,11 @@ tty_delete_glyphs (struct frame *f, int n)
946 805
947 if (tty->delete_in_insert_mode) 806 if (tty->delete_in_insert_mode)
948 { 807 {
949 turn_on_insert (tty); 808 tty_turn_on_insert (tty);
950 } 809 }
951 else 810 else
952 { 811 {
953 turn_off_insert (tty); 812 tty_turn_off_insert (tty);
954 OUTPUT_IF (tty, tty->TS_delete_mode); 813 OUTPUT_IF (tty, tty->TS_delete_mode);
955 } 814 }
956 815
@@ -967,18 +826,9 @@ tty_delete_glyphs (struct frame *f, int n)
967 OUTPUT_IF (tty, tty->TS_end_delete_mode); 826 OUTPUT_IF (tty, tty->TS_end_delete_mode);
968} 827}
969 828
970/* Insert N lines at vpos VPOS. If N is negative, delete -N lines. */
971
972void
973ins_del_lines (struct frame *f, int vpos, int n)
974{
975 if (FRAME_DEVICE (f)->ins_del_lines_hook)
976 (*FRAME_DEVICE (f)->ins_del_lines_hook) (f, vpos, n);
977}
978
979/* An implementation of ins_del_lines for termcap frames. */ 829/* An implementation of ins_del_lines for termcap frames. */
980 830
981void 831static void
982tty_ins_del_lines (struct frame *f, int vpos, int n) 832tty_ins_del_lines (struct frame *f, int vpos, int n)
983{ 833{
984 struct tty_display_info *tty = FRAME_TTY (f); 834 struct tty_display_info *tty = FRAME_TTY (f);
@@ -1006,7 +856,7 @@ tty_ins_del_lines (struct frame *f, int vpos, int n)
1006 if (multi) 856 if (multi)
1007 { 857 {
1008 raw_cursor_to (f, vpos, 0); 858 raw_cursor_to (f, vpos, 0);
1009 background_highlight (tty); 859 tty_background_highlight (tty);
1010 buf = tparam (multi, 0, 0, i); 860 buf = tparam (multi, 0, 0, i);
1011 OUTPUT (tty, buf); 861 OUTPUT (tty, buf);
1012 xfree (buf); 862 xfree (buf);
@@ -1014,7 +864,7 @@ tty_ins_del_lines (struct frame *f, int vpos, int n)
1014 else if (single) 864 else if (single)
1015 { 865 {
1016 raw_cursor_to (f, vpos, 0); 866 raw_cursor_to (f, vpos, 0);
1017 background_highlight (tty); 867 tty_background_highlight (tty);
1018 while (--i >= 0) 868 while (--i >= 0)
1019 OUTPUT (tty, single); 869 OUTPUT (tty, single);
1020 if (tty->TF_teleray) 870 if (tty->TF_teleray)
@@ -1022,15 +872,15 @@ tty_ins_del_lines (struct frame *f, int vpos, int n)
1022 } 872 }
1023 else 873 else
1024 { 874 {
1025 set_scroll_region (f, vpos, tty->specified_window); 875 tty_set_scroll_region (f, vpos, tty->specified_window);
1026 if (n < 0) 876 if (n < 0)
1027 raw_cursor_to (f, tty->specified_window - 1, 0); 877 raw_cursor_to (f, tty->specified_window - 1, 0);
1028 else 878 else
1029 raw_cursor_to (f, vpos, 0); 879 raw_cursor_to (f, vpos, 0);
1030 background_highlight (tty); 880 tty_background_highlight (tty);
1031 while (--i >= 0) 881 while (--i >= 0)
1032 OUTPUTL (tty, scroll, tty->specified_window - vpos); 882 OUTPUTL (tty, scroll, tty->specified_window - vpos);
1033 set_scroll_region (f, 0, tty->specified_window); 883 tty_set_scroll_region (f, 0, tty->specified_window);
1034 } 884 }
1035 885
1036 if (!FRAME_SCROLL_REGION_OK (f) 886 if (!FRAME_SCROLL_REGION_OK (f)
@@ -1331,7 +1181,7 @@ static Lisp_Object term_get_fkeys_1 ();
1331 This function scans the termcap function key sequence entries, and 1181 This function scans the termcap function key sequence entries, and
1332 adds entries to Vfunction_key_map for each function key it finds. */ 1182 adds entries to Vfunction_key_map for each function key it finds. */
1333 1183
1334void 1184static void
1335term_get_fkeys (address, kboard) 1185term_get_fkeys (address, kboard)
1336 char **address; 1186 char **address;
1337 KBOARD *kboard; 1187 KBOARD *kboard;
@@ -1805,13 +1655,13 @@ turn_on_face (f, face_id)
1805 { 1655 {
1806 if (fg == FACE_TTY_DEFAULT_FG_COLOR 1656 if (fg == FACE_TTY_DEFAULT_FG_COLOR
1807 || bg == FACE_TTY_DEFAULT_BG_COLOR) 1657 || bg == FACE_TTY_DEFAULT_BG_COLOR)
1808 toggle_highlight (tty); 1658 tty_toggle_highlight (tty);
1809 } 1659 }
1810 else 1660 else
1811 { 1661 {
1812 if (fg == FACE_TTY_DEFAULT_BG_COLOR 1662 if (fg == FACE_TTY_DEFAULT_BG_COLOR
1813 || bg == FACE_TTY_DEFAULT_FG_COLOR) 1663 || bg == FACE_TTY_DEFAULT_FG_COLOR)
1814 toggle_highlight (tty); 1664 tty_toggle_highlight (tty);
1815 } 1665 }
1816 } 1666 }
1817 else 1667 else
@@ -1822,13 +1672,13 @@ turn_on_face (f, face_id)
1822 { 1672 {
1823 if (fg == FACE_TTY_DEFAULT_FG_COLOR 1673 if (fg == FACE_TTY_DEFAULT_FG_COLOR
1824 || bg == FACE_TTY_DEFAULT_BG_COLOR) 1674 || bg == FACE_TTY_DEFAULT_BG_COLOR)
1825 toggle_highlight (tty); 1675 tty_toggle_highlight (tty);
1826 } 1676 }
1827 else 1677 else
1828 { 1678 {
1829 if (fg == FACE_TTY_DEFAULT_BG_COLOR 1679 if (fg == FACE_TTY_DEFAULT_BG_COLOR
1830 || bg == FACE_TTY_DEFAULT_FG_COLOR) 1680 || bg == FACE_TTY_DEFAULT_FG_COLOR)
1831 toggle_highlight (tty); 1681 tty_toggle_highlight (tty);
1832 } 1682 }
1833 } 1683 }
1834 } 1684 }
@@ -2031,7 +1881,7 @@ tty_default_color_capabilities (struct tty_display_info *tty, int save)
2031 MODE's value is generally the number of colors which we want to 1881 MODE's value is generally the number of colors which we want to
2032 support; zero means set up for the default capabilities, the ones 1882 support; zero means set up for the default capabilities, the ones
2033 we saw at init_tty time; -1 means turn off color support. */ 1883 we saw at init_tty time; -1 means turn off color support. */
2034void 1884static void
2035tty_setup_colors (struct tty_display_info *tty, int mode) 1885tty_setup_colors (struct tty_display_info *tty, int mode)
2036{ 1886{
2037 /* Canonicalize all negative values of MODE. */ 1887 /* Canonicalize all negative values of MODE. */
@@ -2124,43 +1974,6 @@ set_tty_color_mode (f, val)
2124 1974
2125 1975
2126 1976
2127/* Return the display object specified by DEVICE. DEVICE may be a
2128 display id, a frame, or nil for the display device of the current
2129 frame. If THROW is zero, return NULL for failure, otherwise throw
2130 an error. */
2131
2132struct device *
2133get_device (Lisp_Object device, int throw)
2134{
2135 struct device *result = NULL;
2136
2137 if (NILP (device))
2138 device = selected_frame;
2139
2140 if (INTEGERP (device))
2141 {
2142 struct device *d;
2143
2144 for (d = device_list; d; d = d->next_device)
2145 {
2146 if (d->id == XINT (device))
2147 {
2148 result = d;
2149 break;
2150 }
2151 }
2152 }
2153 else if (FRAMEP (device))
2154 {
2155 result = FRAME_DEVICE (XFRAME (device));
2156 }
2157
2158 if (result == NULL && throw)
2159 wrong_type_argument (Qdisplay_live_p, device);
2160
2161 return result;
2162}
2163
2164/* Return the tty display object specified by DEVICE. */ 1977/* Return the tty display object specified by DEVICE. */
2165 1978
2166struct device * 1979struct device *
@@ -2204,24 +2017,6 @@ get_named_tty (name)
2204} 2017}
2205 2018
2206 2019
2207
2208DEFUN ("display-name", Fdisplay_name, Sdisplay_name, 0, 1, 0,
2209 doc: /* Return the name of the display device DEVICE.
2210It is not guaranteed that the returned value is unique among opened devices.
2211
2212DEVICE may be a display device id, a frame, or nil (meaning the
2213selected frame's display device). */)
2214 (device)
2215 Lisp_Object device;
2216{
2217 struct device *d = get_device (device, 1);
2218
2219 if (d->name)
2220 return build_string (d->name);
2221 else
2222 return Qnil;
2223}
2224
2225DEFUN ("display-tty-type", Fdisplay_tty_type, Sdisplay_tty_type, 0, 1, 0, 2020DEFUN ("display-tty-type", Fdisplay_tty_type, Sdisplay_tty_type, 0, 1, 0,
2226 doc: /* Return the type of the tty device that DEVICE uses. 2021 doc: /* Return the type of the tty device that DEVICE uses.
2227 2022
@@ -2275,47 +2070,166 @@ selected frame's display device). */)
2275 return Qnil; 2070 return Qnil;
2276} 2071}
2277 2072
2073
2074
2075DEFUN ("suspend-tty", Fsuspend_tty, Ssuspend_tty, 0, 1, 0,
2076 doc: /* Suspend the terminal device TTY.
2077
2078The device is restored to its default state, and Emacs ceases all
2079access to the tty device. Frames that use the device are not deleted,
2080but input is not read from them and if they change, their display is
2081not updated.
2082
2083TTY may be a terminal id, a frame, or nil for the terminal device of
2084the currently selected frame.
2085
2086This function runs `suspend-tty-functions' after suspending the
2087device. The functions are run with one arg, the id of the suspended
2088terminal device.
2089
2090`suspend-tty' does nothing if it is called on a device that is already
2091suspended.
2092
2093A suspended tty may be resumed by calling `resume-tty' on it. */)
2094 (tty)
2095 Lisp_Object tty;
2096{
2097 struct device *d = get_tty_device (tty);
2098 FILE *f;
2099
2100 if (!d)
2101 error ("Unknown tty device");
2102
2103 f = d->display_info.tty->input;
2104
2105 if (f)
2106 {
2107 reset_sys_modes (d->display_info.tty);
2108
2109 delete_keyboard_wait_descriptor (fileno (f));
2110
2111 fclose (f);
2112 if (f != d->display_info.tty->output)
2113 fclose (d->display_info.tty->output);
2114
2115 d->display_info.tty->input = 0;
2116 d->display_info.tty->output = 0;
2117
2118 if (FRAMEP (d->display_info.tty->top_frame))
2119 FRAME_SET_VISIBLE (XFRAME (d->display_info.tty->top_frame), 0);
2120
2121 /* Run `suspend-tty-functions'. */
2122 if (!NILP (Vrun_hooks))
2123 {
2124 Lisp_Object args[2];
2125 args[0] = intern ("suspend-tty-functions");
2126 args[1] = make_number (d->id);
2127 Frun_hook_with_args (2, args);
2128 }
2129 }
2130
2131 return Qnil;
2132}
2133
2134DEFUN ("resume-tty", Fresume_tty, Sresume_tty, 0, 1, 0,
2135 doc: /* Resume the previously suspended terminal device TTY.
2136The terminal is opened and reinitialized. Frames that are on the
2137suspended display are revived.
2138
2139It is an error to resume a display while another display is active on
2140the same device.
2141
2142This function runs `resume-tty-functions' after resuming the device.
2143The functions are run with one arg, the id of the resumed display
2144device.
2145
2146`resume-tty' does nothing if it is called on a device that is not
2147suspended.
2148
2149TTY may be a display device id, a frame, or nil for the display device
2150of the currently selected frame. */)
2151 (tty)
2152 Lisp_Object tty;
2153{
2154 struct device *d = get_tty_device (tty);
2155 int fd;
2156
2157 if (!d)
2158 error ("Unknown tty device");
2159
2160 if (!d->display_info.tty->input)
2161 {
2162 if (get_named_tty (d->display_info.tty->name))
2163 error ("Cannot resume display while another display is active on the same device");
2164
2165 fd = emacs_open (d->display_info.tty->name, O_RDWR | O_NOCTTY, 0);
2166
2167 /* XXX What if open fails? */
2168
2169 dissociate_if_controlling_tty (fd);
2170
2171 d->display_info.tty->output = fdopen (fd, "w+");
2172 d->display_info.tty->input = d->display_info.tty->output;
2173
2174 add_keyboard_wait_descriptor (fd);
2175
2176 if (FRAMEP (d->display_info.tty->top_frame))
2177 FRAME_SET_VISIBLE (XFRAME (d->display_info.tty->top_frame), 1);
2178
2179 init_sys_modes (d->display_info.tty);
2180
2181 /* Run `suspend-tty-functions'. */
2182 if (!NILP (Vrun_hooks))
2183 {
2184 Lisp_Object args[2];
2185 args[0] = intern ("resume-tty-functions");
2186 args[1] = make_number (d->id);
2187 Frun_hook_with_args (2, args);
2188 }
2189 }
2190
2191 return Qnil;
2192}
2278 2193
2279 2194
2280/*********************************************************************** 2195/***********************************************************************
2281 Initialization 2196 Initialization
2282 ***********************************************************************/ 2197 ***********************************************************************/
2283 2198
2284/* Create the bootstrap display device for the initial frame. 2199/* Initialize the tty-dependent part of frame F. The frame must
2285 Returns a device of type output_initial. */ 2200 already have its device initialized. */
2286 2201
2287struct device * 2202void
2288init_initial_device (void) 2203create_tty_output (struct frame *f)
2289{ 2204{
2290 if (initialized || device_list || tty_list) 2205 struct tty_output *t;
2206
2207 if (! FRAME_TERMCAP_P (f))
2291 abort (); 2208 abort ();
2292 2209
2293 initial_device = create_device (); 2210 t = xmalloc (sizeof (struct tty_output));
2294 initial_device->type = output_initial; 2211 bzero (t, sizeof (struct tty_output));
2295 initial_device->name = xstrdup ("initial_device");
2296 initial_device->kboard = initial_kboard;
2297 2212
2298 initial_device->delete_device_hook = &delete_initial_device; 2213 t->display_info = FRAME_DEVICE (f)->display_info.tty;
2299 /* All other hooks are NULL. */
2300 2214
2301 return initial_device; 2215 f->output_data.tty = t;
2302} 2216}
2303 2217
2304/* Deletes the bootstrap display device. 2218/* Delete the tty-dependent part of frame F. */
2305 Called through delete_device_hook. */
2306 2219
2307void 2220static void
2308delete_initial_device (struct device *device) 2221delete_tty_output (struct frame *f)
2309{ 2222{
2310 if (device != initial_device) 2223 if (! FRAME_TERMCAP_P (f))
2311 abort (); 2224 abort ();
2312 2225
2313 delete_device (device); 2226 xfree (f->output_data.tty);
2314 initial_device = NULL;
2315} 2227}
2316 2228
2229
2230
2317/* Drop the controlling terminal if fd is the same device. */ 2231/* Drop the controlling terminal if fd is the same device. */
2318void 2232static void
2319dissociate_if_controlling_tty (int fd) 2233dissociate_if_controlling_tty (int fd)
2320{ 2234{
2321 int pgid; 2235 int pgid;
@@ -2974,7 +2888,7 @@ static int deleting_tty = 0;
2974 2888
2975/* Delete the given terminal device, closing all frames on it. */ 2889/* Delete the given terminal device, closing all frames on it. */
2976 2890
2977void 2891static void
2978delete_tty (struct device *device) 2892delete_tty (struct device *device)
2979{ 2893{
2980 struct tty_display_info *tty; 2894 struct tty_display_info *tty;
@@ -3066,44 +2980,11 @@ delete_tty (struct device *device)
3066 2980
3067 2981
3068 2982
3069/* Initialize the tty-dependent part of frame F. The frame must
3070 already have its device initialized. */
3071
3072void
3073create_tty_output (struct frame *f)
3074{
3075 struct tty_output *t;
3076
3077 if (! FRAME_TERMCAP_P (f))
3078 abort ();
3079
3080 t = xmalloc (sizeof (struct tty_output));
3081 bzero (t, sizeof (struct tty_output));
3082
3083 t->display_info = FRAME_DEVICE (f)->display_info.tty;
3084
3085 f->output_data.tty = t;
3086}
3087
3088/* Delete the tty-dependent part of frame F. */
3089
3090void
3091delete_tty_output (struct frame *f)
3092{
3093 if (! FRAME_TERMCAP_P (f))
3094 abort ();
3095
3096 xfree (f->output_data.tty);
3097}
3098
3099
3100
3101
3102/* Mark the pointers in the tty_display_info objects. 2983/* Mark the pointers in the tty_display_info objects.
3103 Called by the Fgarbage_collector. */ 2984 Called by the Fgarbage_collector. */
3104 2985
3105void 2986void
3106mark_ttys () 2987mark_ttys (void)
3107{ 2988{
3108 struct tty_display_info *tty; 2989 struct tty_display_info *tty;
3109 2990
@@ -3116,279 +2997,6 @@ mark_ttys ()
3116 2997
3117 2998
3118 2999
3119/* Create a new device object and add it to the device list. */
3120
3121struct device *
3122create_device (void)
3123{
3124 struct device *device = (struct device *) xmalloc (sizeof (struct device));
3125
3126 bzero (device, sizeof (struct device));
3127 device->next_device = device_list;
3128 device_list = device;
3129
3130 device->id = next_device_id++;
3131
3132 device->keyboard_coding =
3133 (struct coding_system *) xmalloc (sizeof (struct coding_system));
3134 device->terminal_coding =
3135 (struct coding_system *) xmalloc (sizeof (struct coding_system));
3136
3137 setup_coding_system (Qnil, device->keyboard_coding);
3138 setup_coding_system (Qnil, device->terminal_coding);
3139
3140 return device;
3141}
3142
3143/* Remove a device from the device list and free its memory. */
3144
3145void
3146delete_device (struct device *device)
3147{
3148 struct device **dp;
3149 Lisp_Object tail, frame;
3150
3151 /* Check for and close live frames that are still on this
3152 device. */
3153 FOR_EACH_FRAME (tail, frame)
3154 {
3155 struct frame *f = XFRAME (frame);
3156 if (FRAME_LIVE_P (f) && f->device == device)
3157 {
3158 Fdelete_frame (frame, Qt);
3159 }
3160 }
3161
3162 for (dp = &device_list; *dp != device; dp = &(*dp)->next_device)
3163 if (! *dp)
3164 abort ();
3165 *dp = device->next_device;
3166
3167 if (device->keyboard_coding)
3168 xfree (device->keyboard_coding);
3169 if (device->terminal_coding)
3170 xfree (device->terminal_coding);
3171 if (device->name)
3172 xfree (device->name);
3173
3174#ifdef MULTI_KBOARD
3175 if (device->kboard && --device->kboard->reference_count == 0)
3176 delete_kboard (device->kboard);
3177#endif
3178
3179 bzero (device, sizeof (struct device));
3180 xfree (device);
3181}
3182
3183DEFUN ("delete-display", Fdelete_display, Sdelete_display, 0, 2, 0,
3184 doc: /* Delete DEVICE by deleting all frames on it and closing the device.
3185DEVICE may be a display device id, a frame, or nil (meaning the
3186selected frame's display device).
3187
3188Normally, you may not delete a display if all other displays are suspended,
3189but if the second argument FORCE is non-nil, you may do so. */)
3190 (device, force)
3191 Lisp_Object device, force;
3192{
3193 struct device *d, *p;
3194
3195 d = get_device (device, 0);
3196
3197 if (!d)
3198 return Qnil;
3199
3200 p = device_list;
3201 while (p && (p == d || !DEVICE_ACTIVE_P (p)))
3202 p = p->next_device;
3203
3204 if (NILP (force) && !p)
3205 error ("Attempt to delete the sole active display device");
3206
3207 if (d->delete_device_hook)
3208 (*d->delete_device_hook) (d);
3209 else
3210 delete_device (d);
3211
3212 return Qnil;
3213}
3214
3215DEFUN ("display-live-p", Fdisplay_live_p, Sdisplay_live_p, 1, 1, 0,
3216 doc: /* Return non-nil if OBJECT is a device which has not been deleted.
3217Value is nil if OBJECT is not a live display device.
3218If object is a live display device, the return value indicates what
3219sort of output device it uses. See the documentation of `framep' for
3220possible return values.
3221
3222Display devices are represented by their integer identifiers. */)
3223 (object)
3224 Lisp_Object object;
3225{
3226 struct device *d;
3227
3228 if (!INTEGERP (object))
3229 return Qnil;
3230
3231 d = get_device (object, 0);
3232
3233 if (!d)
3234 return Qnil;
3235
3236 switch (d->type)
3237 {
3238 case output_initial: /* The initial frame is like a termcap frame. */
3239 case output_termcap:
3240 return Qt;
3241 case output_x_window:
3242 return Qx;
3243 case output_w32:
3244 return Qw32;
3245 case output_msdos_raw:
3246 return Qpc;
3247 case output_mac:
3248 return Qmac;
3249 default:
3250 abort ();
3251 }
3252}
3253
3254DEFUN ("display-list", Fdisplay_list, Sdisplay_list, 0, 0, 0,
3255 doc: /* Return a list of all display devices.
3256Display devices are represented by their integer identifiers. */)
3257 ()
3258{
3259 Lisp_Object devices = Qnil;
3260 struct device *d;
3261
3262 for (d = device_list; d; d = d->next_device)
3263 devices = Fcons (make_number (d->id), devices);
3264
3265 return devices;
3266}
3267
3268
3269
3270
3271DEFUN ("suspend-tty", Fsuspend_tty, Ssuspend_tty, 0, 1, 0,
3272 doc: /* Suspend the terminal device TTY.
3273
3274The device is restored to its default state, and Emacs ceases all
3275access to the tty device. Frames that use the device are not deleted,
3276but input is not read from them and if they change, their display is
3277not updated.
3278
3279TTY may be a terminal id, a frame, or nil for the terminal device of
3280the currently selected frame.
3281
3282This function runs `suspend-tty-functions' after suspending the
3283device. The functions are run with one arg, the id of the suspended
3284terminal device.
3285
3286`suspend-tty' does nothing if it is called on a device that is already
3287suspended.
3288
3289A suspended tty may be resumed by calling `resume-tty' on it. */)
3290 (tty)
3291 Lisp_Object tty;
3292{
3293 struct device *d = get_tty_device (tty);
3294 FILE *f;
3295
3296 if (!d)
3297 error ("Unknown tty device");
3298
3299 f = d->display_info.tty->input;
3300
3301 if (f)
3302 {
3303 reset_sys_modes (d->display_info.tty);
3304
3305 delete_keyboard_wait_descriptor (fileno (f));
3306
3307 fclose (f);
3308 if (f != d->display_info.tty->output)
3309 fclose (d->display_info.tty->output);
3310
3311 d->display_info.tty->input = 0;
3312 d->display_info.tty->output = 0;
3313
3314 if (FRAMEP (d->display_info.tty->top_frame))
3315 FRAME_SET_VISIBLE (XFRAME (d->display_info.tty->top_frame), 0);
3316
3317 /* Run `suspend-tty-functions'. */
3318 if (!NILP (Vrun_hooks))
3319 {
3320 Lisp_Object args[2];
3321 args[0] = intern ("suspend-tty-functions");
3322 args[1] = make_number (d->id);
3323 Frun_hook_with_args (2, args);
3324 }
3325 }
3326
3327 return Qnil;
3328}
3329
3330
3331DEFUN ("resume-tty", Fresume_tty, Sresume_tty, 0, 1, 0,
3332 doc: /* Resume the previously suspended terminal device TTY.
3333The terminal is opened and reinitialized. Frames that are on the
3334suspended display are revived.
3335
3336It is an error to resume a display while another display is active on
3337the same device.
3338
3339This function runs `resume-tty-functions' after resuming the device.
3340The functions are run with one arg, the id of the resumed display
3341device.
3342
3343`resume-tty' does nothing if it is called on a device that is not
3344suspended.
3345
3346TTY may be a display device id, a frame, or nil for the display device
3347of the currently selected frame. */)
3348 (tty)
3349 Lisp_Object tty;
3350{
3351 struct device *d = get_tty_device (tty);
3352 int fd;
3353
3354 if (!d)
3355 error ("Unknown tty device");
3356
3357 if (!d->display_info.tty->input)
3358 {
3359 if (get_named_tty (d->display_info.tty->name))
3360 error ("Cannot resume display while another display is active on the same device");
3361
3362 fd = emacs_open (d->display_info.tty->name, O_RDWR | O_NOCTTY, 0);
3363
3364 /* XXX What if open fails? */
3365
3366 dissociate_if_controlling_tty (fd);
3367
3368 d->display_info.tty->output = fdopen (fd, "w+");
3369 d->display_info.tty->input = d->display_info.tty->output;
3370
3371 add_keyboard_wait_descriptor (fd);
3372
3373 if (FRAMEP (d->display_info.tty->top_frame))
3374 FRAME_SET_VISIBLE (XFRAME (d->display_info.tty->top_frame), 1);
3375
3376 init_sys_modes (d->display_info.tty);
3377
3378 /* Run `suspend-tty-functions'. */
3379 if (!NILP (Vrun_hooks))
3380 {
3381 Lisp_Object args[2];
3382 args[0] = intern ("resume-tty-functions");
3383 args[1] = make_number (d->id);
3384 Frun_hook_with_args (2, args);
3385 }
3386 }
3387
3388 return Qnil;
3389}
3390
3391
3392void 3000void
3393syms_of_term () 3001syms_of_term ()
3394{ 3002{
@@ -3401,11 +3009,6 @@ This variable can be used by terminal emulator packages. */);
3401 system_uses_terminfo = 0; 3009 system_uses_terminfo = 0;
3402#endif 3010#endif
3403 3011
3404 DEFVAR_LISP ("ring-bell-function", &Vring_bell_function,
3405 doc: /* Non-nil means call this function to ring the bell.
3406The function should accept no arguments. */);
3407 Vring_bell_function = Qnil;
3408
3409 DEFVAR_LISP ("suspend-tty-functions", &Vsuspend_tty_functions, 3012 DEFVAR_LISP ("suspend-tty-functions", &Vsuspend_tty_functions,
3410 doc: /* Functions to be run after suspending a tty. 3013 doc: /* Functions to be run after suspending a tty.
3411The functions are run with one argument, the name of the tty to be suspended. 3014The functions are run with one argument, the name of the tty to be suspended.
@@ -3422,17 +3025,10 @@ See `resume-tty'. */);
3422 defsubr (&Stty_display_color_p); 3025 defsubr (&Stty_display_color_p);
3423 defsubr (&Stty_display_color_cells); 3026 defsubr (&Stty_display_color_cells);
3424 defsubr (&Stty_no_underline); 3027 defsubr (&Stty_no_underline);
3425 defsubr (&Sdisplay_name);
3426 defsubr (&Sdisplay_tty_type); 3028 defsubr (&Sdisplay_tty_type);
3427 defsubr (&Sdisplay_controlling_tty_p); 3029 defsubr (&Sdisplay_controlling_tty_p);
3428 defsubr (&Sdelete_display);
3429 defsubr (&Sdisplay_live_p);
3430 defsubr (&Sdisplay_list);
3431 defsubr (&Ssuspend_tty); 3030 defsubr (&Ssuspend_tty);
3432 defsubr (&Sresume_tty); 3031 defsubr (&Sresume_tty);
3433
3434 Fprovide (intern ("multi-tty"), Qnil);
3435
3436} 3032}
3437 3033
3438 3034
diff --git a/src/termhooks.h b/src/termhooks.h
index cb68c9e2c27..824cef60351 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -330,6 +330,9 @@ struct device
330 the function `set-keyboard-coding-system'. */ 330 the function `set-keyboard-coding-system'. */
331 struct coding_system *keyboard_coding; 331 struct coding_system *keyboard_coding;
332 332
333 /* Parameter alist of this terminal. */
334 Lisp_Object param_alist;
335
333 /* Terminal characteristics. */ 336 /* Terminal characteristics. */
334 /* XXX Are these really used on non-termcap displays? */ 337 /* XXX Are these really used on non-termcap displays? */
335 338
diff --git a/src/terminal.c b/src/terminal.c
new file mode 100644
index 00000000000..83879a43afa
--- /dev/null
+++ b/src/terminal.c
@@ -0,0 +1,596 @@
1/* Functions related to terminal devices.
2 Copyright (C) 2005 Free Software Foundation, Inc.
3
4This file is part of GNU Emacs.
5
6GNU Emacs is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11GNU Emacs is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU Emacs; see the file COPYING. If not, write to
18the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19Boston, MA 02110-1301, USA. */
20
21#include <config.h>
22
23#include "lisp.h"
24#include "frame.h"
25#include "termchar.h"
26#include "termhooks.h"
27#include "charset.h"
28#include "coding.h"
29#include "keyboard.h"
30
31/* Chain of all displays currently in use. */
32struct device *device_list;
33
34/* The first unallocated display id. */
35static int next_device_id;
36
37/* The initial display device, created by initial_term_init. */
38struct device *initial_device;
39
40/* Function to use to ring the bell. */
41Lisp_Object Vring_bell_function;
42
43void delete_initial_device P_ ((struct device *));
44
45
46
47void
48ring_bell (struct frame *f)
49{
50 if (!NILP (Vring_bell_function))
51 {
52 Lisp_Object function;
53
54 /* Temporarily set the global variable to nil
55 so that if we get an error, it stays nil
56 and we don't call it over and over.
57
58 We don't specbind it, because that would carefully
59 restore the bad value if there's an error
60 and make the loop of errors happen anyway. */
61
62 function = Vring_bell_function;
63 Vring_bell_function = Qnil;
64
65 call0 (function);
66
67 Vring_bell_function = function;
68 }
69 else if (FRAME_DEVICE (f)->ring_bell_hook)
70 (*FRAME_DEVICE (f)->ring_bell_hook) (f);
71}
72
73void
74update_begin (struct frame *f)
75{
76 if (FRAME_DEVICE (f)->update_begin_hook)
77 (*FRAME_DEVICE (f)->update_begin_hook) (f);
78}
79
80void
81update_end (struct frame *f)
82{
83 if (FRAME_DEVICE (f)->update_end_hook)
84 (*FRAME_DEVICE (f)->update_end_hook) (f);
85}
86
87/* Specify how many text lines, from the top of the window,
88 should be affected by insert-lines and delete-lines operations.
89 This, and those operations, are used only within an update
90 that is bounded by calls to update_begin and update_end. */
91
92void
93set_terminal_window (struct frame *f, int size)
94{
95 if (FRAME_DEVICE (f)->set_terminal_window_hook)
96 (*FRAME_DEVICE (f)->set_terminal_window_hook) (f, size);
97}
98
99/* Move cursor to row/column position VPOS/HPOS. HPOS/VPOS are
100 frame-relative coordinates. */
101
102void
103cursor_to (struct frame *f, int vpos, int hpos)
104{
105 if (FRAME_DEVICE (f)->cursor_to_hook)
106 (*FRAME_DEVICE (f)->cursor_to_hook) (f, vpos, hpos);
107}
108
109/* Similar but don't take any account of the wasted characters. */
110
111void
112raw_cursor_to (struct frame *f, int row, int col)
113{
114 if (FRAME_DEVICE (f)->raw_cursor_to_hook)
115 (*FRAME_DEVICE (f)->raw_cursor_to_hook) (f, row, col);
116}
117
118/* Erase operations */
119
120/* Clear from cursor to end of frame. */
121void
122clear_to_end (struct frame *f)
123{
124 if (FRAME_DEVICE (f)->clear_to_end_hook)
125 (*FRAME_DEVICE (f)->clear_to_end_hook) (f);
126}
127
128/* Clear entire frame */
129
130void
131clear_frame (struct frame *f)
132{
133 if (FRAME_DEVICE (f)->clear_frame_hook)
134 (*FRAME_DEVICE (f)->clear_frame_hook) (f);
135}
136
137/* Clear from cursor to end of line.
138 Assume that the line is already clear starting at column first_unused_hpos.
139
140 Note that the cursor may be moved, on terminals lacking a `ce' string. */
141
142void
143clear_end_of_line (struct frame *f, int first_unused_hpos)
144{
145 if (FRAME_DEVICE (f)->clear_end_of_line_hook)
146 (*FRAME_DEVICE (f)->clear_end_of_line_hook) (f, first_unused_hpos);
147}
148
149/* Output LEN glyphs starting at STRING at the nominal cursor position.
150 Advance the nominal cursor over the text. */
151
152void
153write_glyphs (struct frame *f, struct glyph *string, int len)
154{
155 if (FRAME_DEVICE (f)->write_glyphs_hook)
156 (*FRAME_DEVICE (f)->write_glyphs_hook) (f, string, len);
157}
158
159/* Insert LEN glyphs from START at the nominal cursor position.
160
161 If start is zero, insert blanks instead of a string at start */
162
163void
164insert_glyphs (struct frame *f, struct glyph *start, int len)
165{
166 if (len <= 0)
167 return;
168
169 if (FRAME_DEVICE (f)->insert_glyphs_hook)
170 (*FRAME_DEVICE (f)->insert_glyphs_hook) (f, start, len);
171}
172
173/* Delete N glyphs at the nominal cursor position. */
174
175void
176delete_glyphs (struct frame *f, int n)
177{
178 if (FRAME_DEVICE (f)->delete_glyphs_hook)
179 (*FRAME_DEVICE (f)->delete_glyphs_hook) (f, n);
180}
181
182/* Insert N lines at vpos VPOS. If N is negative, delete -N lines. */
183
184void
185ins_del_lines (struct frame *f, int vpos, int n)
186{
187 if (FRAME_DEVICE (f)->ins_del_lines_hook)
188 (*FRAME_DEVICE (f)->ins_del_lines_hook) (f, vpos, n);
189}
190
191
192
193
194/* Return the display object specified by DEVICE. DEVICE may be a
195 display id, a frame, or nil for the display device of the current
196 frame. If THROW is zero, return NULL for failure, otherwise throw
197 an error. */
198
199struct device *
200get_device (Lisp_Object device, int throw)
201{
202 struct device *result = NULL;
203
204 if (NILP (device))
205 device = selected_frame;
206
207 if (INTEGERP (device))
208 {
209 struct device *d;
210
211 for (d = device_list; d; d = d->next_device)
212 {
213 if (d->id == XINT (device))
214 {
215 result = d;
216 break;
217 }
218 }
219 }
220 else if (FRAMEP (device))
221 {
222 result = FRAME_DEVICE (XFRAME (device));
223 }
224
225 if (result == NULL && throw)
226 wrong_type_argument (Qdisplay_live_p, device);
227
228 return result;
229}
230
231
232
233/* Create a new device object and add it to the device list. */
234
235struct device *
236create_device (void)
237{
238 struct device *device = (struct device *) xmalloc (sizeof (struct device));
239
240 bzero (device, sizeof (struct device));
241 device->next_device = device_list;
242 device_list = device;
243
244 device->id = next_device_id++;
245
246 device->keyboard_coding =
247 (struct coding_system *) xmalloc (sizeof (struct coding_system));
248 device->terminal_coding =
249 (struct coding_system *) xmalloc (sizeof (struct coding_system));
250
251 setup_coding_system (Qnil, device->keyboard_coding);
252 setup_coding_system (Qnil, device->terminal_coding);
253
254 device->param_alist = Qnil;
255 return device;
256}
257
258/* Mark the Lisp pointers in the terminal objects.
259 Called by the Fgarbage_collector. */
260
261void
262mark_devices (void)
263{
264 struct device *d;
265 for (d = device_list; d; d = d->next_device)
266 {
267 mark_object (d->param_alist);
268 }
269}
270
271
272/* Remove a device from the device list and free its memory. */
273
274void
275delete_device (struct device *device)
276{
277 struct device **dp;
278 Lisp_Object tail, frame;
279
280 /* Check for and close live frames that are still on this
281 device. */
282 FOR_EACH_FRAME (tail, frame)
283 {
284 struct frame *f = XFRAME (frame);
285 if (FRAME_LIVE_P (f) && f->device == device)
286 {
287 Fdelete_frame (frame, Qt);
288 }
289 }
290
291 for (dp = &device_list; *dp != device; dp = &(*dp)->next_device)
292 if (! *dp)
293 abort ();
294 *dp = device->next_device;
295
296 if (device->keyboard_coding)
297 xfree (device->keyboard_coding);
298 if (device->terminal_coding)
299 xfree (device->terminal_coding);
300 if (device->name)
301 xfree (device->name);
302
303#ifdef MULTI_KBOARD
304 if (device->kboard && --device->kboard->reference_count == 0)
305 delete_kboard (device->kboard);
306#endif
307
308 bzero (device, sizeof (struct device));
309 xfree (device);
310}
311
312DEFUN ("delete-display", Fdelete_display, Sdelete_display, 0, 2, 0,
313 doc: /* Delete DEVICE by deleting all frames on it and closing the device.
314DEVICE may be a display device id, a frame, or nil (meaning the
315selected frame's display device).
316
317Normally, you may not delete a display if all other displays are suspended,
318but if the second argument FORCE is non-nil, you may do so. */)
319 (device, force)
320 Lisp_Object device, force;
321{
322 struct device *d, *p;
323
324 d = get_device (device, 0);
325
326 if (!d)
327 return Qnil;
328
329 p = device_list;
330 while (p && (p == d || !DEVICE_ACTIVE_P (p)))
331 p = p->next_device;
332
333 if (NILP (force) && !p)
334 error ("Attempt to delete the sole active display device");
335
336 if (d->delete_device_hook)
337 (*d->delete_device_hook) (d);
338 else
339 delete_device (d);
340
341 return Qnil;
342}
343
344DEFUN ("display-live-p", Fdisplay_live_p, Sdisplay_live_p, 1, 1, 0,
345 doc: /* Return non-nil if OBJECT is a device which has not been deleted.
346Value is nil if OBJECT is not a live display device.
347If object is a live display device, the return value indicates what
348sort of output device it uses. See the documentation of `framep' for
349possible return values.
350
351Display devices are represented by their integer identifiers. */)
352 (object)
353 Lisp_Object object;
354{
355 struct device *d;
356
357 if (!INTEGERP (object))
358 return Qnil;
359
360 d = get_device (object, 0);
361
362 if (!d)
363 return Qnil;
364
365 switch (d->type)
366 {
367 case output_initial: /* The initial frame is like a termcap frame. */
368 case output_termcap:
369 return Qt;
370 case output_x_window:
371 return Qx;
372 case output_w32:
373 return Qw32;
374 case output_msdos_raw:
375 return Qpc;
376 case output_mac:
377 return Qmac;
378 default:
379 abort ();
380 }
381}
382
383DEFUN ("display-list", Fdisplay_list, Sdisplay_list, 0, 0, 0,
384 doc: /* Return a list of all display devices.
385Display devices are represented by their integer identifiers. */)
386 ()
387{
388 Lisp_Object devices = Qnil;
389 struct device *d;
390
391 for (d = device_list; d; d = d->next_device)
392 devices = Fcons (make_number (d->id), devices);
393
394 return devices;
395}
396
397DEFUN ("display-name", Fdisplay_name, Sdisplay_name, 0, 1, 0,
398 doc: /* Return the name of the display device DEVICE.
399It is not guaranteed that the returned value is unique among opened devices.
400
401DEVICE may be a display device id, a frame, or nil (meaning the
402selected frame's display device). */)
403 (device)
404 Lisp_Object device;
405{
406 struct device *d = get_device (device, 1);
407
408 if (d->name)
409 return build_string (d->name);
410 else
411 return Qnil;
412}
413
414
415
416/* Return the value of terminal parameter PARAM in device D. */
417Lisp_Object
418get_terminal_param (d, param)
419 struct device *d;
420 Lisp_Object param;
421{
422 Lisp_Object tem = Fassq (param, d->param_alist);
423 if (EQ (tem, Qnil))
424 return tem;
425 return Fcdr (tem);
426}
427
428/* Set the value of terminal parameter PARAMETER in device D to VALUE.
429 Return the previous value. */
430
431Lisp_Object
432store_terminal_param (d, parameter, value)
433 struct device *d;
434 Lisp_Object parameter;
435 Lisp_Object value;
436{
437 Lisp_Object old_alist_elt = Fassq (parameter, d->param_alist);
438 if (EQ (old_alist_elt, Qnil))
439 {
440 d->param_alist = Fcons (Fcons (parameter, value), d->param_alist);
441 return Qnil;
442 }
443 else
444 {
445 Lisp_Object result = Fcdr (old_alist_elt);
446 Fsetcdr (old_alist_elt, value);
447 return result;
448 }
449}
450
451
452DEFUN ("terminal-parameters", Fterminal_parameters, Sterminal_parameters, 0, 1, 0,
453 doc: /* Return the parameter-alist of terminal TERMINAL.
454The value is a list of elements of the form (PARM . VALUE), where PARM
455is a symbol.
456
457TERMINAL can be a terminal if, a frame or nil (meaning the selected
458frame's terminal). */)
459 (terminal)
460 Lisp_Object terminal;
461{
462 struct device *d = get_device (terminal, 1);
463 return Fcopy_alist (d->param_alist);
464}
465
466DEFUN ("terminal-parameter", Fterminal_parameter, Sterminal_parameter, 2, 2, 0,
467 doc: /* Return TERMINAL's value for parameter PARAMETER.
468TERMINAL can be a terminal if, a frame or nil (meaning the selected
469frame's terminal). */)
470 (terminal, parameter)
471 Lisp_Object terminal;
472 Lisp_Object parameter;
473{
474 Lisp_Object value;
475 struct device *d = get_device (terminal, 1);
476 CHECK_SYMBOL (parameter);
477 value = Fcdr (Fassq (parameter, d->param_alist));
478 return value;
479}
480
481DEFUN ("modify-terminal-parameters", Fmodify_terminal_parameters,
482 Smodify_terminal_parameters, 2, 2, 0,
483 doc: /* Modify the parameters of terminal TERMINAL according to ALIST.
484ALIST is an alist of parameters to change and their new values.
485Each element of ALIST has the form (PARM . VALUE), where PARM is a symbol.
486
487TERMINAL can be a terminal if, a frame or nil (meaning the selected
488frame's terminal). */)
489 (terminal, alist)
490 Lisp_Object terminal;
491 Lisp_Object alist;
492{
493 Lisp_Object tail, prop, val;
494 struct device *d = get_device (terminal, 1);
495 int length = XINT (Fsafe_length (alist));
496 int i;
497 Lisp_Object *parms = (Lisp_Object *) alloca (length * sizeof (Lisp_Object));
498 Lisp_Object *values = (Lisp_Object *) alloca (length * sizeof (Lisp_Object));
499
500 /* Extract parm names and values into those vectors. */
501
502 i = 0;
503 for (tail = alist; CONSP (tail); tail = Fcdr (tail))
504 {
505 Lisp_Object elt;
506
507 elt = Fcar (tail);
508 parms[i] = Fcar (elt);
509 values[i] = Fcdr (elt);
510 i++;
511 }
512
513 /* Now process them in reverse of specified order. */
514 for (i--; i >= 0; i--)
515 {
516 prop = parms[i];
517 val = values[i];
518 store_terminal_param (d, prop, val);
519 }
520 return Qnil;
521}
522
523DEFUN ("set-terminal-parameter", Fset_terminal_parameter,
524 Sset_terminal_parameter, 3, 3, 0,
525 doc: /* Set TERMINAL's value for parameter PARAMETER to VALUE.
526Return the previous value of PARAMETER.
527
528TERMINAL can be a terminal if, a frame or nil (meaning the selected
529frame's terminal). */)
530 (terminal, parameter, value)
531 Lisp_Object terminal;
532 Lisp_Object parameter;
533 Lisp_Object value;
534{
535 struct device *d = get_device (terminal, 1);
536 return store_terminal_param (d, parameter, value);
537}
538
539
540
541/* Create the bootstrap display device for the initial frame.
542 Returns a device of type output_initial. */
543
544struct device *
545init_initial_device (void)
546{
547 if (initialized || device_list || tty_list)
548 abort ();
549
550 initial_device = create_device ();
551 initial_device->type = output_initial;
552 initial_device->name = xstrdup ("initial_device");
553 initial_device->kboard = initial_kboard;
554
555 initial_device->delete_device_hook = &delete_initial_device;
556 /* All other hooks are NULL. */
557
558 return initial_device;
559}
560
561/* Deletes the bootstrap display device.
562 Called through delete_device_hook. */
563
564void
565delete_initial_device (struct device *device)
566{
567 if (device != initial_device)
568 abort ();
569
570 delete_device (device);
571 initial_device = NULL;
572}
573
574void
575syms_of_terminal ()
576{
577
578 DEFVAR_LISP ("ring-bell-function", &Vring_bell_function,
579 doc: /* Non-nil means call this function to ring the bell.
580The function should accept no arguments. */);
581 Vring_bell_function = Qnil;
582
583 defsubr (&Sdelete_display);
584 defsubr (&Sdisplay_live_p);
585 defsubr (&Sdisplay_list);
586 defsubr (&Sdisplay_name);
587 defsubr (&Sterminal_parameters);
588 defsubr (&Sterminal_parameter);
589 defsubr (&Smodify_terminal_parameters);
590 defsubr (&Sset_terminal_parameter);
591
592 Fprovide (intern ("multi-tty"), Qnil);
593}
594
595/* arch-tag: e9af6f27-b483-47dc-bb1a-730c1c5cab03
596 (do not change this comment) */
diff --git a/src/xterm.h b/src/xterm.h
index c96d015be4a..b0464b6cbfa 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -995,6 +995,7 @@ extern void x_wm_set_size_hint P_ ((struct frame *, long, int));
995extern void x_wm_set_window_state P_ ((struct frame *, int)); 995extern void x_wm_set_window_state P_ ((struct frame *, int));
996extern void x_wm_set_icon_pixmap P_ ((struct frame *, int)); 996extern void x_wm_set_icon_pixmap P_ ((struct frame *, int));
997extern void x_delete_display P_ ((struct x_display_info *)); 997extern void x_delete_display P_ ((struct x_display_info *));
998extern void x_delete_device P_ ((struct device *device));
998extern void x_initialize P_ ((void)); 999extern void x_initialize P_ ((void));
999extern unsigned long x_copy_color P_ ((struct frame *, unsigned long)); 1000extern unsigned long x_copy_color P_ ((struct frame *, unsigned long));
1000#ifdef USE_X_TOOLKIT 1001#ifdef USE_X_TOOLKIT