annotate src/term.c @ 83450:c69d44922688

Merged from miles@gnu.org--gnu-2005 (patch 682) Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-682 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-490
author Karoly Lorentey <lorentey@elte.hu>
date Tue, 03 Jan 2006 02:15:28 +0000
parents 76396de7f50a 52bbc53dbce1
children b98066f4aa10
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
37959
b53edc686faf (tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 37499
diff changeset
1 /* Terminal control module for terminals described by TERMCAP
64770
a0d1312ede66 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64084
diff changeset
2 Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1998, 2000, 2001,
a0d1312ede66 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64084
diff changeset
3 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5 This file is part of GNU Emacs.
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
7 GNU Emacs is free software; you can redistribute it and/or modify
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
8 it under the terms of the GNU General Public License as published by
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 533
diff changeset
9 the Free Software Foundation; either version 2, or (at your option)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
10 any later version.
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
11
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
12 GNU Emacs is distributed in the hope that it will be useful,
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
15 GNU General Public License for more details.
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
16
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
18 along with GNU Emacs; see the file COPYING. If not, write to
64084
a8fa7c632ee4 Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 63880
diff changeset
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
a8fa7c632ee4 Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 63880
diff changeset
20 Boston, MA 02110-1301, USA. */
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
21
37959
b53edc686faf (tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 37499
diff changeset
22 /* New redisplay, TTY faces by Gerd Moellmann <gerd@gnu.org>. */
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
23
7900
60795e826dad Put stdio.h after config.h.
Richard M. Stallman <rms@gnu.org>
parents: 7649
diff changeset
24 #include <config.h>
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
25 #include <stdio.h>
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
26 #include <ctype.h>
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
27 #include <string.h>
39988
eac4e9ae201c Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents: 39914
diff changeset
28
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
29 #include <sys/file.h>
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
30
83032
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
31 #include <unistd.h> /* For isatty. */
83095
b448166f5664 Fix #include errors for FreeBSD (Frank Ruell)
Karoly Lorentey <lorentey@elte.hu>
parents: 83086
diff changeset
32
b448166f5664 Fix #include errors for FreeBSD (Frank Ruell)
Karoly Lorentey <lorentey@elte.hu>
parents: 83086
diff changeset
33 #if HAVE_TERMIOS_H
b448166f5664 Fix #include errors for FreeBSD (Frank Ruell)
Karoly Lorentey <lorentey@elte.hu>
parents: 83086
diff changeset
34 #include <termios.h> /* For TIOCNOTTY. */
b448166f5664 Fix #include errors for FreeBSD (Frank Ruell)
Karoly Lorentey <lorentey@elte.hu>
parents: 83086
diff changeset
35 #endif
83086
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
36
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
37 #include <signal.h>
83032
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
38
53229
33c3c7c16e13 lib-src/emacsclient.c: Implemented --here option (open a new Emacs tty). Needs more work.
Karoly Lorentey <lorentey@elte.hu>
parents: 53227
diff changeset
39 #include "lisp.h"
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
40 #include "termchar.h"
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
41 #include "termopts.h"
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
42 #include "charset.h"
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
43 #include "coding.h"
31102
6a0caa788013 Include keyboard.h before frame.h.
Andrew Innes <andrewi@gnu.org>
parents: 30848
diff changeset
44 #include "keyboard.h"
765
e4093444f9f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 732
diff changeset
45 #include "frame.h"
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
46 #include "disptab.h"
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
47 #include "termhooks.h"
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
48 #include "dispextern.h"
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
49 #include "window.h"
39697
0b986bb45526 Include keymap.h.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39682
diff changeset
50 #include "keymap.h"
83086
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
51 #include "syssignal.h"
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
52 #include "systty.h"
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
53
33672
a94852aef620 Don't try to include termcap.h; see comment there.
Gerd Moellmann <gerd@gnu.org>
parents: 33006
diff changeset
54 /* For now, don't try to include termcap.h. On some systems,
a94852aef620 Don't try to include termcap.h; see comment there.
Gerd Moellmann <gerd@gnu.org>
parents: 33006
diff changeset
55 configure finds a non-standard termcap.h that the main build
a94852aef620 Don't try to include termcap.h; see comment there.
Gerd Moellmann <gerd@gnu.org>
parents: 33006
diff changeset
56 won't find. */
a94852aef620 Don't try to include termcap.h; see comment there.
Gerd Moellmann <gerd@gnu.org>
parents: 33006
diff changeset
57
a94852aef620 Don't try to include termcap.h; see comment there.
Gerd Moellmann <gerd@gnu.org>
parents: 33006
diff changeset
58 #if defined HAVE_TERMCAP_H && 0
25727
46fe79182b54 (OUTPUT_IF, OUTPUT1_IF): Use do-while.
Gerd Moellmann <gerd@gnu.org>
parents: 25675
diff changeset
59 #include <termcap.h>
29929
bb7557f86f5b [!HAVE_TERMCAP_H]: Declare tputs, tgetent, tgetflag, tgetnum.
Dave Love <fx@gnu.org>
parents: 29462
diff changeset
60 #else
bb7557f86f5b [!HAVE_TERMCAP_H]: Declare tputs, tgetent, tgetflag, tgetnum.
Dave Love <fx@gnu.org>
parents: 29462
diff changeset
61 extern void tputs P_ ((const char *, int, int (*)(int)));
bb7557f86f5b [!HAVE_TERMCAP_H]: Declare tputs, tgetent, tgetflag, tgetnum.
Dave Love <fx@gnu.org>
parents: 29462
diff changeset
62 extern int tgetent P_ ((char *, const char *));
bb7557f86f5b [!HAVE_TERMCAP_H]: Declare tputs, tgetent, tgetflag, tgetnum.
Dave Love <fx@gnu.org>
parents: 29462
diff changeset
63 extern int tgetflag P_ ((char *id));
bb7557f86f5b [!HAVE_TERMCAP_H]: Declare tputs, tgetent, tgetflag, tgetnum.
Dave Love <fx@gnu.org>
parents: 29462
diff changeset
64 extern int tgetnum P_ ((char *id));
25727
46fe79182b54 (OUTPUT_IF, OUTPUT1_IF): Use do-while.
Gerd Moellmann <gerd@gnu.org>
parents: 25675
diff changeset
65 #endif
46fe79182b54 (OUTPUT_IF, OUTPUT1_IF): Use do-while.
Gerd Moellmann <gerd@gnu.org>
parents: 25675
diff changeset
66
21827
87c7f4bd99da Include cm.h after dispextern.h to avoid name conflicts
Geoff Voelker <voelker@cs.washington.edu>
parents: 21624
diff changeset
67 #include "cm.h"
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
68 #ifdef HAVE_X_WINDOWS
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
69 #include "xterm.h"
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
70 #endif
44890
01b93e5e53a7 Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents: 44372
diff changeset
71 #ifdef MAC_OS
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents: 31829
diff changeset
72 #include "macterm.h"
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents: 31829
diff changeset
73 #endif
8898
07bca49c7f84 Declare Fmake_sparse_keymap.
Karl Heuer <kwzh@gnu.org>
parents: 8806
diff changeset
74
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
75 #ifndef O_RDWR
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
76 #define O_RDWR 2
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
77 #endif
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
78
83032
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
79 #ifndef O_NOCTTY
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
80 #define O_NOCTTY 0
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
81 #endif
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
82
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
83 static void tty_set_scroll_region P_ ((struct frame *f, int start, int stop));
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
84 static void turn_on_face P_ ((struct frame *, int face_id));
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
85 static void turn_off_face P_ ((struct frame *, int face_id));
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
86 static void tty_show_cursor P_ ((struct tty_display_info *));
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
87 static void tty_hide_cursor P_ ((struct tty_display_info *));
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
88 static void tty_background_highlight P_ ((struct tty_display_info *tty));
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
89 static void dissociate_if_controlling_tty P_ ((int fd));
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
90 static void delete_tty P_ ((struct terminal *));
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
91
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
92 #define OUTPUT(tty, a) \
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
93 emacs_tputs ((tty), a, \
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
94 (int) (FRAME_LINES (XFRAME (selected_frame)) \
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
95 - curY (tty)), \
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
96 cmputc)
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
97
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
98 #define OUTPUT1(tty, a) emacs_tputs ((tty), a, 1, cmputc)
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
99 #define OUTPUTL(tty, a, lines) emacs_tputs ((tty), a, lines, cmputc)
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
100
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
101 #define OUTPUT_IF(tty, a) \
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
102 do { \
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
103 if (a) \
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
104 emacs_tputs ((tty), a, \
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
105 (int) (FRAME_LINES (XFRAME (selected_frame)) \
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
106 - curY (tty) ), \
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
107 cmputc); \
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
108 } while (0)
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
109
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
110 #define OUTPUT1_IF(tty, a) do { if (a) emacs_tputs ((tty), a, 1, cmputc); } while (0)
15974
61249a8fe735 (Vring_bell_function): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15094
diff changeset
111
67935
52bbc53dbce1 (visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66238
diff changeset
112 /* If true, use "vs", otherwise use "ve" to make the cursor visible. */
52bbc53dbce1 (visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66238
diff changeset
113
52bbc53dbce1 (visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66238
diff changeset
114 static int visible_cursor;
52bbc53dbce1 (visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66238
diff changeset
115
54428
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
116 /* Display space properties */
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
117
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
118 extern Lisp_Object Qspace, QCalign_to, QCwidth;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
119
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
120 /* Functions to call after suspending a tty. */
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
121 Lisp_Object Vsuspend_tty_functions;
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
122
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
123 /* Functions to call after resuming a tty. */
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
124 Lisp_Object Vresume_tty_functions;
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
125
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
126 /* Chain of all tty device parameters. */
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
127 struct tty_display_info *tty_list;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
128
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
129 /* Nonzero means no need to redraw the entire frame on resuming a
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
130 suspended Emacs. This is useful on terminals with multiple
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
131 pages, where one page is used for Emacs and another for all
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
132 else. */
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
133 int no_redraw_on_reenter;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
134
28465
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
135 /* Meaning of bits in no_color_video. Each bit set means that the
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
136 corresponding attribute cannot be combined with colors. */
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
137
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
138 enum no_color_bit
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
139 {
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
140 NC_STANDOUT = 1 << 0,
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
141 NC_UNDERLINE = 1 << 1,
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
142 NC_REVERSE = 1 << 2,
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
143 NC_BLINK = 1 << 3,
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
144 NC_DIM = 1 << 4,
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
145 NC_BOLD = 1 << 5,
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
146 NC_INVIS = 1 << 6,
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
147 NC_PROTECT = 1 << 7,
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
148 NC_ALT_CHARSET = 1 << 8
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
149 };
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
150
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
151 /* internal state */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
152
10771
d564078d10c6 (calculate_costs): Update max_frame_height, max_frame_width.
Richard M. Stallman <rms@gnu.org>
parents: 10481
diff changeset
153 /* The largest frame width in any call to calculate_costs. */
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
154
51212
332134065648 Make (some) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50227
diff changeset
155 int max_frame_cols;
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
156
10771
d564078d10c6 (calculate_costs): Update max_frame_height, max_frame_width.
Richard M. Stallman <rms@gnu.org>
parents: 10481
diff changeset
157 /* The largest frame height in any call to calculate_costs. */
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
158
51212
332134065648 Make (some) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50227
diff changeset
159 int max_frame_lines;
10771
d564078d10c6 (calculate_costs): Update max_frame_height, max_frame_width.
Richard M. Stallman <rms@gnu.org>
parents: 10481
diff changeset
160
83032
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
161 /* Non-zero if we have dropped our controlling tty and therefore
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
162 should not open a frame on stdout. */
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
163 static int no_controlling_tty;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
164
6752
f9236145bad7 (system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 6652
diff changeset
165 /* Provided for lisp packages. */
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
166
6752
f9236145bad7 (system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 6652
diff changeset
167 static int system_uses_terminfo;
f9236145bad7 (system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 6652
diff changeset
168
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
169 char *tparam ();
8612
86065bec6fc9 (term_init): Added missing argument to tgetstr.
Richard M. Stallman <rms@gnu.org>
parents: 8027
diff changeset
170
86065bec6fc9 (term_init): Added missing argument to tgetstr.
Richard M. Stallman <rms@gnu.org>
parents: 8027
diff changeset
171 extern char *tgetstr ();
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
172
9797
05d9072c5a38 (term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents: 9658
diff changeset
173
35448
dc70b7c5709b (FRAME_TERMCAP_P) [WINDOWSNT]: Reinstate original
Andrew Innes <andrewi@gnu.org>
parents: 35091
diff changeset
174 #ifdef WINDOWSNT
dc70b7c5709b (FRAME_TERMCAP_P) [WINDOWSNT]: Reinstate original
Andrew Innes <andrewi@gnu.org>
parents: 35091
diff changeset
175 /* We aren't X windows, but we aren't termcap either. This makes me
dc70b7c5709b (FRAME_TERMCAP_P) [WINDOWSNT]: Reinstate original
Andrew Innes <andrewi@gnu.org>
parents: 35091
diff changeset
176 uncertain as to what value to use for frame.output_method. For
dc70b7c5709b (FRAME_TERMCAP_P) [WINDOWSNT]: Reinstate original
Andrew Innes <andrewi@gnu.org>
parents: 35091
diff changeset
177 this file, we'll define FRAME_TERMCAP_P to be zero so that our
dc70b7c5709b (FRAME_TERMCAP_P) [WINDOWSNT]: Reinstate original
Andrew Innes <andrewi@gnu.org>
parents: 35091
diff changeset
178 output hooks get called instead of the termcap functions. Probably
dc70b7c5709b (FRAME_TERMCAP_P) [WINDOWSNT]: Reinstate original
Andrew Innes <andrewi@gnu.org>
parents: 35091
diff changeset
179 the best long-term solution is to define an output_windows_nt... */
dc70b7c5709b (FRAME_TERMCAP_P) [WINDOWSNT]: Reinstate original
Andrew Innes <andrewi@gnu.org>
parents: 35091
diff changeset
180
dc70b7c5709b (FRAME_TERMCAP_P) [WINDOWSNT]: Reinstate original
Andrew Innes <andrewi@gnu.org>
parents: 35091
diff changeset
181 #undef FRAME_TERMCAP_P
dc70b7c5709b (FRAME_TERMCAP_P) [WINDOWSNT]: Reinstate original
Andrew Innes <andrewi@gnu.org>
parents: 35091
diff changeset
182 #define FRAME_TERMCAP_P(_f_) 0
dc70b7c5709b (FRAME_TERMCAP_P) [WINDOWSNT]: Reinstate original
Andrew Innes <andrewi@gnu.org>
parents: 35091
diff changeset
183 #endif /* WINDOWSNT */
dc70b7c5709b (FRAME_TERMCAP_P) [WINDOWSNT]: Reinstate original
Andrew Innes <andrewi@gnu.org>
parents: 35091
diff changeset
184
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
185
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
186 /* Ring the bell on a tty. */
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
187
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
188 static void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
189 tty_ring_bell (struct frame *f)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
190 {
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
191 struct tty_display_info *tty = FRAME_TTY (f);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
192
83167
69ebc75cb461 Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83161
diff changeset
193 if (tty->output)
15974
61249a8fe735 (Vring_bell_function): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15094
diff changeset
194 {
83167
69ebc75cb461 Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83161
diff changeset
195 OUTPUT (tty, (tty->TS_visible_bell && visible_bell
69ebc75cb461 Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83161
diff changeset
196 ? tty->TS_visible_bell
69ebc75cb461 Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83161
diff changeset
197 : tty->TS_bell));
69ebc75cb461 Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83161
diff changeset
198 fflush (tty->output);
15974
61249a8fe735 (Vring_bell_function): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15094
diff changeset
199 }
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
200 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
201
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
202 /* Set up termcap modes for Emacs. */
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
203
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
204 void
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
205 tty_set_terminal_modes (struct terminal *terminal)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
206 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
207 struct tty_display_info *tty = terminal->display_info.tty;
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
208
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
209 if (tty->output)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
210 {
83353
532e0a9335a9 Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
parents: 83346 65072
diff changeset
211 if (tty->TS_termcap_modes)
532e0a9335a9 Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
parents: 83346 65072
diff changeset
212 OUTPUT (tty, tty->TS_termcap_modes);
64773
aebbf7125281 (set_terminal_modes): If no TS_termcap_modes string,
Richard M. Stallman <rms@gnu.org>
parents: 64770
diff changeset
213 else
83353
532e0a9335a9 Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
parents: 83346 65072
diff changeset
214 {
532e0a9335a9 Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
parents: 83346 65072
diff changeset
215 /* Output enough newlines to scroll all the old screen contents
532e0a9335a9 Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
parents: 83346 65072
diff changeset
216 off the screen, so it won't be overwritten and lost. */
532e0a9335a9 Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
parents: 83346 65072
diff changeset
217 int i;
83382
7a3090aca393 Fix hardcoded stdout usage in term.c. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83370
diff changeset
218 current_tty = tty;
83353
532e0a9335a9 Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
parents: 83346 65072
diff changeset
219 for (i = 0; i < FRAME_LINES (XFRAME (selected_frame)); i++)
83382
7a3090aca393 Fix hardcoded stdout usage in term.c. (Reported by Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83370
diff changeset
220 cmputc ('\n');
83353
532e0a9335a9 Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
parents: 83346 65072
diff changeset
221 }
532e0a9335a9 Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
parents: 83346 65072
diff changeset
222
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
223 OUTPUT_IF (tty, tty->TS_termcap_modes);
83450
c69d44922688 Merged from miles@gnu.org--gnu-2005 (patch 682)
Karoly Lorentey <lorentey@elte.hu>
parents: 83431 67935
diff changeset
224 OUTPUT_IF (tty, visible_cursor ? tty->TS_cursor_visible : tty->TS_cursor_normal);
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
225 OUTPUT_IF (tty, tty->TS_keypad_mode);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
226 losecursor (tty);
83330
233c9974025b Fix the original cause of the "arrow keys don't work on screen" bug.
Karoly Lorentey <lorentey@elte.hu>
parents: 83323
diff changeset
227 fflush (tty->output);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
228 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
229 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
230
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
231 /* Reset termcap modes before exiting Emacs. */
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
232
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
233 void
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
234 tty_reset_terminal_modes (struct terminal *terminal)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
235 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
236 struct tty_display_info *tty = terminal->display_info.tty;
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
237
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
238 if (tty->output)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
239 {
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
240 tty_turn_off_highlight (tty);
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
241 tty_turn_off_insert (tty);
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
242 OUTPUT_IF (tty, tty->TS_end_keypad_mode);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
243 OUTPUT_IF (tty, tty->TS_cursor_normal);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
244 OUTPUT_IF (tty, tty->TS_end_termcap_modes);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
245 OUTPUT_IF (tty, tty->TS_orig_pair);
37959
b53edc686faf (tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 37499
diff changeset
246 /* Output raw CR so kernel can track the cursor hpos. */
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
247 current_tty = tty;
37959
b53edc686faf (tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 37499
diff changeset
248 cmputc ('\r');
83330
233c9974025b Fix the original cause of the "arrow keys don't work on screen" bug.
Karoly Lorentey <lorentey@elte.hu>
parents: 83323
diff changeset
249 fflush (tty->output);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
250 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
251 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
252
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
253 /* Flag the end of a display update on a termcap terminal. */
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
254
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
255 static void
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
256 tty_update_end (struct frame *f)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
257 {
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
258 struct tty_display_info *tty = FRAME_TTY (f);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
259
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
260 if (!XWINDOW (selected_window)->cursor_off_p)
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
261 tty_show_cursor (tty);
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
262 tty_turn_off_insert (tty);
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
263 tty_background_highlight (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
264 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
265
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
266 /* The implementation of set_terminal_window for termcap frames. */
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
267
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
268 static void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
269 tty_set_terminal_window (struct frame *f, int size)
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
270 {
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
271 struct tty_display_info *tty = FRAME_TTY (f);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
272
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
273 tty->specified_window = size ? size : FRAME_LINES (f);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
274 if (FRAME_SCROLL_REGION_OK (f))
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
275 tty_set_scroll_region (f, 0, tty->specified_window);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
276 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
277
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
278 static void
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
279 tty_set_scroll_region (struct frame *f, int start, int stop)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
280 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
281 char *buf;
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
282 struct tty_display_info *tty = FRAME_TTY (f);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
283
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
284 if (tty->TS_set_scroll_region)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
285 buf = tparam (tty->TS_set_scroll_region, 0, 0, start, stop - 1);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
286 else if (tty->TS_set_scroll_region_1)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
287 buf = tparam (tty->TS_set_scroll_region_1, 0, 0,
53227
1595c5e1e9bb Updating_frame vs. selected_frame in term.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 53226
diff changeset
288 FRAME_LINES (f), start,
1595c5e1e9bb Updating_frame vs. selected_frame in term.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 53226
diff changeset
289 FRAME_LINES (f) - stop,
1595c5e1e9bb Updating_frame vs. selected_frame in term.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 53226
diff changeset
290 FRAME_LINES (f));
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
291 else
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
292 buf = tparam (tty->TS_set_window, 0, 0, start, 0, stop, FRAME_COLS (f));
53227
1595c5e1e9bb Updating_frame vs. selected_frame in term.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 53226
diff changeset
293
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
294 OUTPUT (tty, buf);
2439
b6c62e4abf59 Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents: 2243
diff changeset
295 xfree (buf);
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
296 losecursor (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
297 }
37959
b53edc686faf (tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 37499
diff changeset
298
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
299
37959
b53edc686faf (tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 37499
diff changeset
300 static void
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
301 tty_turn_on_insert (struct tty_display_info *tty)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
302 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
303 if (!tty->insert_mode)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
304 OUTPUT (tty, tty->TS_insert_mode);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
305 tty->insert_mode = 1;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
306 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
307
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
308 void
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
309 tty_turn_off_insert (struct tty_display_info *tty)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
310 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
311 if (tty->insert_mode)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
312 OUTPUT (tty, tty->TS_end_insert_mode);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
313 tty->insert_mode = 0;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
314 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
315
40086
050b19294988 (TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents: 40081
diff changeset
316 /* Handle highlighting. */
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
317
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
318 void
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
319 tty_turn_off_highlight (struct tty_display_info *tty)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
320 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
321 if (tty->standout_mode)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
322 OUTPUT_IF (tty, tty->TS_end_standout_mode);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
323 tty->standout_mode = 0;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
324 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
325
37959
b53edc686faf (tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 37499
diff changeset
326 static void
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
327 tty_turn_on_highlight (struct tty_display_info *tty)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
328 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
329 if (!tty->standout_mode)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
330 OUTPUT_IF (tty, tty->TS_standout_mode);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
331 tty->standout_mode = 1;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
332 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
333
37477
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
334 static void
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
335 tty_toggle_highlight (struct tty_display_info *tty)
37477
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
336 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
337 if (tty->standout_mode)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
338 tty_turn_off_highlight (tty);
37477
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
339 else
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
340 tty_turn_on_highlight (tty);
37477
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
341 }
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
342
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
343
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
344 /* Make cursor invisible. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
345
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
346 static void
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
347 tty_hide_cursor (struct tty_display_info *tty)
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
348 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
349 if (tty->cursor_hidden == 0)
37959
b53edc686faf (tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 37499
diff changeset
350 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
351 tty->cursor_hidden = 1;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
352 OUTPUT_IF (tty, tty->TS_cursor_invisible);
37959
b53edc686faf (tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 37499
diff changeset
353 }
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
354 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
355
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
356
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
357 /* Ensure that cursor is visible. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
358
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
359 static void
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
360 tty_show_cursor (struct tty_display_info *tty)
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
361 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
362 if (tty->cursor_hidden)
37959
b53edc686faf (tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 37499
diff changeset
363 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
364 tty->cursor_hidden = 0;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
365 OUTPUT_IF (tty, tty->TS_cursor_normal);
67935
52bbc53dbce1 (visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66238
diff changeset
366 if (visible_cursor)
83450
c69d44922688 Merged from miles@gnu.org--gnu-2005 (patch 682)
Karoly Lorentey <lorentey@elte.hu>
parents: 83431 67935
diff changeset
367 OUTPUT_IF (tty, tty->TS_cursor_visible);
37959
b53edc686faf (tty_cursor_hidden): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 37499
diff changeset
368 }
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
369 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
370
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
371
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
372 /* Set standout mode to the state it should be in for
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
373 empty space inside windows. What this is,
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
374 depends on the user option inverse-video. */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
375
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
376 static void
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
377 tty_background_highlight (struct tty_display_info *tty)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
378 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
379 if (inverse_video)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
380 tty_turn_on_highlight (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
381 else
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
382 tty_turn_off_highlight (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
383 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
384
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
385 /* Set standout mode to the mode specified for the text to be output. */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
386
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
387 static void
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
388 tty_highlight_if_desired (struct tty_display_info *tty)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
389 {
40081
07d7dbf18784 (reassert_line_highlight_hook, change_line_highlight_hook): Variables removed.
Miles Bader <miles@gnu.org>
parents: 39988
diff changeset
390 if (inverse_video)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
391 tty_turn_on_highlight (tty);
40081
07d7dbf18784 (reassert_line_highlight_hook, change_line_highlight_hook): Variables removed.
Miles Bader <miles@gnu.org>
parents: 39988
diff changeset
392 else
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
393 tty_turn_off_highlight (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
394 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
395
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
396
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
397 /* Move cursor to row/column position VPOS/HPOS. HPOS/VPOS are
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
398 frame-relative coordinates. */
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
399
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
400 static void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
401 tty_cursor_to (struct frame *f, int vpos, int hpos)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
402 {
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
403 struct tty_display_info *tty = FRAME_TTY (f);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
404
12071
f85f23c50344 (cursor_to, clear_to_end_of_line_raw):
Karl Heuer <kwzh@gnu.org>
parents: 11530
diff changeset
405 /* Detect the case where we are called from reset_sys_modes
f85f23c50344 (cursor_to, clear_to_end_of_line_raw):
Karl Heuer <kwzh@gnu.org>
parents: 11530
diff changeset
406 and the costs have never been calculated. Do nothing. */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
407 if (! tty->costs_set)
12071
f85f23c50344 (cursor_to, clear_to_end_of_line_raw):
Karl Heuer <kwzh@gnu.org>
parents: 11530
diff changeset
408 return;
f85f23c50344 (cursor_to, clear_to_end_of_line_raw):
Karl Heuer <kwzh@gnu.org>
parents: 11530
diff changeset
409
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
410 if (curY (tty) == vpos
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
411 && curX (tty) == hpos)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
412 return;
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
413 if (!tty->TF_standout_motion)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
414 tty_background_highlight (tty);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
415 if (!tty->TF_insmode_motion)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
416 tty_turn_off_insert (tty);
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
417 cmgoto (tty, vpos, hpos);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
418 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
419
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
420 /* Similar but don't take any account of the wasted characters. */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
421
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
422 static void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
423 tty_raw_cursor_to (struct frame *f, int row, int col)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
424 {
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
425 struct tty_display_info *tty = FRAME_TTY (f);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
426
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
427 if (curY (tty) == row
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
428 && curX (tty) == col)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
429 return;
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
430 if (!tty->TF_standout_motion)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
431 tty_background_highlight (tty);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
432 if (!tty->TF_insmode_motion)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
433 tty_turn_off_insert (tty);
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
434 cmgoto (tty, row, col);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
435 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
436
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
437 /* Erase operations */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
438
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
439 /* Clear from cursor to end of frame on a termcap device. */
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
440
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
441 static void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
442 tty_clear_to_end (struct frame *f)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
443 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
444 register int i;
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
445 struct tty_display_info *tty = FRAME_TTY (f);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
446
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
447 if (tty->TS_clr_to_bottom)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
448 {
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
449 tty_background_highlight (tty);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
450 OUTPUT (tty, tty->TS_clr_to_bottom);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
451 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
452 else
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
453 {
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
454 for (i = curY (tty); i < FRAME_LINES (f); i++)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
455 {
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
456 cursor_to (f, i, 0);
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
457 clear_end_of_line (f, FRAME_COLS (f));
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
458 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
459 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
460 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
461
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
462 /* Clear an entire termcap frame. */
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
463
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
464 static void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
465 tty_clear_frame (struct frame *f)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
466 {
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
467 struct tty_display_info *tty = FRAME_TTY (f);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
468
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
469 if (tty->TS_clr_frame)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
470 {
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
471 tty_background_highlight (tty);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
472 OUTPUT (tty, tty->TS_clr_frame);
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
473 cmat (tty, 0, 0);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
474 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
475 else
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
476 {
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
477 cursor_to (f, 0, 0);
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
478 clear_to_end (f);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
479 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
480 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
481
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
482 /* An implementation of clear_end_of_line for termcap frames.
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
483
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
484 Note that the cursor may be moved, on terminals lacking a `ce' string. */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
485
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
486 static void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
487 tty_clear_end_of_line (struct frame *f, int first_unused_hpos)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
488 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
489 register int i;
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
490 struct tty_display_info *tty = FRAME_TTY (f);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
491
12071
f85f23c50344 (cursor_to, clear_to_end_of_line_raw):
Karl Heuer <kwzh@gnu.org>
parents: 11530
diff changeset
492 /* Detect the case where we are called from reset_sys_modes
f85f23c50344 (cursor_to, clear_to_end_of_line_raw):
Karl Heuer <kwzh@gnu.org>
parents: 11530
diff changeset
493 and the costs have never been calculated. Do nothing. */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
494 if (! tty->costs_set)
12071
f85f23c50344 (cursor_to, clear_to_end_of_line_raw):
Karl Heuer <kwzh@gnu.org>
parents: 11530
diff changeset
495 return;
f85f23c50344 (cursor_to, clear_to_end_of_line_raw):
Karl Heuer <kwzh@gnu.org>
parents: 11530
diff changeset
496
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
497 if (curX (tty) >= first_unused_hpos)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
498 return;
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
499 tty_background_highlight (tty);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
500 if (tty->TS_clr_line)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
501 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
502 OUTPUT1 (tty, tty->TS_clr_line);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
503 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
504 else
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
505 { /* have to do it the hard way */
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
506 tty_turn_off_insert (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
507
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
508 /* Do not write in last row last col with Auto-wrap on. */
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
509 if (AutoWrap (tty)
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
510 && curY (tty) == FrameRows (tty) - 1
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
511 && first_unused_hpos == FrameCols (tty))
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
512 first_unused_hpos--;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
513
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
514 for (i = curX (tty); i < first_unused_hpos; i++)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
515 {
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
516 if (tty->termscript)
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
517 fputc (' ', tty->termscript);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
518 fputc (' ', tty->output);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
519 }
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
520 cmplus (tty, first_unused_hpos - curX (tty));
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
521 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
522 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
523
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
524 /* Buffer to store the source and result of code conversion for terminal. */
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
525 static unsigned char *encode_terminal_buf;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
526 /* Allocated size of the above buffer. */
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
527 static int encode_terminal_bufsize;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
528
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
529 /* Encode SRC_LEN glyphs starting at SRC to terminal output codes.
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
530 Set CODING->produced to the byte-length of the resulting byte
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
531 sequence, and return a pointer to that byte sequence. */
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
532
58701
24c51e9d8586 (encode_terminal_code): Don't make it "static".
Kenichi Handa <handa@m17n.org>
parents: 58638
diff changeset
533 unsigned char *
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
534 encode_terminal_code (src, src_len, coding)
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
535 struct glyph *src;
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
536 int src_len;
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
537 struct coding_system *coding;
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
538 {
66238
d3f5aa0f18c4 (encode_terminal_code): Remove unused var src_start.
Kim F. Storm <storm@cua.dk>
parents: 65795
diff changeset
539 struct glyph *src_end = src + src_len;
17180
364327df6e7c (encode_terminal_code): Check validity of character code.
Kenichi Handa <handa@m17n.org>
parents: 17046
diff changeset
540 register GLYPH g;
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
541 unsigned char *buf;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
542 int nchars, nbytes, required;
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
543 register int tlen = GLYPH_TABLE_LENGTH;
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
544 register Lisp_Object *tbase = GLYPH_TABLE_BASE;
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
545
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
546 /* Allocate sufficient size of buffer to store all characters in
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
547 multibyte-form. But, it may be enlarged on demand if
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
548 Vglyph_table contains a string. */
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
549 required = MAX_MULTIBYTE_LENGTH * src_len;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
550 if (encode_terminal_bufsize < required)
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
551 {
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
552 if (encode_terminal_bufsize == 0)
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
553 encode_terminal_buf = xmalloc (required);
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
554 else
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
555 encode_terminal_buf = xrealloc (encode_terminal_buf, required);
58906
b55034e18dd2 (encode_terminal_code): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 58701
diff changeset
556 encode_terminal_bufsize = required;
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
557 }
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
558
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
559 buf = encode_terminal_buf;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
560 nchars = 0;
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
561 while (src < src_end)
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
562 {
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
563 /* We must skip glyphs to be padded for a wide character. */
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
564 if (! CHAR_GLYPH_PADDING_P (*src))
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
565 {
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
566 g = GLYPH_FROM_CHAR_GLYPH (src[0]);
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
567
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
568 if (g < 0 || g >= tlen)
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
569 {
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
570 /* This glyph doesn't has an entry in Vglyph_table. */
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
571 if (CHAR_VALID_P (src->u.ch, 0))
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
572 buf += CHAR_STRING (src->u.ch, buf);
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
573 else
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
574 *buf++ = SPACEGLYPH;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
575 nchars++;
26871
aaf45e665b14 (encode_terminal_code): Delete codes for a composite
Kenichi Handa <handa@m17n.org>
parents: 26425
diff changeset
576 }
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
577 else
19035
0b4c1d43cb95 Minor cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 18058
diff changeset
578 {
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
579 /* This glyph has an entry in Vglyph_table,
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
580 so process any alias before testing for simpleness. */
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
581 GLYPH_FOLLOW_ALIASES (tbase, tlen, g);
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
582
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
583 if (GLYPH_SIMPLE_P (tbase, tlen, g))
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
584 {
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
585 int c = FAST_GLYPH_CHAR (g);
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
586
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
587 if (CHAR_VALID_P (c, 0))
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
588 buf += CHAR_STRING (c, buf);
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
589 else
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
590 *buf++ = SPACEGLYPH;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
591 nchars++;
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
592 }
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
593 else
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
594 {
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
595 /* We have a string in Vglyph_table. */
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
596 Lisp_Object string;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
597
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
598 string = tbase[g];
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
599 if (! STRING_MULTIBYTE (string))
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
600 string = string_to_multibyte (string);
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
601 nbytes = buf - encode_terminal_buf;
59382
e25d041a3a6e (encode_terminal_code): Fix buffer size computation.
Kenichi Handa <handa@m17n.org>
parents: 58906
diff changeset
602 if (encode_terminal_bufsize < nbytes + SBYTES (string))
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
603 {
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
604 encode_terminal_bufsize = nbytes + SBYTES (string);
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
605 encode_terminal_buf = xrealloc (encode_terminal_buf,
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
606 encode_terminal_bufsize);
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
607 buf = encode_terminal_buf + nbytes;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
608 }
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
609 bcopy (SDATA (string), buf, SBYTES (string));
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
610 buf += SBYTES (string);
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
611 nchars += SCHARS (string);
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
612 }
19035
0b4c1d43cb95 Minor cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 18058
diff changeset
613 }
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
614 }
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
615 src++;
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
616 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
617
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
618 nbytes = buf - encode_terminal_buf;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
619 coding->src_multibyte = 1;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
620 coding->dst_multibyte = 0;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
621 if (SYMBOLP (coding->pre_write_conversion)
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
622 && ! NILP (Ffboundp (coding->pre_write_conversion)))
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
623 {
66238
d3f5aa0f18c4 (encode_terminal_code): Remove unused var src_start.
Kim F. Storm <storm@cua.dk>
parents: 65795
diff changeset
624 run_pre_write_conversin_on_c_str (&encode_terminal_buf,
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
625 &encode_terminal_bufsize,
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
626 nchars, nbytes, coding);
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
627 nchars = coding->produced_char;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
628 nbytes = coding->produced;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
629 }
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
630 required = nbytes + encoding_buffer_size (coding, nbytes);
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
631 if (encode_terminal_bufsize < required)
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
632 {
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
633 encode_terminal_bufsize = required;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
634 encode_terminal_buf = xrealloc (encode_terminal_buf, required);
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
635 }
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
636
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
637 encode_coding (coding, encode_terminal_buf, encode_terminal_buf + nbytes,
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
638 nbytes, encode_terminal_bufsize - nbytes);
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
639 return encode_terminal_buf + nbytes;
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
640 }
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
641
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
642
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
643 /* An implementation of write_glyphs for termcap frames. */
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
644
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
645 static void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
646 tty_write_glyphs (struct frame *f, struct glyph *string, int len)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
647 {
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
648 unsigned char *conversion_buffer;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
649 struct coding_system *coding;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
650
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
651 struct tty_display_info *tty = FRAME_TTY (f);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
652
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
653 tty_turn_off_insert (tty);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
654 tty_hide_cursor (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
655
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
656 /* Don't dare write in last column of bottom line, if Auto-Wrap,
765
e4093444f9f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 732
diff changeset
657 since that would scroll the whole frame on some terminals. */
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
658
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
659 if (AutoWrap (tty)
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
660 && curY (tty) + 1 == FRAME_LINES (f)
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
661 && (curX (tty) + len) == FRAME_COLS (f))
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
662 len --;
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
663 if (len <= 0)
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
664 return;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
665
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
666 cmplus (tty, len);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
667
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
668 /* If terminal_coding does any conversion, use it, otherwise use
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
669 safe_terminal_coding. We can't use CODING_REQUIRE_ENCODING here
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
670 because it always return 1 if the member src_multibyte is 1. */
83231
549734260e34 Merged in changes from CVS trunk.
Karoly Lorentey <lorentey@elte.hu>
parents: 83173 58701
diff changeset
671 coding = (FRAME_TERMINAL_CODING (f)->common_flags & CODING_REQUIRE_ENCODING_MASK
549734260e34 Merged in changes from CVS trunk.
Karoly Lorentey <lorentey@elte.hu>
parents: 83173 58701
diff changeset
672 ? FRAME_TERMINAL_CODING (f) : &safe_terminal_coding);
20711
9ab8e061c0bf (encode_terminal_code): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 20223
diff changeset
673 /* The mode bit CODING_MODE_LAST_BLOCK should be set to 1 only at
9ab8e061c0bf (encode_terminal_code): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 20223
diff changeset
674 the tail. */
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
675 coding->mode &= ~CODING_MODE_LAST_BLOCK;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
676
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
677 while (len > 0)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
678 {
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
679 /* Identify a run of glyphs with the same face. */
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
680 int face_id = string->face_id;
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
681 int n;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
682
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
683 for (n = 1; n < len; ++n)
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
684 if (string[n].face_id != face_id)
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
685 break;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
686
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
687 /* Turn appearance modes of the face of the run on. */
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
688 tty_highlight_if_desired (tty);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
689 turn_on_face (f, face_id);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
690
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
691 if (n == len)
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
692 /* This is the last run. */
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
693 coding->mode |= CODING_MODE_LAST_BLOCK;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
694 conversion_buffer = encode_terminal_code (string, n, coding);
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
695 if (coding->produced > 0)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
696 {
83231
549734260e34 Merged in changes from CVS trunk.
Karoly Lorentey <lorentey@elte.hu>
parents: 83173 58701
diff changeset
697 fwrite (conversion_buffer, 1, coding->produced, tty->output);
549734260e34 Merged in changes from CVS trunk.
Karoly Lorentey <lorentey@elte.hu>
parents: 83173 58701
diff changeset
698 if (ferror (tty->output))
549734260e34 Merged in changes from CVS trunk.
Karoly Lorentey <lorentey@elte.hu>
parents: 83173 58701
diff changeset
699 clearerr (tty->output);
549734260e34 Merged in changes from CVS trunk.
Karoly Lorentey <lorentey@elte.hu>
parents: 83173 58701
diff changeset
700 if (tty->termscript)
549734260e34 Merged in changes from CVS trunk.
Karoly Lorentey <lorentey@elte.hu>
parents: 83173 58701
diff changeset
701 fwrite (conversion_buffer, 1, coding->produced, tty->termscript);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
702 }
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
703 len -= n;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
704 string += n;
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
705
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
706 /* Turn appearance modes off. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
707 turn_off_face (f, face_id);
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
708 tty_turn_off_highlight (tty);
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
709 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
710
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
711 cmcheckmagic (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
712 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
713
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
714 /* An implementation of insert_glyphs for termcap frames. */
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
715
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
716 static void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
717 tty_insert_glyphs (struct frame *f, struct glyph *start, int len)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
718 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
719 char *buf;
31829
43566b0aec59 Avoid some more compiler warnings.
Gerd Moellmann <gerd@gnu.org>
parents: 31102
diff changeset
720 struct glyph *glyph = NULL;
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
721 unsigned char *conversion_buffer;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
722 unsigned char space[1];
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
723 struct coding_system *coding;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
724
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
725 struct tty_display_info *tty = FRAME_TTY (f);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
726
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
727 if (tty->TS_ins_multi_chars)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
728 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
729 buf = tparam (tty->TS_ins_multi_chars, 0, 0, len);
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
730 OUTPUT1 (tty, buf);
2439
b6c62e4abf59 Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents: 2243
diff changeset
731 xfree (buf);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
732 if (start)
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
733 write_glyphs (f, start, len);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
734 return;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
735 }
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
736
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
737 tty_turn_on_insert (tty);
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
738 cmplus (tty, len);
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
739
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
740 if (! start)
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
741 space[0] = SPACEGLYPH;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
742
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
743 /* If terminal_coding does any conversion, use it, otherwise use
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
744 safe_terminal_coding. We can't use CODING_REQUIRE_ENCODING here
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
745 because it always return 1 if the member src_multibyte is 1. */
83231
549734260e34 Merged in changes from CVS trunk.
Karoly Lorentey <lorentey@elte.hu>
parents: 83173 58701
diff changeset
746 coding = (FRAME_TERMINAL_CODING (f)->common_flags & CODING_REQUIRE_ENCODING_MASK
549734260e34 Merged in changes from CVS trunk.
Karoly Lorentey <lorentey@elte.hu>
parents: 83173 58701
diff changeset
747 ? FRAME_TERMINAL_CODING (f) : &safe_terminal_coding);
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
748 /* The mode bit CODING_MODE_LAST_BLOCK should be set to 1 only at
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
749 the tail. */
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
750 coding->mode &= ~CODING_MODE_LAST_BLOCK;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
751
17191
36caec9c2e52 (insert_glyphs): Fix a bug which turns up when
Kenichi Handa <handa@m17n.org>
parents: 17180
diff changeset
752 while (len-- > 0)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
753 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
754 OUTPUT1_IF (tty, tty->TS_ins_char);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
755 if (!start)
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
756 {
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
757 conversion_buffer = space;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
758 coding->produced = 1;
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
759 }
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
760 else
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
761 {
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
762 tty_highlight_if_desired (tty);
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
763 turn_on_face (f, start->face_id);
27085
59913a531d4e (insert_glyphs): Pass glyph, not &glyph, to
Eli Zaretskii <eliz@gnu.org>
parents: 26999
diff changeset
764 glyph = start;
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
765 ++start;
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
766 /* We must open sufficient space for a character which
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
767 occupies more than one column. */
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
768 while (len && CHAR_GLYPH_PADDING_P (*start))
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
769 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
770 OUTPUT1_IF (tty, tty->TS_ins_char);
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
771 start++, len--;
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
772 }
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
773
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
774 if (len <= 0)
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
775 /* This is the last glyph. */
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
776 coding->mode |= CODING_MODE_LAST_BLOCK;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
777
83231
549734260e34 Merged in changes from CVS trunk.
Karoly Lorentey <lorentey@elte.hu>
parents: 83173 58701
diff changeset
778 conversion_buffer = encode_terminal_code (glyph, 1, coding);
17046
84b0e9794a87 Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents: 16894
diff changeset
779 }
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
780
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
781 if (coding->produced > 0)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
782 {
83231
549734260e34 Merged in changes from CVS trunk.
Karoly Lorentey <lorentey@elte.hu>
parents: 83173 58701
diff changeset
783 fwrite (conversion_buffer, 1, coding->produced, tty->output);
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
784 if (ferror (tty->output))
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
785 clearerr (tty->output);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
786 if (tty->termscript)
83231
549734260e34 Merged in changes from CVS trunk.
Karoly Lorentey <lorentey@elte.hu>
parents: 83173 58701
diff changeset
787 fwrite (conversion_buffer, 1, coding->produced, tty->termscript);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
788 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
789
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
790 OUTPUT1_IF (tty, tty->TS_pad_inserted_char);
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
791 if (start)
30848
fc80dcfc32cd (write_glyphs): Also turn off inverse video after turning
Gerd Moellmann <gerd@gnu.org>
parents: 30836
diff changeset
792 {
fc80dcfc32cd (write_glyphs): Also turn off inverse video after turning
Gerd Moellmann <gerd@gnu.org>
parents: 30836
diff changeset
793 turn_off_face (f, glyph->face_id);
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
794 tty_turn_off_highlight (tty);
30848
fc80dcfc32cd (write_glyphs): Also turn off inverse video after turning
Gerd Moellmann <gerd@gnu.org>
parents: 30836
diff changeset
795 }
10439
1fcbeb4410f6 (write_glyphs, insert_glyphs): Call checkmagic.
Karl Heuer <kwzh@gnu.org>
parents: 10332
diff changeset
796 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
797
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
798 cmcheckmagic (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
799 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
800
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
801 /* An implementation of delete_glyphs for termcap frames. */
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
802
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
803 static void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
804 tty_delete_glyphs (struct frame *f, int n)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
805 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
806 char *buf;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
807 register int i;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
808
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
809 struct tty_display_info *tty = FRAME_TTY (f);
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
810
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
811 if (tty->delete_in_insert_mode)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
812 {
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
813 tty_turn_on_insert (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
814 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
815 else
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
816 {
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
817 tty_turn_off_insert (tty);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
818 OUTPUT_IF (tty, tty->TS_delete_mode);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
819 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
820
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
821 if (tty->TS_del_multi_chars)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
822 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
823 buf = tparam (tty->TS_del_multi_chars, 0, 0, n);
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
824 OUTPUT1 (tty, buf);
2439
b6c62e4abf59 Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents: 2243
diff changeset
825 xfree (buf);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
826 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
827 else
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
828 for (i = 0; i < n; i++)
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
829 OUTPUT1 (tty, tty->TS_del_char);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
830 if (!tty->delete_in_insert_mode)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
831 OUTPUT_IF (tty, tty->TS_end_delete_mode);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
832 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
833
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
834 /* An implementation of ins_del_lines for termcap frames. */
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
835
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
836 static void
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
837 tty_ins_del_lines (struct frame *f, int vpos, int n)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
838 {
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
839 struct tty_display_info *tty = FRAME_TTY (f);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
840 char *multi = n > 0 ? tty->TS_ins_multi_lines : tty->TS_del_multi_lines;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
841 char *single = n > 0 ? tty->TS_ins_line : tty->TS_del_line;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
842 char *scroll = n > 0 ? tty->TS_rev_scroll : tty->TS_fwd_scroll;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
843
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
844 register int i = n > 0 ? n : -n;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
845 register char *buf;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
846
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
847 /* If the lines below the insertion are being pushed
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
848 into the end of the window, this is the same as clearing;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
849 and we know the lines are already clear, since the matching
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
850 deletion has already been done. So can ignore this. */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
851 /* If the lines below the deletion are blank lines coming
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
852 out of the end of the window, don't bother,
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
853 as there will be a matching inslines later that will flush them. */
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
854 if (FRAME_SCROLL_REGION_OK (f)
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
855 && vpos + i >= tty->specified_window)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
856 return;
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
857 if (!FRAME_MEMORY_BELOW_FRAME (f)
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
858 && vpos + i >= FRAME_LINES (f))
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
859 return;
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
860
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
861 if (multi)
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
862 {
83102
a330cf2446ad Fix segfault in term.c (reported by lukhas@free.fr).
Karoly Lorentey <lorentey@elte.hu>
parents: 83100
diff changeset
863 raw_cursor_to (f, vpos, 0);
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
864 tty_background_highlight (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
865 buf = tparam (multi, 0, 0, i);
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
866 OUTPUT (tty, buf);
2439
b6c62e4abf59 Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents: 2243
diff changeset
867 xfree (buf);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
868 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
869 else if (single)
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
870 {
83102
a330cf2446ad Fix segfault in term.c (reported by lukhas@free.fr).
Karoly Lorentey <lorentey@elte.hu>
parents: 83100
diff changeset
871 raw_cursor_to (f, vpos, 0);
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
872 tty_background_highlight (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
873 while (--i >= 0)
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
874 OUTPUT (tty, single);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
875 if (tty->TF_teleray)
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
876 curX (tty) = 0;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
877 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
878 else
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
879 {
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
880 tty_set_scroll_region (f, vpos, tty->specified_window);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
881 if (n < 0)
83102
a330cf2446ad Fix segfault in term.c (reported by lukhas@free.fr).
Karoly Lorentey <lorentey@elte.hu>
parents: 83100
diff changeset
882 raw_cursor_to (f, tty->specified_window - 1, 0);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
883 else
83102
a330cf2446ad Fix segfault in term.c (reported by lukhas@free.fr).
Karoly Lorentey <lorentey@elte.hu>
parents: 83100
diff changeset
884 raw_cursor_to (f, vpos, 0);
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
885 tty_background_highlight (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
886 while (--i >= 0)
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
887 OUTPUTL (tty, scroll, tty->specified_window - vpos);
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
888 tty_set_scroll_region (f, 0, tty->specified_window);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
889 }
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
890
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
891 if (!FRAME_SCROLL_REGION_OK (f)
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
892 && FRAME_MEMORY_BELOW_FRAME (f)
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
893 && n < 0)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
894 {
83100
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
895 cursor_to (f, FRAME_LINES (f) + n, 0);
4970ad4995f5 Eliminated updating_frame.
Karoly Lorentey <lorentey@elte.hu>
parents: 83095
diff changeset
896 clear_to_end (f);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
897 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
898 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
899
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
900 /* Compute cost of sending "str", in characters,
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
901 not counting any line-dependent padding. */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
902
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
903 int
83102
a330cf2446ad Fix segfault in term.c (reported by lukhas@free.fr).
Karoly Lorentey <lorentey@elte.hu>
parents: 83100
diff changeset
904 string_cost (char *str)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
905 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
906 cost = 0;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
907 if (str)
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
908 tputs (str, 0, evalcost);
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
909 return cost;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
910 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
911
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
912 /* Compute cost of sending "str", in characters,
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
913 counting any line-dependent padding at one line. */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
914
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
915 static int
83102
a330cf2446ad Fix segfault in term.c (reported by lukhas@free.fr).
Karoly Lorentey <lorentey@elte.hu>
parents: 83100
diff changeset
916 string_cost_one_line (char *str)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
917 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
918 cost = 0;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
919 if (str)
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
920 tputs (str, 1, evalcost);
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
921 return cost;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
922 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
923
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
924 /* Compute per line amount of line-dependent padding,
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
925 in tenths of characters. */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
926
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
927 int
83102
a330cf2446ad Fix segfault in term.c (reported by lukhas@free.fr).
Karoly Lorentey <lorentey@elte.hu>
parents: 83100
diff changeset
928 per_line_cost (char *str)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
929 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
930 cost = 0;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
931 if (str)
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
932 tputs (str, 0, evalcost);
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
933 cost = - cost;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
934 if (str)
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
935 tputs (str, 10, evalcost);
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
936 return cost;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
937 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
938
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
939 #ifndef old
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
940 /* char_ins_del_cost[n] is cost of inserting N characters.
10771
d564078d10c6 (calculate_costs): Update max_frame_height, max_frame_width.
Richard M. Stallman <rms@gnu.org>
parents: 10481
diff changeset
941 char_ins_del_cost[-n] is cost of deleting N characters.
51212
332134065648 Make (some) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50227
diff changeset
942 The length of this vector is based on max_frame_cols. */
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
943
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
944 int *char_ins_del_vector;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
945
51212
332134065648 Make (some) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50227
diff changeset
946 #define char_ins_del_cost(f) (&char_ins_del_vector[FRAME_COLS ((f))])
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
947 #endif
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
948
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
949 /* ARGSUSED */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
950 static void
83102
a330cf2446ad Fix segfault in term.c (reported by lukhas@free.fr).
Karoly Lorentey <lorentey@elte.hu>
parents: 83100
diff changeset
951 calculate_ins_del_char_costs (struct frame *f)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
952 {
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
953 struct tty_display_info *tty = FRAME_TTY (f);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
954 int ins_startup_cost, del_startup_cost;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
955 int ins_cost_per_char, del_cost_per_char;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
956 register int i;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
957 register int *p;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
958
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
959 if (tty->TS_ins_multi_chars)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
960 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
961 ins_cost_per_char = 0;
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
962 ins_startup_cost = string_cost_one_line (tty->TS_ins_multi_chars);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
963 }
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
964 else if (tty->TS_ins_char || tty->TS_pad_inserted_char
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
965 || (tty->TS_insert_mode && tty->TS_end_insert_mode))
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
966 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
967 ins_startup_cost = (30 * (string_cost (tty->TS_insert_mode)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
968 + string_cost (tty->TS_end_insert_mode))) / 100;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
969 ins_cost_per_char = (string_cost_one_line (tty->TS_ins_char)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
970 + string_cost_one_line (tty->TS_pad_inserted_char));
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
971 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
972 else
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
973 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
974 ins_startup_cost = 9999;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
975 ins_cost_per_char = 0;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
976 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
977
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
978 if (tty->TS_del_multi_chars)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
979 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
980 del_cost_per_char = 0;
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
981 del_startup_cost = string_cost_one_line (tty->TS_del_multi_chars);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
982 }
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
983 else if (tty->TS_del_char)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
984 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
985 del_startup_cost = (string_cost (tty->TS_delete_mode)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
986 + string_cost (tty->TS_end_delete_mode));
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
987 if (tty->delete_in_insert_mode)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
988 del_startup_cost /= 2;
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
989 del_cost_per_char = string_cost_one_line (tty->TS_del_char);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
990 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
991 else
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
992 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
993 del_startup_cost = 9999;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
994 del_cost_per_char = 0;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
995 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
996
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
997 /* Delete costs are at negative offsets */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
998 p = &char_ins_del_cost (f)[0];
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
999 for (i = FRAME_COLS (f); --i >= 0;)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1000 *--p = (del_startup_cost += del_cost_per_char);
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1001
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1002 /* Doing nothing is free */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1003 p = &char_ins_del_cost (f)[0];
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1004 *p++ = 0;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1005
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1006 /* Insert costs are at positive offsets */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1007 for (i = FRAME_COLS (f); --i >= 0;)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1008 *p++ = (ins_startup_cost += ins_cost_per_char);
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1009 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1010
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
1011 void
83102
a330cf2446ad Fix segfault in term.c (reported by lukhas@free.fr).
Karoly Lorentey <lorentey@elte.hu>
parents: 83100
diff changeset
1012 calculate_costs (struct frame *frame)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1013 {
10121
3f9f77a9488d (calculate_costs): Set FRAME_COST_BAUD_RATE.
Richard M. Stallman <rms@gnu.org>
parents: 9797
diff changeset
1014 FRAME_COST_BAUD_RATE (frame) = baud_rate;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1015
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
1016 if (FRAME_TERMCAP_P (frame))
82990
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1017 {
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1018 struct tty_display_info *tty = FRAME_TTY (frame);
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1019 register char *f = (tty->TS_set_scroll_region
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1020 ? tty->TS_set_scroll_region
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1021 : tty->TS_set_scroll_region_1);
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1022
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1023 FRAME_SCROLL_REGION_COST (frame) = string_cost (f);
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1024
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1025 tty->costs_set = 1;
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1026
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1027 /* These variables are only used for terminal stuff. They are
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1028 allocated once for the terminal frame of X-windows emacs, but not
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1029 used afterwards.
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1030
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1031 char_ins_del_vector (i.e., char_ins_del_cost) isn't used because
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1032 X turns off char_ins_del_ok. */
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1033
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1034 max_frame_lines = max (max_frame_lines, FRAME_LINES (frame));
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1035 max_frame_cols = max (max_frame_cols, FRAME_COLS (frame));
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1036
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1037 if (char_ins_del_vector != 0)
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1038 char_ins_del_vector
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1039 = (int *) xrealloc (char_ins_del_vector,
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1040 (sizeof (int)
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1041 + 2 * max_frame_cols * sizeof (int)));
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1042 else
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1043 char_ins_del_vector
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1044 = (int *) xmalloc (sizeof (int)
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1045 + 2 * max_frame_cols * sizeof (int));
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1046
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1047 bzero (char_ins_del_vector, (sizeof (int)
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1048 + 2 * max_frame_cols * sizeof (int)));
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1049
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1050
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1051 if (f && (!tty->TS_ins_line && !tty->TS_del_line))
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1052 do_line_insertion_deletion_costs (frame,
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1053 tty->TS_rev_scroll, tty->TS_ins_multi_lines,
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1054 tty->TS_fwd_scroll, tty->TS_del_multi_lines,
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1055 f, f, 1);
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1056 else
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1057 do_line_insertion_deletion_costs (frame,
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1058 tty->TS_ins_line, tty->TS_ins_multi_lines,
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1059 tty->TS_del_line, tty->TS_del_multi_lines,
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1060 0, 0, 1);
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1061
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1062 calculate_ins_del_char_costs (frame);
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1063
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1064 /* Don't use TS_repeat if its padding is worse than sending the chars */
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1065 if (tty->TS_repeat && per_line_cost (tty->TS_repeat) * baud_rate < 9000)
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1066 tty->RPov = string_cost (tty->TS_repeat);
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1067 else
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1068 tty->RPov = FRAME_COLS (frame) * 2;
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1069
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1070 cmcostinit (FRAME_TTY (frame)); /* set up cursor motion costs */
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
1071 }
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1072 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1073
1015
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1074 struct fkey_table {
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1075 char *cap, *name;
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1076 };
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1077
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1078 /* Termcap capability names that correspond directly to X keysyms.
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1079 Some of these (marked "terminfo") aren't supplied by old-style
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1080 (Berkeley) termcap entries. They're listed in X keysym order;
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1081 except we put the keypad keys first, so that if they clash with
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1082 other keys (as on the IBM PC keyboard) they get overridden.
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1083 */
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1084
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1085 static struct fkey_table keys[] =
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1086 {
42122
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1087 {"kh", "home"}, /* termcap */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1088 {"kl", "left"}, /* termcap */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1089 {"ku", "up"}, /* termcap */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1090 {"kr", "right"}, /* termcap */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1091 {"kd", "down"}, /* termcap */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1092 {"%8", "prior"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1093 {"%5", "next"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1094 {"@7", "end"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1095 {"@1", "begin"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1096 {"*6", "select"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1097 {"%9", "print"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1098 {"@4", "execute"}, /* terminfo --- actually the `command' key */
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1099 /*
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1100 * "insert" --- see below
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1101 */
42122
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1102 {"&8", "undo"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1103 {"%0", "redo"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1104 {"%7", "menu"}, /* terminfo --- actually the `options' key */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1105 {"@0", "find"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1106 {"@2", "cancel"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1107 {"%1", "help"}, /* terminfo */
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1108 /*
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1109 * "break" goes here, but can't be reliably intercepted with termcap
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1110 */
42122
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1111 {"&4", "reset"}, /* terminfo --- actually `restart' */
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1112 /*
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1113 * "system" and "user" --- no termcaps
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1114 */
42122
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1115 {"kE", "clearline"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1116 {"kA", "insertline"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1117 {"kL", "deleteline"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1118 {"kI", "insertchar"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1119 {"kD", "deletechar"}, /* terminfo */
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1120 {"kB", "backtab"}, /* terminfo */
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1121 /*
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1122 * "kp_backtab", "kp-space", "kp-tab" --- no termcaps
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1123 */
42122
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1124 {"@8", "kp-enter"}, /* terminfo */
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1125 /*
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1126 * "kp-f1", "kp-f2", "kp-f3" "kp-f4",
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1127 * "kp-multiply", "kp-add", "kp-separator",
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1128 * "kp-subtract", "kp-decimal", "kp-divide", "kp-0";
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1129 * --- no termcaps for any of these.
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1130 */
42122
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1131 {"K4", "kp-1"}, /* terminfo */
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1132 /*
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1133 * "kp-2" --- no termcap
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1134 */
42122
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1135 {"K5", "kp-3"}, /* terminfo */
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1136 /*
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1137 * "kp-4" --- no termcap
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1138 */
42122
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1139 {"K2", "kp-5"}, /* terminfo */
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1140 /*
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1141 * "kp-6" --- no termcap
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1142 */
42122
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1143 {"K1", "kp-7"}, /* terminfo */
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1144 /*
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1145 * "kp-8" --- no termcap
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1146 */
42122
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1147 {"K3", "kp-9"}, /* terminfo */
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1148 /*
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1149 * "kp-equal" --- no termcap
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1150 */
42122
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1151 {"k1", "f1"},
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1152 {"k2", "f2"},
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1153 {"k3", "f3"},
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1154 {"k4", "f4"},
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1155 {"k5", "f5"},
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1156 {"k6", "f6"},
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1157 {"k7", "f7"},
706558f91b28 (keys): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents: 40086
diff changeset
1158 {"k8", "f8"},
61591
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1159 {"k9", "f9"},
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1160
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1161 {"&0", "S-cancel"}, /*shifted cancel key*/
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1162 {"&9", "S-begin"}, /*shifted begin key*/
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1163 {"*0", "S-find"}, /*shifted find key*/
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1164 {"*1", "S-execute"}, /*shifted execute? actually shifted command key*/
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1165 {"*4", "S-delete"}, /*shifted delete-character key*/
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1166 {"*7", "S-end"}, /*shifted end key*/
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1167 {"*8", "S-clearline"}, /*shifted clear-to end-of-line key*/
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1168 {"#1", "S-help"}, /*shifted help key*/
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1169 {"#2", "S-home"}, /*shifted home key*/
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1170 {"#3", "S-insert"}, /*shifted insert-character key*/
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1171 {"#4", "S-left"}, /*shifted left-arrow key*/
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1172 {"%d", "S-menu"}, /*shifted menu? actually shifted options key*/
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1173 {"%c", "S-next"}, /*shifted next key*/
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1174 {"%e", "S-prior"}, /*shifted previous key*/
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1175 {"%f", "S-print"}, /*shifted print key*/
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1176 {"%g", "S-redo"}, /*shifted redo key*/
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1177 {"%i", "S-right"}, /*shifted right-arrow key*/
b015e12637bc (struct keys): Add support for shifted keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 59382
diff changeset
1178 {"!3", "S-undo"} /*shifted undo key*/
1015
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1179 };
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1180
83317
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
1181 static char **term_get_fkeys_address;
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
1182 static KBOARD *term_get_fkeys_kboard;
6248
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1183 static Lisp_Object term_get_fkeys_1 ();
4543
929e4c850e76 (term_get_fkeys_define_1, term_get_fkeys_define): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 4499
diff changeset
1184
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1185 /* Find the escape codes sent by the function keys for Vfunction_key_map.
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1186 This function scans the termcap function key sequence entries, and
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1187 adds entries to Vfunction_key_map for each function key it finds. */
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1188
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
1189 static void
83317
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
1190 term_get_fkeys (address, kboard)
533
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1191 char **address;
83317
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
1192 KBOARD *kboard;
533
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1193 {
6248
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1194 /* We run the body of the function (term_get_fkeys_1) and ignore all Lisp
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1195 errors during the call. The only errors should be from Fdefine_key
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1196 when given a key sequence containing an invalid prefix key. If the
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1197 termcap defines function keys which use a prefix that is already bound
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1198 to a command by the default bindings, we should silently ignore that
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1199 function key specification, rather than giving the user an error and
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1200 refusing to run at all on such a terminal. */
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1201
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1202 extern Lisp_Object Fidentity ();
83317
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
1203 term_get_fkeys_address = address;
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
1204 term_get_fkeys_kboard = kboard;
6248
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1205 internal_condition_case (term_get_fkeys_1, Qerror, Fidentity);
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1206 }
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1207
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1208 static Lisp_Object
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1209 term_get_fkeys_1 ()
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1210 {
533
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1211 int i;
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1212
83317
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
1213 char **address = term_get_fkeys_address;
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
1214 KBOARD *kboard = term_get_fkeys_kboard;
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
1215
3359
ef29e2a4fc46 (term_get_fkeys): If not initialized, init Vfunction_key_map.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
1216 /* This can happen if CANNOT_DUMP or with strange options. */
ef29e2a4fc46 (term_get_fkeys): If not initialized, init Vfunction_key_map.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
1217 if (!initialized)
83346
7372c2f9daac Rename function-key-map to local-function-key-map, and global-function-key-map to function-key-map. Same for key-translation-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83343
diff changeset
1218 kboard->Vlocal_function_key_map = Fmake_sparse_keymap (Qnil);
3359
ef29e2a4fc46 (term_get_fkeys): If not initialized, init Vfunction_key_map.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
1219
533
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1220 for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++)
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1221 {
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1222 char *sequence = tgetstr (keys[i].cap, address);
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1223 if (sequence)
83346
7372c2f9daac Rename function-key-map to local-function-key-map, and global-function-key-map to function-key-map. Same for key-translation-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83343
diff changeset
1224 Fdefine_key (kboard->Vlocal_function_key_map, build_string (sequence),
6248
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1225 Fmake_vector (make_number (1),
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1226 intern (keys[i].name)));
533
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1227 }
1015
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1228
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1229 /* The uses of the "k0" capability are inconsistent; sometimes it
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1230 describes F10, whereas othertimes it describes F0 and "k;" describes F10.
3591
507f64624555 Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents: 3489
diff changeset
1231 We will attempt to politely accommodate both systems by testing for
1015
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1232 "k;", and if it is present, assuming that "k0" denotes F0, otherwise F10.
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1233 */
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1234 {
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1235 char *k_semi = tgetstr ("k;", address);
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1236 char *k0 = tgetstr ("k0", address);
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1237 char *k0_name = "f10";
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1238
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1239 if (k_semi)
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1240 {
43073
c9baf4b00820 (term_get_fkeys_1): If `k0' and `k;' are both specified and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 42959
diff changeset
1241 if (k0)
c9baf4b00820 (term_get_fkeys_1): If `k0' and `k;' are both specified and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 42959
diff changeset
1242 /* Define f0 first, so that f10 takes precedence in case the
c9baf4b00820 (term_get_fkeys_1): If `k0' and `k;' are both specified and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 42959
diff changeset
1243 key sequences happens to be the same. */
83346
7372c2f9daac Rename function-key-map to local-function-key-map, and global-function-key-map to function-key-map. Same for key-translation-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83343
diff changeset
1244 Fdefine_key (kboard->Vlocal_function_key_map, build_string (k0),
43073
c9baf4b00820 (term_get_fkeys_1): If `k0' and `k;' are both specified and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 42959
diff changeset
1245 Fmake_vector (make_number (1), intern ("f0")));
83346
7372c2f9daac Rename function-key-map to local-function-key-map, and global-function-key-map to function-key-map. Same for key-translation-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83343
diff changeset
1246 Fdefine_key (kboard->Vlocal_function_key_map, build_string (k_semi),
6248
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1247 Fmake_vector (make_number (1), intern ("f10")));
1015
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1248 }
43073
c9baf4b00820 (term_get_fkeys_1): If `k0' and `k;' are both specified and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 42959
diff changeset
1249 else if (k0)
83346
7372c2f9daac Rename function-key-map to local-function-key-map, and global-function-key-map to function-key-map. Same for key-translation-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83343
diff changeset
1250 Fdefine_key (kboard->Vlocal_function_key_map, build_string (k0),
6248
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1251 Fmake_vector (make_number (1), intern (k0_name)));
1015
58c373be762c * term.c (term_get_fkeys): Some systems define `static' to be the
Jim Blandy <jimb@redhat.com>
parents: 969
diff changeset
1252 }
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1253
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1254 /* Set up cookies for numbered function keys above f10. */
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1255 {
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1256 char fcap[3], fkey[4];
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1257
3489
5c2b4797aab2 (term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents: 3359
diff changeset
1258 fcap[0] = 'F'; fcap[2] = '\0';
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1259 for (i = 11; i < 64; i++)
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1260 {
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1261 if (i <= 19)
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1262 fcap[1] = '1' + i - 11;
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1263 else if (i <= 45)
10481
24756aef26e3 (term_get_fkeys_1): Bug fix for function key above f19.
Richard M. Stallman <rms@gnu.org>
parents: 10439
diff changeset
1264 fcap[1] = 'A' + i - 20;
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1265 else
10481
24756aef26e3 (term_get_fkeys_1): Bug fix for function key above f19.
Richard M. Stallman <rms@gnu.org>
parents: 10439
diff changeset
1266 fcap[1] = 'a' + i - 46;
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1267
3489
5c2b4797aab2 (term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents: 3359
diff changeset
1268 {
5c2b4797aab2 (term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents: 3359
diff changeset
1269 char *sequence = tgetstr (fcap, address);
5c2b4797aab2 (term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents: 3359
diff changeset
1270 if (sequence)
5c2b4797aab2 (term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents: 3359
diff changeset
1271 {
4543
929e4c850e76 (term_get_fkeys_define_1, term_get_fkeys_define): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 4499
diff changeset
1272 sprintf (fkey, "f%d", i);
83346
7372c2f9daac Rename function-key-map to local-function-key-map, and global-function-key-map to function-key-map. Same for key-translation-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83343
diff changeset
1273 Fdefine_key (kboard->Vlocal_function_key_map, build_string (sequence),
6248
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1274 Fmake_vector (make_number (1),
0e4319197d29 (term_get_fkeys_data): Variable removed.
Roland McGrath <roland@gnu.org>
parents: 5933
diff changeset
1275 intern (fkey)));
3489
5c2b4797aab2 (term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents: 3359
diff changeset
1276 }
5c2b4797aab2 (term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents: 3359
diff changeset
1277 }
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1278 }
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1279 }
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1280
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1281 /*
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1282 * Various mappings to try and get a better fit.
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1283 */
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1284 {
3489
5c2b4797aab2 (term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents: 3359
diff changeset
1285 #define CONDITIONAL_REASSIGN(cap1, cap2, sym) \
5c2b4797aab2 (term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents: 3359
diff changeset
1286 if (!tgetstr (cap1, address)) \
5c2b4797aab2 (term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents: 3359
diff changeset
1287 { \
5c2b4797aab2 (term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents: 3359
diff changeset
1288 char *sequence = tgetstr (cap2, address); \
83317
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
1289 if (sequence) \
83346
7372c2f9daac Rename function-key-map to local-function-key-map, and global-function-key-map to function-key-map. Same for key-translation-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83343
diff changeset
1290 Fdefine_key (kboard->Vlocal_function_key_map, build_string (sequence), \
83317
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
1291 Fmake_vector (make_number (1), \
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
1292 intern (sym))); \
3489
5c2b4797aab2 (term_get_fkeys): Use correct names for F10 and up.
Richard M. Stallman <rms@gnu.org>
parents: 3359
diff changeset
1293 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1294
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1295 /* if there's no key_next keycap, map key_npage to `next' keysym */
2243
23228edebc59 Fix spacing conventions.
Richard M. Stallman <rms@gnu.org>
parents: 2239
diff changeset
1296 CONDITIONAL_REASSIGN ("%5", "kN", "next");
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1297 /* if there's no key_prev keycap, map key_ppage to `previous' keysym */
3706
5a563b062c0d (term_get_fkeys): Use `prior', not `previous', for %8/kP.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
1298 CONDITIONAL_REASSIGN ("%8", "kP", "prior");
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1299 /* if there's no key_dc keycap, map key_ic to `insert' keysym */
2243
23228edebc59 Fix spacing conventions.
Richard M. Stallman <rms@gnu.org>
parents: 2239
diff changeset
1300 CONDITIONAL_REASSIGN ("kD", "kI", "insert");
19385
8f58b5d12021 (term_get_fkeys_1): Use kH as alternate for move-to-last-line.
Richard M. Stallman <rms@gnu.org>
parents: 19277
diff changeset
1301 /* if there's no key_end keycap, map key_ll to 'end' keysym */
8f58b5d12021 (term_get_fkeys_1): Use kH as alternate for move-to-last-line.
Richard M. Stallman <rms@gnu.org>
parents: 19277
diff changeset
1302 CONDITIONAL_REASSIGN ("@7", "kH", "end");
9524
f42e5fd15f6f (term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents: 8898
diff changeset
1303
f42e5fd15f6f (term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents: 8898
diff changeset
1304 /* IBM has their own non-standard dialect of terminfo.
f42e5fd15f6f (term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents: 8898
diff changeset
1305 If the standard name isn't found, try the IBM name. */
f42e5fd15f6f (term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents: 8898
diff changeset
1306 CONDITIONAL_REASSIGN ("kB", "KO", "backtab");
f42e5fd15f6f (term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents: 8898
diff changeset
1307 CONDITIONAL_REASSIGN ("@4", "kJ", "execute"); /* actually "action" */
f42e5fd15f6f (term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents: 8898
diff changeset
1308 CONDITIONAL_REASSIGN ("@4", "kc", "execute"); /* actually "command" */
f42e5fd15f6f (term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents: 8898
diff changeset
1309 CONDITIONAL_REASSIGN ("%7", "ki", "menu");
f42e5fd15f6f (term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents: 8898
diff changeset
1310 CONDITIONAL_REASSIGN ("@7", "kw", "end");
f42e5fd15f6f (term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents: 8898
diff changeset
1311 CONDITIONAL_REASSIGN ("F1", "k<", "f11");
f42e5fd15f6f (term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents: 8898
diff changeset
1312 CONDITIONAL_REASSIGN ("F2", "k>", "f12");
f42e5fd15f6f (term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents: 8898
diff changeset
1313 CONDITIONAL_REASSIGN ("%1", "kq", "help");
f42e5fd15f6f (term_get_fkeys_1): Workaround for IBM's dialect of terminfo.
Karl Heuer <kwzh@gnu.org>
parents: 8898
diff changeset
1314 CONDITIONAL_REASSIGN ("*6", "kU", "select");
2224
49bda4cf498c Supply second arg for tgetstr() calls.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2179
diff changeset
1315 #undef CONDITIONAL_REASSIGN
2137
8e4d2d1e7c66 Added lots more cookies to fkey_table[], and code to do even more.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1994
diff changeset
1316 }
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1317
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1318 return Qnil;
533
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1319 }
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1320
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
1321
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1322 /***********************************************************************
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1323 Character Display Information
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1324 ***********************************************************************/
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1325
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1326 static void append_glyph P_ ((struct it *));
54428
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1327 static void produce_stretch_glyph P_ ((struct it *));
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1328
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1329
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1330 /* Append glyphs to IT's glyph_row. Called from produce_glyphs for
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1331 terminal frames if IT->glyph_row != NULL. IT->c is the character
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1332 for which to produce glyphs; IT->face_id contains the character's
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1333 face. Padding glyphs are appended if IT->c has a IT->pixel_width >
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1334 1. */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1335
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1336 static void
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1337 append_glyph (it)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1338 struct it *it;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1339 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1340 struct glyph *glyph, *end;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1341 int i;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1342
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1343 xassert (it->glyph_row);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1344 glyph = (it->glyph_row->glyphs[it->area]
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1345 + it->glyph_row->used[it->area]);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1346 end = it->glyph_row->glyphs[1 + it->area];
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1347
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1348 for (i = 0;
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1349 i < it->pixel_width && glyph < end;
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1350 ++i)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1351 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1352 glyph->type = CHAR_GLYPH;
29462
3306af2e4f3d (append_glyph): Revert change of 2000-06-06.
Gerd Moellmann <gerd@gnu.org>
parents: 29448
diff changeset
1353 glyph->pixel_width = 1;
26999
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
1354 glyph->u.ch = it->c;
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
1355 glyph->face_id = it->face_id;
5d0057e6170e (encode_terminal_code): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 26902
diff changeset
1356 glyph->padding_p = i > 0;
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1357 glyph->charpos = CHARPOS (it->position);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1358 glyph->object = it->object;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1359
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1360 ++it->glyph_row->used[it->area];
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1361 ++glyph;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1362 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1363 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1364
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1365
44372
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1366 /* Produce glyphs for the display element described by IT. *IT
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1367 specifies what we want to produce a glyph for (character, image, ...),
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1368 and where in the glyph matrix we currently are (glyph row and hpos).
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1369 produce_glyphs fills in output fields of *IT with information such as the
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1370 pixel width and height of a character, and maybe output actual glyphs at
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1371 the same time if IT->glyph_row is non-null. See the explanation of
44372
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1372 struct display_iterator in dispextern.h for an overview.
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1373
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1374 produce_glyphs also stores the result of glyph width, ascent
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1375 etc. computations in *IT.
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1376
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1377 IT->glyph_row may be null, in which case produce_glyphs does not
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1378 actually fill in the glyphs. This is used in the move_* functions
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1379 in xdisp.c for text width and height computations.
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1380
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1381 Callers usually don't call produce_glyphs directly;
65c0edf0d53c Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 43073
diff changeset
1382 instead they use the macro PRODUCE_GLYPHS. */
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1383
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1384 void
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1385 produce_glyphs (it)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1386 struct it *it;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1387 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1388 /* If a hook is installed, let it do the work. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1389 xassert (it->what == IT_CHARACTER
26871
aaf45e665b14 (encode_terminal_code): Delete codes for a composite
Kenichi Handa <handa@m17n.org>
parents: 26425
diff changeset
1390 || it->what == IT_COMPOSITION
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1391 || it->what == IT_STRETCH);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1392
54428
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1393 if (it->what == IT_STRETCH)
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1394 {
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1395 produce_stretch_glyph (it);
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1396 goto done;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1397 }
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1398
26871
aaf45e665b14 (encode_terminal_code): Delete codes for a composite
Kenichi Handa <handa@m17n.org>
parents: 26425
diff changeset
1399 /* Nothing but characters are supported on terminal frames. For a
aaf45e665b14 (encode_terminal_code): Delete codes for a composite
Kenichi Handa <handa@m17n.org>
parents: 26425
diff changeset
1400 composition sequence, it->c is the first character of the
aaf45e665b14 (encode_terminal_code): Delete codes for a composite
Kenichi Handa <handa@m17n.org>
parents: 26425
diff changeset
1401 sequence. */
aaf45e665b14 (encode_terminal_code): Delete codes for a composite
Kenichi Handa <handa@m17n.org>
parents: 26425
diff changeset
1402 xassert (it->what == IT_CHARACTER
aaf45e665b14 (encode_terminal_code): Delete codes for a composite
Kenichi Handa <handa@m17n.org>
parents: 26425
diff changeset
1403 || it->what == IT_COMPOSITION);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1404
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1405 if (it->c >= 040 && it->c < 0177)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1406 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1407 it->pixel_width = it->nglyphs = 1;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1408 if (it->glyph_row)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1409 append_glyph (it);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1410 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1411 else if (it->c == '\n')
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1412 it->pixel_width = it->nglyphs = 0;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1413 else if (it->c == '\t')
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1414 {
28685
b4310b6f3b5e (produce_glyphs): Remove reference to struct it's prompt_width.
Gerd Moellmann <gerd@gnu.org>
parents: 28507
diff changeset
1415 int absolute_x = (it->current_x
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1416 + it->continuation_lines_width);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1417 int next_tab_x
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1418 = (((1 + absolute_x + it->tab_width - 1)
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1419 / it->tab_width)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1420 * it->tab_width);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1421 int nspaces;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1422
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1423 /* If part of the TAB has been displayed on the previous line
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1424 which is continued now, continuation_lines_width will have
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1425 been incremented already by the part that fitted on the
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1426 continued line. So, we will get the right number of spaces
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1427 here. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1428 nspaces = next_tab_x - absolute_x;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1429
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1430 if (it->glyph_row)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1431 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1432 int n = nspaces;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1433
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1434 it->c = ' ';
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1435 it->pixel_width = it->len = 1;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1436
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1437 while (n--)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1438 append_glyph (it);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1439
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1440 it->c = '\t';
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1441 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1442
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1443 it->pixel_width = nspaces;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1444 it->nglyphs = nspaces;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1445 }
29262
b7059c9f98ac (produce_glyphs): Don't treat eight-bit-* charsets as multibyte.
Eli Zaretskii <eliz@gnu.org>
parents: 29097
diff changeset
1446 else if (SINGLE_BYTE_CHAR_P (it->c))
b7059c9f98ac (produce_glyphs): Don't treat eight-bit-* charsets as multibyte.
Eli Zaretskii <eliz@gnu.org>
parents: 29097
diff changeset
1447 {
29263
167d236e633b Correct a typo in a comment.
Eli Zaretskii <eliz@gnu.org>
parents: 29262
diff changeset
1448 /* Coming here means that it->c is from display table, thus we
29262
b7059c9f98ac (produce_glyphs): Don't treat eight-bit-* charsets as multibyte.
Eli Zaretskii <eliz@gnu.org>
parents: 29097
diff changeset
1449 must send the code as is to the terminal. Although there's
b7059c9f98ac (produce_glyphs): Don't treat eight-bit-* charsets as multibyte.
Eli Zaretskii <eliz@gnu.org>
parents: 29097
diff changeset
1450 no way to know how many columns it occupies on a screen, it
b7059c9f98ac (produce_glyphs): Don't treat eight-bit-* charsets as multibyte.
Eli Zaretskii <eliz@gnu.org>
parents: 29097
diff changeset
1451 is a good assumption that a single byte code has 1-column
b7059c9f98ac (produce_glyphs): Don't treat eight-bit-* charsets as multibyte.
Eli Zaretskii <eliz@gnu.org>
parents: 29097
diff changeset
1452 width. */
b7059c9f98ac (produce_glyphs): Don't treat eight-bit-* charsets as multibyte.
Eli Zaretskii <eliz@gnu.org>
parents: 29097
diff changeset
1453 it->pixel_width = it->nglyphs = 1;
b7059c9f98ac (produce_glyphs): Don't treat eight-bit-* charsets as multibyte.
Eli Zaretskii <eliz@gnu.org>
parents: 29097
diff changeset
1454 if (it->glyph_row)
b7059c9f98ac (produce_glyphs): Don't treat eight-bit-* charsets as multibyte.
Eli Zaretskii <eliz@gnu.org>
parents: 29097
diff changeset
1455 append_glyph (it);
b7059c9f98ac (produce_glyphs): Don't treat eight-bit-* charsets as multibyte.
Eli Zaretskii <eliz@gnu.org>
parents: 29097
diff changeset
1456 }
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1457 else
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1458 {
26871
aaf45e665b14 (encode_terminal_code): Delete codes for a composite
Kenichi Handa <handa@m17n.org>
parents: 26425
diff changeset
1459 /* A multi-byte character. The display width is fixed for all
aaf45e665b14 (encode_terminal_code): Delete codes for a composite
Kenichi Handa <handa@m17n.org>
parents: 26425
diff changeset
1460 characters of the set. Some of the glyphs may have to be
aaf45e665b14 (encode_terminal_code): Delete codes for a composite
Kenichi Handa <handa@m17n.org>
parents: 26425
diff changeset
1461 ignored because they are already displayed in a continued
aaf45e665b14 (encode_terminal_code): Delete codes for a composite
Kenichi Handa <handa@m17n.org>
parents: 26425
diff changeset
1462 line. */
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1463 int charset = CHAR_CHARSET (it->c);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1464
26871
aaf45e665b14 (encode_terminal_code): Delete codes for a composite
Kenichi Handa <handa@m17n.org>
parents: 26425
diff changeset
1465 it->pixel_width = CHARSET_WIDTH (charset);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1466 it->nglyphs = it->pixel_width;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1467
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1468 if (it->glyph_row)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1469 append_glyph (it);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1470 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1471
54428
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1472 done:
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1473 /* Advance current_x by the pixel width as a convenience for
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1474 the caller. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1475 if (it->area == TEXT_AREA)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1476 it->current_x += it->pixel_width;
25187
39feb68ed3c7 (produce_glyphs): Set iterator's physical height
Gerd Moellmann <gerd@gnu.org>
parents: 25002
diff changeset
1477 it->ascent = it->max_ascent = it->phys_ascent = it->max_phys_ascent = 0;
39feb68ed3c7 (produce_glyphs): Set iterator's physical height
Gerd Moellmann <gerd@gnu.org>
parents: 25002
diff changeset
1478 it->descent = it->max_descent = it->phys_descent = it->max_phys_descent = 1;
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1479 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1480
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1481
54428
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1482 /* Produce a stretch glyph for iterator IT. IT->object is the value
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1483 of the glyph property displayed. The value must be a list
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1484 `(space KEYWORD VALUE ...)' with the following KEYWORD/VALUE pairs
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1485 being recognized:
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1486
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1487 1. `:width WIDTH' specifies that the space should be WIDTH *
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1488 canonical char width wide. WIDTH may be an integer or floating
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1489 point number.
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1490
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1491 2. `:align-to HPOS' specifies that the space should be wide enough
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1492 to reach HPOS, a value in canonical character units. */
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1493
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1494 static void
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1495 produce_stretch_glyph (it)
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1496 struct it *it;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1497 {
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1498 /* (space :width WIDTH ...) */
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1499 Lisp_Object prop, plist;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1500 int width = 0, align_to = -1;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1501 int zero_width_ok_p = 0;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1502 double tem;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1503
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1504 /* List should start with `space'. */
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1505 xassert (CONSP (it->object) && EQ (XCAR (it->object), Qspace));
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1506 plist = XCDR (it->object);
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1507
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1508 /* Compute the width of the stretch. */
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1509 if ((prop = Fplist_get (plist, QCwidth), !NILP (prop))
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1510 && calc_pixel_width_or_height (&tem, it, prop, 0, 1, 0))
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1511 {
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1512 /* Absolute width `:width WIDTH' specified and valid. */
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1513 zero_width_ok_p = 1;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1514 width = (int)(tem + 0.5);
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1515 }
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1516 else if ((prop = Fplist_get (plist, QCalign_to), !NILP (prop))
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1517 && calc_pixel_width_or_height (&tem, it, prop, 0, 1, &align_to))
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1518 {
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1519 if (it->glyph_row == NULL || !it->glyph_row->mode_line_p)
66238
d3f5aa0f18c4 (encode_terminal_code): Remove unused var src_start.
Kim F. Storm <storm@cua.dk>
parents: 65795
diff changeset
1520 align_to = (align_to < 0
54428
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1521 ? 0
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1522 : align_to - window_box_left_offset (it->w, TEXT_AREA));
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1523 else if (align_to < 0)
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1524 align_to = window_box_left_offset (it->w, TEXT_AREA);
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1525 width = max (0, (int)(tem + 0.5) + align_to - it->current_x);
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1526 zero_width_ok_p = 1;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1527 }
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1528 else
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1529 /* Nothing specified -> width defaults to canonical char width. */
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1530 width = FRAME_COLUMN_WIDTH (it->f);
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1531
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1532 if (width <= 0 && (width < 0 || !zero_width_ok_p))
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1533 width = 1;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1534
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1535 if (width > 0 && it->glyph_row)
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1536 {
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1537 Lisp_Object o_object = it->object;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1538 Lisp_Object object = it->stack[it->sp - 1].string;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1539 int n = width;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1540 int c = it->c;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1541
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1542 if (!STRINGP (object))
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1543 object = it->w->buffer;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1544 it->object = object;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1545 it->c = ' ';
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1546 it->pixel_width = it->len = 1;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1547 while (n--)
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1548 append_glyph (it);
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1549 it->object = o_object;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1550 it->c = c;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1551 }
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1552 it->pixel_width = width;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1553 it->nglyphs = width;
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1554 }
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1555
3a86bc69c0e3 (produce_glyphs): Handle IT_STRETCH.
Kim F. Storm <storm@cua.dk>
parents: 54167
diff changeset
1556
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1557 /* Get information about special display element WHAT in an
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1558 environment described by IT. WHAT is one of IT_TRUNCATION or
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1559 IT_CONTINUATION. Maybe produce glyphs for WHAT if IT has a
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1560 non-null glyph_row member. This function ensures that fields like
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1561 face_id, c, len of IT are left untouched. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1562
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1563 void
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1564 produce_special_glyphs (it, what)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1565 struct it *it;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1566 enum display_element_type what;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1567 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1568 struct it temp_it;
63549
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
1569 GLYPH glyph;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1570
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1571 temp_it = *it;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1572 temp_it.dp = NULL;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1573 temp_it.what = IT_CHARACTER;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1574 temp_it.len = 1;
28507
b6f06a755c7d make_number/XINT/XUINT conversions; EQ/== fixes; ==Qnil -> NILP
Ken Raeburn <raeburn@raeburn.org>
parents: 28465
diff changeset
1575 temp_it.object = make_number (0);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1576 bzero (&temp_it.current, sizeof temp_it.current);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1577
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1578 if (what == IT_CONTINUATION)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1579 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1580 /* Continuation glyph. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1581 if (it->dp
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1582 && INTEGERP (DISP_CONTINUE_GLYPH (it->dp))
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1583 && GLYPH_CHAR_VALID_P (XINT (DISP_CONTINUE_GLYPH (it->dp))))
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1584 {
63549
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
1585 glyph = XINT (DISP_CONTINUE_GLYPH (it->dp));
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
1586 glyph = spec_glyph_lookup_face (XWINDOW (it->window), glyph);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1587 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1588 else
63549
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
1589 glyph = '\\';
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1590 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1591 else if (what == IT_TRUNCATION)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1592 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1593 /* Truncation glyph. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1594 if (it->dp
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1595 && INTEGERP (DISP_TRUNC_GLYPH (it->dp))
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1596 && GLYPH_CHAR_VALID_P (XINT (DISP_TRUNC_GLYPH (it->dp))))
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1597 {
63549
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
1598 glyph = XINT (DISP_TRUNC_GLYPH (it->dp));
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
1599 glyph = spec_glyph_lookup_face (XWINDOW (it->window), glyph);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1600 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1601 else
63549
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
1602 glyph = '$';
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1603 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1604 else
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1605 abort ();
63549
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
1606
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
1607 temp_it.c = FAST_GLYPH_CHAR (glyph);
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
1608 temp_it.face_id = FAST_GLYPH_FACE (glyph);
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
1609 temp_it.len = CHAR_BYTES (temp_it.c);
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
1610
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
1611 produce_glyphs (&temp_it);
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
1612 it->pixel_width = temp_it.pixel_width;
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
1613 it->nglyphs = temp_it.pixel_width;
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1614 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1615
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1616
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1617
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1618 /***********************************************************************
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1619 Faces
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1620 ***********************************************************************/
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1621
28465
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
1622 /* Value is non-zero if attribute ATTR may be used. ATTR should be
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
1623 one of the enumerators from enum no_color_bit, or a bit set built
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
1624 from them. Some display attributes may not be used together with
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
1625 color; the termcap capability `NC' specifies which ones. */
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
1626
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1627 #define MAY_USE_WITH_COLORS_P(tty, ATTR) \
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1628 (tty->TN_max_colors > 0 \
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1629 ? (tty->TN_no_color_video & (ATTR)) == 0 \
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1630 : 1)
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1631
63549
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
1632 /* Turn appearances of face FACE_ID on tty frame F on.
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
1633 FACE_ID is a realized face ID number, in the face cache. */
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1634
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1635 static void
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1636 turn_on_face (f, face_id)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1637 struct frame *f;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1638 int face_id;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1639 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1640 struct face *face = FACE_FROM_ID (f, face_id);
37477
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1641 long fg = face->foreground;
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1642 long bg = face->background;
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
1643 struct tty_display_info *tty = FRAME_TTY (f);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1644
37477
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1645 /* Do this first because TS_end_standout_mode may be the same
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1646 as TS_exit_attribute_mode, which turns all appearances off. */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1647 if (MAY_USE_WITH_COLORS_P (tty, NC_REVERSE))
37477
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1648 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1649 if (tty->TN_max_colors > 0)
37477
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1650 {
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1651 if (fg >= 0 && bg >= 0)
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1652 {
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1653 /* If the terminal supports colors, we can set them
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1654 below without using reverse video. The face's fg
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1655 and bg colors are set as they should appear on
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1656 the screen, i.e. they take the inverse-video'ness
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1657 of the face already into account. */
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1658 }
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1659 else if (inverse_video)
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1660 {
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1661 if (fg == FACE_TTY_DEFAULT_FG_COLOR
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1662 || bg == FACE_TTY_DEFAULT_BG_COLOR)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
1663 tty_toggle_highlight (tty);
37477
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1664 }
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1665 else
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1666 {
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1667 if (fg == FACE_TTY_DEFAULT_BG_COLOR
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1668 || bg == FACE_TTY_DEFAULT_FG_COLOR)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
1669 tty_toggle_highlight (tty);
37477
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1670 }
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1671 }
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1672 else
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1673 {
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1674 /* If we can't display colors, use reverse video
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1675 if the face specifies that. */
37499
b8ff92361366 (turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents: 37477
diff changeset
1676 if (inverse_video)
b8ff92361366 (turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents: 37477
diff changeset
1677 {
b8ff92361366 (turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents: 37477
diff changeset
1678 if (fg == FACE_TTY_DEFAULT_FG_COLOR
b8ff92361366 (turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents: 37477
diff changeset
1679 || bg == FACE_TTY_DEFAULT_BG_COLOR)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
1680 tty_toggle_highlight (tty);
37499
b8ff92361366 (turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents: 37477
diff changeset
1681 }
b8ff92361366 (turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents: 37477
diff changeset
1682 else
b8ff92361366 (turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents: 37477
diff changeset
1683 {
b8ff92361366 (turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents: 37477
diff changeset
1684 if (fg == FACE_TTY_DEFAULT_BG_COLOR
b8ff92361366 (turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents: 37477
diff changeset
1685 || bg == FACE_TTY_DEFAULT_FG_COLOR)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
1686 tty_toggle_highlight (tty);
37499
b8ff92361366 (turn_on_face): Fix reverse video handling on terminals
Gerd Moellmann <gerd@gnu.org>
parents: 37477
diff changeset
1687 }
37477
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1688 }
6a7ab4d2c7b3 (toggle_highlight): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 35448
diff changeset
1689 }
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1690
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1691 if (face->tty_bold_p)
28465
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
1692 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1693 if (MAY_USE_WITH_COLORS_P (tty, NC_BOLD))
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1694 OUTPUT1_IF (tty, tty->TS_enter_bold_mode);
28465
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
1695 }
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1696 else if (face->tty_dim_p)
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1697 if (MAY_USE_WITH_COLORS_P (tty, NC_DIM))
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1698 OUTPUT1_IF (tty, tty->TS_enter_dim_mode);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1699
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1700 /* Alternate charset and blinking not yet used. */
28465
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
1701 if (face->tty_alt_charset_p
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1702 && MAY_USE_WITH_COLORS_P (tty, NC_ALT_CHARSET))
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1703 OUTPUT1_IF (tty, tty->TS_enter_alt_charset_mode);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1704
28465
113efc964095 (TN_no_color_video): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 28200
diff changeset
1705 if (face->tty_blinking_p
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1706 && MAY_USE_WITH_COLORS_P (tty, NC_BLINK))
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1707 OUTPUT1_IF (tty, tty->TS_enter_blink_mode);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1708
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1709 if (face->tty_underline_p && MAY_USE_WITH_COLORS_P (tty, NC_UNDERLINE))
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1710 OUTPUT1_IF (tty, tty->TS_enter_underline_mode);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1711
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1712 if (tty->TN_max_colors > 0)
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1713 {
65072
462eb3df5c58 (turn_on_face): Check for TS_set_foreground and
Juri Linkov <juri@jurta.org>
parents: 64773
diff changeset
1714 char *ts, *p;
462eb3df5c58 (turn_on_face): Check for TS_set_foreground and
Juri Linkov <juri@jurta.org>
parents: 64773
diff changeset
1715
83353
532e0a9335a9 Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
parents: 83346 65072
diff changeset
1716 ts = tty->standout_mode ? tty->TS_set_background : tty->TS_set_foreground;
65072
462eb3df5c58 (turn_on_face): Check for TS_set_foreground and
Juri Linkov <juri@jurta.org>
parents: 64773
diff changeset
1717 if (fg >= 0 && ts)
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1718 {
83353
532e0a9335a9 Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
parents: 83346 65072
diff changeset
1719 p = tparam (ts, NULL, 0, (int) fg);
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
1720 OUTPUT (tty, p);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1721 xfree (p);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1722 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1723
83353
532e0a9335a9 Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
parents: 83346 65072
diff changeset
1724 ts = tty->standout_mode ? tty->TS_set_foreground : tty->TS_set_background;
65072
462eb3df5c58 (turn_on_face): Check for TS_set_foreground and
Juri Linkov <juri@jurta.org>
parents: 64773
diff changeset
1725 if (bg >= 0 && ts)
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1726 {
83353
532e0a9335a9 Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Karoly Lorentey <lorentey@elte.hu>
parents: 83346 65072
diff changeset
1727 p = tparam (ts, NULL, 0, (int) bg);
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
1728 OUTPUT (tty, p);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1729 xfree (p);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1730 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1731 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1732 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1733
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1734
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1735 /* Turn off appearances of face FACE_ID on tty frame F. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1736
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1737 static void
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1738 turn_off_face (f, face_id)
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1739 struct frame *f;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1740 int face_id;
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1741 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1742 struct face *face = FACE_FROM_ID (f, face_id);
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
1743 struct tty_display_info *tty = FRAME_TTY (f);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1744
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1745 xassert (face != NULL);
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1746
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1747 if (tty->TS_exit_attribute_mode)
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1748 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1749 /* Capability "me" will turn off appearance modes double-bright,
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1750 half-bright, reverse-video, standout, underline. It may or
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1751 may not turn off alt-char-mode. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1752 if (face->tty_bold_p
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1753 || face->tty_dim_p
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1754 || face->tty_reverse_p
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1755 || face->tty_alt_charset_p
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1756 || face->tty_blinking_p
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1757 || face->tty_underline_p)
30848
fc80dcfc32cd (write_glyphs): Also turn off inverse video after turning
Gerd Moellmann <gerd@gnu.org>
parents: 30836
diff changeset
1758 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1759 OUTPUT1_IF (tty, tty->TS_exit_attribute_mode);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1760 if (strcmp (tty->TS_exit_attribute_mode, tty->TS_end_standout_mode) == 0)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1761 tty->standout_mode = 0;
30848
fc80dcfc32cd (write_glyphs): Also turn off inverse video after turning
Gerd Moellmann <gerd@gnu.org>
parents: 30836
diff changeset
1762 }
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1763
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1764 if (face->tty_alt_charset_p)
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1765 OUTPUT_IF (tty, tty->TS_exit_alt_charset_mode);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1766 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1767 else
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1768 {
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1769 /* If we don't have "me" we can only have those appearances
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1770 that have exit sequences defined. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1771 if (face->tty_alt_charset_p)
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1772 OUTPUT_IF (tty, tty->TS_exit_alt_charset_mode);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1773
40086
050b19294988 (TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents: 40081
diff changeset
1774 if (face->tty_underline_p)
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1775 OUTPUT_IF (tty, tty->TS_exit_underline_mode);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1776 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1777
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1778 /* Switch back to default colors. */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1779 if (tty->TN_max_colors > 0
26902
264b83a3a688 Changes for separate unspecified foreground and background colors
Eli Zaretskii <eliz@gnu.org>
parents: 26871
diff changeset
1780 && ((face->foreground != FACE_TTY_DEFAULT_COLOR
264b83a3a688 Changes for separate unspecified foreground and background colors
Eli Zaretskii <eliz@gnu.org>
parents: 26871
diff changeset
1781 && face->foreground != FACE_TTY_DEFAULT_FG_COLOR)
264b83a3a688 Changes for separate unspecified foreground and background colors
Eli Zaretskii <eliz@gnu.org>
parents: 26871
diff changeset
1782 || (face->background != FACE_TTY_DEFAULT_COLOR
264b83a3a688 Changes for separate unspecified foreground and background colors
Eli Zaretskii <eliz@gnu.org>
parents: 26871
diff changeset
1783 && face->background != FACE_TTY_DEFAULT_BG_COLOR)))
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1784 OUTPUT1_IF (tty, tty->TS_orig_pair);
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1785 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1786
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
1787
45522
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1788 /* Return non-zero if the terminal on frame F supports all of the
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1789 capabilities in CAPS simultaneously, with foreground and background
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1790 colors FG and BG. */
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1791
45548
612208417377 C style fix.
Miles Bader <miles@gnu.org>
parents: 45522
diff changeset
1792 int
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1793 tty_capable_p (tty, caps, fg, bg)
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
1794 struct tty_display_info *tty;
45522
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1795 unsigned caps;
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1796 unsigned long fg, bg;
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1797 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1798 #define TTY_CAPABLE_P_TRY(tty, cap, TS, NC_bit) \
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1799 if ((caps & (cap)) && (!(TS) || !MAY_USE_WITH_COLORS_P(tty, NC_bit))) \
45522
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1800 return 0;
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1801
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1802 TTY_CAPABLE_P_TRY (tty, TTY_CAP_INVERSE, tty->TS_standout_mode, NC_REVERSE);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1803 TTY_CAPABLE_P_TRY (tty, TTY_CAP_UNDERLINE, tty->TS_enter_underline_mode, NC_UNDERLINE);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1804 TTY_CAPABLE_P_TRY (tty, TTY_CAP_BOLD, tty->TS_enter_bold_mode, NC_BOLD);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1805 TTY_CAPABLE_P_TRY (tty, TTY_CAP_DIM, tty->TS_enter_dim_mode, NC_DIM);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1806 TTY_CAPABLE_P_TRY (tty, TTY_CAP_BLINK, tty->TS_enter_blink_mode, NC_BLINK);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1807 TTY_CAPABLE_P_TRY (tty, TTY_CAP_ALT_CHARSET, tty->TS_enter_alt_charset_mode, NC_ALT_CHARSET);
45522
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1808
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1809 /* We can do it! */
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1810 return 1;
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1811 }
1513f6afe56f (tty_capable_p): New function.
Miles Bader <miles@gnu.org>
parents: 44890
diff changeset
1812
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1813 /* Return non-zero if the terminal is capable to display colors. */
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1814
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1815 DEFUN ("tty-display-color-p", Ftty_display_color_p, Stty_display_color_p,
27087
8de2d17323c2 (Ftty_display_color_p): Accept an optional argument FRAME.
Eli Zaretskii <eliz@gnu.org>
parents: 27085
diff changeset
1816 0, 1, 0,
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1817 doc: /* Return non-nil if the tty device TERMINAL can display colors.
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1818
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1819 TERMINAL can be a terminal id, a frame or nil (meaning the selected
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1820 frame's terminal). This function always returns nil if TERMINAL
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1821 is not on a tty device. */)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1822 (terminal)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1823 Lisp_Object terminal;
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1824 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1825 struct terminal *t = get_tty_terminal (terminal);
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1826 if (!t)
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
1827 return Qnil;
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1828 else
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1829 return t->display_info.tty->TN_max_colors > 0 ? Qt : Qnil;
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1830 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1831
42954
e514d4931d6f (Ftty_display_color_cells): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 42808
diff changeset
1832 /* Return the number of supported colors. */
e514d4931d6f (Ftty_display_color_cells): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 42808
diff changeset
1833 DEFUN ("tty-display-color-cells", Ftty_display_color_cells,
e514d4931d6f (Ftty_display_color_cells): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 42808
diff changeset
1834 Stty_display_color_cells, 0, 1, 0,
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1835 doc: /* Return the number of colors supported by the tty device TERMINAL.
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1836
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1837 TERMINAL can be a terminal id, a frame or nil (meaning the selected
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1838 frame's terminal). This function always returns nil if TERMINAL
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1839 is not on a tty device. */)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1840 (terminal)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1841 Lisp_Object terminal;
42954
e514d4931d6f (Ftty_display_color_cells): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 42808
diff changeset
1842 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1843 struct terminal *t = get_tty_terminal (terminal);
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1844 if (!t)
83161
8d62eda26760 Fix byte-compile errors during bootstrap. (Reported by Juraj Kubelka.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83158
diff changeset
1845 return make_number (0);
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1846 else
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1847 return make_number (t->display_info.tty->TN_max_colors);
42954
e514d4931d6f (Ftty_display_color_cells): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 42808
diff changeset
1848 }
e514d4931d6f (Ftty_display_color_cells): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 42808
diff changeset
1849
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1850 #ifndef WINDOWSNT
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1851
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1852 /* Save or restore the default color-related capabilities of this
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1853 terminal. */
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1854 static void
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
1855 tty_default_color_capabilities (struct tty_display_info *tty, int save)
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1856 {
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1857 static char
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1858 *default_orig_pair, *default_set_foreground, *default_set_background;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1859 static int default_max_colors, default_max_pairs, default_no_color_video;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1860
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1861 if (save)
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1862 {
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1863 if (default_orig_pair)
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1864 xfree (default_orig_pair);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1865 default_orig_pair = tty->TS_orig_pair ? xstrdup (tty->TS_orig_pair) : NULL;
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1866
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1867 if (default_set_foreground)
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1868 xfree (default_set_foreground);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1869 default_set_foreground = tty->TS_set_foreground ? xstrdup (tty->TS_set_foreground)
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1870 : NULL;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1871
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1872 if (default_set_background)
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1873 xfree (default_set_background);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1874 default_set_background = tty->TS_set_background ? xstrdup (tty->TS_set_background)
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1875 : NULL;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1876
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1877 default_max_colors = tty->TN_max_colors;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1878 default_max_pairs = tty->TN_max_pairs;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1879 default_no_color_video = tty->TN_no_color_video;
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1880 }
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1881 else
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1882 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1883 tty->TS_orig_pair = default_orig_pair;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1884 tty->TS_set_foreground = default_set_foreground;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1885 tty->TS_set_background = default_set_background;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1886 tty->TN_max_colors = default_max_colors;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1887 tty->TN_max_pairs = default_max_pairs;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1888 tty->TN_no_color_video = default_no_color_video;
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1889 }
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1890 }
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1891
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1892 /* Setup one of the standard tty color schemes according to MODE.
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1893 MODE's value is generally the number of colors which we want to
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1894 support; zero means set up for the default capabilities, the ones
83341
76e51706154e Rename term_init to init_tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83338
diff changeset
1895 we saw at init_tty time; -1 means turn off color support. */
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
1896 static void
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
1897 tty_setup_colors (struct tty_display_info *tty, int mode)
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1898 {
52652
31a3a92c1a03 (tty_setup_colors): Treat any negative argument as -1.
Eli Zaretskii <eliz@gnu.org>
parents: 52579
diff changeset
1899 /* Canonicalize all negative values of MODE. */
31a3a92c1a03 (tty_setup_colors): Treat any negative argument as -1.
Eli Zaretskii <eliz@gnu.org>
parents: 52579
diff changeset
1900 if (mode < -1)
31a3a92c1a03 (tty_setup_colors): Treat any negative argument as -1.
Eli Zaretskii <eliz@gnu.org>
parents: 52579
diff changeset
1901 mode = -1;
31a3a92c1a03 (tty_setup_colors): Treat any negative argument as -1.
Eli Zaretskii <eliz@gnu.org>
parents: 52579
diff changeset
1902
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1903 switch (mode)
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1904 {
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1905 case -1: /* no colors at all */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1906 tty->TN_max_colors = 0;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1907 tty->TN_max_pairs = 0;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1908 tty->TN_no_color_video = 0;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1909 tty->TS_set_foreground = tty->TS_set_background = tty->TS_orig_pair = NULL;
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1910 break;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1911 case 0: /* default colors, if any */
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1912 default:
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1913 tty_default_color_capabilities (tty, 0);
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1914 break;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1915 case 8: /* 8 standard ANSI colors */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1916 tty->TS_orig_pair = "\033[0m";
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1917 #ifdef TERMINFO
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1918 tty->TS_set_foreground = "\033[3%p1%dm";
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1919 tty->TS_set_background = "\033[4%p1%dm";
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1920 #else
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1921 tty->TS_set_foreground = "\033[3%dm";
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1922 tty->TS_set_background = "\033[4%dm";
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1923 #endif
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1924 tty->TN_max_colors = 8;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1925 tty->TN_max_pairs = 64;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1926 tty->TN_no_color_video = 0;
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1927 break;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1928 }
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1929 }
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1930
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1931 void
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1932 set_tty_color_mode (f, val)
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1933 struct frame *f;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1934 Lisp_Object val;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1935 {
42808
cb0b3b9b61ec (set_tty_color_mode): Remove unused variable `tem'.
Pavel Janík <Pavel@Janik.cz>
parents: 42742
diff changeset
1936 Lisp_Object color_mode_spec, current_mode_spec;
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1937 Lisp_Object color_mode, current_mode;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1938 int mode, old_mode;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1939 extern Lisp_Object Qtty_color_mode;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1940 Lisp_Object tty_color_mode_alist;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1941
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1942 tty_color_mode_alist = Fintern_soft (build_string ("tty-color-mode-alist"),
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1943 Qnil);
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1944
52579
611336925095 (set_tty_color_mode): Use INTEGERP to test whether a
Eli Zaretskii <eliz@gnu.org>
parents: 52401
diff changeset
1945 if (INTEGERP (val))
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1946 color_mode = val;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1947 else
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1948 {
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1949 if (NILP (tty_color_mode_alist))
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1950 color_mode_spec = Qnil;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1951 else
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1952 color_mode_spec = Fassq (val, XSYMBOL (tty_color_mode_alist)->value);
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1953
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1954 if (CONSP (color_mode_spec))
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1955 color_mode = XCDR (color_mode_spec);
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1956 else
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1957 color_mode = Qnil;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1958 }
52681
2036a4307b6c (set_tty_color_mode): Calculate current_mode_spec regardless of value of VAL.
Richard M. Stallman <rms@gnu.org>
parents: 52652
diff changeset
1959
2036a4307b6c (set_tty_color_mode): Calculate current_mode_spec regardless of value of VAL.
Richard M. Stallman <rms@gnu.org>
parents: 52652
diff changeset
1960 current_mode_spec = assq_no_quit (Qtty_color_mode, f->param_alist);
2036a4307b6c (set_tty_color_mode): Calculate current_mode_spec regardless of value of VAL.
Richard M. Stallman <rms@gnu.org>
parents: 52652
diff changeset
1961
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1962 if (CONSP (current_mode_spec))
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1963 current_mode = XCDR (current_mode_spec);
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1964 else
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1965 current_mode = Qnil;
52579
611336925095 (set_tty_color_mode): Use INTEGERP to test whether a
Eli Zaretskii <eliz@gnu.org>
parents: 52401
diff changeset
1966 if (INTEGERP (color_mode))
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1967 mode = XINT (color_mode);
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1968 else
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1969 mode = 0; /* meaning default */
52579
611336925095 (set_tty_color_mode): Use INTEGERP to test whether a
Eli Zaretskii <eliz@gnu.org>
parents: 52401
diff changeset
1970 if (INTEGERP (current_mode))
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1971 old_mode = XINT (current_mode);
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1972 else
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1973 old_mode = 0;
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1974
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1975 if (mode != old_mode)
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1976 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
1977 tty_setup_colors (FRAME_TTY (f), mode);
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1978 /* This recomputes all the faces given the new color
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1979 definitions. */
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1980 call0 (intern ("tty-set-up-initial-frame-faces"));
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1981 redraw_frame (f);
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1982 }
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1983 }
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1984
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
1985 #endif /* !WINDOWSNT */
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1986
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
1987
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
1988
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1989 /* Return the tty display object specified by TERMINAL. */
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1990
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1991 struct terminal *
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1992 get_tty_terminal (Lisp_Object terminal)
83167
69ebc75cb461 Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83161
diff changeset
1993 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1994 struct terminal *t = get_terminal (terminal, 0);
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1995
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1996 if (t && t->type == output_initial)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1997 t = NULL;
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1998
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
1999 if (t && t->type != output_termcap)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2000 error ("Device %d is not a termcap terminal device", t->id);
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2001
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2002 return t;
83167
69ebc75cb461 Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83161
diff changeset
2003 }
69ebc75cb461 Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83161
diff changeset
2004
83342
9216636c02fc Rename `struct display' to `struct device'. Update function, parameter and variable names accordingly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83341
diff changeset
2005 /* Return the active termcap device that uses the tty device with the
9216636c02fc Rename `struct display' to `struct device'. Update function, parameter and variable names accordingly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83341
diff changeset
2006 given name. If NAME is NULL, return the device corresponding to
83167
69ebc75cb461 Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83161
diff changeset
2007 our controlling terminal.
69ebc75cb461 Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83161
diff changeset
2008
83342
9216636c02fc Rename `struct display' to `struct device'. Update function, parameter and variable names accordingly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83341
diff changeset
2009 This function ignores suspended devices.
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
2010
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
2011 Returns NULL if the named terminal device is not opened. */
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
2012
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2013 struct terminal *
83342
9216636c02fc Rename `struct display' to `struct device'. Update function, parameter and variable names accordingly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83341
diff changeset
2014 get_named_tty (name)
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2015 char *name;
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2016 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2017 struct terminal *t;
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2018
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2019 for (t = terminal_list; t; t = t->next_terminal) {
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2020 if (t->type == output_termcap
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2021 && ((t->display_info.tty->name == 0 && name == 0)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2022 || (name && t->display_info.tty->name
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2023 && !strcmp (t->display_info.tty->name, name)))
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2024 && TERMINAL_ACTIVE_P (t))
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2025 return t;
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2026 };
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2027
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2028 return 0;
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2029 }
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2030
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2031
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2032 DEFUN ("tty-type", Ftty_type, Stty_type, 0, 1, 0,
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2033 doc: /* Return the type of the tty device that TERMINAL uses.
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2034
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2035 TERMINAL can be a terminal id, a frame or nil (meaning the selected
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2036 frame's terminal). */)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2037 (terminal)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2038 Lisp_Object terminal;
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2039 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2040 struct terminal *t = get_terminal (terminal, 1);
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2041
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2042 if (t->type != output_termcap)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2043 error ("Terminal %d is not a termcap terminal", t->id);
83167
69ebc75cb461 Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83161
diff changeset
2044
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2045 if (t->display_info.tty->type)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2046 return build_string (t->display_info.tty->type);
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2047 else
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2048 return Qnil;
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2049 }
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2050
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2051 DEFUN ("controlling-tty-p", Fcontrolling_tty_p, Scontrolling_tty_p, 0, 1, 0,
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2052 doc: /* Return non-nil if TERMINAL is on the controlling tty of the Emacs process.
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2053
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2054 TERMINAL can be a terminal id, a frame or nil (meaning the selected
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2055 frame's terminal). This function always returns nil if TERMINAL
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2056 is not on a tty device. */)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2057 (terminal)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2058 Lisp_Object terminal;
83173
6b4b299e2cd5 Fix suspend-frame on the controlling tty (reported by Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83168
diff changeset
2059 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2060 struct terminal *t = get_terminal (terminal, 1);
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2061
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2062 if (t->type != output_termcap || t->display_info.tty->name)
83173
6b4b299e2cd5 Fix suspend-frame on the controlling tty (reported by Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83168
diff changeset
2063 return Qnil;
6b4b299e2cd5 Fix suspend-frame on the controlling tty (reported by Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83168
diff changeset
2064 else
6b4b299e2cd5 Fix suspend-frame on the controlling tty (reported by Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83168
diff changeset
2065 return Qt;
6b4b299e2cd5 Fix suspend-frame on the controlling tty (reported by Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83168
diff changeset
2066 }
6b4b299e2cd5 Fix suspend-frame on the controlling tty (reported by Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83168
diff changeset
2067
83311
c016d82bf02b Merged from miles@gnu.org--gnu-2005 (patch 423-434)
Karoly Lorentey <lorentey@elte.hu>
parents: 83299 63549
diff changeset
2068 DEFUN ("tty-no-underline", Ftty_no_underline, Stty_no_underline, 0, 1, 0,
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2069 doc: /* Declare that the tty used by TERMINAL does not handle underlining.
83311
c016d82bf02b Merged from miles@gnu.org--gnu-2005 (patch 423-434)
Karoly Lorentey <lorentey@elte.hu>
parents: 83299 63549
diff changeset
2070 This is used to override the terminfo data, for certain terminals that
c016d82bf02b Merged from miles@gnu.org--gnu-2005 (patch 423-434)
Karoly Lorentey <lorentey@elte.hu>
parents: 83299 63549
diff changeset
2071 do not really do underlining, but say that they do. This function has
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2072 no effect if used on a non-tty terminal.
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2073
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2074 TERMINAL can be a terminal id, a frame or nil (meaning the selected
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2075 frame's terminal). This function always returns nil if TERMINAL
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2076 is not on a tty device. */)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2077 (terminal)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2078 Lisp_Object terminal;
83311
c016d82bf02b Merged from miles@gnu.org--gnu-2005 (patch 423-434)
Karoly Lorentey <lorentey@elte.hu>
parents: 83299 63549
diff changeset
2079 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2080 struct terminal *t = get_terminal (terminal, 1);
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2081
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2082 if (t->type == output_termcap)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2083 t->display_info.tty->TS_enter_underline_mode = 0;
83311
c016d82bf02b Merged from miles@gnu.org--gnu-2005 (patch 423-434)
Karoly Lorentey <lorentey@elte.hu>
parents: 83299 63549
diff changeset
2084 return Qnil;
c016d82bf02b Merged from miles@gnu.org--gnu-2005 (patch 423-434)
Karoly Lorentey <lorentey@elte.hu>
parents: 83299 63549
diff changeset
2085 }
c016d82bf02b Merged from miles@gnu.org--gnu-2005 (patch 423-434)
Karoly Lorentey <lorentey@elte.hu>
parents: 83299 63549
diff changeset
2086
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2087
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2088
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2089 DEFUN ("suspend-tty", Fsuspend_tty, Ssuspend_tty, 0, 1, 0,
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2090 doc: /* Suspend the terminal device TTY.
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2091
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2092 The device is restored to its default state, and Emacs ceases all
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2093 access to the tty device. Frames that use the device are not deleted,
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2094 but input is not read from them and if they change, their display is
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2095 not updated.
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2096
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2097 TTY may be a terminal id, a frame, or nil for the terminal device of
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2098 the currently selected frame.
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2099
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2100 This function runs `suspend-tty-functions' after suspending the
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2101 device. The functions are run with one arg, the id of the suspended
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2102 terminal device.
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2103
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2104 `suspend-tty' does nothing if it is called on a device that is already
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2105 suspended.
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2106
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2107 A suspended tty may be resumed by calling `resume-tty' on it. */)
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2108 (tty)
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2109 Lisp_Object tty;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2110 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2111 struct terminal *t = get_tty_terminal (tty);
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2112 FILE *f;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2113
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2114 if (!t)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2115 error ("Unknown tty device");
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2116
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2117 f = t->display_info.tty->input;
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2118
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2119 if (f)
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2120 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2121 reset_sys_modes (t->display_info.tty);
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2122
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2123 delete_keyboard_wait_descriptor (fileno (f));
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2124
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2125 fclose (f);
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2126 if (f != t->display_info.tty->output)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2127 fclose (t->display_info.tty->output);
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2128
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2129 t->display_info.tty->input = 0;
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2130 t->display_info.tty->output = 0;
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2131
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2132 if (FRAMEP (t->display_info.tty->top_frame))
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2133 FRAME_SET_VISIBLE (XFRAME (t->display_info.tty->top_frame), 0);
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2134
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2135 /* Run `suspend-tty-functions'. */
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2136 if (!NILP (Vrun_hooks))
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2137 {
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2138 Lisp_Object args[2];
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2139 args[0] = intern ("suspend-tty-functions");
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2140 args[1] = make_number (t->id);
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2141 Frun_hook_with_args (2, args);
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2142 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2143 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2144
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2145 return Qnil;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2146 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2147
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2148 DEFUN ("resume-tty", Fresume_tty, Sresume_tty, 0, 1, 0,
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2149 doc: /* Resume the previously suspended terminal device TTY.
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2150 The terminal is opened and reinitialized. Frames that are on the
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2151 suspended terminal are revived.
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2152
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2153 It is an error to resume a terminal while another terminal is active
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2154 on the same device.
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2155
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2156 This function runs `resume-tty-functions' after resuming the terminal.
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2157 The functions are run with one arg, the id of the resumed terminal
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2158 device.
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2159
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2160 `resume-tty' does nothing if it is called on a device that is not
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2161 suspended.
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2162
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2163 TTY may be a terminal id, a frame, or nil for the terminal device of
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2164 the currently selected frame. */)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2165 (tty)
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2166 Lisp_Object tty;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2167 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2168 struct terminal *t = get_tty_terminal (tty);
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2169 int fd;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2170
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2171 if (!t)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2172 error ("Unknown tty device");
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2173
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2174 if (!t->display_info.tty->input)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2175 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2176 if (get_named_tty (t->display_info.tty->name))
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2177 error ("Cannot resume display while another display is active on the same device");
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2178
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2179 fd = emacs_open (t->display_info.tty->name, O_RDWR | O_NOCTTY, 0);
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2180
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2181 /* XXX What if open fails? */
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2182
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2183 dissociate_if_controlling_tty (fd);
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2184
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2185 t->display_info.tty->output = fdopen (fd, "w+");
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2186 t->display_info.tty->input = t->display_info.tty->output;
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2187
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2188 add_keyboard_wait_descriptor (fd);
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2189
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2190 if (FRAMEP (t->display_info.tty->top_frame))
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2191 FRAME_SET_VISIBLE (XFRAME (t->display_info.tty->top_frame), 1);
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2192
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2193 init_sys_modes (t->display_info.tty);
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2194
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2195 /* Run `suspend-tty-functions'. */
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2196 if (!NILP (Vrun_hooks))
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2197 {
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2198 Lisp_Object args[2];
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2199 args[0] = intern ("resume-tty-functions");
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2200 args[1] = make_number (t->id);
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2201 Frun_hook_with_args (2, args);
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2202 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2203 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2204
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2205 return Qnil;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2206 }
83311
c016d82bf02b Merged from miles@gnu.org--gnu-2005 (patch 423-434)
Karoly Lorentey <lorentey@elte.hu>
parents: 83299 63549
diff changeset
2207
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2208
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
2209 /***********************************************************************
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
2210 Initialization
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
2211 ***********************************************************************/
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
2212
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2213 /* Initialize the tty-dependent part of frame F. The frame must
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2214 already have its device initialized. */
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
2215
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
2216 void
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2217 create_tty_output (struct frame *f)
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2218 {
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2219 struct tty_output *t;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2220
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2221 if (! FRAME_TERMCAP_P (f))
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2222 abort ();
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2223
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2224 t = xmalloc (sizeof (struct tty_output));
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2225 bzero (t, sizeof (struct tty_output));
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2226
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2227 t->display_info = FRAME_TERMINAL (f)->display_info.tty;
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2228
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2229 f->output_data.tty = t;
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2230 }
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2231
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2232 /* Delete the tty-dependent part of frame F. */
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2233
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2234 static void
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2235 delete_tty_output (struct frame *f)
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2236 {
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2237 if (! FRAME_TERMCAP_P (f))
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2238 abort ();
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2239
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2240 xfree (f->output_data.tty);
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2241 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2242
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2243
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2244
83086
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2245 /* Drop the controlling terminal if fd is the same device. */
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2246 static void
83086
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2247 dissociate_if_controlling_tty (int fd)
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2248 {
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2249 int pgid;
83154
ae72b7a6c292 Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents: 83147
diff changeset
2250 EMACS_GET_TTY_PGRP (fd, &pgid); /* If tcgetpgrp succeeds, fd is the ctty. */
83086
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2251 if (pgid != -1)
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2252 {
83154
ae72b7a6c292 Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents: 83147
diff changeset
2253 #if defined (USG) && !defined (BSD_PGRPS)
83086
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2254 setpgrp ();
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2255 no_controlling_tty = 1;
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2256 #else
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2257 #ifdef TIOCNOTTY /* Try BSD ioctls. */
83154
ae72b7a6c292 Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents: 83147
diff changeset
2258 sigblock (sigmask (SIGTTOU));
ae72b7a6c292 Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents: 83147
diff changeset
2259 fd = emacs_open ("/dev/tty", O_RDWR, 0);
ae72b7a6c292 Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents: 83147
diff changeset
2260 if (fd != -1 && ioctl (fd, TIOCNOTTY, 0) != -1)
ae72b7a6c292 Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents: 83147
diff changeset
2261 {
ae72b7a6c292 Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents: 83147
diff changeset
2262 no_controlling_tty = 1;
ae72b7a6c292 Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents: 83147
diff changeset
2263 }
ae72b7a6c292 Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents: 83147
diff changeset
2264 if (fd != -1)
ae72b7a6c292 Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents: 83147
diff changeset
2265 emacs_close (fd);
ae72b7a6c292 Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents: 83147
diff changeset
2266 sigunblock (sigmask (SIGTTOU));
ae72b7a6c292 Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents: 83147
diff changeset
2267 #else
ae72b7a6c292 Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents: 83147
diff changeset
2268 /* Unknown system. */
ae72b7a6c292 Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents: 83147
diff changeset
2269 croak ();
ae72b7a6c292 Dissociate from the controlling tty correctly on FreeBSD.
Karoly Lorentey <lorentey@elte.hu>
parents: 83147
diff changeset
2270 #endif /* ! TIOCNOTTY */
83158
f948c9fd910c Fix parse error in term.c (ARISAWA Akihiro).
Karoly Lorentey <lorentey@elte.hu>
parents: 83154
diff changeset
2271 #endif /* ! USG */
83086
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2272 }
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2273 }
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2274
83338
5f293f92f85e Fix compilation error in src/term.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83332
diff changeset
2275 static void maybe_fatal();
5f293f92f85e Fix compilation error in src/term.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83332
diff changeset
2276
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2277 /* Create a termcap display on the tty device with the given name and
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2278 type.
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2279
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2280 If NAME is NULL, then use the controlling tty, i.e., stdin/stdout.
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2281 Otherwise NAME should be a path to the tty device file,
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2282 e.g. "/dev/pts/7".
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2283
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2284 TERMINAL_TYPE is the termcap type of the device, e.g. "vt100".
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2285
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2286 If MUST_SUCCEED is true, then all errors are fatal. */
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
2287
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2288 struct terminal *
83341
76e51706154e Rename term_init to init_tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83338
diff changeset
2289 init_tty (char *name, char *terminal_type, int must_succeed)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2290 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2291 char *area;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2292 char **address = &area;
52265
84e49afb2178 (term_init): Use a buffer of size 4096 for tgetent since
Richard M. Stallman <rms@gnu.org>
parents: 51212
diff changeset
2293 char *buffer = NULL;
52314
529dd59ee898 (term_init): Remove `const' from buffer_size's declaration.
Eli Zaretskii <eliz@gnu.org>
parents: 52294
diff changeset
2294 int buffer_size = 4096;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2295 register char *p;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2296 int status;
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
2297 struct tty_display_info *tty;
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2298 struct terminal *terminal;
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2299
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2300 if (!terminal_type)
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2301 maybe_fatal (must_succeed, 0, 0,
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2302 "Unknown terminal type",
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2303 "Unknown terminal type");
83167
69ebc75cb461 Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83161
diff changeset
2304
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2305 /* If we already have a terminal on the given device, use that. If
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2306 all such terminals are suspended, create a new one instead. */
83341
76e51706154e Rename term_init to init_tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83338
diff changeset
2307 /* XXX Perhaps this should be made explicit by having init_tty
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2308 always create a new terminal and separating terminal and frame
83167
69ebc75cb461 Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83161
diff changeset
2309 creation on Lisp level. */
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2310 terminal = get_named_tty (name);
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2311 if (terminal)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2312 return terminal;
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2313
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2314 terminal = create_terminal ();
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2315 tty = (struct tty_display_info *) xmalloc (sizeof (struct tty_display_info));
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2316 bzero (tty, sizeof (struct tty_display_info));
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2317 tty->next = tty_list;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2318 tty_list = tty;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2319
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2320 terminal->type = output_termcap;
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2321 terminal->display_info.tty = tty;
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2322 tty->terminal = terminal;
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2323
82991
2b26656ff804 MULTI_KBOARD support for ttys. Input-related bugfixes for X+tty sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82990
diff changeset
2324 tty->Wcm = (struct cm *) xmalloc (sizeof (struct cm));
2b26656ff804 MULTI_KBOARD support for ttys. Input-related bugfixes for X+tty sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82990
diff changeset
2325 Wcm_clear (tty);
2b26656ff804 MULTI_KBOARD support for ttys. Input-related bugfixes for X+tty sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82990
diff changeset
2326
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2327 terminal->rif = 0; /* ttys don't support window-based redisplay. */
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2328
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2329 terminal->cursor_to_hook = &tty_cursor_to;
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2330 terminal->raw_cursor_to_hook = &tty_raw_cursor_to;
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2331
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2332 terminal->clear_to_end_hook = &tty_clear_to_end;
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2333 terminal->clear_frame_hook = &tty_clear_frame;
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2334 terminal->clear_end_of_line_hook = &tty_clear_end_of_line;
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2335
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2336 terminal->ins_del_lines_hook = &tty_ins_del_lines;
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2337
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2338 terminal->insert_glyphs_hook = &tty_insert_glyphs;
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2339 terminal->write_glyphs_hook = &tty_write_glyphs;
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2340 terminal->delete_glyphs_hook = &tty_delete_glyphs;
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2341
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2342 terminal->ring_bell_hook = &tty_ring_bell;
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2343
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2344 terminal->reset_terminal_modes_hook = &tty_reset_terminal_modes;
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2345 terminal->set_terminal_modes_hook = &tty_set_terminal_modes;
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2346 terminal->update_begin_hook = 0; /* Not needed. */
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2347 terminal->update_end_hook = &tty_update_end;
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2348 terminal->set_terminal_window_hook = &tty_set_terminal_window;
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2349
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2350 terminal->mouse_position_hook = 0; /* Not needed. */
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2351 terminal->frame_rehighlight_hook = 0; /* Not needed. */
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2352 terminal->frame_raise_lower_hook = 0; /* Not needed. */
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2353
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2354 terminal->set_vertical_scroll_bar_hook = 0; /* Not needed. */
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2355 terminal->condemn_scroll_bars_hook = 0; /* Not needed. */
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2356 terminal->redeem_scroll_bar_hook = 0; /* Not needed. */
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2357 terminal->judge_scroll_bars_hook = 0; /* Not needed. */
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2358
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2359 terminal->read_socket_hook = &tty_read_avail_input; /* keyboard.c */
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2360 terminal->frame_up_to_date_hook = 0; /* Not needed. */
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2361
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2362 terminal->delete_frame_hook = &delete_tty_output;
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2363 terminal->delete_terminal_hook = &delete_tty;
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2364
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2365 if (name)
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2366 {
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2367 int fd;
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2368 FILE *file;
83032
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2369
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2370 #ifdef O_IGNORE_CTTY
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2371 /* Open the terminal device. Don't recognize it as our
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2372 controlling terminal, and don't make it the controlling tty
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2373 if we don't have one at the moment. */
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2374 fd = emacs_open (name, O_RDWR | O_IGNORE_CTTY | O_NOCTTY, 0);
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2375 #else
83074
34a7a8f40548 Fix background-mode on terminal frames (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83065
diff changeset
2376 /* Alas, O_IGNORE_CTTY is a GNU extension that seems to be only
34a7a8f40548 Fix background-mode on terminal frames (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83065
diff changeset
2377 defined on Hurd. On other systems, we need to dissociate
34a7a8f40548 Fix background-mode on terminal frames (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83065
diff changeset
2378 ourselves from the controlling tty when we want to open a
83086
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2379 frame on the same terminal. */
83032
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2380
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2381 fd = emacs_open (name, O_RDWR | O_NOCTTY, 0);
83086
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2382
83032
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2383 #endif /* O_IGNORE_CTTY */
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2384
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2385 if (fd < 0)
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2386 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2387 delete_tty (terminal);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2388 error ("Could not open file: %s", name);
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2389 }
83317
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
2390 if (!isatty (fd))
83032
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2391 {
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2392 close (fd);
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2393 error ("Not a tty device: %s", name);
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2394 }
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2395
83086
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2396 dissociate_if_controlling_tty (fd);
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2397
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2398 file = fdopen (fd, "w+");
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
2399 tty->name = xstrdup (name);
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2400 terminal->name = xstrdup (name);
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
2401 tty->input = file;
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
2402 tty->output = file;
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2403 }
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2404 else
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2405 {
83032
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2406 if (no_controlling_tty)
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2407 {
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2408 /* Opening a frame on stdout is unsafe if we have
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2409 disconnected our controlling terminal. */
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2410 error ("There is no controlling terminal any more");
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
2411 }
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
2412 tty->name = 0;
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2413 terminal->name = xstrdup (ttyname (0));
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
2414 tty->input = stdin;
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
2415 tty->output = stdout;
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2416 }
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2417
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
2418 tty->type = xstrdup (terminal_type);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2419
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2420 add_keyboard_wait_descriptor (fileno (tty->input));
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2421
58638
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
2422 encode_terminal_bufsize = 0;
67bea14002c3 (encode_terminal_buf, encode_terminal_bufsize): New
Kenichi Handa <handa@m17n.org>
parents: 54428
diff changeset
2423
9797
05d9072c5a38 (term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents: 9658
diff changeset
2424 #ifdef WINDOWSNT
16885
ddd632f61ce3 (term_init): Use new name initialize_w32_display.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16260
diff changeset
2425 initialize_w32_display ();
9797
05d9072c5a38 (term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents: 9658
diff changeset
2426
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2427 Wcm_clear (tty);
9797
05d9072c5a38 (term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents: 9658
diff changeset
2428
24431
00398ed56396 (term_init): Use xmalloc, not malloc.
Karl Heuer <kwzh@gnu.org>
parents: 24263
diff changeset
2429 area = (char *) xmalloc (2044);
9797
05d9072c5a38 (term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents: 9658
diff changeset
2430
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2431 FrameRows (tty) = FRAME_LINES (f); /* XXX */
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2432 FrameCols (tty) = FRAME_COLS (f); /* XXX */
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2433 tty->specified_window = FRAME_LINES (f); /* XXX */
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2434
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2435 tty->terminal->delete_in_insert_mode = 1;
82990
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
2436
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
2437 UseTabs (tty) = 0;
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2438 terminal->scroll_region_ok = 0;
83342
9216636c02fc Rename `struct display' to `struct device'. Update function, parameter and variable names accordingly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83341
diff changeset
2439
9216636c02fc Rename `struct display' to `struct device'. Update function, parameter and variable names accordingly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83341
diff changeset
2440 /* Seems to insert lines when it's not supposed to, messing up the
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2441 display. In doing a trace, it didn't seem to be called much, so I
83342
9216636c02fc Rename `struct display' to `struct device'. Update function, parameter and variable names accordingly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83341
diff changeset
2442 don't think we're losing anything by turning it off. */
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2443 terminal->line_ins_del_ok = 0;
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2444 terminal->char_ins_del_ok = 1;
9797
05d9072c5a38 (term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents: 9658
diff changeset
2445
05d9072c5a38 (term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents: 9658
diff changeset
2446 baud_rate = 19200;
05d9072c5a38 (term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents: 9658
diff changeset
2447
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2448 FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; /* XXX */
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2449 FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none; /* XXX */
27519
fd4d74bc1e42 (term_init) [WINDOWSNT]: Initialize TN_max_colors.
Jason Rumney <jasonr@gnu.org>
parents: 27128
diff changeset
2450 TN_max_colors = 16; /* Required to be non-zero for tty-display-color-p */
9797
05d9072c5a38 (term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents: 9658
diff changeset
2451
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2452 return terminal;
21827
87c7f4bd99da Include cm.h after dispextern.h to avoid name conflicts
Geoff Voelker <voelker@cs.washington.edu>
parents: 21624
diff changeset
2453 #else /* not WINDOWSNT */
9797
05d9072c5a38 (term_init) [WINDOWSNT]: Do some Windows-specific
Richard M. Stallman <rms@gnu.org>
parents: 9658
diff changeset
2454
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2455 Wcm_clear (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2456
52265
84e49afb2178 (term_init): Use a buffer of size 4096 for tgetent since
Richard M. Stallman <rms@gnu.org>
parents: 51212
diff changeset
2457 buffer = (char *) xmalloc (buffer_size);
83086
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2458
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2459 /* On some systems, tgetent tries to access the controlling
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2460 terminal. */
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2461 sigblock (sigmask (SIGTTOU));
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2462 status = tgetent (buffer, terminal_type);
83086
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2463 sigunblock (sigmask (SIGTTOU));
347ce3d5d79c Fix dropping of the controlling tty on Solaris (Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83082
diff changeset
2464
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2465 if (status < 0)
10824
894369e950f5 (term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents: 10771
diff changeset
2466 {
894369e950f5 (term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents: 10771
diff changeset
2467 #ifdef TERMINFO
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2468 maybe_fatal (must_succeed, buffer, terminal,
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2469 "Cannot open terminfo database file",
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2470 "Cannot open terminfo database file");
10824
894369e950f5 (term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents: 10771
diff changeset
2471 #else
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2472 maybe_fatal (must_succeed, buffer, terminal,
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2473 "Cannot open termcap database file",
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2474 "Cannot open termcap database file");
10824
894369e950f5 (term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents: 10771
diff changeset
2475 #endif
894369e950f5 (term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents: 10771
diff changeset
2476 }
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2477 if (status == 0)
10824
894369e950f5 (term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents: 10771
diff changeset
2478 {
894369e950f5 (term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents: 10771
diff changeset
2479 #ifdef TERMINFO
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2480 maybe_fatal (must_succeed, buffer, terminal,
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2481 "Terminal type %s is not defined",
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2482 "Terminal type %s is not defined.\n\
10824
894369e950f5 (term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents: 10771
diff changeset
2483 If that is not the actual type of terminal you have,\n\
894369e950f5 (term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents: 10771
diff changeset
2484 use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
894369e950f5 (term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents: 10771
diff changeset
2485 `setenv TERM ...') to specify the correct type. It may be necessary\n\
16894
cd8d6bf6b320 (fatal): Print a newline at the end.
Richard M. Stallman <rms@gnu.org>
parents: 16885
diff changeset
2486 to do `unset TERMINFO' (C-shell: `unsetenv TERMINFO') as well.",
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2487 terminal_type);
10824
894369e950f5 (term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents: 10771
diff changeset
2488 #else
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2489 maybe_fatal (must_succeed, buffer, terminal,
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2490 "Terminal type %s is not defined",
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2491 "Terminal type %s is not defined.\n\
4499
c7bfd863aefd (term_init): Improve error messages (give sh commands).
Richard M. Stallman <rms@gnu.org>
parents: 3706
diff changeset
2492 If that is not the actual type of terminal you have,\n\
c7bfd863aefd (term_init): Improve error messages (give sh commands).
Richard M. Stallman <rms@gnu.org>
parents: 3706
diff changeset
2493 use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
c7bfd863aefd (term_init): Improve error messages (give sh commands).
Richard M. Stallman <rms@gnu.org>
parents: 3706
diff changeset
2494 `setenv TERM ...') to specify the correct type. It may be necessary\n\
16894
cd8d6bf6b320 (fatal): Print a newline at the end.
Richard M. Stallman <rms@gnu.org>
parents: 16885
diff changeset
2495 to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2496 terminal_type);
10824
894369e950f5 (term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents: 10771
diff changeset
2497 #endif
894369e950f5 (term_init) [TERMINFO]: Make error message more accurate.
Karl Heuer <kwzh@gnu.org>
parents: 10771
diff changeset
2498 }
52265
84e49afb2178 (term_init): Use a buffer of size 4096 for tgetent since
Richard M. Stallman <rms@gnu.org>
parents: 51212
diff changeset
2499
52294
d9ae4cdf1ed1 (term_init): Fix previous change
Kenichi Handa <handa@m17n.org>
parents: 52293
diff changeset
2500 #ifndef TERMINFO
52265
84e49afb2178 (term_init): Use a buffer of size 4096 for tgetent since
Richard M. Stallman <rms@gnu.org>
parents: 51212
diff changeset
2501 if (strlen (buffer) >= buffer_size)
84e49afb2178 (term_init): Use a buffer of size 4096 for tgetent since
Richard M. Stallman <rms@gnu.org>
parents: 51212
diff changeset
2502 abort ();
52294
d9ae4cdf1ed1 (term_init): Fix previous change
Kenichi Handa <handa@m17n.org>
parents: 52293
diff changeset
2503 buffer_size = strlen (buffer);
52293
473d34d4814c (term_init): Fix previous change; don't rely on the
Kenichi Handa <handa@m17n.org>
parents: 52265
diff changeset
2504 #endif
52294
d9ae4cdf1ed1 (term_init): Fix previous change
Kenichi Handa <handa@m17n.org>
parents: 52293
diff changeset
2505 area = (char *) xmalloc (buffer_size);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2506
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2507 tty->TS_ins_line = tgetstr ("al", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2508 tty->TS_ins_multi_lines = tgetstr ("AL", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2509 tty->TS_bell = tgetstr ("bl", address);
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2510 BackTab (tty) = tgetstr ("bt", address);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2511 tty->TS_clr_to_bottom = tgetstr ("cd", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2512 tty->TS_clr_line = tgetstr ("ce", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2513 tty->TS_clr_frame = tgetstr ("cl", address);
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2514 ColPosition (tty) = NULL; /* tgetstr ("ch", address); */
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2515 AbsPosition (tty) = tgetstr ("cm", address);
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2516 CR (tty) = tgetstr ("cr", address);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2517 tty->TS_set_scroll_region = tgetstr ("cs", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2518 tty->TS_set_scroll_region_1 = tgetstr ("cS", address);
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2519 RowPosition (tty) = tgetstr ("cv", address);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2520 tty->TS_del_char = tgetstr ("dc", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2521 tty->TS_del_multi_chars = tgetstr ("DC", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2522 tty->TS_del_line = tgetstr ("dl", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2523 tty->TS_del_multi_lines = tgetstr ("DL", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2524 tty->TS_delete_mode = tgetstr ("dm", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2525 tty->TS_end_delete_mode = tgetstr ("ed", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2526 tty->TS_end_insert_mode = tgetstr ("ei", address);
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2527 Home (tty) = tgetstr ("ho", address);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2528 tty->TS_ins_char = tgetstr ("ic", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2529 tty->TS_ins_multi_chars = tgetstr ("IC", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2530 tty->TS_insert_mode = tgetstr ("im", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2531 tty->TS_pad_inserted_char = tgetstr ("ip", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2532 tty->TS_end_keypad_mode = tgetstr ("ke", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2533 tty->TS_keypad_mode = tgetstr ("ks", address);
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2534 LastLine (tty) = tgetstr ("ll", address);
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2535 Right (tty) = tgetstr ("nd", address);
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2536 Down (tty) = tgetstr ("do", address);
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2537 if (!Down (tty))
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2538 Down (tty) = tgetstr ("nl", address); /* Obsolete name for "do" */
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2539 #ifdef VMS
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2540 /* VMS puts a carriage return before each linefeed,
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2541 so it is not safe to use linefeeds. */
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2542 if (Down (tty) && Down (tty)[0] == '\n' && Down (tty)[1] == '\0')
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2543 Down (tty) = 0;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2544 #endif /* VMS */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2545 if (tgetflag ("bs"))
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2546 Left (tty) = "\b"; /* can't possibly be longer! */
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2547 else /* (Actually, "bs" is obsolete...) */
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2548 Left (tty) = tgetstr ("le", address);
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2549 if (!Left (tty))
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2550 Left (tty) = tgetstr ("bc", address); /* Obsolete name for "le" */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2551 tty->TS_pad_char = tgetstr ("pc", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2552 tty->TS_repeat = tgetstr ("rp", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2553 tty->TS_end_standout_mode = tgetstr ("se", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2554 tty->TS_fwd_scroll = tgetstr ("sf", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2555 tty->TS_standout_mode = tgetstr ("so", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2556 tty->TS_rev_scroll = tgetstr ("sr", address);
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2557 tty->Wcm->cm_tab = tgetstr ("ta", address);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2558 tty->TS_end_termcap_modes = tgetstr ("te", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2559 tty->TS_termcap_modes = tgetstr ("ti", address);
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2560 Up (tty) = tgetstr ("up", address);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2561 tty->TS_visible_bell = tgetstr ("vb", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2562 tty->TS_cursor_normal = tgetstr ("ve", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2563 tty->TS_cursor_visible = tgetstr ("vs", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2564 tty->TS_cursor_invisible = tgetstr ("vi", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2565 tty->TS_set_window = tgetstr ("wi", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2566
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2567 tty->TS_enter_underline_mode = tgetstr ("us", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2568 tty->TS_exit_underline_mode = tgetstr ("ue", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2569 tty->TS_enter_bold_mode = tgetstr ("md", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2570 tty->TS_enter_dim_mode = tgetstr ("mh", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2571 tty->TS_enter_blink_mode = tgetstr ("mb", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2572 tty->TS_enter_reverse_mode = tgetstr ("mr", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2573 tty->TS_enter_alt_charset_mode = tgetstr ("as", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2574 tty->TS_exit_alt_charset_mode = tgetstr ("ae", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2575 tty->TS_exit_attribute_mode = tgetstr ("me", address);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
2576
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2577 MultiUp (tty) = tgetstr ("UP", address);
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2578 MultiDown (tty) = tgetstr ("DO", address);
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2579 MultiLeft (tty) = tgetstr ("LE", address);
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2580 MultiRight (tty) = tgetstr ("RI", address);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2581
26425
08c26156186a (term_init): If "op" isn't available, don't support color
Gerd Moellmann <gerd@gnu.org>
parents: 25727
diff changeset
2582 /* SVr4/ANSI color suppert. If "op" isn't available, don't support
08c26156186a (term_init): If "op" isn't available, don't support color
Gerd Moellmann <gerd@gnu.org>
parents: 25727
diff changeset
2583 color because we can't switch back to the default foreground and
08c26156186a (term_init): If "op" isn't available, don't support color
Gerd Moellmann <gerd@gnu.org>
parents: 25727
diff changeset
2584 background. */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2585 tty->TS_orig_pair = tgetstr ("op", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2586 if (tty->TS_orig_pair)
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
2587 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2588 tty->TS_set_foreground = tgetstr ("AF", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2589 tty->TS_set_background = tgetstr ("AB", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2590 if (!tty->TS_set_foreground)
26425
08c26156186a (term_init): If "op" isn't available, don't support color
Gerd Moellmann <gerd@gnu.org>
parents: 25727
diff changeset
2591 {
08c26156186a (term_init): If "op" isn't available, don't support color
Gerd Moellmann <gerd@gnu.org>
parents: 25727
diff changeset
2592 /* SVr4. */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2593 tty->TS_set_foreground = tgetstr ("Sf", address);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2594 tty->TS_set_background = tgetstr ("Sb", address);
26425
08c26156186a (term_init): If "op" isn't available, don't support color
Gerd Moellmann <gerd@gnu.org>
parents: 25727
diff changeset
2595 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
2596
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2597 tty->TN_max_colors = tgetnum ("Co");
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2598 tty->TN_max_pairs = tgetnum ("pa");
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2599
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2600 tty->TN_no_color_video = tgetnum ("NC");
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2601 if (tty->TN_no_color_video == -1)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2602 tty->TN_no_color_video = 0;
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
2603 }
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
2604
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2605 tty_default_color_capabilities (tty, 1);
42742
73fcf65b58d3 (tty_default_color_capabilities, tty_setup_colors)
Eli Zaretskii <eliz@gnu.org>
parents: 42122
diff changeset
2606
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2607 MagicWrap (tty) = tgetflag ("xn");
11530
a265aaa699e0 (term_init): MagicWrap implies AutoWrap.
Karl Heuer <kwzh@gnu.org>
parents: 11235
diff changeset
2608 /* Since we make MagicWrap terminals look like AutoWrap, we need to have
a265aaa699e0 (term_init): MagicWrap implies AutoWrap.
Karl Heuer <kwzh@gnu.org>
parents: 11235
diff changeset
2609 the former flag imply the latter. */
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2610 AutoWrap (tty) = MagicWrap (tty) || tgetflag ("am");
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2611 terminal->memory_below_frame = tgetflag ("db");
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2612 tty->TF_hazeltine = tgetflag ("hz");
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2613 terminal->must_write_spaces = tgetflag ("in");
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2614 tty->meta_key = tgetflag ("km") || tgetflag ("MT");
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2615 tty->TF_insmode_motion = tgetflag ("mi");
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2616 tty->TF_standout_motion = tgetflag ("ms");
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2617 tty->TF_underscore = tgetflag ("ul");
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2618 tty->TF_teleray = tgetflag ("xt");
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2619
83317
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
2620 #ifdef MULTI_KBOARD
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2621 terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2622 init_kboard (terminal->kboard);
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2623 terminal->kboard->next_kboard = all_kboards;
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2624 all_kboards = terminal->kboard;
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2625 terminal->kboard->reference_count++;
83317
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
2626 /* Don't let the initial kboard remain current longer than necessary.
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
2627 That would cause problems if a file loaded on startup tries to
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
2628 prompt in the mini-buffer. */
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
2629 if (current_kboard == initial_kboard)
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2630 current_kboard = terminal->kboard;
83317
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
2631 #endif
e235da12dd03 Make sure the terminfo function key sequences are set up in the correct function-key-map.
Karoly Lorentey <lorentey@elte.hu>
parents: 83315
diff changeset
2632
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2633 term_get_fkeys (address, terminal->kboard);
533
31e638e8fe93 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 425
diff changeset
2634
765
e4093444f9f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 732
diff changeset
2635 /* Get frame size from system, or else from termcap. */
16093
4c74d7f1cfa6 (term_init): Avoid type-mismatch calling get_frame_size.
Richard M. Stallman <rms@gnu.org>
parents: 15974
diff changeset
2636 {
4c74d7f1cfa6 (term_init): Avoid type-mismatch calling get_frame_size.
Richard M. Stallman <rms@gnu.org>
parents: 15974
diff changeset
2637 int height, width;
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
2638 get_tty_size (fileno (tty->input), &width, &height);
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2639 FrameCols (tty) = width;
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2640 FrameRows (tty) = height;
16093
4c74d7f1cfa6 (term_init): Avoid type-mismatch calling get_frame_size.
Richard M. Stallman <rms@gnu.org>
parents: 15974
diff changeset
2641 }
4c74d7f1cfa6 (term_init): Avoid type-mismatch calling get_frame_size.
Richard M. Stallman <rms@gnu.org>
parents: 15974
diff changeset
2642
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2643 if (FrameCols (tty) <= 0)
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2644 FrameCols (tty) = tgetnum ("co");
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2645 if (FrameRows (tty) <= 0)
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2646 FrameRows (tty) = tgetnum ("li");
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2647
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2648 if (FrameRows (tty) < 3 || FrameCols (tty) < 3)
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2649 maybe_fatal (must_succeed, NULL, terminal,
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2650 "Screen size %dx%d is too small"
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2651 "Screen size %dx%d is too small",
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2652 FrameCols (tty), FrameRows (tty));
10332
e14daed4a820 (term_init): Fatal error if screen is too small.
Richard M. Stallman <rms@gnu.org>
parents: 10261
diff changeset
2653
53225
4250e7e26247 Add a level of indirection to terminal characteristics.
Karoly Lorentey <lorentey@elte.hu>
parents: 52681
diff changeset
2654 #if 0 /* This is not used anywhere. */
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2655 tty->terminal->min_padding_speed = tgetnum ("pb");
53225
4250e7e26247 Add a level of indirection to terminal characteristics.
Karoly Lorentey <lorentey@elte.hu>
parents: 52681
diff changeset
2656 #endif
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2657
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2658 TabWidth (tty) = tgetnum ("tw");
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2659
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2660 #ifdef VMS
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2661 /* These capabilities commonly use ^J.
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2662 I don't know why, but sending them on VMS does not work;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2663 it causes following spaces to be lost, sometimes.
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2664 For now, the simplest fix is to avoid using these capabilities ever. */
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2665 if (Down (tty) && Down (tty)[0] == '\n')
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2666 Down (tty) = 0;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2667 #endif /* VMS */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2668
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2669 if (!tty->TS_bell)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2670 tty->TS_bell = "\07";
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2671
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2672 if (!tty->TS_fwd_scroll)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2673 tty->TS_fwd_scroll = Down (tty);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2674
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2675 PC = tty->TS_pad_char ? *tty->TS_pad_char : 0;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2676
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2677 if (TabWidth (tty) < 0)
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2678 TabWidth (tty) = 8;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46559
diff changeset
2679
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2680 /* Turned off since /etc/termcap seems to have :ta= for most terminals
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2681 and newer termcap doc does not seem to say there is a default.
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2682 if (!tty->Wcm->cm_tab)
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2683 tty->Wcm->cm_tab = "\t";
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2684 */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2685
40086
050b19294988 (TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents: 40081
diff changeset
2686 /* We don't support standout modes that use `magic cookies', so
050b19294988 (TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents: 40081
diff changeset
2687 turn off any that do. */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2688 if (tty->TS_standout_mode && tgetnum ("sg") >= 0)
40086
050b19294988 (TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents: 40081
diff changeset
2689 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2690 tty->TS_standout_mode = 0;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2691 tty->TS_end_standout_mode = 0;
40086
050b19294988 (TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents: 40081
diff changeset
2692 }
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2693 if (tty->TS_enter_underline_mode && tgetnum ("ug") >= 0)
40086
050b19294988 (TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents: 40081
diff changeset
2694 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2695 tty->TS_enter_underline_mode = 0;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2696 tty->TS_exit_underline_mode = 0;
40086
050b19294988 (TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents: 40081
diff changeset
2697 }
050b19294988 (TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents: 40081
diff changeset
2698
050b19294988 (TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents: 40081
diff changeset
2699 /* If there's no standout mode, try to use underlining instead. */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2700 if (tty->TS_standout_mode == 0)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2701 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2702 tty->TS_standout_mode = tty->TS_enter_underline_mode;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2703 tty->TS_end_standout_mode = tty->TS_exit_underline_mode;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2704 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2705
5933
560cee2048ed (term_init): If no `se', use `me';
Richard M. Stallman <rms@gnu.org>
parents: 5648
diff changeset
2706 /* If no `se' string, try using a `me' string instead.
560cee2048ed (term_init): If no `se', use `me';
Richard M. Stallman <rms@gnu.org>
parents: 5648
diff changeset
2707 If that fails, we can't use standout mode at all. */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2708 if (tty->TS_end_standout_mode == 0)
5933
560cee2048ed (term_init): If no `se', use `me';
Richard M. Stallman <rms@gnu.org>
parents: 5648
diff changeset
2709 {
8612
86065bec6fc9 (term_init): Added missing argument to tgetstr.
Richard M. Stallman <rms@gnu.org>
parents: 8027
diff changeset
2710 char *s = tgetstr ("me", address);
5933
560cee2048ed (term_init): If no `se', use `me';
Richard M. Stallman <rms@gnu.org>
parents: 5648
diff changeset
2711 if (s != 0)
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2712 tty->TS_end_standout_mode = s;
5933
560cee2048ed (term_init): If no `se', use `me';
Richard M. Stallman <rms@gnu.org>
parents: 5648
diff changeset
2713 else
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2714 tty->TS_standout_mode = 0;
5933
560cee2048ed (term_init): If no `se', use `me';
Richard M. Stallman <rms@gnu.org>
parents: 5648
diff changeset
2715 }
560cee2048ed (term_init): If no `se', use `me';
Richard M. Stallman <rms@gnu.org>
parents: 5648
diff changeset
2716
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2717 if (tty->TF_teleray)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2718 {
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2719 tty->Wcm->cm_tab = 0;
40086
050b19294988 (TN_standout_width, TF_xs, TN_magic_cookie_glitch_ul): Variables removed.
Miles Bader <miles@gnu.org>
parents: 40081
diff changeset
2720 /* We can't support standout mode, because it uses magic cookies. */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2721 tty->TS_standout_mode = 0;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2722 /* But that means we cannot rely on ^M to go to column zero! */
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2723 CR (tty) = 0;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2724 /* LF can't be trusted either -- can alter hpos */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2725 /* if move at column 0 thru a line with TS_standout_mode */
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2726 Down (tty) = 0;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2727 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2728
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2729 /* Special handling for certain terminal types known to need it */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2730
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2731 if (!strcmp (terminal_type, "supdup"))
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2732 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2733 terminal->memory_below_frame = 1;
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2734 tty->Wcm->cm_losewrap = 1;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2735 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2736 if (!strncmp (terminal_type, "c10", 3)
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2737 || !strcmp (terminal_type, "perq"))
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2738 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2739 /* Supply a makeshift :wi string.
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2740 This string is not valid in general since it works only
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2741 for windows starting at the upper left corner;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2742 but that is all Emacs uses.
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2743
765
e4093444f9f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 732
diff changeset
2744 This string works only if the frame is using
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2745 the top of the video memory, because addressing is memory-relative.
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2746 So first check the :ti string to see if that is true.
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2747
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2748 It would be simpler if the :wi string could go in the termcap
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2749 entry, but it can't because it is not fully valid.
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2750 If it were in the termcap entry, it would confuse other programs. */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2751 if (!tty->TS_set_window)
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2752 {
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2753 p = tty->TS_termcap_modes;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2754 while (*p && strcmp (p, "\033v "))
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2755 p++;
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2756 if (*p)
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2757 tty->TS_set_window = "\033v%C %C %C %C ";
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2758 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2759 /* Termcap entry often fails to have :in: flag */
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2760 terminal->must_write_spaces = 1;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2761 /* :ti string typically fails to have \E^G! in it */
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2762 /* This limits scope of insert-char to one line. */
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2763 strcpy (area, tty->TS_termcap_modes);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2764 strcat (area, "\033\007!");
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2765 tty->TS_termcap_modes = area;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2766 area += strlen (area) + 1;
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2767 p = AbsPosition (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2768 /* Change all %+ parameters to %C, to handle
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2769 values above 96 correctly for the C100. */
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2770 while (*p)
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2771 {
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2772 if (p[0] == '%' && p[1] == '+')
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2773 p[1] = 'C';
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2774 p++;
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2775 }
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2776 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2777
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2778 tty->specified_window = FrameRows (tty);
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2779
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2780 if (Wcm_init (tty) == -1) /* can't do cursor motion */
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2781 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2782 maybe_fatal (must_succeed, NULL, terminal,
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2783 "Terminal type \"%s\" is not powerful enough to run Emacs",
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2784 #ifdef VMS
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2785 "Terminal type \"%s\" is not powerful enough to run Emacs.\n\
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2786 It lacks the ability to position the cursor.\n\
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2787 If that is not the actual type of terminal you have, use either the\n\
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2788 DCL command `SET TERMINAL/DEVICE= ...' for DEC-compatible terminals,\n\
16894
cd8d6bf6b320 (fatal): Print a newline at the end.
Richard M. Stallman <rms@gnu.org>
parents: 16885
diff changeset
2789 or `define EMACS_TERM \"terminal type\"' for non-DEC terminals.",
12412
7f2c068121d8 (term_init): Alternative error messages for TERMCAP/TERMINFO.
Richard M. Stallman <rms@gnu.org>
parents: 12071
diff changeset
2790 #else /* not VMS */
7f2c068121d8 (term_init): Alternative error messages for TERMCAP/TERMINFO.
Richard M. Stallman <rms@gnu.org>
parents: 12071
diff changeset
2791 # ifdef TERMINFO
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2792 "Terminal type \"%s\" is not powerful enough to run Emacs.\n\
12412
7f2c068121d8 (term_init): Alternative error messages for TERMCAP/TERMINFO.
Richard M. Stallman <rms@gnu.org>
parents: 12071
diff changeset
2793 It lacks the ability to position the cursor.\n\
7f2c068121d8 (term_init): Alternative error messages for TERMCAP/TERMINFO.
Richard M. Stallman <rms@gnu.org>
parents: 12071
diff changeset
2794 If that is not the actual type of terminal you have,\n\
7f2c068121d8 (term_init): Alternative error messages for TERMCAP/TERMINFO.
Richard M. Stallman <rms@gnu.org>
parents: 12071
diff changeset
2795 use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
7f2c068121d8 (term_init): Alternative error messages for TERMCAP/TERMINFO.
Richard M. Stallman <rms@gnu.org>
parents: 12071
diff changeset
2796 `setenv TERM ...') to specify the correct type. It may be necessary\n\
16894
cd8d6bf6b320 (fatal): Print a newline at the end.
Richard M. Stallman <rms@gnu.org>
parents: 16885
diff changeset
2797 to do `unset TERMINFO' (C-shell: `unsetenv TERMINFO') as well.",
12412
7f2c068121d8 (term_init): Alternative error messages for TERMCAP/TERMINFO.
Richard M. Stallman <rms@gnu.org>
parents: 12071
diff changeset
2798 # else /* TERMCAP */
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2799 "Terminal type \"%s\" is not powerful enough to run Emacs.\n\
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2800 It lacks the ability to position the cursor.\n\
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2801 If that is not the actual type of terminal you have,\n\
4499
c7bfd863aefd (term_init): Improve error messages (give sh commands).
Richard M. Stallman <rms@gnu.org>
parents: 3706
diff changeset
2802 use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
c7bfd863aefd (term_init): Improve error messages (give sh commands).
Richard M. Stallman <rms@gnu.org>
parents: 3706
diff changeset
2803 `setenv TERM ...') to specify the correct type. It may be necessary\n\
16894
cd8d6bf6b320 (fatal): Print a newline at the end.
Richard M. Stallman <rms@gnu.org>
parents: 16885
diff changeset
2804 to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
12412
7f2c068121d8 (term_init): Alternative error messages for TERMCAP/TERMINFO.
Richard M. Stallman <rms@gnu.org>
parents: 12071
diff changeset
2805 # endif /* TERMINFO */
7f2c068121d8 (term_init): Alternative error messages for TERMCAP/TERMINFO.
Richard M. Stallman <rms@gnu.org>
parents: 12071
diff changeset
2806 #endif /*VMS */
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2807 terminal_type);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2808 }
82990
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
2809
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2810 if (FrameRows (tty) <= 0 || FrameCols (tty) <= 0)
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2811 maybe_fatal (must_succeed, NULL, terminal,
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2812 "Could not determine the frame size",
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2813 "Could not determine the frame size");
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2814
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2815 tty->delete_in_insert_mode
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2816 = tty->TS_delete_mode && tty->TS_insert_mode
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2817 && !strcmp (tty->TS_delete_mode, tty->TS_insert_mode);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2818
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2819 tty->se_is_so = (tty->TS_standout_mode
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2820 && tty->TS_end_standout_mode
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2821 && !strcmp (tty->TS_standout_mode, tty->TS_end_standout_mode));
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2822
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
2823 UseTabs (tty) = tabs_safe_p (fileno (tty->input)) && TabWidth (tty) == 8;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2824
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2825 terminal->scroll_region_ok
53232
22aaf1e5fbe6 Full support for multiple terminal I/O (with some rough edges).
Karoly Lorentey <lorentey@elte.hu>
parents: 53229
diff changeset
2826 = (tty->Wcm->cm_abs
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2827 && (tty->TS_set_window || tty->TS_set_scroll_region || tty->TS_set_scroll_region_1));
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2828
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2829 terminal->line_ins_del_ok
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2830 = (((tty->TS_ins_line || tty->TS_ins_multi_lines)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2831 && (tty->TS_del_line || tty->TS_del_multi_lines))
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2832 || (terminal->scroll_region_ok
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2833 && tty->TS_fwd_scroll && tty->TS_rev_scroll));
53226
dd3018b4785b Implemented multiple tty support.
Karoly Lorentey <lorentey@elte.hu>
parents: 53225
diff changeset
2834
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2835 terminal->char_ins_del_ok
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2836 = ((tty->TS_ins_char || tty->TS_insert_mode
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2837 || tty->TS_pad_inserted_char || tty->TS_ins_multi_chars)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2838 && (tty->TS_del_char || tty->TS_del_multi_chars));
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2839
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2840 terminal->fast_clear_end_of_line = tty->TS_clr_line != 0;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2841
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
2842 init_baud_rate (fileno (tty->input));
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2843
82990
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
2844 #ifdef AIXHFT
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
2845 /* The HFT system on AIX doesn't optimize for scrolling, so it's
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
2846 really ugly at times. */
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2847 terminal->line_ins_del_ok = 0;
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2848 terminal->char_ins_del_ok = 0;
82990
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
2849 #endif
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
2850
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2851 /* Don't do this. I think termcap may still need the buffer. */
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2852 /* xfree (buffer); */
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2853
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2854 /* Init system terminal modes (RAW or CBREAK, etc.). */
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2855 init_sys_modes (tty);
82990
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
2856
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2857 return terminal;
82991
2b26656ff804 MULTI_KBOARD support for ttys. Input-related bugfixes for X+tty sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82990
diff changeset
2858 #endif /* not WINDOWSNT */
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2859 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2860
83341
76e51706154e Rename term_init to init_tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83338
diff changeset
2861 /* Auxiliary error-handling function for init_tty.
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2862 Free BUFFER and delete TERMINAL, then call error or fatal
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
2863 with str1 or str2, respectively, according to MUST_SUCCEED. */
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
2864
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2865 static void
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2866 maybe_fatal (must_succeed, buffer, terminal, str1, str2, arg1, arg2)
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2867 int must_succeed;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2868 char *buffer;
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2869 struct terminal *terminal;
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2870 char *str1, *str2, *arg1, *arg2;
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2871 {
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2872 if (buffer)
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2873 xfree (buffer);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2874
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2875 if (terminal)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2876 delete_tty (terminal);
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2877
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2878 if (must_succeed)
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2879 fatal (str2, arg1, arg2);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2880 else
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2881 error (str1, arg1, arg2);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2882
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2883 abort ();
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2884 }
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2885
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2886 /* VARARGS 1 */
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
2887 void
65795
4b20a22635a5 * lisp.h (fatal): Undo previous change.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 65764
diff changeset
2888 fatal (str, arg1, arg2)
4b20a22635a5 * lisp.h (fatal): Undo previous change.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 65764
diff changeset
2889 char *str, *arg1, *arg2;
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2890 {
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2891 fprintf (stderr, "emacs: ");
65795
4b20a22635a5 * lisp.h (fatal): Undo previous change.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 65764
diff changeset
2892 fprintf (stderr, str, arg1, arg2);
4b20a22635a5 * lisp.h (fatal): Undo previous change.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 65764
diff changeset
2893 fprintf (stderr, "\n");
253
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2894 fflush (stderr);
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2895 exit (1);
96e7be36ffe5 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2896 }
6752
f9236145bad7 (system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 6652
diff changeset
2897
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2898
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2899
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2900 static int deleting_tty = 0;
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2901
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
2902
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2903 /* Delete the given tty terminal, closing all frames on it. */
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
2904
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
2905 static void
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2906 delete_tty (struct terminal *terminal)
63549
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
2907 {
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2908 struct tty_display_info *tty;
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2909 Lisp_Object tail, frame;
82995
039bd6989d29 Portability fixes (now it compiles & runs fine on Solaris).
Karoly Lorentey <lorentey@elte.hu>
parents: 82992
diff changeset
2910 char *tty_name;
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2911 int last_terminal;
82995
039bd6989d29 Portability fixes (now it compiles & runs fine on Solaris).
Karoly Lorentey <lorentey@elte.hu>
parents: 82992
diff changeset
2912
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2913 if (deleting_tty)
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2914 /* We get a recursive call when we delete the last frame on this
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2915 terminal. */
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2916 return;
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2917
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2918 if (terminal->type != output_termcap)
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2919 abort ();
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2920
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2921 tty = terminal->display_info.tty;
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2922
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2923 last_terminal = 1;
83050
85e5a786f728 Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83041
diff changeset
2924 FOR_EACH_FRAME (tail, frame)
85e5a786f728 Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83041
diff changeset
2925 {
85e5a786f728 Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83041
diff changeset
2926 struct frame *f = XFRAME (frame);
85e5a786f728 Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83041
diff changeset
2927 if (FRAME_LIVE_P (f) && (!FRAME_TERMCAP_P (f) || FRAME_TTY (f) != tty))
85e5a786f728 Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83041
diff changeset
2928 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2929 last_terminal = 0;
83050
85e5a786f728 Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83041
diff changeset
2930 break;
85e5a786f728 Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83041
diff changeset
2931 }
85e5a786f728 Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83041
diff changeset
2932 }
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2933 if (last_terminal)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2934 error ("Attempt to delete the sole terminal device with live frames");
83050
85e5a786f728 Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83041
diff changeset
2935
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2936 if (tty == tty_list)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2937 tty_list = tty->next;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2938 else
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2939 {
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
2940 struct tty_display_info *p;
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2941 for (p = tty_list; p && p->next != tty; p = p->next)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2942 ;
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2943
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2944 if (! p)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2945 /* This should not happen. */
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2946 abort ();
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2947
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2948 p->next = tty->next;
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2949 tty->next = 0;
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2950 }
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2951
83050
85e5a786f728 Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83041
diff changeset
2952 deleting_tty = 1;
85e5a786f728 Don't delete a tty if it's the last device with frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83041
diff changeset
2953
53340
db645482d6bc Trivial changes
Karoly Lorentey <lorentey@elte.hu>
parents: 53233
diff changeset
2954 FOR_EACH_FRAME (tail, frame)
db645482d6bc Trivial changes
Karoly Lorentey <lorentey@elte.hu>
parents: 53233
diff changeset
2955 {
db645482d6bc Trivial changes
Karoly Lorentey <lorentey@elte.hu>
parents: 53233
diff changeset
2956 struct frame *f = XFRAME (frame);
82990
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
2957 if (FRAME_TERMCAP_P (f) && FRAME_LIVE_P (f) && FRAME_TTY (f) == tty)
53340
db645482d6bc Trivial changes
Karoly Lorentey <lorentey@elte.hu>
parents: 53233
diff changeset
2958 {
db645482d6bc Trivial changes
Karoly Lorentey <lorentey@elte.hu>
parents: 53233
diff changeset
2959 Fdelete_frame (frame, Qt);
db645482d6bc Trivial changes
Karoly Lorentey <lorentey@elte.hu>
parents: 53233
diff changeset
2960 }
db645482d6bc Trivial changes
Karoly Lorentey <lorentey@elte.hu>
parents: 53233
diff changeset
2961 }
82990
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
2962
83342
9216636c02fc Rename `struct display' to `struct device'. Update function, parameter and variable names accordingly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83341
diff changeset
2963 /* reset_sys_modes needs a valid device, so this call needs to be
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2964 before delete_terminal. */
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2965 reset_sys_modes (tty);
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
2966
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
2967 delete_terminal (terminal);
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2968
82995
039bd6989d29 Portability fixes (now it compiles & runs fine on Solaris).
Karoly Lorentey <lorentey@elte.hu>
parents: 82992
diff changeset
2969 tty_name = tty->name;
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2970 if (tty->type)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2971 xfree (tty->type);
82990
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
2972
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2973 if (tty->input)
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2974 {
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2975 delete_keyboard_wait_descriptor (fileno (tty->input));
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2976 if (tty->input != stdin)
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2977 fclose (tty->input);
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2978 }
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2979 if (tty->output && tty->output != stdout && tty->output != tty->input)
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2980 fclose (tty->output);
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2981 if (tty->termscript)
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2982 fclose (tty->termscript);
82990
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
2983
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2984 if (tty->old_tty)
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2985 xfree (tty->old_tty);
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2986
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2987 if (tty->Wcm)
82990
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
2988 xfree (tty->Wcm);
2ecd1f669db9 Fixed X support, preliminary support for X-tty combo sessions.
Karoly Lorentey <lorentey@elte.hu>
parents: 82989
diff changeset
2989
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
2990 bzero (tty, sizeof (struct tty_display_info));
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
2991 xfree (tty);
53341
d4e6a050c9b1 Bugfix festival.
Karoly Lorentey <lorentey@elte.hu>
parents: 53340
diff changeset
2992 deleting_tty = 0;
63549
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
2993 }
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
2994
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2995
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
2996
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
2997 /* Mark the pointers in the tty_display_info objects.
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
2998 Called by the Fgarbage_collector. */
83025
c66ebcc29777 Removed %T in mode-line-format. Trivial documentation changes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83021
diff changeset
2999
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3000 void
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
3001 mark_ttys (void)
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3002 {
82989
f3845715a5f6 Separate frame-local, tty-dependent parameters from tty-local parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 82988
diff changeset
3003 struct tty_display_info *tty;
83032
b8237c556f0e Fix the case when emacsclient is run on Emacs's controlling tty.
Karoly Lorentey <lorentey@elte.hu>
parents: 83027
diff changeset
3004
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3005 for (tty = tty_list; tty; tty = tty->next)
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3006 {
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3007 if (tty->top_frame)
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3008 mark_object (tty->top_frame);
53233
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3009 }
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3010 }
fe9b37bee5f7 Fully eliminated global tty state variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 53232
diff changeset
3011
83004
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3012
7900111db01c Converted display hooks to be display-local. Plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 82995
diff changeset
3013
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 20711
diff changeset
3014 void
6752
f9236145bad7 (system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 6652
diff changeset
3015 syms_of_term ()
f9236145bad7 (system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 6652
diff changeset
3016 {
39988
eac4e9ae201c Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents: 39914
diff changeset
3017 DEFVAR_BOOL ("system-uses-terminfo", &system_uses_terminfo,
eac4e9ae201c Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents: 39914
diff changeset
3018 doc: /* Non-nil means the system uses terminfo rather than termcap.
39914
91951fb5b9e5 Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents: 39697
diff changeset
3019 This variable can be used by terminal emulator packages. */);
6752
f9236145bad7 (system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 6652
diff changeset
3020 #ifdef TERMINFO
f9236145bad7 (system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 6652
diff changeset
3021 system_uses_terminfo = 1;
f9236145bad7 (system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 6652
diff changeset
3022 #else
f9236145bad7 (system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 6652
diff changeset
3023 system_uses_terminfo = 0;
f9236145bad7 (system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 6652
diff changeset
3024 #endif
15974
61249a8fe735 (Vring_bell_function): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15094
diff changeset
3025
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3026 DEFVAR_LISP ("suspend-tty-functions", &Vsuspend_tty_functions,
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3027 doc: /* Functions to be run after suspending a tty.
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3028 The functions are run with one argument, the name of the tty to be suspended.
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3029 See `suspend-tty'. */);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3030 Vsuspend_tty_functions = Qnil;
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3031
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3032
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3033 DEFVAR_LISP ("resume-tty-functions", &Vresume_tty_functions,
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3034 doc: /* Functions to be run after resuming a tty.
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3035 The functions are run with one argument, the name of the tty that was revived.
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3036 See `resume-tty'. */);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3037 Vresume_tty_functions = Qnil;
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
3038
67935
52bbc53dbce1 (visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66238
diff changeset
3039 DEFVAR_BOOL ("visible-cursor", &visible_cursor,
52bbc53dbce1 (visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66238
diff changeset
3040 doc: /* Non-nil means to make the cursor very visible.
52bbc53dbce1 (visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66238
diff changeset
3041 This only has an effect when running in a text terminal.
52bbc53dbce1 (visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66238
diff changeset
3042 What means \"very visible\" is up to your terminal. It may make the cursor
52bbc53dbce1 (visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66238
diff changeset
3043 bigger, or it may make it blink, or it may do nothing at all. */);
52bbc53dbce1 (visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66238
diff changeset
3044 visible_cursor = 1;
52bbc53dbce1 (visible_cursor): New boolean var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66238
diff changeset
3045
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
3046 defsubr (&Stty_display_color_p);
42954
e514d4931d6f (Ftty_display_color_cells): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 42808
diff changeset
3047 defsubr (&Stty_display_color_cells);
63549
bda22724fc82 (produce_special_glyphs): Use spec_glyph_lookup_face.
Richard M. Stallman <rms@gnu.org>
parents: 61591
diff changeset
3048 defsubr (&Stty_no_underline);
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3049 defsubr (&Stty_type);
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
3050 defsubr (&Scontrolling_tty_p);
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3051 defsubr (&Ssuspend_tty);
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83050
diff changeset
3052 defsubr (&Sresume_tty);
6752
f9236145bad7 (system_uses_terminfo): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 6652
diff changeset
3053 }
25002
28d5af43eeb6 Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24431
diff changeset
3054
82988
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3055
f82e3a6f5ccb A few more bugfixes and new features.
Karoly Lorentey <lorentey@elte.hu>
parents: 82987
diff changeset
3056
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 52314
diff changeset
3057 /* arch-tag: 498e7449-6f2e-45e2-91dd-b7d4ca488193
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 52314
diff changeset
3058 (do not change this comment) */