annotate src/redisplay-tty.c @ 169:15872534500d r20-3b11

Import from CVS: tag r20-3b11
author cvs
date Mon, 13 Aug 2007 09:46:53 +0200
parents d2f30a177268
children 3d6bfa290dbd
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 {
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 50
diff changeset
351 #ifdef MULE
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 50
diff changeset
352 Emchar ch = charptr_emchar (temptemp);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 50
diff changeset
353 i += XCHARSET_COLUMNS (CHAR_CHARSET (ch));
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 50
diff changeset
354 #else
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 i++; /* telescope this */
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 50
diff changeset
356 #endif
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 INC_CHARPTR (temptemp);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 /* If we truncated one column too many, then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 add a space at the beginning. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 if (i > rb->object.dglyph.xoffset)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 assert (i > 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 *--temptemp = ' ';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 i--;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 len -= i;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 tty_output_bufbyte_string (w, dl, temptemp, len,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 xpos, findex, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 if (xpos >= cursor_start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 && (cursor_start <
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 xpos + (bufbyte_string_displayed_columns
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 (temptemp, len))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 cmgoto (f, dl->ypos - 1, cursor_start);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 case IMAGE_MONO_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 case IMAGE_COLOR_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 case IMAGE_SUBWINDOW:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 /* just do nothing here */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 case IMAGE_POINTER:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 case IMAGE_NOTHING:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 /* nothing is as nothing does */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 xpos += rb->width;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 elt++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 }
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 if (Dynarr_length (buf))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 tty_output_emchar_dynarr (w, dl, buf, xpos, findex, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 Dynarr_free (buf);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 tty_output_vertical_divider
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 Draw a vertical divider down the left side of the given window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 tty_output_vertical_divider (struct window *w, int clear)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 struct frame *f = XFRAME (w->frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 int line;
169
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 122
diff changeset
428 int y_top = WINDOW_TEXT_TOP (w);
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 122
diff changeset
429 int y_bot = WINDOW_TEXT_BOTTOM (w);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 unsigned char divv = '|';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431
122
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 82
diff changeset
432 tty_turn_on_face (w, MODELINE_INDEX);
169
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 122
diff changeset
433 for (line = y_top; line < y_bot; line++)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 cmgoto (f, line, WINDOW_TEXT_LEFT (w) - 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 send_string_to_tty_console (c, &divv, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 TTY_INC_CURSOR_X (c, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 /* Draw the divider in the modeline. */
169
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 122
diff changeset
441 cmgoto (f, y_bot, WINDOW_TEXT_LEFT (w) - 1);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 send_string_to_tty_console (c, &divv, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 TTY_INC_CURSOR_X (c, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 tty_turn_off_face (w, MODELINE_INDEX);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 /****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 tty_clear_region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 Clear the area in the box defined by the given parameters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 tty_clear_region (Lisp_Object window, face_index findex, int x, int y,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 int width, int height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 struct window *w = XWINDOW (window);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 struct frame *f = XFRAME (w->frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 int line;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 if (!width || !height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 tty_turn_on_face (w, findex);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 for (line = y; line < y + height; line++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 int col;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 cmgoto (f, line, x);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 if (window_is_leftmost (w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 && window_is_rightmost (w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 && TTY_SE (c).clr_to_eol)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 OUTPUT1 (c, TTY_SE (c).clr_to_eol);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 unsigned char sp = ' ';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 /* #### Of course, this is all complete and utter crap. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 for (col = x; col < x + width; col++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 send_string_to_tty_console (c, &sp, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 TTY_INC_CURSOR_X (c, width);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 tty_turn_off_face (w, findex);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 cmgoto (f, y, x);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 tty_clear_to_window_end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 Clear the area between ypos1 and ypos2. Each margin area and the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 text area is handled separately since they may each have their own
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 background color.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 tty_clear_to_window_end (struct window *w, int ypos1, int ypos2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 struct frame *f = XFRAME (w->frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 int x, width;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 x = WINDOW_TEXT_LEFT (w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 width = WINDOW_TEXT_WIDTH (w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 if (window_is_rightmost (w))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 /* #### Optimize to use clr_to_eol function of tty if available, if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 the window is the entire width of the frame. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 /* #### Is this actually an optimization? */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 int line;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 tty_turn_on_face (w, DEFAULT_INDEX);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 for (line = ypos1; line < ypos2; line++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 cmgoto (XFRAME (w->frame), line, x);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 OUTPUT1 (c, TTY_SE (c).clr_to_eol);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 tty_turn_off_face (w, DEFAULT_INDEX);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 Lisp_Object window;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 XSETWINDOW (window, w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 tty_clear_region (window, DEFAULT_INDEX, x, ypos1, width, ypos2 - ypos1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 /****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 tty_clear_frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 Clear the entire frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 tty_clear_frame (struct frame *f)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 tty_turn_on_frame_face (f, Vdefault_face);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 if (TTY_SE (c).clr_frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 OUTPUT1 (c, TTY_SE (c).clr_frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 #ifdef NOT_SURE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 FRAME_CURSOR_X (f) = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 FRAME_CURSOR_Y (f) = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 #ifdef NOT_SURE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 internal_cursor_to (f, 0, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 clear_to_end (f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 /* #### Not implemented. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 fprintf (stderr, "Not yet.\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 tty_turn_off_frame_face (f, Vdefault_face);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 tty_output_bufbyte_string (struct window *w, struct display_line *dl,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 Bufbyte *str, Bytecount len, int xpos,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 face_index findex, int cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 struct frame *f = XFRAME (w->frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 /* First position the cursor. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 cmgoto (f, dl->ypos - 1, xpos);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 /* Enable any face properties. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 tty_turn_on_face (w, findex);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 send_string_to_tty_console (c, str, len);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 TTY_INC_CURSOR_X (c, bufbyte_string_displayed_columns (str, len));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 /* Turn the face properties back off. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 tty_turn_off_face (w, findex);
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 static bufbyte_dynarr *tty_output_emchar_dynarr_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 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 tty_output_emchar_dynarr
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 Given a string and a starting position, output that string in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 given face. If cursor is true, draw a cursor around the string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 tty_output_emchar_dynarr (struct window *w, struct display_line *dl,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 emchar_dynarr *buf, int xpos, face_index findex,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 int cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 if (!tty_output_emchar_dynarr_dynarr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 tty_output_emchar_dynarr_dynarr = Dynarr_new (Bufbyte);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 Dynarr_reset (tty_output_emchar_dynarr_dynarr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 convert_emchar_string_into_bufbyte_dynarr (Dynarr_atp (buf, 0),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 Dynarr_length (buf),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 tty_output_emchar_dynarr_dynarr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 tty_output_bufbyte_string (w, dl,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 Dynarr_atp (tty_output_emchar_dynarr_dynarr, 0),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 Dynarr_length (tty_output_emchar_dynarr_dynarr),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 xpos, findex, cursor);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 #if 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 static bufbyte_dynarr *sidcs_dynarr;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 substitute_in_dynamic_color_string (Lisp_Object spec, Lisp_Object string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 int i;
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
619 Bufbyte *specdata = XSTRING_DATA (spec);
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
620 Bytecount speclen = XSTRING_LENGTH (spec);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 if (!sidcs_dynarr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 sidcs_dynarr = Dynarr_new (Bufbyte);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 Dynarr_reset (sidcs_dynarr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 for (i = 0; i < speclen; i++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 if (specdata[i] == '%' && specdata[i+1] == '%')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 Dynarr_add (sidcs_dynarr, '%');
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 i++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 else if (specdata[i] == '%' && specdata[i+1] == 's')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 {
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
636 Dynarr_add_many (sidcs_dynarr,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
637 XSTRING_DATA (string),
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
638 XSTRING_LENGTH (string));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 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 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 Dynarr_add (sidcs_dynarr, specdata[i]);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 set_foreground_to (struct console *c, Lisp_Object sym)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 Lisp_Object result;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 Bufbyte *escseq = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 Bytecount escseqlen = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 result = assq_no_quit (sym, Vtty_color_alist);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 if (!NILP (result))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 Lisp_Object esc_seq = XCAR (XCDR (result));
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
659 escseq = XSTRING_DATA (esc_seq);
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
660 escseqlen = XSTRING_LENGTH (esc_seq);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 #if 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 else if (STRINGP (Vtty_dynamic_color_fg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 substitute_in_dynamic_color_string (Vtty_dynamic_color_fg,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 Fsymbol_name (sym));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 escseq = Dynarr_atp (sidcs_dynarr, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 escseqlen = Dynarr_length (sidcs_dynarr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 if (escseq)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674 send_string_to_tty_console (c, escseq, escseqlen);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679 set_background_to (struct console *c, Lisp_Object sym)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 Lisp_Object result;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 Bufbyte *escseq = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 Bytecount escseqlen = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 result = assq_no_quit (sym, Vtty_color_alist);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 if (!NILP (result))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 Lisp_Object esc_seq = XCDR (XCDR (result));
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
689 escseq = XSTRING_DATA (esc_seq);
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
690 escseqlen = XSTRING_LENGTH (esc_seq);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692 #if 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693 else if (STRINGP (Vtty_dynamic_color_bg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695 substitute_in_dynamic_color_string (Vtty_dynamic_color_bg,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 Fsymbol_name (sym));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 escseq = Dynarr_atp (sidcs_dynarr, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 escseqlen = Dynarr_length (sidcs_dynarr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 if (escseq)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 send_string_to_tty_console (c, escseq, escseqlen);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 tty_turn_on_face_1 (struct console *c, int highlight_p,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 int blinking_p, int dim_p, int underline_p,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 int reverse_p, Lisp_Object cinst_fore,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712 Lisp_Object cinst_back)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 if (highlight_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 OUTPUT1_IF (c, TTY_SD (c).turn_on_bold);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719 if (blinking_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 OUTPUT1_IF (c, TTY_SD (c).turn_on_blinking);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724 if (dim_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726 OUTPUT1_IF (c, TTY_SD (c).turn_on_dim);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 if (underline_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 /* #### punt for now if underline mode is glitchy */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 if (!TTY_FLAGS (c).underline_width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734 OUTPUT1_IF (c, TTY_SD (c).begin_underline);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 if (reverse_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 /* #### punt for now if standout mode is glitchy */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 if (!TTY_FLAGS (c).standout_width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 OUTPUT1_IF (c, TTY_SD (c).begin_standout);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 reverse_p = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 if (reverse_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751 Lisp_Object temp = cinst_fore;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 cinst_fore = cinst_back;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 cinst_back = temp;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756 if (COLOR_INSTANCEP (cinst_fore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 && !EQ (cinst_fore, Vthe_null_color_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 set_foreground_to (c, COLOR_INSTANCE_TTY_SYMBOL
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759 (XCOLOR_INSTANCE (cinst_fore)));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761 if (COLOR_INSTANCEP (cinst_back)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762 && !EQ (cinst_back, Vthe_null_color_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 set_background_to (c, COLOR_INSTANCE_TTY_SYMBOL
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 (XCOLOR_INSTANCE (cinst_back)));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 tty_turn_on_face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770 Turn on all set properties of the given face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773 tty_turn_on_face (struct window *w, face_index findex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775 struct frame *f = XFRAME (w->frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 tty_turn_on_face_1 (c,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 WINDOW_FACE_CACHEL_HIGHLIGHT_P (w, findex),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780 WINDOW_FACE_CACHEL_BLINKING_P (w, findex),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 WINDOW_FACE_CACHEL_DIM_P (w, findex),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782 WINDOW_FACE_CACHEL_UNDERLINE_P (w, findex),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783 WINDOW_FACE_CACHEL_REVERSE_P (w, findex),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784 WINDOW_FACE_CACHEL_FOREGROUND (w, findex),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785 WINDOW_FACE_CACHEL_BACKGROUND (w, findex));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789 tty_turn_off_face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 Turn off all set properties of the given face (revert to default
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792 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
793 face so that it's properties are actually active.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796 tty_turn_off_face (struct window *w, face_index findex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798 struct frame *f = XFRAME (w->frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
799 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801 if (WINDOW_FACE_CACHEL_REVERSE_P (w, findex))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803 /* #### punt for now if standout mode is glitchy */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804 if (!TTY_FLAGS (c).standout_width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806 OUTPUT1_IF (c, TTY_SD (c).end_standout);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 if (WINDOW_FACE_CACHEL_UNDERLINE_P (w, findex))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812 /* #### punt for now if underline mode is glitchy */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813 if (!TTY_FLAGS (c).underline_width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815 OUTPUT1_IF (c, TTY_SD (c).end_underline);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 if (WINDOW_FACE_CACHEL_HIGHLIGHT_P (w, findex) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820 WINDOW_FACE_CACHEL_BLINKING_P (w, findex) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 WINDOW_FACE_CACHEL_DIM_P (w, findex) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 !EQ (WINDOW_FACE_CACHEL_FOREGROUND (w, findex),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 Vthe_null_color_instance) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 !EQ (WINDOW_FACE_CACHEL_BACKGROUND (w, findex),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825 Vthe_null_color_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827 OUTPUT1_IF (c, TTY_SD (c).turn_off_attributes);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 tty_turn_on_frame_face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 Turn on all set properties of the given 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 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 tty_turn_on_frame_face (struct frame *f, Lisp_Object face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 Lisp_Object frame = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 XSETFRAME (frame, f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 tty_turn_on_face_1 (c,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 FACE_HIGHLIGHT_P (face, frame),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 FACE_BLINKING_P (face, frame),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846 FACE_DIM_P (face, frame),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 FACE_UNDERLINE_P (face, frame),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 FACE_REVERSE_P (face, frame),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 FACE_FOREGROUND (face, frame),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 FACE_BACKGROUND (face, frame));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 tty_turn_off_frame_face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856 Turn off all set properties of the given face (revert to default
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857 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
858 face so that it's properties are actually active.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 tty_turn_off_frame_face (struct frame *f, Lisp_Object face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 Lisp_Object frame = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 XSETFRAME (frame, f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868 if (FACE_REVERSE_P (face, frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 /* #### punt for now if standout mode is glitchy */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871 if (!TTY_FLAGS (c).standout_width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 OUTPUT1_IF (c, TTY_SD (c).end_standout);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 if (FACE_UNDERLINE_P (face, frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 /* #### punt for now if underline mode is glitchy */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880 if (!TTY_FLAGS (c).underline_width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882 OUTPUT1_IF (c, TTY_SD (c).end_underline);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886 if (FACE_HIGHLIGHT_P (face, frame) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 FACE_BLINKING_P (face, frame) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 FACE_DIM_P (face, frame) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889 !EQ (FACE_FOREGROUND (face, frame), Vthe_null_color_instance) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 !EQ (FACE_BACKGROUND (face, frame), Vthe_null_color_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892 OUTPUT1_IF (c, TTY_SD (c).turn_off_attributes);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 set_tty_modes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 Sets up various parameters on tty modes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902 set_tty_modes (struct console *c)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904 if (!CONSOLE_TTY_P (c))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907 OUTPUT1_IF (c, TTY_SD (c).init_motion);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908 OUTPUT1_IF (c, TTY_SD (c).cursor_visible);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909 OUTPUT1_IF (c, TTY_SD (c).keypad_on);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 reset_tty_modes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 Restore default state of tty.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 reset_tty_modes (struct console *c)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920 if (!CONSOLE_TTY_P (c))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922
122
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 82
diff changeset
923 OUTPUT1_IF (c, TTY_SD (c).orig_pair);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 OUTPUT1_IF (c, TTY_SD (c).keypad_off);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925 OUTPUT1_IF (c, TTY_SD (c).cursor_normal);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926 OUTPUT1_IF (c, TTY_SD (c).end_motion);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 tty_output_end (XDEVICE (CONSOLE_SELECTED_DEVICE (c)));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931 tty_redisplay_shutdown
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 Clear the frame and position the cursor properly for exiting.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 tty_redisplay_shutdown (struct console *c)
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 dev = CONSOLE_SELECTED_DEVICE (c);
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 (dev))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942 Lisp_Object frm = DEVICE_SELECTED_FRAME (XDEVICE (dev));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944 if (!GC_NILP (frm))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 struct frame *f = XFRAME (frm);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 /* Clear the bottom line of the frame. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 tty_clear_region (FRAME_SELECTED_WINDOW (f), DEFAULT_INDEX, 0,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950 f->height, f->width, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 /* And then stick the cursor there. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 cmgoto (f, f->height, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954 tty_output_end (XDEVICE (dev));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957 }
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 /* #### Everything below here is old shit. It should either be moved
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961 up or removed. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964 /* FLAGS - these don't need to be console local since only one console
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965 can be being updated at a time. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966 static int insert_mode_on; /* nonzero if in insert mode */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967 static int standout_mode_on; /* nonzero if in standout mode */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968 static int underline_mode_on; /* nonzero if in underline mode */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 static int alternate_mode_on; /* nonzero if in alternate char set */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970 static int attributes_on; /* nonzero if any attributes on */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972 #ifdef NOT_YET
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 turn_on_insert (struct frame *f)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978 if (!insert_mode_on)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979 OUTPUT1_IF (c, TTY_SE (c).begin_ins_mode);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980 insert_mode_on = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984 turn_off_insert (struct frame *f)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988 if (insert_mode_on)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 OUTPUT1 (c, TTY_SE (c).end_ins_mode);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990 insert_mode_on = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 internal_cursor_to (struct frame *f, int row, int col)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998 if (!TTY_FLAGS (c).insert_mode_motion)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999 turn_off_insert (f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000 if (!TTY_FLAGS (c).standout_motion)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1002 turn_off_standout (f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003 turn_off_underline (f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1004 turn_off_alternate (f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007 cmgoto (f, row, col);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1010 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011 clear_to_end (struct frame *f)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1012 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1013 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015 /* assumes cursor is already positioned */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016 if (TTY_SE (c).clr_from_cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 OUTPUT1 (c, TTY_SE (c).clr_from_cursor);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 int line = FRAME_CURSOR_Y (f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 while (line < FRAME_HEIGHT (f))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026 internal_cursor_to (f, line, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 OUTPUT1 (c, TTY_SE (c).clr_to_eol);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031 #endif /* 0 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1032
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033 #if 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035 * clear from last visible line on window to window end (presumably
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1036 * the line above window's modeline
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039 tty_clear_window_end (struct window *w, int ystart, int yend)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041 struct console *c = XCONSOLE (WINDOW_CONSOLE (w));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042 int line;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1043
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044 for (line = ystart; line < yend; line++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046 cmgoto (XFRAME (w->frame), line, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047 OUTPUT1 (c, TTY_SE (c).clr_to_eol);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1049 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1051 #endif /* 0 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1052
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1053 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054 tty_flash (struct device *d)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1055 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056 struct console *c = XCONSOLE (DEVICE_CONSOLE (d));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1057 if (TTY_SD (c).visual_bell)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1058 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1059 OUTPUT1 (c, TTY_SD (c).visual_bell);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060 Lstream_flush (XLSTREAM (CONSOLE_TTY_DATA (c)->outstream));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061 return 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1062 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1064 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1067 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1068 * tty_ring_bell - sound an audio beep.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1069 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1070 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1071 tty_ring_bell (struct device *d, int volume, int pitch, int duration)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1072 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1073 struct console *c = XCONSOLE (DEVICE_CONSOLE (d));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1074
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 74
diff changeset
1075 if (volume)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 74
diff changeset
1076 {
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 74
diff changeset
1077 OUTPUT1 (c, TTY_SD (c).audio_bell);
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 74
diff changeset
1078 Lstream_flush (XLSTREAM (CONSOLE_TTY_DATA (c)->outstream));
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 74
diff changeset
1079 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1080 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1082
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1083 int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1084 init_tty_for_redisplay (struct device *d, char *terminal_type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1085 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086 int status;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087 char entry_buffer[2044];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1088 /* char temp_buffer[2044]; */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1089 char *bufptr;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090 struct console *c = XCONSOLE (DEVICE_CONSOLE (d));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1091
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1092 /* What we should really do is allocate just enough space for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1093 the actual strings that are stored; but this would require
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1094 doing this after all the tgetstr()s and adjusting all the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1095 pointers. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096 CONSOLE_TTY_DATA (c)->term_entry_buffer = (char *) xmalloc (2044);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1097 bufptr = CONSOLE_TTY_DATA (c)->term_entry_buffer;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1099 EMACS_BLOCK_SIGNAL (SIGTTOU);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1100 status = tgetent (entry_buffer, terminal_type);
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1101 EMACS_UNBLOCK_SIGNAL (SIGTTOU);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102 #if 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1103 if (status < 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1104 return TTY_UNABLE_OPEN_DATABASE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1105 else 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 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1108 /* Under Linux at least, <0 is returned for TTY_TYPE_UNDEFINED. --ben */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1109 if (status <= 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1110 return TTY_TYPE_UNDEFINED;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1111
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1112 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1113 * Establish the terminal size.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1114 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1115 /* First try to get the info from the system. If that fails, check
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1116 the termcap entry. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1117 get_tty_device_size (d, &CONSOLE_TTY_DATA (c)->width,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1118 &CONSOLE_TTY_DATA (c)->height);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1119
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1120 if (CONSOLE_TTY_DATA (c)->width <= 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1121 CONSOLE_TTY_DATA (c)->width = tgetnum ("co");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1122 if (CONSOLE_TTY_DATA (c)->height <= 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1123 CONSOLE_TTY_DATA (c)->height = tgetnum ("li");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1124
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1125 if (CONSOLE_TTY_DATA (c)->width <= 0 || CONSOLE_TTY_DATA (c)->height <= 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1126 return TTY_SIZE_UNSPECIFIED;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1127
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1128 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1129 * Initialize cursor motion information.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1130 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1131
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1132 /* local cursor movement */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1133 TTY_CM (c).up = tgetstr ("up", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1134 TTY_CM (c).down = tgetstr ("do", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135 TTY_CM (c).left = tgetstr ("le", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1136 TTY_CM (c).right = tgetstr ("nd", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1137 TTY_CM (c).home = tgetstr ("ho", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1138 TTY_CM (c).low_left = tgetstr ("ll", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1139 TTY_CM (c).car_return = tgetstr ("cr", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1140
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1141 /* absolute cursor motion */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1142 TTY_CM (c).abs = tgetstr ("cm", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1143 TTY_CM (c).hor_abs = tgetstr ("ch", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1144 TTY_CM (c).ver_abs = tgetstr ("cv", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1145
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1146 /* Verify that the terminal is powerful enough to run Emacs */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1147 if (!TTY_CM (c).abs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1148 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1149 if (!TTY_CM (c).up || !TTY_CM (c).down
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1150 || !TTY_CM (c).left || !TTY_CM (c).right)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1151 return TTY_TYPE_INSUFFICIENT;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1152 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1153
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1154 /* parameterized local cursor movement */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1155 TTY_CM (c).multi_up = tgetstr ("UP", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1156 TTY_CM (c).multi_down = tgetstr ("DO", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1157 TTY_CM (c).multi_left = tgetstr ("LE", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1158 TTY_CM (c).multi_right = tgetstr ("RI", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1159
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1160 /* scrolling */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1161 TTY_CM (c).scroll_forw = tgetstr ("sf", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1162 TTY_CM (c).scroll_back = tgetstr ("sr", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1163 TTY_CM (c).multi_scroll_forw = tgetstr ("SF", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1164 TTY_CM (c).multi_scroll_back = tgetstr ("SR", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1165 TTY_CM (c).set_scroll_region = tgetstr ("cs", &bufptr);
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 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1169 * Initialize screen editing information.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1170 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1171
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1172 /* adding to the screen */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1173 TTY_SE (c).ins_line = tgetstr ("al", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1174 TTY_SE (c).multi_ins_line = tgetstr ("AL", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1175 TTY_SE (c).repeat = tgetstr ("rp", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1176 TTY_SE (c).begin_ins_mode = tgetstr ("im", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1177 TTY_SE (c).end_ins_mode = tgetstr ("ei", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1178 TTY_SE (c).ins_char = tgetstr ("ic", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1179 TTY_SE (c).multi_ins_char = tgetstr ("IC", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1180 TTY_SE (c).insert_pad = tgetstr ("ip", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1181
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1182 /* deleting from the screen */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1183 TTY_SE (c).clr_frame = tgetstr ("cl", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1184 TTY_SE (c).clr_from_cursor = tgetstr ("cd", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1185 TTY_SE (c).clr_to_eol = tgetstr ("ce", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1186 TTY_SE (c).del_line = tgetstr ("dl", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1187 TTY_SE (c).multi_del_line = tgetstr ("DL", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1188 TTY_SE (c).del_char = tgetstr ("dc", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1189 TTY_SE (c).multi_del_char = tgetstr ("DC", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1190 TTY_SE (c).begin_del_mode = tgetstr ("dm", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1191 TTY_SE (c).end_del_mode = tgetstr ("ed", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1192 TTY_SE (c).erase_at_cursor = tgetstr ("ec", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1193
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1194
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1195 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1196 * Initialize screen display information.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1197 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1198 TTY_SD (c).begin_standout = tgetstr ("so", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1199 TTY_SD (c).end_standout = tgetstr ("se", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1200 TTY_SD (c).begin_underline = tgetstr ("us", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1201 TTY_SD (c).end_underline = tgetstr ("ue", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1202 TTY_SD (c).begin_alternate = tgetstr ("as", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1203 TTY_SD (c).end_alternate = tgetstr ("ae", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1204 TTY_SD (c).turn_on_reverse = tgetstr ("mr", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1205 TTY_SD (c).turn_on_blinking = tgetstr ("mb", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1206 TTY_SD (c).turn_on_bold = tgetstr ("md", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1207 TTY_SD (c).turn_on_dim = tgetstr ("mh", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1208 TTY_SD (c).turn_off_attributes = tgetstr ("me", &bufptr);
122
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 82
diff changeset
1209 TTY_SD (c).orig_pair = tgetstr ("op", &bufptr);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1210
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1211 TTY_SD (c).visual_bell = tgetstr ("vb", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1212 TTY_SD (c).audio_bell = tgetstr ("bl", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1213 if (!TTY_SD (c).audio_bell)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1214 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1215 /* 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
1216 ugly but is what Emacs has done from time immortal. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1217 TTY_SD (c).audio_bell = "\07";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1218 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1219
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1220 TTY_SD (c).cursor_visible = tgetstr ("ve", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1221 TTY_SD (c).cursor_normal = tgetstr ("vs", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1222 TTY_SD (c).init_motion = tgetstr ("ti", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1223 TTY_SD (c).end_motion = tgetstr ("te", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1224 TTY_SD (c).keypad_on = tgetstr ("ks", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1225 TTY_SD (c).keypad_off = tgetstr ("ke", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1226
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1227
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1228 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1229 * Initialize additional terminal information.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1230 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1231 TTY_FLAGS (c).must_write_spaces = tgetflag ("in");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1232 TTY_FLAGS (c).insert_mode_motion = tgetflag ("mi");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1233 TTY_FLAGS (c).standout_motion = tgetflag ("ms");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1234 TTY_FLAGS (c).memory_above_frame = tgetflag ("da");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1235 TTY_FLAGS (c).memory_below_frame = tgetflag ("db");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1236 TTY_FLAGS (c).standout_width = tgetnum ("sg");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1237 TTY_FLAGS (c).underline_width = tgetnum ("ug");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1238
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1239 if (TTY_FLAGS (c).standout_width == -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1240 TTY_FLAGS (c).standout_width = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1241 if (TTY_FLAGS (c).underline_width == -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1242 TTY_FLAGS (c).underline_width = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1243
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1244 TTY_FLAGS (c).meta_key =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1245 eight_bit_tty (d) ? tgetflag ("km") || tgetflag ("MT") ? 1 : 2 : 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1246
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 * Setup the costs tables for this tty console.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1250 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1251 cm_cost_init (c);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1252
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1253 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1254 * Initialize local flags.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1255 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1256 insert_mode_on = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1257 standout_mode_on = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1258 underline_mode_on = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1259 alternate_mode_on = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1260 attributes_on = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1261
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1262 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1263 * Attempt to initialise the function_key_map to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1264 * some kind of sensible value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1265 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1266
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1267 term_get_fkeys (c->function_key_map, &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1268
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1269 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1270 /* check for ANSI set-foreground and set-background strings,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1271 and assume color if so.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1272
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1273 #### we should support the other (non-ANSI) ways of specifying
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1274 color, too. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1275 char foobuf[500];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1276 char *fooptr = foobuf;
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 50
diff changeset
1277 if (tgetstr ("AB", &fooptr) && tgetstr ("AF", &fooptr))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1278 DEVICE_CLASS (d) = Qcolor;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1279 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1280 DEVICE_CLASS (d) = Qmono;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1281 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1282
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1283 return TTY_INIT_SUCCESS;
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 struct fkey_table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1287 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1288 CONST char *cap, *name;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1289 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1290
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1291 /* Termcap capability names that correspond directly to X keysyms.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1292 Some of these (marked "terminfo") aren't supplied by old-style
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1293 (Berkeley) termcap entries. They're listed in X keysym order;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1294 except we put the keypad keys first, so that if they clash with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1295 other keys (as on the IBM PC keyboard) they get overridden.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1296 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1297
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1298 static struct fkey_table keys[] =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1299 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1300 {"kh", "home"}, /* termcap */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1301 {"kl", "left"}, /* termcap */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1302 {"ku", "up"}, /* termcap */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1303 {"kr", "right"}, /* termcap */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1304 {"kd", "down"}, /* termcap */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1305 {"%8", "prior"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1306 {"%5", "next"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1307 {"@7", "end"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1308 {"@1", "begin"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1309 {"*6", "select"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1310 {"%9", "print"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1311 {"@4", "execute"}, /* terminfo --- actually the `command' key */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1312 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1313 * "insert" --- see below
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1314 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1315 {"&8", "undo"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1316 {"%0", "redo"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1317 {"%7", "menu"}, /* terminfo --- actually the `options' key */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1318 {"@0", "find"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1319 {"@2", "cancel"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1320 {"%1", "help"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1321 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1322 * "break" goes here, but can't be reliably intercepted with termcap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1323 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1324 {"&4", "reset"}, /* terminfo --- actually `restart' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1325 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1326 * "system" and "user" --- no termcaps
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1327 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1328 {"kE", "clearline"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1329 {"kA", "insertline"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1330 {"kL", "deleteline"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1331 {"kI", "insertchar"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1332 {"kD", "delete"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1333 {"kB", "backtab"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1334 /*
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1335 * "kp-backtab", "kp-space", "kp-tab" --- no termcaps
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1336 */
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1337 {"@8", "kp-enter"}, /* terminfo */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1338 /*
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1339 * "kp-f1", "kp-f2", "kp-f3" "kp-f4",
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1340 * "kp-multiply", "kp-add", "kp-separator",
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1341 * "kp-subtract", "kp-decimal", "kp-divide", "kp-0";
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1342 * --- no termcaps for any of these.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1343 */
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1344 {"K4", "kp-1"}, /* terminfo */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1345 /*
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1346 * "kp-2" --- no termcap
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1347 */
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1348 {"K5", "kp-3"}, /* terminfo */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1349 /*
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1350 * "kp-4" --- no termcap
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1351 */
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1352 {"K2", "kp-5"}, /* terminfo */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1353 /*
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1354 * "kp-6" --- no termcap
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1355 */
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1356 {"K1", "kp-7"}, /* terminfo */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1357 /*
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1358 * "kp-8" --- no termcap
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1359 */
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1360 {"K3", "kp-9"}, /* terminfo */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1361 /*
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1362 * "kp-equal" --- no termcap
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1363 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1364 {"k1", "f1"},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1365 {"k2", "f2"},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1366 {"k3", "f3"},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1367 {"k4", "f4"},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1368 {"k5", "f5"},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1369 {"k6", "f6"},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1370 {"k7", "f7"},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1371 {"k8", "f8"},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1372 {"k9", "f9"},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1373 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1374
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1375 static char **term_get_fkeys_arg;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1376
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1377 static Lisp_Object term_get_fkeys_1 (Lisp_Object keymap);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1378 static Lisp_Object term_get_fkeys_error (Lisp_Object err, Lisp_Object arg);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1379
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1380 /* Find the escape codes sent by the function keys for Vfunction_key_map.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1381 This function scans the termcap function key sequence entries, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1382 adds entries to Vfunction_key_map for each function key it finds. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1383
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1384 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1385 term_get_fkeys (Lisp_Object keymap, char **address)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1386 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1387 /* 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
1388 errors during the call. The only errors should be from Fdefine_key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1389 when given a key sequence containing an invalid prefix key. If the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1390 termcap defines function keys which use a prefix that is already bound
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1391 to a command by the default bindings, we should silently ignore that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1392 function key specification, rather than giving the user an error and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1393 refusing to run at all on such a terminal. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1394
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1395 term_get_fkeys_arg = address;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1396
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1397 condition_case_1 (Qerror,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1398 term_get_fkeys_1, keymap,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1399 term_get_fkeys_error, Qnil);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1400 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1401
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1402 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1403 term_get_fkeys_error (Lisp_Object err, Lisp_Object arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1404 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1405 return arg;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1406 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1407
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1408 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1409 term_get_fkeys_1 (Lisp_Object function_key_map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1410 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1411 int i;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1412
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1413 char **address = term_get_fkeys_arg;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1414
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1415 for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1416 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1417 char *sequence = tgetstr (keys[i].cap, address);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1418 if (sequence)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1419 Fdefine_key (function_key_map,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1420 build_string (sequence),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1421 vector1 (intern (keys[i].name)));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1422 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1423
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1424 /* The uses of the "k0" capability are inconsistent; sometimes it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1425 describes F10, whereas othertimes it describes F0 and "k;" describes F10.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1426 We will attempt to politely accommodate both systems by testing for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1427 "k;", and if it is present, assuming that "k0" denotes F0, otherwise 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 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1430 char *k_semi = tgetstr ("k;", address);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1431 char *k0 = tgetstr ("k0", address);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1432 CONST char *k0_name = "f10";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1433
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1434 if (k_semi)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1435 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1436 Fdefine_key (function_key_map, build_string (k_semi),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1437 vector1 (intern ("f10")));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1438 k0_name = "f0";
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 if (k0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1442 Fdefine_key (function_key_map, build_string (k0),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1443 vector1 (intern (k0_name)));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1444 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1445
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1446 /* Set up cookies for numbered function keys above f10. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1447 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1448 char fcap[3], fkey[4];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1449
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1450 fcap[0] = 'F'; fcap[2] = '\0';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1451 for (i = 11; i < 64; i++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1452 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1453 if (i <= 19)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1454 fcap[1] = '1' + i - 11;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1455 else if (i <= 45)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1456 fcap[1] = 'A' + i - 20;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1457 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1458 fcap[1] = 'a' + i - 46;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1459
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1460 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1461 char *sequence = tgetstr (fcap, address);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1462 if (sequence)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1463 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1464 sprintf (fkey, "f%d", i);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1465 Fdefine_key (function_key_map,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1466 build_string (sequence),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1467 vector1 (intern (fkey)));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1468 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1469 }
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
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1473 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1474 * Various mappings to try and get a better fit.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1475 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1476 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1477 #define CONDITIONAL_REASSIGN(cap1, cap2, sym) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1478 if (!tgetstr (cap1, address)) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1479 { \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1480 char *sequence = tgetstr (cap2, address); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1481 if (sequence) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1482 Fdefine_key (function_key_map, \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1483 build_string (sequence), \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1484 vector1 (intern (sym))); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1485 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1486
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1487 /* if there's no key_next keycap, map key_npage to `next' keysym */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1488 CONDITIONAL_REASSIGN ("%5", "kN", "next");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1489 /* if there's no key_prev keycap, map key_ppage to `previous' keysym */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1490 CONDITIONAL_REASSIGN ("%8", "kP", "prior");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1491 /* if there's no key_dc keycap, map key_ic to `insert' keysym */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1492 CONDITIONAL_REASSIGN ("kD", "kI", "insert");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1493
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1494 /* IBM has their own non-standard dialect of terminfo.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1495 If the standard name isn't found, try the IBM name. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1496 CONDITIONAL_REASSIGN ("kB", "KO", "backtab");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1497 CONDITIONAL_REASSIGN ("@4", "kJ", "execute"); /* actually "action" */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1498 CONDITIONAL_REASSIGN ("@4", "kc", "execute"); /* actually "command" */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1499 CONDITIONAL_REASSIGN ("%7", "ki", "menu");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1500 CONDITIONAL_REASSIGN ("@7", "kw", "end");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1501 CONDITIONAL_REASSIGN ("F1", "k<", "f11");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1502 CONDITIONAL_REASSIGN ("F2", "k>", "f12");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1503 CONDITIONAL_REASSIGN ("%1", "kq", "help");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1504 CONDITIONAL_REASSIGN ("*6", "kU", "select");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1505 #undef CONDITIONAL_REASSIGN
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 return Qnil;
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
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1512 /************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1513 /* initialization */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1514 /************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1515
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1516 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1517 console_type_create_redisplay_tty (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1518 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1519 /* redisplay methods */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1520 CONSOLE_HAS_METHOD (tty, text_width);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1521 CONSOLE_HAS_METHOD (tty, output_display_block);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1522 CONSOLE_HAS_METHOD (tty, output_vertical_divider);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1523 CONSOLE_HAS_METHOD (tty, divider_width);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1524 CONSOLE_HAS_METHOD (tty, divider_height);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1525 CONSOLE_HAS_METHOD (tty, eol_cursor_width);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1526 CONSOLE_HAS_METHOD (tty, clear_to_window_end);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1527 CONSOLE_HAS_METHOD (tty, clear_region);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1528 CONSOLE_HAS_METHOD (tty, clear_frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1529 CONSOLE_HAS_METHOD (tty, output_begin);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1530 CONSOLE_HAS_METHOD (tty, output_end);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1531 CONSOLE_HAS_METHOD (tty, flash);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1532 CONSOLE_HAS_METHOD (tty, ring_bell);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1533 }