annotate src/redisplay-tty.c @ 18:d95e72db5c07 r19-15b92

Import from CVS: tag r19-15b92
author cvs
date Mon, 13 Aug 2007 08:49:43 +0200
parents 0293115a14e9
children 56c54cf7c5b6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 /* Communication module for TTY terminals.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 Copyright (C) 1995 Sun Microsystems, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 Copyright (C) 1995, 1996 Ben Wing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 Copyright (C) 1996 Chuck Thompson.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 under the terms of the GNU General Public License as published by the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 Free Software Foundation; either version 2, or (at your option) any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 XEmacs is distributed in the hope that it will be useful, but WITHOUT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 along with XEmacs; see the file COPYING. If not, write to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 Boston, MA 02111-1307, USA. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 /* Synched up with: Not completely synched with FSF. Mostly divergent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 from FSF. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 /* This file has been Mule-ized. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 /* Written by Chuck Thompson. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 /* Color support added by Ben Wing. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 #include <config.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 #include "lisp.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 #include "buffer.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 #include "console-tty.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 #include "events.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 #include "faces.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 #include "frame.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 #include "glyphs.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 #include "lstream.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 #include "objects-tty.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 #include "redisplay.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 #include "sysdep.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 #include "window.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 /* These headers #define all kinds of common words like "columns"...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 What a bunch of losers. If we were to include them, we'd have to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 include them last to prevent them from messing up our own header
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 files (struct slot names, etc.). But it turns out that there are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 other conflicts as well on some systems, so screw it: we'll just
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 re-declare the routines we use and assume the code in this file is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 invoking them correctly. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 /* # include <curses.h> */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 /* # include <term.h> */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 extern int tgetent (CONST char *, CONST char *);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 extern int tgetflag (CONST char *);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 extern int tgetnum (CONST char *);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 extern char *tgetstr (CONST char *, char **);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 extern void tputs (CONST char *, int, void (*)(int));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 #define FORCE_CURSOR_UPDATE(c) send_string_to_tty_console (c, 0, 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 #define OUTPUTN(c, a, n) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 do { \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 cmputc_console = c; \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 FORCE_CURSOR_UPDATE (c); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 tputs (a, n, cmputc); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 } while (0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 #define OUTPUT1(c, a) OUTPUTN (c, a, 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 #define OUTPUTN_IF(c, a, n) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 do { \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 cmputc_console = c; \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 FORCE_CURSOR_UPDATE (c); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 if (a) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 tputs (a, n, cmputc); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 } while (0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 #define OUTPUT1_IF(c, a) OUTPUTN_IF (c, a, 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 static void tty_output_emchar_dynarr (struct window *w,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 struct display_line *dl,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 emchar_dynarr *buf, int xpos,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 face_index findex,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 int cursor);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 static void tty_output_bufbyte_string (struct window *w,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 struct display_line *dl,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 Bufbyte *str, Bytecount len,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 int xpos, face_index findex,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 int cursor);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 static void tty_turn_on_face (struct window *w, face_index findex);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 static void tty_turn_off_face (struct window *w, face_index findex);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 static void tty_turn_on_frame_face (struct frame *f, Lisp_Object face);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 static void tty_turn_off_frame_face (struct frame *f, Lisp_Object face);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 static void term_get_fkeys (Lisp_Object keymap, char **address);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 tty_text_width
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 tty's don't have fonts (that we use at least), so everything is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 considered to be fixed width. In other words, we just return len.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 tty_text_width (struct face_cachel *cachel, CONST Emchar *str,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 Charcount len)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 return emchar_string_displayed_columns (str, len);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 tty_divider_width
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 Return the width of the vertical divider. This is a function because
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 divider_width is a console method.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 tty_divider_width (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 return 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 tty_divider_height
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 Return the width of the horizontal divider. This is a function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 because divider_height is a console method.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 tty_divider_height (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 return 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 tty_eol_cursor_width
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 Return the width of the end-of-line cursor. This is a function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 because eol_cursor_width is a console method.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 tty_eol_cursor_width (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 return 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 tty_output_begin
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 Perform any necessary initialization prior to an update.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 #ifdef DEBUG_XEMACS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 void tty_output_begin (struct device *d);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 tty_output_begin (struct device *d)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 #ifndef HAVE_TERMIOS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 /* Termcap requires `ospeed' to be a global variable so we have to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 always set it for whatever tty console we are actually currently
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 working with. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 ospeed = DEVICE_TTY_DATA (d)->ospeed;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 tty_output_end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 Perform any necessary flushing of queues when an update has completed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 #ifdef DEBUG_XEMACS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 void tty_output_end (struct device *d);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 tty_output_end (struct device *d)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 struct console *c = XCONSOLE (DEVICE_CONSOLE (d));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 FORCE_CURSOR_UPDATE (c);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 Lstream_flush (XLSTREAM (CONSOLE_TTY_DATA (c)->outstream));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 tty_output_display_block
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 Given a display line, a block number for that start line, output all
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 runes between start and end in the specified display block.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 tty_output_display_block (struct window *w, struct display_line *dl, int block,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 int start, int end, int start_pixpos,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 int cursor_start, int cursor_width,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 int cursor_height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 struct frame *f = XFRAME (w->frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 emchar_dynarr *buf = Dynarr_new (Emchar);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 struct display_block *db = Dynarr_atp (dl->display_blocks, block);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 rune_dynarr *rba = db->runes;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 struct rune *rb;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 int elt = start;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 face_index findex;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 int xpos;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 rb = Dynarr_atp (rba, elt);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 if (!rb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 /* Nothing to do so don't do anything. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 findex = rb->findex;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 xpos = rb->xpos;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 if (end < 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 end = Dynarr_length (rba);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 Dynarr_reset (buf);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 while (elt < end && Dynarr_atp (rba, elt)->xpos < start_pixpos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 elt++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 findex = Dynarr_atp (rba, elt)->findex;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 xpos = Dynarr_atp (rba, elt)->xpos;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 while (elt < end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 rb = Dynarr_atp (rba, elt);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 if (rb->findex == findex && rb->type == RUNE_CHAR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 && rb->object.chr.ch != '\n'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 && (rb->cursor_type != CURSOR_ON
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 || NILP (w->text_cursor_visible_p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 Dynarr_add (buf, rb->object.chr.ch);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 elt++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 if (Dynarr_length (buf))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 tty_output_emchar_dynarr (w, dl, buf, xpos, findex, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 xpos = rb->xpos;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 Dynarr_reset (buf);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 if (rb->type == RUNE_CHAR)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 findex = rb->findex;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 xpos = rb->xpos;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 if (rb->object.chr.ch == '\n')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 /* Clear in case a cursor was formerly here. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 Dynarr_add (buf, ' ');
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 tty_output_emchar_dynarr (w, dl, buf, rb->xpos,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 DEFAULT_INDEX, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 Dynarr_reset (buf);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 cmgoto (f, dl->ypos - 1, rb->xpos);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 elt++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 else if (rb->cursor_type == CURSOR_ON)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 /* There is not a distinct eol cursor on tty's. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 Dynarr_add (buf, rb->object.chr.ch);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 tty_output_emchar_dynarr (w, dl, buf, xpos, findex, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 Dynarr_reset (buf);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 cmgoto (f, dl->ypos - 1, xpos);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 xpos += rb->width;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 elt++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 /* #### RUNE_HLINE is actualy a little more complicated than this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 but at the moment it is only used to draw a turned off
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 modeline and this will suffice for that. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 else if (rb->type == RUNE_BLANK || rb->type == RUNE_HLINE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 Emchar ch_to_add;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 int size = rb->width;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 if (rb->type == RUNE_BLANK)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 ch_to_add = ' ';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 ch_to_add = '-';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 while (size--)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 Dynarr_add (buf, ch_to_add);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 tty_output_emchar_dynarr (w, dl, buf, rb->xpos, findex, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 if (xpos >= cursor_start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 && cursor_start < xpos + Dynarr_length (buf))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 cmgoto (f, dl->ypos - 1, cursor_start);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 Dynarr_reset (buf);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 elt++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 if (elt < end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 rb = Dynarr_atp (rba, elt);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 findex = rb->findex;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 xpos = rb->xpos;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 else if (rb->type == RUNE_DGLYPH)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 Lisp_Object window;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 Lisp_Object instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 XSETWINDOW (window, w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 instance = glyph_image_instance (rb->object.dglyph.glyph,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 window, ERROR_ME_NOT, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 if (IMAGE_INSTANCEP (instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 switch (XIMAGE_INSTANCE_TYPE (instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 case IMAGE_TEXT:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 Bufbyte *temptemp;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 Lisp_Object string =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 XIMAGE_INSTANCE_TEXT_STRING (instance);
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
336 Bytecount len = XSTRING_LENGTH (string);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 /* In the unlikely instance that a garbage-collect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 occurs during encoding, we at least need to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 copy the string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 temptemp = (Bufbyte *) alloca (len);
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
343 memcpy (temptemp, XSTRING_DATA (string), len);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 int i;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 /* Now truncate the first rb->object.dglyph.xoffset
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 columns. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 for (i = 0; i < rb->object.dglyph.xoffset;)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 i++; /* telescope this */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 INC_CHARPTR (temptemp);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 /* If we truncated one column too many, then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 add a space at the beginning. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 if (i > rb->object.dglyph.xoffset)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 assert (i > 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 *--temptemp = ' ';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 i--;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 len -= i;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 tty_output_bufbyte_string (w, dl, temptemp, len,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 xpos, findex, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 if (xpos >= cursor_start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 && (cursor_start <
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 xpos + (bufbyte_string_displayed_columns
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 (temptemp, len))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 cmgoto (f, dl->ypos - 1, cursor_start);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 case IMAGE_MONO_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 case IMAGE_COLOR_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 case IMAGE_SUBWINDOW:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 /* just do nothing here */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 case IMAGE_POINTER:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 case IMAGE_NOTHING:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 /* nothing is as nothing does */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 xpos += rb->width;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 elt++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 if (Dynarr_length (buf))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 tty_output_emchar_dynarr (w, dl, buf, xpos, findex, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 Dynarr_free (buf);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 tty_output_vertical_divider
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 Draw a vertical divider down the left side of the given window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 tty_output_vertical_divider (struct window *w, int clear)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 struct frame *f = XFRAME (w->frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 int line;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 int y1 = WINDOW_TEXT_TOP (w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 int y2 = WINDOW_TEXT_BOTTOM (w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 unsigned char divv = '|';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 tty_turn_on_face (w, DEFAULT_INDEX);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 for (line = y1; line < y2; line++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 cmgoto (f, line, WINDOW_TEXT_LEFT (w) - 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 send_string_to_tty_console (c, &divv, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 TTY_INC_CURSOR_X (c, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 tty_turn_off_face (w, DEFAULT_INDEX);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 /* Draw the divider in the modeline. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 cmgoto (f, y2, WINDOW_TEXT_LEFT (w) - 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 tty_turn_on_face (w, MODELINE_INDEX);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 send_string_to_tty_console (c, &divv, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 TTY_INC_CURSOR_X (c, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 tty_turn_off_face (w, MODELINE_INDEX);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 /****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 tty_clear_region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 Clear the area in the box defined by the given parameters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 tty_clear_region (Lisp_Object window, face_index findex, int x, int y,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 int width, int height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 struct window *w = XWINDOW (window);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 struct frame *f = XFRAME (w->frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 int line;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 if (!width || !height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 tty_turn_on_face (w, findex);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 for (line = y; line < y + height; line++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 int col;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 cmgoto (f, line, x);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 if (window_is_leftmost (w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 && window_is_rightmost (w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 && TTY_SE (c).clr_to_eol)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 OUTPUT1 (c, TTY_SE (c).clr_to_eol);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 unsigned char sp = ' ';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 /* #### Of course, this is all complete and utter crap. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 for (col = x; col < x + width; col++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 send_string_to_tty_console (c, &sp, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 TTY_INC_CURSOR_X (c, width);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 tty_turn_off_face (w, findex);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 cmgoto (f, y, x);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 tty_clear_to_window_end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 Clear the area between ypos1 and ypos2. Each margin area and the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 text area is handled separately since they may each have their own
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 background color.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 tty_clear_to_window_end (struct window *w, int ypos1, int ypos2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 struct frame *f = XFRAME (w->frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 int x, width;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 x = WINDOW_TEXT_LEFT (w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 width = WINDOW_TEXT_WIDTH (w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 if (window_is_rightmost (w))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 /* #### Optimize to use clr_to_eol function of tty if available, if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 the window is the entire width of the frame. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 /* #### Is this actually an optimization? */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 int line;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 tty_turn_on_face (w, DEFAULT_INDEX);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 for (line = ypos1; line < ypos2; line++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 cmgoto (XFRAME (w->frame), line, x);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 OUTPUT1 (c, TTY_SE (c).clr_to_eol);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 tty_turn_off_face (w, DEFAULT_INDEX);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 Lisp_Object window;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 XSETWINDOW (window, w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 tty_clear_region (window, DEFAULT_INDEX, x, ypos1, width, ypos2 - ypos1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 /****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 tty_clear_frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 Clear the entire frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 tty_clear_frame (struct frame *f)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 tty_turn_on_frame_face (f, Vdefault_face);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 if (TTY_SE (c).clr_frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 OUTPUT1 (c, TTY_SE (c).clr_frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 #ifdef NOT_SURE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 FRAME_CURSOR_X (f) = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 FRAME_CURSOR_Y (f) = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 #ifdef NOT_SURE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 internal_cursor_to (f, 0, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 clear_to_end (f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 /* #### Not implemented. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 fprintf (stderr, "Not yet.\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 tty_turn_off_frame_face (f, Vdefault_face);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 tty_output_bufbyte_string (struct window *w, struct display_line *dl,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 Bufbyte *str, Bytecount len, int xpos,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 face_index findex, int cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 struct frame *f = XFRAME (w->frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 /* First position the cursor. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 cmgoto (f, dl->ypos - 1, xpos);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 /* Enable any face properties. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 tty_turn_on_face (w, findex);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 send_string_to_tty_console (c, str, len);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 TTY_INC_CURSOR_X (c, bufbyte_string_displayed_columns (str, len));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 /* Turn the face properties back off. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 tty_turn_off_face (w, findex);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 static bufbyte_dynarr *tty_output_emchar_dynarr_dynarr;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 tty_output_emchar_dynarr
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 Given a string and a starting position, output that string in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 given face. If cursor is true, draw a cursor around the string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 tty_output_emchar_dynarr (struct window *w, struct display_line *dl,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 emchar_dynarr *buf, int xpos, face_index findex,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 int cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 if (!tty_output_emchar_dynarr_dynarr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 tty_output_emchar_dynarr_dynarr = Dynarr_new (Bufbyte);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 Dynarr_reset (tty_output_emchar_dynarr_dynarr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 convert_emchar_string_into_bufbyte_dynarr (Dynarr_atp (buf, 0),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 Dynarr_length (buf),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 tty_output_emchar_dynarr_dynarr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 tty_output_bufbyte_string (w, dl,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 Dynarr_atp (tty_output_emchar_dynarr_dynarr, 0),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 Dynarr_length (tty_output_emchar_dynarr_dynarr),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 xpos, findex, cursor);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 #if 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 static bufbyte_dynarr *sidcs_dynarr;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 substitute_in_dynamic_color_string (Lisp_Object spec, Lisp_Object string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 int i;
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
616 Bufbyte *specdata = XSTRING_DATA (spec);
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
617 Bytecount speclen = XSTRING_LENGTH (spec);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 if (!sidcs_dynarr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 sidcs_dynarr = Dynarr_new (Bufbyte);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 Dynarr_reset (sidcs_dynarr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 for (i = 0; i < speclen; i++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 if (specdata[i] == '%' && specdata[i+1] == '%')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 Dynarr_add (sidcs_dynarr, '%');
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 i++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 else if (specdata[i] == '%' && specdata[i+1] == 's')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 {
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
633 Dynarr_add_many (sidcs_dynarr,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
634 XSTRING_DATA (string),
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
635 XSTRING_LENGTH (string));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 i++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 Dynarr_add (sidcs_dynarr, specdata[i]);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 set_foreground_to (struct console *c, Lisp_Object sym)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 Lisp_Object result;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 Bufbyte *escseq = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 Bytecount escseqlen = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 result = assq_no_quit (sym, Vtty_color_alist);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 if (!NILP (result))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 Lisp_Object esc_seq = XCAR (XCDR (result));
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
656 escseq = XSTRING_DATA (esc_seq);
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
657 escseqlen = XSTRING_LENGTH (esc_seq);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 #if 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 else if (STRINGP (Vtty_dynamic_color_fg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 substitute_in_dynamic_color_string (Vtty_dynamic_color_fg,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 Fsymbol_name (sym));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 escseq = Dynarr_atp (sidcs_dynarr, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 escseqlen = Dynarr_length (sidcs_dynarr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 if (escseq)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 send_string_to_tty_console (c, escseq, escseqlen);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 set_background_to (struct console *c, Lisp_Object sym)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 Lisp_Object result;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679 Bufbyte *escseq = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 Bytecount escseqlen = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 result = assq_no_quit (sym, Vtty_color_alist);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 if (!NILP (result))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 Lisp_Object esc_seq = XCDR (XCDR (result));
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
686 escseq = XSTRING_DATA (esc_seq);
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
687 escseqlen = XSTRING_LENGTH (esc_seq);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689 #if 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690 else if (STRINGP (Vtty_dynamic_color_bg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692 substitute_in_dynamic_color_string (Vtty_dynamic_color_bg,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693 Fsymbol_name (sym));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 escseq = Dynarr_atp (sidcs_dynarr, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695 escseqlen = Dynarr_length (sidcs_dynarr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 if (escseq)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701 send_string_to_tty_console (c, escseq, escseqlen);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 tty_turn_on_face_1 (struct console *c, int highlight_p,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707 int blinking_p, int dim_p, int underline_p,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 int reverse_p, Lisp_Object cinst_fore,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 Lisp_Object cinst_back)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 if (highlight_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 OUTPUT1_IF (c, TTY_SD (c).turn_on_bold);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 if (blinking_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 OUTPUT1_IF (c, TTY_SD (c).turn_on_blinking);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 if (dim_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 OUTPUT1_IF (c, TTY_SD (c).turn_on_dim);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726 if (underline_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 /* #### punt for now if underline mode is glitchy */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 if (!TTY_FLAGS (c).underline_width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 OUTPUT1_IF (c, TTY_SD (c).begin_underline);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 if (reverse_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 /* #### punt for now if standout mode is glitchy */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 if (!TTY_FLAGS (c).standout_width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 OUTPUT1_IF (c, TTY_SD (c).begin_standout);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 reverse_p = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 if (reverse_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748 Lisp_Object temp = cinst_fore;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 cinst_fore = cinst_back;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 cinst_back = temp;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 if (COLOR_INSTANCEP (cinst_fore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 && !EQ (cinst_fore, Vthe_null_color_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 set_foreground_to (c, COLOR_INSTANCE_TTY_SYMBOL
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756 (XCOLOR_INSTANCE (cinst_fore)));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 if (COLOR_INSTANCEP (cinst_back)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759 && !EQ (cinst_back, Vthe_null_color_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760 set_background_to (c, COLOR_INSTANCE_TTY_SYMBOL
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761 (XCOLOR_INSTANCE (cinst_back)));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 tty_turn_on_face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767 Turn on all set properties of the given face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770 tty_turn_on_face (struct window *w, face_index findex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772 struct frame *f = XFRAME (w->frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775 tty_turn_on_face_1 (c,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776 WINDOW_FACE_CACHEL_HIGHLIGHT_P (w, findex),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777 WINDOW_FACE_CACHEL_BLINKING_P (w, findex),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 WINDOW_FACE_CACHEL_DIM_P (w, findex),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 WINDOW_FACE_CACHEL_UNDERLINE_P (w, findex),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780 WINDOW_FACE_CACHEL_REVERSE_P (w, findex),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 WINDOW_FACE_CACHEL_FOREGROUND (w, findex),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782 WINDOW_FACE_CACHEL_BACKGROUND (w, findex));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786 tty_turn_off_face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 Turn off all set properties of the given face (revert to default
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789 face). We assume that tty_turn_on_face has been called for the given
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790 face so that it's properties are actually active.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793 tty_turn_off_face (struct window *w, face_index findex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795 struct frame *f = XFRAME (w->frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798 if (WINDOW_FACE_CACHEL_REVERSE_P (w, findex))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
799 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800 /* #### punt for now if standout mode is glitchy */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801 if (!TTY_FLAGS (c).standout_width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803 OUTPUT1_IF (c, TTY_SD (c).end_standout);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807 if (WINDOW_FACE_CACHEL_UNDERLINE_P (w, findex))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809 /* #### punt for now if underline mode is glitchy */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 if (!TTY_FLAGS (c).underline_width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812 OUTPUT1_IF (c, TTY_SD (c).end_underline);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816 if (WINDOW_FACE_CACHEL_HIGHLIGHT_P (w, findex) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817 WINDOW_FACE_CACHEL_BLINKING_P (w, findex) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818 WINDOW_FACE_CACHEL_DIM_P (w, findex) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 !EQ (WINDOW_FACE_CACHEL_FOREGROUND (w, findex),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820 Vthe_null_color_instance) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 !EQ (WINDOW_FACE_CACHEL_BACKGROUND (w, findex),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 Vthe_null_color_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 OUTPUT1_IF (c, TTY_SD (c).turn_off_attributes);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 tty_turn_on_frame_face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831 Turn on all set properties of the given face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 tty_turn_on_frame_face (struct frame *f, Lisp_Object face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 Lisp_Object frame = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 XSETFRAME (frame, f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 tty_turn_on_face_1 (c,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841 FACE_HIGHLIGHT_P (face, frame),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 FACE_BLINKING_P (face, frame),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 FACE_DIM_P (face, frame),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 FACE_UNDERLINE_P (face, frame),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 FACE_REVERSE_P (face, frame),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846 FACE_FOREGROUND (face, frame),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 FACE_BACKGROUND (face, frame));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 tty_turn_off_frame_face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853 Turn off all set properties of the given face (revert to default
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 face). We assume that tty_turn_on_face has been called for the given
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855 face so that it's properties are actually active.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858 tty_turn_off_frame_face (struct frame *f, Lisp_Object face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 Lisp_Object frame = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 XSETFRAME (frame, f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865 if (FACE_REVERSE_P (face, frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867 /* #### punt for now if standout mode is glitchy */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868 if (!TTY_FLAGS (c).standout_width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 OUTPUT1_IF (c, TTY_SD (c).end_standout);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 if (FACE_UNDERLINE_P (face, frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 /* #### punt for now if underline mode is glitchy */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 if (!TTY_FLAGS (c).underline_width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 OUTPUT1_IF (c, TTY_SD (c).end_underline);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 if (FACE_HIGHLIGHT_P (face, frame) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 FACE_BLINKING_P (face, frame) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 FACE_DIM_P (face, frame) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886 !EQ (FACE_FOREGROUND (face, frame), Vthe_null_color_instance) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 !EQ (FACE_BACKGROUND (face, frame), Vthe_null_color_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889 OUTPUT1_IF (c, TTY_SD (c).turn_off_attributes);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 set_tty_modes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 Sets up various parameters on tty modes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 set_tty_modes (struct console *c)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 if (!CONSOLE_TTY_P (c))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904 OUTPUT1_IF (c, TTY_SD (c).init_motion);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905 OUTPUT1_IF (c, TTY_SD (c).cursor_visible);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906 OUTPUT1_IF (c, TTY_SD (c).keypad_on);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910 reset_tty_modes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912 Restore default state of tty.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 reset_tty_modes (struct console *c)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917 if (!CONSOLE_TTY_P (c))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920 OUTPUT1_IF (c, TTY_SD (c).keypad_off);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921 OUTPUT1_IF (c, TTY_SD (c).cursor_normal);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922 OUTPUT1_IF (c, TTY_SD (c).end_motion);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923 tty_output_end (XDEVICE (CONSOLE_SELECTED_DEVICE (c)));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 tty_redisplay_shutdown
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 Clear the frame and position the cursor properly for exiting.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932 tty_redisplay_shutdown (struct console *c)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 Lisp_Object dev = CONSOLE_SELECTED_DEVICE (c);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 if (!GC_NILP (dev))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938 Lisp_Object frm = DEVICE_SELECTED_FRAME (XDEVICE (dev));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940 if (!GC_NILP (frm))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942 struct frame *f = XFRAME (frm);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944 /* Clear the bottom line of the frame. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945 tty_clear_region (FRAME_SELECTED_WINDOW (f), DEFAULT_INDEX, 0,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 f->height, f->width, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 /* And then stick the cursor there. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 cmgoto (f, f->height, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950 tty_output_end (XDEVICE (dev));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956 /* #### Everything below here is old shit. It should either be moved
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957 up or removed. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960 /* FLAGS - these don't need to be console local since only one console
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961 can be being updated at a time. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962 static int insert_mode_on; /* nonzero if in insert mode */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963 static int standout_mode_on; /* nonzero if in standout mode */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964 static int underline_mode_on; /* nonzero if in underline mode */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965 static int alternate_mode_on; /* nonzero if in alternate char set */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966 static int attributes_on; /* nonzero if any attributes on */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968 #ifdef NOT_YET
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970 turn_on_insert (struct frame *f)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 if (!insert_mode_on)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975 OUTPUT1_IF (c, TTY_SE (c).begin_ins_mode);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976 insert_mode_on = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980 turn_off_insert (struct frame *f)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984 if (insert_mode_on)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985 OUTPUT1 (c, TTY_SE (c).end_ins_mode);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986 insert_mode_on = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990 internal_cursor_to (struct frame *f, int row, int col)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 if (!TTY_FLAGS (c).insert_mode_motion)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995 turn_off_insert (f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 if (!TTY_FLAGS (c).standout_motion)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998 turn_off_standout (f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999 turn_off_underline (f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000 turn_off_alternate (f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1002
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003 cmgoto (f, row, col);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1004 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007 clear_to_end (struct frame *f)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1010
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011 /* assumes cursor is already positioned */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1012 if (TTY_SE (c).clr_from_cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1013 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014 OUTPUT1 (c, TTY_SE (c).clr_from_cursor);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 int line = FRAME_CURSOR_Y (f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020 while (line < FRAME_HEIGHT (f))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 internal_cursor_to (f, line, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 OUTPUT1 (c, TTY_SE (c).clr_to_eol);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 #endif /* 0 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029 #if 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031 * clear from last visible line on window to window end (presumably
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1032 * the line above window's modeline
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035 tty_clear_window_end (struct window *w, int ystart, int yend)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1036 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037 struct console *c = XCONSOLE (WINDOW_CONSOLE (w));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038 int line;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040 for (line = ystart; line < yend; line++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042 cmgoto (XFRAME (w->frame), line, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1043 OUTPUT1 (c, TTY_SE (c).clr_to_eol);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047 #endif /* 0 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1049 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050 tty_flash (struct device *d)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1051 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1052 struct console *c = XCONSOLE (DEVICE_CONSOLE (d));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1053 if (TTY_SD (c).visual_bell)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1055 OUTPUT1 (c, TTY_SD (c).visual_bell);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056 Lstream_flush (XLSTREAM (CONSOLE_TTY_DATA (c)->outstream));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1057 return 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1058 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1059 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1062
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1064 * tty_ring_bell - sound an audio beep.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1067 tty_ring_bell (struct device *d, int volume, int pitch, int duration)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1068 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1069 struct console *c = XCONSOLE (DEVICE_CONSOLE (d));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1070
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1071 if (volume)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1072 {
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1073 OUTPUT1 (c, TTY_SD (c).audio_bell);
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1074 Lstream_flush (XLSTREAM (CONSOLE_TTY_DATA (c)->outstream));
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1075 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1076 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1077
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1079 int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1080 init_tty_for_redisplay (struct device *d, char *terminal_type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1082 int status;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1083 char entry_buffer[2044];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1084 /* char temp_buffer[2044]; */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1085 char *bufptr;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086 struct console *c = XCONSOLE (DEVICE_CONSOLE (d));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1088 /* What we should really do is allocate just enough space for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1089 the actual strings that are stored; but this would require
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090 doing this after all the tgetstr()s and adjusting all the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1091 pointers. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1092 CONSOLE_TTY_DATA (c)->term_entry_buffer = (char *) xmalloc (2044);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1093 bufptr = CONSOLE_TTY_DATA (c)->term_entry_buffer;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1094
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1095 EMACS_BLOCK_SIGNAL (SIGTTOU);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096 status = tgetent (entry_buffer, terminal_type);
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1097 EMACS_UNBLOCK_SIGNAL (SIGTTOU);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098 #if 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1099 if (status < 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1100 return TTY_UNABLE_OPEN_DATABASE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1101 else if (status == 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102 return TTY_TYPE_UNDEFINED;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1103 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1104 /* Under Linux at least, <0 is returned for TTY_TYPE_UNDEFINED. --ben */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1105 if (status <= 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1106 return TTY_TYPE_UNDEFINED;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1107
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1108 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1109 * Establish the terminal size.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1110 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1111 /* First try to get the info from the system. If that fails, check
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1112 the termcap entry. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1113 get_tty_device_size (d, &CONSOLE_TTY_DATA (c)->width,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1114 &CONSOLE_TTY_DATA (c)->height);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1115
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1116 if (CONSOLE_TTY_DATA (c)->width <= 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1117 CONSOLE_TTY_DATA (c)->width = tgetnum ("co");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1118 if (CONSOLE_TTY_DATA (c)->height <= 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1119 CONSOLE_TTY_DATA (c)->height = tgetnum ("li");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1120
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1121 if (CONSOLE_TTY_DATA (c)->width <= 0 || CONSOLE_TTY_DATA (c)->height <= 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1122 return TTY_SIZE_UNSPECIFIED;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1123
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1124 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1125 * Initialize cursor motion information.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1126 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1127
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1128 /* local cursor movement */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1129 TTY_CM (c).up = tgetstr ("up", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1130 TTY_CM (c).down = tgetstr ("do", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1131 TTY_CM (c).left = tgetstr ("le", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1132 TTY_CM (c).right = tgetstr ("nd", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1133 TTY_CM (c).home = tgetstr ("ho", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1134 TTY_CM (c).low_left = tgetstr ("ll", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135 TTY_CM (c).car_return = tgetstr ("cr", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1136
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1137 /* absolute cursor motion */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1138 TTY_CM (c).abs = tgetstr ("cm", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1139 TTY_CM (c).hor_abs = tgetstr ("ch", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1140 TTY_CM (c).ver_abs = tgetstr ("cv", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1141
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1142 /* Verify that the terminal is powerful enough to run Emacs */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1143 if (!TTY_CM (c).abs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1144 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1145 if (!TTY_CM (c).up || !TTY_CM (c).down
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1146 || !TTY_CM (c).left || !TTY_CM (c).right)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1147 return TTY_TYPE_INSUFFICIENT;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1148 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1149
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1150 /* parameterized local cursor movement */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1151 TTY_CM (c).multi_up = tgetstr ("UP", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1152 TTY_CM (c).multi_down = tgetstr ("DO", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1153 TTY_CM (c).multi_left = tgetstr ("LE", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1154 TTY_CM (c).multi_right = tgetstr ("RI", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1155
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1156 /* scrolling */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1157 TTY_CM (c).scroll_forw = tgetstr ("sf", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1158 TTY_CM (c).scroll_back = tgetstr ("sr", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1159 TTY_CM (c).multi_scroll_forw = tgetstr ("SF", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1160 TTY_CM (c).multi_scroll_back = tgetstr ("SR", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1161 TTY_CM (c).set_scroll_region = tgetstr ("cs", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1162
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1163
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1164 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1165 * Initialize screen editing information.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1166 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1167
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1168 /* adding to the screen */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1169 TTY_SE (c).ins_line = tgetstr ("al", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1170 TTY_SE (c).multi_ins_line = tgetstr ("AL", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1171 TTY_SE (c).repeat = tgetstr ("rp", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1172 TTY_SE (c).begin_ins_mode = tgetstr ("im", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1173 TTY_SE (c).end_ins_mode = tgetstr ("ei", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1174 TTY_SE (c).ins_char = tgetstr ("ic", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1175 TTY_SE (c).multi_ins_char = tgetstr ("IC", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1176 TTY_SE (c).insert_pad = tgetstr ("ip", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1177
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1178 /* deleting from the screen */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1179 TTY_SE (c).clr_frame = tgetstr ("cl", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1180 TTY_SE (c).clr_from_cursor = tgetstr ("cd", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1181 TTY_SE (c).clr_to_eol = tgetstr ("ce", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1182 TTY_SE (c).del_line = tgetstr ("dl", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1183 TTY_SE (c).multi_del_line = tgetstr ("DL", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1184 TTY_SE (c).del_char = tgetstr ("dc", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1185 TTY_SE (c).multi_del_char = tgetstr ("DC", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1186 TTY_SE (c).begin_del_mode = tgetstr ("dm", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1187 TTY_SE (c).end_del_mode = tgetstr ("ed", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1188 TTY_SE (c).erase_at_cursor = tgetstr ("ec", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1189
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1190
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1191 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1192 * Initialize screen display information.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1193 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1194 TTY_SD (c).begin_standout = tgetstr ("so", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1195 TTY_SD (c).end_standout = tgetstr ("se", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1196 TTY_SD (c).begin_underline = tgetstr ("us", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1197 TTY_SD (c).end_underline = tgetstr ("ue", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1198 TTY_SD (c).begin_alternate = tgetstr ("as", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1199 TTY_SD (c).end_alternate = tgetstr ("ae", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1200 TTY_SD (c).turn_on_reverse = tgetstr ("mr", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1201 TTY_SD (c).turn_on_blinking = tgetstr ("mb", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1202 TTY_SD (c).turn_on_bold = tgetstr ("md", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1203 TTY_SD (c).turn_on_dim = tgetstr ("mh", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1204 TTY_SD (c).turn_off_attributes = tgetstr ("me", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1205
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1206 TTY_SD (c).visual_bell = tgetstr ("vb", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1207 TTY_SD (c).audio_bell = tgetstr ("bl", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1208 if (!TTY_SD (c).audio_bell)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1209 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1210 /* If audio_bell doesn't get set, then assume C-g. This is gross and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1211 ugly but is what Emacs has done from time immortal. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1212 TTY_SD (c).audio_bell = "\07";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1213 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1214
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1215 TTY_SD (c).cursor_visible = tgetstr ("ve", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1216 TTY_SD (c).cursor_normal = tgetstr ("vs", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1217 TTY_SD (c).init_motion = tgetstr ("ti", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1218 TTY_SD (c).end_motion = tgetstr ("te", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1219 TTY_SD (c).keypad_on = tgetstr ("ks", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1220 TTY_SD (c).keypad_off = tgetstr ("ke", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1221
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1222
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1223 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1224 * Initialize additional terminal information.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1225 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1226 TTY_FLAGS (c).must_write_spaces = tgetflag ("in");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1227 TTY_FLAGS (c).insert_mode_motion = tgetflag ("mi");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1228 TTY_FLAGS (c).standout_motion = tgetflag ("ms");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1229 TTY_FLAGS (c).memory_above_frame = tgetflag ("da");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1230 TTY_FLAGS (c).memory_below_frame = tgetflag ("db");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1231 TTY_FLAGS (c).standout_width = tgetnum ("sg");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1232 TTY_FLAGS (c).underline_width = tgetnum ("ug");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1233
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1234 if (TTY_FLAGS (c).standout_width == -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1235 TTY_FLAGS (c).standout_width = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1236 if (TTY_FLAGS (c).underline_width == -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1237 TTY_FLAGS (c).underline_width = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1238
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1239 TTY_FLAGS (c).meta_key =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1240 eight_bit_tty (d) ? tgetflag ("km") || tgetflag ("MT") ? 1 : 2 : 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1241
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1242
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1243 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1244 * Setup the costs tables for this tty console.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1245 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1246 cm_cost_init (c);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1247
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1248 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1249 * Initialize local flags.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1250 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1251 insert_mode_on = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1252 standout_mode_on = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1253 underline_mode_on = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1254 alternate_mode_on = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1255 attributes_on = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1256
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1257 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1258 * Attempt to initialise the function_key_map to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1259 * some kind of sensible value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1260 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1261
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1262 term_get_fkeys (c->function_key_map, &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1263
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1264 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1265 /* check for ANSI set-foreground and set-background strings,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1266 and assume color if so.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1267
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1268 #### we should support the other (non-ANSI) ways of specifying
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1269 color, too. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1270 char foobuf[500];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1271 char *fooptr = foobuf;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1272 if (tgetstr ("AB", &fooptr) && tgetstr ("AF", &fooptr))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1273 DEVICE_CLASS (d) = Qcolor;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1274 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1275 DEVICE_CLASS (d) = Qmono;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1276 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1277
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1278 return TTY_INIT_SUCCESS;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1279 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1280
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1281 struct fkey_table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1282 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1283 CONST char *cap, *name;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1284 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1285
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1286 /* Termcap capability names that correspond directly to X keysyms.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1287 Some of these (marked "terminfo") aren't supplied by old-style
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1288 (Berkeley) termcap entries. They're listed in X keysym order;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1289 except we put the keypad keys first, so that if they clash with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1290 other keys (as on the IBM PC keyboard) they get overridden.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1291 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1292
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1293 static struct fkey_table keys[] =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1294 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1295 {"kh", "home"}, /* termcap */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1296 {"kl", "left"}, /* termcap */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1297 {"ku", "up"}, /* termcap */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1298 {"kr", "right"}, /* termcap */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1299 {"kd", "down"}, /* termcap */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1300 {"%8", "prior"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1301 {"%5", "next"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1302 {"@7", "end"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1303 {"@1", "begin"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1304 {"*6", "select"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1305 {"%9", "print"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1306 {"@4", "execute"}, /* terminfo --- actually the `command' key */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1307 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1308 * "insert" --- see below
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1309 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1310 {"&8", "undo"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1311 {"%0", "redo"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1312 {"%7", "menu"}, /* terminfo --- actually the `options' key */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1313 {"@0", "find"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1314 {"@2", "cancel"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1315 {"%1", "help"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1316 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1317 * "break" goes here, but can't be reliably intercepted with termcap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1318 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1319 {"&4", "reset"}, /* terminfo --- actually `restart' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1320 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1321 * "system" and "user" --- no termcaps
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1322 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1323 {"kE", "clearline"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1324 {"kA", "insertline"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1325 {"kL", "deleteline"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1326 {"kI", "insertchar"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1327 {"kD", "delete"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1328 {"kB", "backtab"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1329 /*
8
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 2
diff changeset
1330 * "kp-backtab", "kp-space", "kp-tab" --- no termcaps
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1331 */
8
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 2
diff changeset
1332 {"@8", "kp-enter"}, /* terminfo */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1333 /*
8
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 2
diff changeset
1334 * "kp-f1", "kp-f2", "kp-f3" "kp-f4",
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 2
diff changeset
1335 * "kp-multiply", "kp-add", "kp-separator",
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 2
diff changeset
1336 * "kp-subtract", "kp-decimal", "kp-divide", "kp-0";
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1337 * --- no termcaps for any of these.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1338 */
8
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 2
diff changeset
1339 {"K4", "kp-1"}, /* terminfo */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1340 /*
8
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 2
diff changeset
1341 * "kp-2" --- no termcap
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1342 */
8
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 2
diff changeset
1343 {"K5", "kp-3"}, /* terminfo */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1344 /*
8
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 2
diff changeset
1345 * "kp-4" --- no termcap
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1346 */
8
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 2
diff changeset
1347 {"K2", "kp-5"}, /* terminfo */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1348 /*
8
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 2
diff changeset
1349 * "kp-6" --- no termcap
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1350 */
8
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 2
diff changeset
1351 {"K1", "kp-7"}, /* terminfo */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1352 /*
8
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 2
diff changeset
1353 * "kp-8" --- no termcap
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1354 */
8
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 2
diff changeset
1355 {"K3", "kp-9"}, /* terminfo */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1356 /*
8
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 2
diff changeset
1357 * "kp-equal" --- no termcap
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1358 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1359 {"k1", "f1"},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1360 {"k2", "f2"},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1361 {"k3", "f3"},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1362 {"k4", "f4"},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1363 {"k5", "f5"},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1364 {"k6", "f6"},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1365 {"k7", "f7"},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1366 {"k8", "f8"},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1367 {"k9", "f9"},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1368 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1369
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1370 static char **term_get_fkeys_arg;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1371
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1372 static Lisp_Object term_get_fkeys_1 (Lisp_Object keymap);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1373 static Lisp_Object term_get_fkeys_error (Lisp_Object err, Lisp_Object arg);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1374
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1375 /* Find the escape codes sent by the function keys for Vfunction_key_map.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1376 This function scans the termcap function key sequence entries, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1377 adds entries to Vfunction_key_map for each function key it finds. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1378
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1379 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1380 term_get_fkeys (Lisp_Object keymap, char **address)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1381 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1382 /* We run the body of the function (term_get_fkeys_1) and ignore all Lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1383 errors during the call. The only errors should be from Fdefine_key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1384 when given a key sequence containing an invalid prefix key. If the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1385 termcap defines function keys which use a prefix that is already bound
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1386 to a command by the default bindings, we should silently ignore that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1387 function key specification, rather than giving the user an error and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1388 refusing to run at all on such a terminal. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1389
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1390 term_get_fkeys_arg = address;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1391
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1392 condition_case_1 (Qerror,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1393 term_get_fkeys_1, keymap,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1394 term_get_fkeys_error, Qnil);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1395 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1396
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1397 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1398 term_get_fkeys_error (Lisp_Object err, Lisp_Object arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1399 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1400 return arg;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1401 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1402
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1403 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1404 term_get_fkeys_1 (Lisp_Object function_key_map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1405 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1406 int i;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1407
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1408 char **address = term_get_fkeys_arg;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1409
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1410 for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1411 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1412 char *sequence = tgetstr (keys[i].cap, address);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1413 if (sequence)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1414 Fdefine_key (function_key_map,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1415 build_string (sequence),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1416 vector1 (intern (keys[i].name)));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1417 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1418
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1419 /* The uses of the "k0" capability are inconsistent; sometimes it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1420 describes F10, whereas othertimes it describes F0 and "k;" describes F10.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1421 We will attempt to politely accommodate both systems by testing for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1422 "k;", and if it is present, assuming that "k0" denotes F0, otherwise F10.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1423 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1424 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1425 char *k_semi = tgetstr ("k;", address);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1426 char *k0 = tgetstr ("k0", address);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1427 CONST char *k0_name = "f10";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1428
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1429 if (k_semi)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1430 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1431 Fdefine_key (function_key_map, build_string (k_semi),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1432 vector1 (intern ("f10")));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1433 k0_name = "f0";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1434 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1435
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1436 if (k0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1437 Fdefine_key (function_key_map, build_string (k0),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1438 vector1 (intern (k0_name)));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1439 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1440
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1441 /* Set up cookies for numbered function keys above f10. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1442 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1443 char fcap[3], fkey[4];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1444
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1445 fcap[0] = 'F'; fcap[2] = '\0';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1446 for (i = 11; i < 64; i++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1447 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1448 if (i <= 19)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1449 fcap[1] = '1' + i - 11;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1450 else if (i <= 45)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1451 fcap[1] = 'A' + i - 20;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1452 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1453 fcap[1] = 'a' + i - 46;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1454
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1455 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1456 char *sequence = tgetstr (fcap, address);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1457 if (sequence)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1458 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1459 sprintf (fkey, "f%d", i);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1460 Fdefine_key (function_key_map,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1461 build_string (sequence),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1462 vector1 (intern (fkey)));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1463 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1464 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1465 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1466 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1467
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1468 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1469 * Various mappings to try and get a better fit.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1470 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1471 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1472 #define CONDITIONAL_REASSIGN(cap1, cap2, sym) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1473 if (!tgetstr (cap1, address)) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1474 { \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1475 char *sequence = tgetstr (cap2, address); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1476 if (sequence) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1477 Fdefine_key (function_key_map, \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1478 build_string (sequence), \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1479 vector1 (intern (sym))); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1480 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1481
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1482 /* if there's no key_next keycap, map key_npage to `next' keysym */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1483 CONDITIONAL_REASSIGN ("%5", "kN", "next");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1484 /* if there's no key_prev keycap, map key_ppage to `previous' keysym */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1485 CONDITIONAL_REASSIGN ("%8", "kP", "prior");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1486 /* if there's no key_dc keycap, map key_ic to `insert' keysym */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1487 CONDITIONAL_REASSIGN ("kD", "kI", "insert");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1488
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1489 /* IBM has their own non-standard dialect of terminfo.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1490 If the standard name isn't found, try the IBM name. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1491 CONDITIONAL_REASSIGN ("kB", "KO", "backtab");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1492 CONDITIONAL_REASSIGN ("@4", "kJ", "execute"); /* actually "action" */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1493 CONDITIONAL_REASSIGN ("@4", "kc", "execute"); /* actually "command" */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1494 CONDITIONAL_REASSIGN ("%7", "ki", "menu");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1495 CONDITIONAL_REASSIGN ("@7", "kw", "end");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1496 CONDITIONAL_REASSIGN ("F1", "k<", "f11");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1497 CONDITIONAL_REASSIGN ("F2", "k>", "f12");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1498 CONDITIONAL_REASSIGN ("%1", "kq", "help");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1499 CONDITIONAL_REASSIGN ("*6", "kU", "select");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1500 #undef CONDITIONAL_REASSIGN
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1501 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1502
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1503 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1504 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1505
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1506
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1507 /************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1508 /* initialization */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1509 /************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1510
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1511 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1512 console_type_create_redisplay_tty (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1513 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1514 /* redisplay methods */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1515 CONSOLE_HAS_METHOD (tty, text_width);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1516 CONSOLE_HAS_METHOD (tty, output_display_block);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1517 CONSOLE_HAS_METHOD (tty, output_vertical_divider);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1518 CONSOLE_HAS_METHOD (tty, divider_width);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1519 CONSOLE_HAS_METHOD (tty, divider_height);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1520 CONSOLE_HAS_METHOD (tty, eol_cursor_width);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1521 CONSOLE_HAS_METHOD (tty, clear_to_window_end);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1522 CONSOLE_HAS_METHOD (tty, clear_region);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1523 CONSOLE_HAS_METHOD (tty, clear_frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1524 CONSOLE_HAS_METHOD (tty, output_begin);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1525 CONSOLE_HAS_METHOD (tty, output_end);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1526 CONSOLE_HAS_METHOD (tty, flash);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1527 CONSOLE_HAS_METHOD (tty, ring_bell);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1528 }