annotate src/msdos.c @ 20:859a2309aef8 r19-15b93

Import from CVS: tag r19-15b93
author cvs
date Mon, 13 Aug 2007 08:50:05 +0200
parents 0293115a14e9
children 131b0175ea99
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 /* MS-DOS specific C utilities.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 Free Software Foundation; either version 2, or (at your option) any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 along with XEmacs; see the file COPYING. If not, write to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 Boston, MA 02111-1307, USA. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 /* Synched up with: FSF 19.30. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 /* Contributed by Morten Welinder */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 /* New display, keyboard, and mouse control by Kim F. Storm */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 /* Note: some of the stuff here was taken from end of sysdep.c in demacs. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 #define DONT_ENCAPSULATE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 #include <config.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 #ifdef MSDOS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 #include <sys/param.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 #include <sys/time.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 #include <dos.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 #include "lisp.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 #include "dosfns.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 #include "msdos.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 #include "redisplay.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 #include "systime.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 #include "termhooks.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 #include "frame.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 #include "window.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 #include <go32.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 #include <pc.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 static unsigned long
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 event_timestamp (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 struct time t;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 unsigned long s;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 gettime (&t);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 s = t.ti_min;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 s *= 60;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 s += t.ti_sec;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 s *= 1000;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 s += t.ti_hund * 10;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 return s;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 /* ------------------------ Mouse control ---------------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 * Coordinates are in screen positions and zero based.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 * Mouse buttons are numbered from left to right and also zero based.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 int have_mouse; /* 0: no, 1: enabled, -1: disabled */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 static int mouse_visible;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 static int mouse_last_x;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 static int mouse_last_y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 static int mouse_button_translate[NUM_MOUSE_BUTTONS];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 static int mouse_button_count;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 mouse_on (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 union REGS regs;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 if (have_mouse > 0 && !mouse_visible)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 if (termscript)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 fprintf (termscript, "<M_ON>");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 regs.x.ax = 0x0001;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 int86 (0x33, &regs, &regs);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 mouse_visible = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 mouse_off (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 union REGS regs;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 if (have_mouse > 0 && mouse_visible)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 if (termscript)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 fprintf (termscript, "<M_OFF>");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 regs.x.ax = 0x0002;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 int86 (0x33, &regs, &regs);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 mouse_visible = 0;
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 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 mouse_moveto (int x, int y)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 union REGS regs;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 if (termscript)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 fprintf (termscript, "<M_XY=%dx%d>", x, y);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 regs.x.ax = 0x0004;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 mouse_last_x = regs.x.cx = x * 8;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 mouse_last_y = regs.x.dx = y * 8;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 int86 (0x33, &regs, &regs);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 mouse_pressed (int b, int *xp, int *yp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 union REGS regs;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 if (b >= mouse_button_count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 regs.x.ax = 0x0005;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 regs.x.bx = mouse_button_translate[b];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 int86 (0x33, &regs, &regs);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 if (regs.x.bx)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 *xp = regs.x.cx / 8, *yp = regs.x.dx / 8;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 return (regs.x.bx != 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 mouse_released (int b, int *xp, int *yp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 union REGS regs;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 if (b >= mouse_button_count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 regs.x.ax = 0x0006;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 regs.x.bx = mouse_button_translate[b];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 int86 (0x33, &regs, &regs);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 if (regs.x.bx)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 *xp = regs.x.cx / 8, *yp = regs.x.dx / 8;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 return (regs.x.bx != 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 mouse_get_xy (int *x, int *y)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 union REGS regs;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 regs.x.ax = 0x0003;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 int86 (0x33, &regs, &regs);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 *x = regs.x.cx / 8;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 *y = regs.x.dx / 8;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 mouse_get_pos (FRAME_PTR *f, int insist, Lisp_Object *bar_window,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 Lisp_Object *x, Lisp_Object *y, enum scroll_bar_part *part,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 unsigned long *time)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 int ix, iy;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 union REGS regs;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 regs.x.ax = 0x0003;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 int86 (0x33, &regs, &regs);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 *f = selected_frame;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 *bar_window = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 mouse_get_xy (&ix, &iy);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 selected_frame->mouse_moved = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 *x = make_int (ix);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 *y = make_int (iy);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 *time = event_timestamp ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 mouse_check_moved (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 int x, y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 mouse_get_xy (&x, &y);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 selected_frame->mouse_moved |= (x != mouse_last_x || y != mouse_last_y);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 mouse_last_x = x;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 mouse_last_y = y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 mouse_init (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 union REGS regs;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 if (termscript)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 fprintf (termscript, "<M_INIT>");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 regs.x.ax = 0x0021;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 int86 (0x33, &regs, &regs);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 regs.x.ax = 0x0007;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 regs.x.cx = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 regs.x.dx = 8 * (ScreenCols () - 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 int86 (0x33, &regs, &regs);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 regs.x.ax = 0x0008;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 regs.x.cx = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 regs.x.dx = 8 * (ScreenRows () - 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 int86 (0x33, &regs, &regs);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 mouse_moveto (0, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 mouse_visible = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 /* ------------------------- Screen control ----------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 static int internal_terminal = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 #ifndef HAVE_X_WINDOWS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 extern unsigned char ScreenAttrib;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 static int screen_face;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 static int highlight;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 static int screen_size_X;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 static int screen_size_Y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 static int screen_size;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 static int current_pos_X;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 static int current_pos_Y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 static int new_pos_X;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 static int new_pos_Y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 static void *startup_screen_buffer;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 static int startup_screen_size_X;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 static int startup_screen_size_Y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 static int startup_pos_X;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 static int startup_pos_Y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 static int term_setup_done;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 /* Similar to the_only_frame. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 struct x_output the_only_x_display;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 /* This is never dereferenced. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 Display *x_current_display;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 #define SCREEN_SET_CURSOR() \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 if (current_pos_X != new_pos_X || current_pos_Y != new_pos_Y) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 ScreenSetCursor (current_pos_Y = new_pos_Y, current_pos_X = new_pos_X)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 static
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 dos_direct_output (int y, int x, char *buf, int len)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 int t = (int) ScreenPrimary + 2 * (x + y * screen_size_X);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 while (--len >= 0) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 dosmemput (buf++, 1, t);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 t += 2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 /* Flash the screen as a substitute for BEEPs. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 #if (__DJGPP__ < 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 do_visible_bell (unsigned char xorattr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 asm volatile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 (" movb $1,%%dl
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 visible_bell_0:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 movl _ScreenPrimary,%%eax
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 call dosmemsetup
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 movl %%eax,%%ebx
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 movl %1,%%ecx
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 movb %0,%%al
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 incl %%ebx
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 visible_bell_1:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 xorb %%al,%%gs:(%%ebx)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 addl $2,%%ebx
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 decl %%ecx
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 jne visible_bell_1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 decb %%dl
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 jne visible_bell_3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 visible_bell_2:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 movzwl %%ax,%%eax
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 movzwl %%ax,%%eax
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 movzwl %%ax,%%eax
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 movzwl %%ax,%%eax
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 decw %%cx
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 jne visible_bell_2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 jmp visible_bell_0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 visible_bell_3:"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 : /* no output */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 : "m" (xorattr), "g" (screen_size)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 : "%eax", "%ebx", /* "%gs",*/ "%ecx", "%edx");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 ScreenVisualBell (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 /* This creates an xor-mask that will swap the default fore- and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 background colors. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 do_visible_bell (((the_only_x_display.foreground_pixel
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 ^ the_only_x_display.background_pixel)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 * 0x11) & 0x7f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 #ifndef HAVE_X_WINDOWS
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 * If we write a character in the position where the mouse is,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 * the mouse cursor may need to be refreshed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 mouse_off_maybe (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 int x, y;
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 (!mouse_visible)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 mouse_get_xy (&x, &y);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 if (y != new_pos_Y || x < new_pos_X)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 mouse_off ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 static
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 IT_ring_bell (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 if (visible_bell)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 mouse_off ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 ScreenVisualBell ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 union REGS inregs, outregs;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 inregs.h.ah = 2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 inregs.h.dl = 7;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 intdos (&inregs, &outregs);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 IT_set_face (int face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 struct face *fp;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 extern struct face *intern_face (/* FRAME_PTR, struct face * */);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 if (face == 1 || (face == 0 && highlight))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 fp = FRAME_MODE_LINE_FACE (foo);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 else if (face <= 0 || face >= FRAME_N_COMPUTED_FACES (foo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 fp = FRAME_DEFAULT_FACE (foo);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 fp = intern_face (selected_frame, FRAME_COMPUTED_FACES (foo)[face]);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 if (termscript)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 fprintf (termscript, "<FACE:%d:%d>", FACE_FOREGROUND (fp), FACE_BACKGROUND (fp));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 screen_face = face;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 ScreenAttrib = (FACE_BACKGROUND (fp) << 4) | FACE_FOREGROUND (fp);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 static
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 IT_write_glyphs (GLYPH *str, int len)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 int newface;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 int ch, l = len;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 unsigned char *buf, *bp;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 if (len == 0) return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 buf = bp = alloca (len * 2);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 while (--l >= 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 newface = FAST_GLYPH_FACE (*str);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 if (newface != screen_face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 IT_set_face (newface);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 ch = FAST_GLYPH_CHAR (*str);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 *bp++ = (unsigned char)ch;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 *bp++ = ScreenAttrib;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 if (termscript)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 fputc (ch, termscript);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 str++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 mouse_off_maybe ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 dosmemput (buf, 2 * len,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 (int)ScreenPrimary + 2 * (new_pos_X + screen_size_X * new_pos_Y));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 new_pos_X += len;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 static
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 IT_clear_end_of_line (int first_unused)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 char *spaces, *sp;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 int i, j;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 IT_set_face (0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 if (termscript)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 fprintf (termscript, "<CLR:EOL>");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 i = (j = screen_size_X - new_pos_X) * 2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 spaces = sp = alloca (i);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 while (--j >= 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 *sp++ = ' ';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 *sp++ = ScreenAttrib;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 mouse_off_maybe ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 dosmemput (spaces, i,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 (int)ScreenPrimary + 2 * (new_pos_X + screen_size_X * new_pos_Y));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 static
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 IT_clear_screen (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 if (termscript)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 fprintf (termscript, "<CLR:SCR>");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 IT_set_face (0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 mouse_off ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 ScreenClear ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 new_pos_X = new_pos_Y = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 static
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 IT_clear_to_end (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 if (termscript)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 fprintf (termscript, "<CLR:EOS>");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 while (new_pos_Y < screen_size_Y) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 new_pos_X = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 IT_clear_end_of_line (0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 new_pos_Y++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 static
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 IT_cursor_to (int y, int x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 if (termscript)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 fprintf (termscript, "\n<XY=%dx%d>", x, y);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 new_pos_X = x;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 new_pos_Y = y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 static
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 IT_reassert_line_highlight (int new, int vpos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 highlight = new;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 IT_set_face (0); /* To possibly clear the highlighting. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 static
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 IT_change_line_highlight (int new_highlight, int vpos, int first_unused_hpos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 highlight = new_highlight;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 IT_set_face (0); /* To possibly clear the highlighting. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 IT_cursor_to (vpos, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 IT_clear_end_of_line (first_unused_hpos);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 static
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 IT_update_begin (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 highlight = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 IT_set_face (0); /* To possibly clear the highlighting. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 screen_face = -1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 static
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 IT_update_end (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 /* This was more or less copied from xterm.c */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 IT_set_menu_bar_lines (Lisp_Object window, int n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 struct window *w = XWINDOW (window);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 XSETINT (w->last_modified, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 XSETINT (w->top, XINT (w->top) + n);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 XSETINT (w->height, XINT (w->height) - n);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 /* Handle just the top child in a vertical split. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 if (!NILP (w->vchild))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 IT_set_menu_bar_lines (w->vchild, n);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 /* Adjust all children in a horizontal split. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 for (window = w->hchild; !NILP (window); window = w->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 w = XWINDOW (window);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 IT_set_menu_bar_lines (window, n);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 * IT_set_terminal_modes is called when emacs is started,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 * resumed, and whenever the screen is redrawn!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 static
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 IT_set_terminal_modes (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 char *colors;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 FRAME_PTR f;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 struct face *fp;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 if (termscript)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 fprintf (termscript, "\n<SET_TERM>");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 highlight = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 screen_size_X = ScreenCols ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 screen_size_Y = ScreenRows ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 screen_size = screen_size_X * screen_size_Y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 new_pos_X = new_pos_Y = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 current_pos_X = current_pos_Y = -1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 if (term_setup_done)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 term_setup_done = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 startup_screen_size_X = screen_size_X;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 startup_screen_size_Y = screen_size_Y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 ScreenGetCursor (&startup_pos_Y, &startup_pos_X);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 ScreenRetrieve (startup_screen_buffer = xmalloc (screen_size * 2));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 if (termscript)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 fprintf (termscript, "<SCREEN SAVED>\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 * IT_reset_terminal_modes is called when emacs is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 * suspended or killed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 static
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 IT_reset_terminal_modes (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 if (termscript)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 fprintf (termscript, "\n<RESET_TERM>");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 highlight = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 if (!term_setup_done)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 ScreenUpdate (startup_screen_buffer);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 ScreenSetCursor (startup_pos_Y, startup_pos_X);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 xfree (startup_screen_buffer);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 if (termscript)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 fprintf (termscript, "<SCREEN RESTORED>\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 term_setup_done = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 static
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 IT_set_terminal_window (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 IT_set_frame_parameters (FRAME_PTR frame, Lisp_Object alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 Lisp_Object tail;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 int redraw;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 extern unsigned long load_color ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 FRAME_PTR f = (FRAME_PTR) &the_only_frame;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 redraw = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 for (tail = alist; CONSP (tail); tail = Fcdr (tail))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 Lisp_Object elt, prop, val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 elt = Fcar (tail);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 prop = Fcar (elt);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 val = Fcdr (elt);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 CHECK_SYMBOL (prop);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 if (EQ (prop, intern ("foreground-color")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 unsigned long new_color = load_color (f, val);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 if (new_color != ~0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 FRAME_FOREGROUND_PIXEL (f) = new_color;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 redraw = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 else if (EQ (prop, intern ("background-color")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 unsigned long new_color = load_color (f, val);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 if (new_color != ~0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 FRAME_BACKGROUND_PIXEL (f) = new_color & ~8;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 redraw = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 else if (EQ (prop, intern ("menu-bar-lines")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 int new;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 int old = FRAME_MENU_BAR_LINES (the_only_frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 if (INTEGERP (val))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 new = XINT (val);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 new = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 FRAME_MENU_BAR_LINES (f) = new;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 IT_set_menu_bar_lines (the_only_frame.root_window, new - old);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 }
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 (redraw)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 recompute_basic_faces (f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 Fredraw_frame (Fselected_frame (Qnil), Qnil);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 #endif /* !HAVE_X_WINDOWS */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 /* Do we need the internal terminal? */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 internal_terminal_init (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 char *term = getenv ("TERM");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 char *colors;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 #ifdef HAVE_X_WINDOWS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 if (!inhibit_window_system)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 internal_terminal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 = (!noninteractive) && term && !strcmp (term, "internal");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 if (getenv ("EMACSTEST"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 termscript = fopen (getenv ("EMACSTEST"), "wt");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 #ifndef HAVE_X_WINDOWS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 if (!internal_terminal || inhibit_window_system)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 the_only_frame.output_method = output_termcap;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 Vwindow_system = intern ("pc");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 bzero (&the_only_x_display, sizeof the_only_x_display);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 the_only_x_display.background_pixel = 7; /* White */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 the_only_x_display.foreground_pixel = 0; /* Black */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 colors = getenv ("EMACSCOLORS");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 if (colors && strlen (colors) >= 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 the_only_x_display.foreground_pixel = colors[0] & 0x07;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 the_only_x_display.background_pixel = colors[1] & 0x07;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 the_only_x_display.line_height = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 the_only_frame.output_data.x = &the_only_x_display;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 the_only_frame.output_method = output_msdos_raw;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 the_only_x_display.font = (XFontStruct *)1; /* must *not* be zero */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 init_frame_faces ((FRAME_PTR) &the_only_frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 ring_bell_hook = IT_ring_bell;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 write_glyphs_hook = IT_write_glyphs;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 cursor_to_hook = raw_cursor_to_hook = IT_cursor_to;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 clear_to_end_hook = IT_clear_to_end;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 clear_end_of_line_hook = IT_clear_end_of_line;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 clear_frame_hook = IT_clear_screen;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 change_line_highlight_hook = IT_change_line_highlight;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689 update_begin_hook = IT_update_begin;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690 update_end_hook = IT_update_end;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 reassert_line_highlight_hook = IT_reassert_line_highlight;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693 /* These hooks are called by term.c without being checked. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 set_terminal_modes_hook = IT_set_terminal_modes;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695 reset_terminal_modes_hook = IT_reset_terminal_modes;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 set_terminal_window_hook = IT_set_terminal_window;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 dos_get_saved_screen (char **screen, int *rows, int *cols)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 #ifndef HAVE_X_WINDOWS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 *screen = startup_screen_buffer;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 *cols = startup_screen_size_X;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 *rows = startup_screen_size_Y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 return 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 /* ----------------------- Keyboard control ----------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 * Keymaps reflect the following keyboard layout:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 * 0 1 2 3 4 5 6 7 8 9 10 11 12 BS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719 * TAB 15 16 17 18 19 20 21 22 23 24 25 26 (41)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 * CLOK 30 31 32 33 34 35 36 37 38 39 40 (41) RET
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 * SH () 45 46 47 48 49 50 51 52 53 54 SHIFT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 * SPACE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725 static int extended_kbd; /* 101 (102) keyboard present. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 struct dos_keyboard_map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 char *unshifted;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 char *shifted;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 char *alt_gr;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 static struct dos_keyboard_map us_keyboard = {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 /* 0 1 2 3 4 5 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 /* 01234567890123456789012345678901234567890 12345678901234 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 "`1234567890-= qwertyuiop[] asdfghjkl;'\\ zxcvbnm,./ ",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 /* 0123456789012345678901234567890123456789 012345678901234 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 "~!@#$%^&*()_+ QWERTYUIOP{} ASDFGHJKL:\"| ZXCVBNM<>? ",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 0 /* no Alt-Gr key */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 static struct dos_keyboard_map fr_keyboard = {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 /* 0 1 2 3 4 5 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 /* 012 3456789012345678901234567890123456789012345678901234 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 "ý&‚\",(-Š_€…)= azertyuiop^$ qsdfghjklm—* wxcvbnm;:! ",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748 /* 0123456789012345678901234567890123456789012345678901234 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 " 1234567890ø+ AZERTYUIOPùœ QSDFGHJKLM%æ WXCVBN?./õ ",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 /* 01234567 89012345678901234567890123456789012345678901234 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751 " ~#{[|`\\^@]} Ï "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 static struct dos_keyboard_map dk_keyboard = {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 /* 0 1 2 3 4 5 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756 /* 0123456789012345678901234567890123456789012345678901234 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 "«1234567890+| qwertyuiop†~ asdfghjkl‘›' zxcvbnm,.- ",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 /* 01 23456789012345678901234567890123456789012345678901234 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759 "õ!\"#$%&/()=?` QWERTYUIOP^ ASDFGHJKL’* ZXCVBNM;:_ ",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760 /* 0123456789012345678901234567890123456789012345678901234 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761 " @œ$ {[]} | "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 static struct keyboard_layout_list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766 int country_code;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767 struct dos_keyboard_map *keyboard_map;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 } keyboard_layout_list[] =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770 1, &us_keyboard,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771 33, &fr_keyboard,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772 45, &dk_keyboard
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775 static struct dos_keyboard_map *keyboard;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776 static int keyboard_map_all;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 dos_set_keyboard (int code, int always)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 int i;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783 /* Initialize to US settings, for countries that don't have their own. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784 keyboard = keyboard_layout_list[0].keyboard_map;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785 keyboard_map_all = always;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786 dos_keyboard_layout = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 for (i = 0; i < (sizeof (keyboard_layout_list)/sizeof (struct keyboard_layout_list)); i++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789 if (code == keyboard_layout_list[i].country_code)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 keyboard = keyboard_layout_list[i].keyboard_map;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792 keyboard_map_all = always;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793 dos_keyboard_layout = code;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794 return 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
799 #define Ignore 0x0000
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800 #define Normal 0x0000 /* normal key - alt changes scan-code */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801 #define FctKey 0x1000 /* func key if c == 0, else c */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 #define Special 0x2000 /* func key even if c != 0 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803 #define ModFct 0x3000 /* special if mod-keys, else 'c' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804 #define Map 0x4000 /* alt scan-code, map to unshift/shift key */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805 #define KeyPad 0x5000 /* map to insert/kp-0 depending on c == 0xe0 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806 #define Grey 0x6000 /* Grey keypad key */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808 #define Alt 0x0100 /* alt scan-code */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809 #define Ctrl 0x0200 /* ctrl scan-code */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 #define Shift 0x0400 /* shift scan-code */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812 static struct
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814 unsigned char char_code; /* normal code */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815 unsigned char meta_code; /* M- code */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816 unsigned char keypad_code; /* keypad code */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817 unsigned char editkey_code; /* edit key */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818 } keypad_translate_map[] = {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 '0', '0', 0xb0, /* kp-0 */ 0x63, /* insert */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820 '1', '1', 0xb1, /* kp-1 */ 0x57, /* end */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 '2', '2', 0xb2, /* kp-2 */ 0x54, /* down */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 '3', '3', 0xb3, /* kp-3 */ 0x56, /* next */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 '4', '4', 0xb4, /* kp-4 */ 0x51, /* left */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 '5', '5', 0xb5, /* kp-5 */ 0xb5, /* kp-5 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825 '6', '6', 0xb6, /* kp-6 */ 0x53, /* right */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 '7', '7', 0xb7, /* kp-7 */ 0x50, /* home */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827 '8', '8', 0xb8, /* kp-8 */ 0x52, /* up */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 '9', '9', 0xb9, /* kp-9 */ 0x55, /* prior */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 '.', '-', 0xae, /* kp-decimal */ 0xff /* delete */
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 static struct
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 unsigned char char_code; /* normal code */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 unsigned char keypad_code; /* keypad code */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 } grey_key_translate_map[] = {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 '/', 0xaf, /* kp-decimal */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 '*', 0xaa, /* kp-multiply */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 '-', 0xad, /* kp-subtract */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 '+', 0xab, /* kp-add */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841 '\r', 0x8d /* kp-enter */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 static unsigned short
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 ibmpc_translate_map[] =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 /* --------------- 00 to 0f --------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 Normal | 0xff, /* Ctrl Break + Alt-NNN */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 Alt | ModFct | 0x1b, /* Escape */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 Normal | 1, /* '1' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 Normal | 2, /* '2' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 Normal | 3, /* '3' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853 Normal | 4, /* '4' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 Normal | 5, /* '5' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855 Normal | 6, /* '6' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856 Normal | 7, /* '7' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857 Normal | 8, /* '8' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858 Normal | 9, /* '9' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 Normal | 10, /* '0' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 Normal | 11, /* '-' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 Normal | 12, /* '=' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 Special | 0x08, /* Backspace */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 ModFct | 0x74, /* Tab/Backtab */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865 /* --------------- 10 to 1f --------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 Map | 15, /* 'q' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867 Map | 16, /* 'w' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868 Map | 17, /* 'e' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 Map | 18, /* 'r' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 Map | 19, /* 't' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871 Map | 20, /* 'y' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 Map | 21, /* 'u' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 Map | 22, /* 'i' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 Map | 23, /* 'o' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875 Map | 24, /* 'p' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 Map | 25, /* '[' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 Map | 26, /* ']' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 ModFct | 0x0d, /* Return */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 Ignore, /* Ctrl */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880 Map | 30, /* 'a' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 Map | 31, /* 's' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 /* --------------- 20 to 2f --------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 Map | 32, /* 'd' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 Map | 33, /* 'f' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886 Map | 34, /* 'g' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 Map | 35, /* 'h' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 Map | 36, /* 'j' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889 Map | 37, /* 'k' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 Map | 38, /* 'l' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891 Map | 39, /* ';' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892 Map | 40, /* '\'' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893 Map | 0, /* '`' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 Ignore, /* Left shift */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 Map | 41, /* '\\' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 Map | 45, /* 'z' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 Map | 46, /* 'x' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 Map | 47, /* 'c' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 Map | 48, /* 'v' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 /* --------------- 30 to 3f --------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902 Map | 49, /* 'b' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 Map | 50, /* 'n' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904 Map | 51, /* 'm' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905 Map | 52, /* ',' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906 Map | 53, /* '.' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907 Map | 54, /* '/' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908 Ignore, /* Right shift */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909 Grey | 1, /* Grey * */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910 Ignore, /* Alt */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911 Normal | ' ', /* ' ' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912 Ignore, /* Caps Lock */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 FctKey | 0xbe, /* F1 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914 FctKey | 0xbf, /* F2 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 FctKey | 0xc0, /* F3 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 FctKey | 0xc1, /* F4 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917 FctKey | 0xc2, /* F5 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919 /* --------------- 40 to 4f --------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920 FctKey | 0xc3, /* F6 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921 FctKey | 0xc4, /* F7 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922 FctKey | 0xc5, /* F8 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923 FctKey | 0xc6, /* F9 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 FctKey | 0xc7, /* F10 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925 Ignore, /* Num Lock */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926 Ignore, /* Scroll Lock */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 KeyPad | 7, /* Home */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928 KeyPad | 8, /* Up */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 KeyPad | 9, /* Page Up */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 Grey | 2, /* Grey - */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931 KeyPad | 4, /* Left */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932 KeyPad | 5, /* Keypad 5 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 KeyPad | 6, /* Right */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 Grey | 3, /* Grey + */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935 KeyPad | 1, /* End */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937 /* --------------- 50 to 5f --------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938 KeyPad | 2, /* Down */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939 KeyPad | 3, /* Page Down */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940 KeyPad | 0, /* Insert */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941 KeyPad | 10, /* Delete */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942 Shift | FctKey | 0xbe, /* (Shift) F1 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 Shift | FctKey | 0xbf, /* (Shift) F2 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944 Shift | FctKey | 0xc0, /* (Shift) F3 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945 Shift | FctKey | 0xc1, /* (Shift) F4 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 Shift | FctKey | 0xc2, /* (Shift) F5 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 Shift | FctKey | 0xc3, /* (Shift) F6 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 Shift | FctKey | 0xc4, /* (Shift) F7 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 Shift | FctKey | 0xc5, /* (Shift) F8 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950 Shift | FctKey | 0xc6, /* (Shift) F9 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 Shift | FctKey | 0xc7, /* (Shift) F10 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 Ctrl | FctKey | 0xbe, /* (Ctrl) F1 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 Ctrl | FctKey | 0xbf, /* (Ctrl) F2 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 /* --------------- 60 to 6f --------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956 Ctrl | FctKey | 0xc0, /* (Ctrl) F3 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957 Ctrl | FctKey | 0xc1, /* (Ctrl) F4 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958 Ctrl | FctKey | 0xc2, /* (Ctrl) F5 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959 Ctrl | FctKey | 0xc3, /* (Ctrl) F6 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960 Ctrl | FctKey | 0xc4, /* (Ctrl) F7 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961 Ctrl | FctKey | 0xc5, /* (Ctrl) F8 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962 Ctrl | FctKey | 0xc6, /* (Ctrl) F9 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963 Ctrl | FctKey | 0xc7, /* (Ctrl) F10 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964 Alt | FctKey | 0xbe, /* (Alt) F1 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965 Alt | FctKey | 0xbf, /* (Alt) F2 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966 Alt | FctKey | 0xc0, /* (Alt) F3 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967 Alt | FctKey | 0xc1, /* (Alt) F4 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968 Alt | FctKey | 0xc2, /* (Alt) F5 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 Alt | FctKey | 0xc3, /* (Alt) F6 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970 Alt | FctKey | 0xc4, /* (Alt) F7 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971 Alt | FctKey | 0xc5, /* (Alt) F8 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973 /* --------------- 70 to 7f --------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 Alt | FctKey | 0xc6, /* (Alt) F9 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975 Alt | FctKey | 0xc7, /* (Alt) F10 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976 Ctrl | FctKey | 0x6d, /* (Ctrl) Sys Rq */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977 Ctrl | KeyPad | 4, /* (Ctrl) Left */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978 Ctrl | KeyPad | 6, /* (Ctrl) Right */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979 Ctrl | KeyPad | 1, /* (Ctrl) End */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980 Ctrl | KeyPad | 3, /* (Ctrl) Page Down */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981 Ctrl | KeyPad | 7, /* (Ctrl) Home */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982 Alt | Map | 1, /* '1' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983 Alt | Map | 2, /* '2' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984 Alt | Map | 3, /* '3' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985 Alt | Map | 4, /* '4' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986 Alt | Map | 5, /* '5' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987 Alt | Map | 6, /* '6' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988 Alt | Map | 7, /* '7' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 Alt | Map | 8, /* '8' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991 /* --------------- 80 to 8f --------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992 Alt | Map | 9, /* '9' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993 Alt | Map | 10, /* '0' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 Alt | Map | 11, /* '-' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995 Alt | Map | 12, /* '=' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 Ctrl | KeyPad | 9, /* (Ctrl) Page Up */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 FctKey | 0xc8, /* F11 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998 FctKey | 0xc9, /* F12 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999 Shift | FctKey | 0xc8, /* (Shift) F11 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000 Shift | FctKey | 0xc9, /* (Shift) F12 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001 Ctrl | FctKey | 0xc8, /* (Ctrl) F11 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1002 Ctrl | FctKey | 0xc9, /* (Ctrl) F12 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003 Alt | FctKey | 0xc8, /* (Alt) F11 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1004 Alt | FctKey | 0xc9, /* (Alt) F12 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005 Ctrl | KeyPad | 8, /* (Ctrl) Up */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006 Ctrl | Grey | 2, /* (Ctrl) Grey - */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007 Ctrl | KeyPad | 5, /* (Ctrl) Keypad 5 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009 /* --------------- 90 to 9f --------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1010 Ctrl | Grey | 3, /* (Ctrl) Grey + */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011 Ctrl | KeyPad | 2, /* (Ctrl) Down */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1012 Ctrl | KeyPad | 0, /* (Ctrl) Insert */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1013 Ctrl | KeyPad | 10, /* (Ctrl) Delete */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014 Ctrl | FctKey | 0x09, /* (Ctrl) Tab */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015 Ctrl | Grey | 0, /* (Ctrl) Grey / */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016 Ctrl | Grey | 1, /* (Ctrl) Grey * */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017 Alt | FctKey | 0x50, /* (Alt) Home */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 Alt | FctKey | 0x52, /* (Alt) Up */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019 Alt | FctKey | 0x55, /* (Alt) Page Up */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020 Ignore, /* NO KEY */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021 Alt | FctKey | 0x51, /* (Alt) Left */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 Ignore, /* NO KEY */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 Alt | FctKey | 0x53, /* (Alt) Right */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 Ignore, /* NO KEY */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025 Alt | FctKey | 0x57, /* (Alt) End */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 /* --------------- a0 to af --------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028 Alt | KeyPad | 2, /* (Alt) Down */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029 Alt | KeyPad | 3, /* (Alt) Page Down */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 Alt | KeyPad | 0, /* (Alt) Insert */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031 Alt | KeyPad | 10, /* (Alt) Delete */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1032 Alt | Grey | 0, /* (Alt) Grey / */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033 Alt | FctKey | 0x09, /* (Alt) Tab */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034 Alt | Grey | 4 /* (Alt) Keypad Enter */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1036
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037 /* These bit-positions corresponds to values returned by BIOS */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038 #define SHIFT_P 0x0003 /* two bits! */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039 #define CTRL_P 0x0004
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040 #define ALT_P 0x0008
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041 #define SCRLOCK_P 0x0010
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042 #define NUMLOCK_P 0x0020
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1043 #define CAPSLOCK_P 0x0040
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044 #define ALT_GR_P 0x0800
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045 #define SUPER_P 0x4000 /* pseudo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046 #define HYPER_P 0x8000 /* pseudo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1049 dos_get_modifiers (int *keymask)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1051 union REGS regs;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1052 int mask;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1053 int modifiers = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1055 /* Calculate modifier bits */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056 regs.h.ah = extended_kbd ? 0x12 : 0x02;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1057 int86 (0x16, &regs, &regs);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1058
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1059 if (!extended_kbd)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061 mask = regs.h.al & (SHIFT_P | CTRL_P | ALT_P |
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1062 SCRLOCK_P | NUMLOCK_P | CAPSLOCK_P);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1064 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066 mask = regs.h.al & (SHIFT_P |
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1067 SCRLOCK_P | NUMLOCK_P | CAPSLOCK_P);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1068
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1069 /* Do not break international keyboard support. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1070 /* When Keyb.Com is loaded, the right Alt key is */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1071 /* used for accessing characters like { and } */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1072 if (regs.h.ah & 2) /* Left ALT pressed ? */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1073 mask |= ALT_P;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1074
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1075 if ((regs.h.ah & 8) != 0) /* Right ALT pressed ? */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1076 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1077 mask |= ALT_GR_P;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078 if (dos_hyper_key == 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1079 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1080 mask |= HYPER_P;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081 modifiers |= hyper_modifier;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1082 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1083 else if (dos_super_key == 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1084 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1085 mask |= SUPER_P;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086 modifiers |= super_modifier;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1088 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1089
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090 if (regs.h.ah & 1) /* Left CTRL pressed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1091 mask |= CTRL_P;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1092
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1093 if (regs.h.ah & 4) /* Right CTRL pressed ? */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1094 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1095 if (dos_hyper_key == 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1097 mask |= HYPER_P;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098 modifiers |= hyper_modifier;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1099 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1100 else if (dos_super_key == 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1101 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102 mask |= SUPER_P;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1103 modifiers |= super_modifier;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1104 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1105 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1106 mask |= CTRL_P;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1107 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1108 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1109
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1110 if (mask & SHIFT_P)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1111 modifiers |= shift_modifier;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1112 if (mask & CTRL_P)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1113 modifiers |= ctrl_modifier;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1114 if (mask & ALT_P)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1115 modifiers |= meta_modifier;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1116
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1117 if (keymask)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1118 *keymask = mask;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1119 return modifiers;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1120 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1121
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1122 #define NUM_RECENT_DOSKEYS (100)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1123 int recent_doskeys_index; /* Index for storing next element into recent_doskeys */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1124 int total_doskeys; /* Total number of elements stored into recent_doskeys */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1125 Lisp_Object recent_doskeys; /* A vector, holding the last 100 keystrokes */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1126
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1127 DEFUN ("recent-doskeys", Frecent_doskeys, 0, 0, 0, /*
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1128 Return vector of last 100 keyboard input values seen in dos_rawgetc.
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1129 Each input key receives two values in this vector: first the ASCII code,
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1130 and then the scan code.
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1131 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1132 ())
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1133 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1134 Lisp_Object *keys = XVECTOR (recent_doskeys)->contents;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135 Lisp_Object val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1136
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1137 if (total_doskeys < NUM_RECENT_DOSKEYS)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1138 return Fvector (total_doskeys, keys);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1139 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1140 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1141 val = Fvector (NUM_RECENT_DOSKEYS, keys);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1142 bcopy (keys + recent_doskeys_index,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1143 XVECTOR (val)->contents,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1144 (NUM_RECENT_DOSKEYS - recent_doskeys_index) * sizeof (Lisp_Object));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1145 bcopy (keys,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1146 XVECTOR (val)->contents + NUM_RECENT_DOSKEYS - recent_doskeys_index,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1147 recent_doskeys_index * sizeof (Lisp_Object));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1148 return val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1149 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1150 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1151
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1152 /* Get a char from keyboard. Function keys are put into the event queue. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1153 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1154 dos_rawgetc (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1155 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1156 struct input_event event;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1157 union REGS regs;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1158
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1159 #ifndef HAVE_X_WINDOWS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1160 SCREEN_SET_CURSOR ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1161 if (!mouse_visible) mouse_on ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1162 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1163
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1164 /* The following condition is equivalent to `kbhit ()', except that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1165 it uses the bios to do its job. This pleases DESQview/X. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1166 while ((regs.h.ah = extended_kbd ? 0x11 : 0x01),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1167 int86 (0x16, &regs, &regs),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1168 (regs.x.flags & 0x40) == 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1169 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1170 union REGS regs;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1171 REGISTER unsigned char c;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1172 int sc, code, mask, kp_mode;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1173 int modifiers;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1174
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1175 regs.h.ah = extended_kbd ? 0x10 : 0x00;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1176 int86 (0x16, &regs, &regs);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1177 c = regs.h.al;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1178 sc = regs.h.ah;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1179
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1180 total_doskeys += 2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1181 XVECTOR (recent_doskeys)->contents[recent_doskeys_index++]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1182 = make_int (c);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1183 if (recent_doskeys_index == NUM_RECENT_DOSKEYS)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1184 recent_doskeys_index = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1185 XVECTOR (recent_doskeys)->contents[recent_doskeys_index++]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1186 = make_int (sc);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1187 if (recent_doskeys_index == NUM_RECENT_DOSKEYS)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1188 recent_doskeys_index = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1189
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1190 modifiers = dos_get_modifiers (&mask);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1191
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1192 #ifndef HAVE_X_WINDOWS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1193 if (!NILP (Vdos_display_scancodes))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1194 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1195 char buf[10];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1196 sprintf (buf, "%02x:%02x*%04x",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1197 (unsigned) (sc&0xff), (unsigned) c, mask);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1198 dos_direct_output (screen_size_Y - 2, screen_size_X - 12, buf, 10);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1199 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1200 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1201
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1202 if (sc == 0xe0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1203 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1204 switch (c)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1205 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1206 case 10: /* Ctrl Grey Enter */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1207 code = Ctrl | Grey | 4;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1208 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1209 case 13: /* Grey Enter */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1210 code = Grey | 4;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1211 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1212 case '/': /* Grey / */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1213 code = Grey | 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1214 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1215 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1216 continue;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1217 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1218 c = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1219 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1220 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1221 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1222 if (sc >= (sizeof (ibmpc_translate_map) / sizeof (short)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1223 continue;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1224 if ((code = ibmpc_translate_map[sc]) == Ignore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1225 continue;
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 if (c == 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1229 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1230 if (code & Alt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1231 modifiers |= meta_modifier;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1232 if (code & Ctrl)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1233 modifiers |= ctrl_modifier;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1234 if (code & Shift)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1235 modifiers |= shift_modifier;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1236 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1237
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1238 switch (code & 0xf000)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1239 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1240 case ModFct:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1241 if (c && !(mask & (SHIFT_P | ALT_P | CTRL_P | HYPER_P | SUPER_P)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1242 return c;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1243 c = 0; /* Special */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1244
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1245 case FctKey:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1246 if (c != 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1247 return c;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1248
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1249 case Special:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1250 code |= 0xff00;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1251 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1252
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1253 case Normal:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1254 if (sc == 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1255 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1256 if (c == 0) /* ctrl-break */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1257 continue;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1258 return c; /* ALT-nnn */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1259 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1260 if (!keyboard_map_all)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1261 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1262 if (c != ' ')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1263 return c;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1264 code = c;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1265 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1266 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1267
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1268 case Map:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1269 if (c && !(mask & ALT_P) && !((mask & SHIFT_P) && (mask & CTRL_P)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1270 if (!keyboard_map_all)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1271 return c;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1272
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1273 code &= 0xff;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1274 if (mask & ALT_P && code <= 10 && code > 0 && dos_keypad_mode & 0x200)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1275 mask |= SHIFT_P; /* ALT-1 => M-! etc. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1276
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1277 if (mask & SHIFT_P)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1278 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1279 code = keyboard->shifted[code];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1280 mask -= SHIFT_P;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1281 modifiers &= ~shift_modifier;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1282 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1283 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1284 if ((mask & ALT_GR_P) && keyboard->alt_gr && keyboard->alt_gr[code] != ' ')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1285 code = keyboard->alt_gr[code];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1286 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1287 code = keyboard->unshifted[code];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1288 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1289
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1290 case KeyPad:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1291 code &= 0xff;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1292 if (c == 0xe0) /* edit key */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1293 kp_mode = 3;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1294 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1295 if ((mask & (NUMLOCK_P|CTRL_P|SHIFT_P|ALT_P)) == NUMLOCK_P) /* numlock on */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1296 kp_mode = dos_keypad_mode & 0x03;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1297 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1298 kp_mode = (dos_keypad_mode >> 4) & 0x03;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1299
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1300 switch (kp_mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1301 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1302 case 0:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1303 if (code == 10 && dos_decimal_point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1304 return dos_decimal_point;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1305 return keypad_translate_map[code].char_code;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1306
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1307 case 1:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1308 code = 0xff00 | keypad_translate_map[code].keypad_code;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1309 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1310
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1311 case 2:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1312 code = keypad_translate_map[code].meta_code;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1313 modifiers = meta_modifier;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1314 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1315
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1316 case 3:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1317 code = 0xff00 | keypad_translate_map[code].editkey_code;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1318 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1319 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1320 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1321
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1322 case Grey:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1323 code &= 0xff;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1324 kp_mode = ((mask & (NUMLOCK_P|CTRL_P|SHIFT_P|ALT_P)) == NUMLOCK_P) ? 0x04 : 0x40;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1325 if (dos_keypad_mode & kp_mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1326 code = 0xff00 | grey_key_translate_map[code].keypad_code;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1327 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1328 code = grey_key_translate_map[code].char_code;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1329 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1330 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1331
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1332 make_event:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1333 if (code == 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1334 continue;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1335
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1336 if (code >= 0x100)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1337 event.kind = non_ascii_keystroke;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1338 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1339 event.kind = ascii_keystroke;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1340 event.code = code;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1341 event.modifiers = modifiers;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1342 XSETFRAME (event.frame_or_window, selected_frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1343 event.timestamp = event_timestamp ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1344 kbd_buffer_store_event (&event);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1345 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1346
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1347 if (have_mouse > 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1348 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1349 int but, press, x, y, ok;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1350
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1351 /* Check for mouse movement *before* buttons. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1352 mouse_check_moved ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1353
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1354 for (but = 0; but < NUM_MOUSE_BUTTONS; but++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1355 for (press = 0; press < 2; press++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1356 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1357 if (press)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1358 ok = mouse_pressed (but, &x, &y);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1359 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1360 ok = mouse_released (but, &x, &y);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1361 if (ok)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1362 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1363 event.kind = mouse_click;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1364 event.code = but;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1365 event.modifiers = dos_get_modifiers (0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1366 | (press ? down_modifier : up_modifier);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1367 event.x = x;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1368 event.y = y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1369 XSETFRAME (event.frame_or_window, selected_frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1370 event.timestamp = event_timestamp ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1371 kbd_buffer_store_event (&event);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1372 }
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
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1376 return -1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1377 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1378
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1379 static int prev_get_char = -1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1380
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1381 /* Return 1 if a key is ready to be read without suspending execution. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1382 dos_keysns (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1383 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1384 if (prev_get_char != -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1385 return 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1386 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1387 return ((prev_get_char = dos_rawgetc ()) != -1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1388 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1389
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1390 /* Read a key. Return -1 if no key is ready. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1391 dos_keyread (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1392 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1393 if (prev_get_char != -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1394 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1395 int c = prev_get_char;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1396 prev_get_char = -1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1397 return c;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1398 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1399 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1400 return dos_rawgetc ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1401 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1402
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1403 #ifndef HAVE_X_WINDOWS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1404 /* See xterm.c for more info. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1405 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1406 pixel_to_glyph_coords (FRAME_PTR f, REGISTER int pix_x, REGISTER int pix_y,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1407 REGISTER int *x, REGISTER int *y,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1408 void /* XRectangle */ *bounds,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1409 int noclip)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1410 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1411 if (bounds) abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1412
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1413 /* Ignore clipping. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1414
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1415 *x = pix_x;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1416 *y = pix_y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1417 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1418
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1419 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1420 glyph_to_pixel_coords (FRAME_PTR f, REGISTER int x, REGISTER int y,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1421 REGISTER int *pix_x, REGISTER int *pix_y)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1422 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1423 *pix_x = x;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1424 *pix_y = y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1425 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1426
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1427 /* Simulation of X's menus. Nothing too fancy here -- just make it work
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1428 for now.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1429
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1430 Actually, I don't know the meaning of all the parameters of the functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1431 here -- I only know how they are called by xmenu.c. I could of course
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1432 grab the nearest Xlib manual (down the hall, second-to-last door on the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1433 left), but I don't think it's worth the effort. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1434
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1435 static XMenu *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1436 IT_menu_create (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1437 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1438 XMenu *menu;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1439
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1440 menu = (XMenu *) xmalloc (sizeof (XMenu));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1441 menu->allocated = menu->count = menu->panecount = menu->width = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1442 return menu;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1443 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1444
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1445 /* Allocate some (more) memory for MENU ensuring that there is room for one
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1446 for item. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1447
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1448 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1449 IT_menu_make_room (XMenu *menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1450 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1451 if (menu->allocated == 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1452 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1453 int count = menu->allocated = 10;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1454 menu->text = (char **) xmalloc (count * sizeof (char *));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1455 menu->submenu = (XMenu **) xmalloc (count * sizeof (XMenu *));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1456 menu->panenumber = (int *) xmalloc (count * sizeof (int));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1457 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1458 else if (menu->allocated == menu->count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1459 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1460 int count = menu->allocated = menu->allocated + 10;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1461 menu->text
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1462 = (char **) xrealloc (menu->text, count * sizeof (char *));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1463 menu->submenu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1464 = (XMenu **) xrealloc (menu->submenu, count * sizeof (XMenu *));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1465 menu->panenumber
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1466 = (int *) xrealloc (menu->panenumber, count * sizeof (int));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1467 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1468 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1469
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1470 /* Search the given menu structure for a given pane number. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1471
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1472 static XMenu *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1473 IT_menu_search_pane (XMenu *menu, int pane)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1474 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1475 int i;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1476 XMenu *try;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1477
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1478 for (i = 0; i < menu->count; i++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1479 if (menu->submenu[i])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1480 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1481 if (pane == menu->panenumber[i])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1482 return menu->submenu[i];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1483 if ((try = IT_menu_search_pane (menu->submenu[i], pane)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1484 return try;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1485 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1486 return (XMenu *) 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1487 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1488
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1489 /* Determine how much screen space a given menu needs. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1490
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1491 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1492 IT_menu_calc_size (XMenu *menu, int *width, int *height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1493 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1494 int i, h2, w2, maxsubwidth, maxheight;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1495
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1496 maxsubwidth = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1497 maxheight = menu->count;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1498 for (i = 0; i < menu->count; i++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1499 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1500 if (menu->submenu[i])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1501 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1502 IT_menu_calc_size (menu->submenu[i], &w2, &h2);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1503 if (w2 > maxsubwidth) maxsubwidth = w2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1504 if (i + h2 > maxheight) maxheight = i + h2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1505 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1506 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1507 *width = menu->width + maxsubwidth;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1508 *height = maxheight;
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 /* Display MENU at (X,Y) using FACES. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1512
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1513 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1514 IT_menu_display (XMenu *menu, int y, int x, int *faces)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1515 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1516 int i, j, face, width;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1517 GLYPH *text, *p;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1518 char *q;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1519 int mx, my;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1520 int enabled, mousehere;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1521 int row, col;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1522
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1523 width = menu->width;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1524 text = (GLYPH *) xmalloc ((width + 2) * sizeof (GLYPH));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1525 ScreenGetCursor (&row, &col);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1526 mouse_get_xy (&mx, &my);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1527 IT_update_begin ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1528 for (i = 0; i < menu->count; i++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1529 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1530 IT_cursor_to (y + i, x);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1531 enabled
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1532 = (!menu->submenu[i] && menu->panenumber[i]) || (menu->submenu[i]);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1533 mousehere = (y + i == my && x <= mx && mx < x + width + 2);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1534 face = faces[enabled + mousehere * 2];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1535 p = text;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1536 *p++ = FAST_MAKE_GLYPH (' ', face);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1537 for (j = 0, q = menu->text[i]; *q; j++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1538 *p++ = FAST_MAKE_GLYPH (*q++, face);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1539 for (; j < width; j++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1540 *p++ = FAST_MAKE_GLYPH (' ', face);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1541 *p++ = FAST_MAKE_GLYPH (menu->submenu[i] ? 16 : ' ', face);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1542 IT_write_glyphs (text, width + 2);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1543 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1544 IT_update_end ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1545 IT_cursor_to (row, col);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1546 xfree (text);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1547 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1548
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1549 /* --------------------------- X Menu emulation ---------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1550
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1551 /* Create a brand new menu structure. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1552
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1553 XMenu *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1554 XMenuCreate (Display *foo1, Window foo2, char *foo3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1555 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1556 return IT_menu_create ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1557 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1558
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1559 /* Create a new pane and place it on the outer-most level. It is not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1560 clear that it should be placed out there, but I don't know what else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1561 to do. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1562
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1563 int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1564 XMenuAddPane (Display *foo, XMenu *menu, char *txt, int enable)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1565 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1566 int len;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1567
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1568 if (!enable)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1569 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1570
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1571 IT_menu_make_room (menu);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1572 menu->submenu[menu->count] = IT_menu_create ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1573 menu->text[menu->count] = txt;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1574 menu->panenumber[menu->count] = ++menu->panecount;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1575 menu->count++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1576 if ((len = strlen (txt)) > menu->width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1577 menu->width = len;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1578 return menu->panecount;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1579 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1580
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1581 /* Create a new item in a menu pane. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1582
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1583 int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1584 XMenuAddSelection (Display *bar, XMenu *menu, int pane,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1585 int foo, char *txt, int enable)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1586 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1587 int len;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1588
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1589 if (pane)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1590 if (!(menu = IT_menu_search_pane (menu, pane)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1591 return XM_FAILURE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1592 IT_menu_make_room (menu);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1593 menu->submenu[menu->count] = (XMenu *) 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1594 menu->text[menu->count] = txt;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1595 menu->panenumber[menu->count] = enable;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1596 menu->count++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1597 if ((len = strlen (txt)) > menu->width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1598 menu->width = len;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1599 return XM_SUCCESS;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1600 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1601
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1602 /* Decide where the menu would be placed if requested at (X,Y). */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1603
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1604 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1605 XMenuLocate (Display *foo0, XMenu *menu, int foo1, int foo2, int x, int y,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1606 int *ulx, int *uly, int *width, int *height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1607 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1608 if (menu->count == 1 && menu->submenu[0])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1609 /* Special case: the menu consists of only one pane. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1610 IT_menu_calc_size (menu->submenu[0], width, height);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1611 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1612 IT_menu_calc_size (menu, width, height);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1613 *ulx = x + 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1614 *uly = y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1615 *width += 2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1616 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1617
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1618 struct IT_menu_state
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1619 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1620 void *screen_behind;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1621 XMenu *menu;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1622 int pane;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1623 int x, y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1624 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1625
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1626
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1627 /* Display menu, wait for user's response, and return that response. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1628
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1629 int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1630 XMenuActivate (Display *foo, XMenu *menu, int *pane, int *selidx,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1631 int x0, int y0, unsigned ButtonMask, char **txt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1632 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1633 struct IT_menu_state *state;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1634 int statecount;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1635 int x, y, i, b;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1636 int screensize;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1637 int faces[4], selectface;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1638 int leave, result, onepane;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1639
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1640 /* Just in case we got here without a mouse present... */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1641 if (have_mouse <= 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1642 return XM_IA_SELECT;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1643
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1644 state = alloca (menu->panecount * sizeof (struct IT_menu_state));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1645 screensize = screen_size * 2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1646 faces[0]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1647 = compute_glyph_face (&the_only_frame,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1648 face_name_id_number
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1649 (&the_only_frame,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1650 intern ("msdos-menu-passive-face")),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1651 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1652 faces[1]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1653 = compute_glyph_face (&the_only_frame,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1654 face_name_id_number
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1655 (&the_only_frame,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1656 intern ("msdos-menu-active-face")),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1657 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1658 selectface
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1659 = face_name_id_number (&the_only_frame, intern ("msdos-menu-select-face"));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1660 faces[2] = compute_glyph_face (&the_only_frame, selectface, faces[0]);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1661 faces[3] = compute_glyph_face (&the_only_frame, selectface, faces[1]);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1662
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1663 statecount = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1664 state[0].menu = menu;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1665 mouse_off ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1666 ScreenRetrieve (state[0].screen_behind = xmalloc (screensize));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1667 if ((onepane = menu->count == 1 && menu->submenu[0]))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1668 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1669 menu->width = menu->submenu[0]->width;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1670 state[0].menu = menu->submenu[0];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1671 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1672 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1673 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1674 state[0].menu = menu;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1675 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1676 state[0].x = x0 - 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1677 state[0].y = y0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1678 state[0].pane = onepane;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1679
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1680 mouse_last_x = -1; /* A hack that forces display. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1681 leave = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1682 while (!leave)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1683 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1684 if (!mouse_visible) mouse_on ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1685 mouse_check_moved ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1686 if (selected_frame->mouse_moved)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1687 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1688 selected_frame->mouse_moved = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1689 result = XM_IA_SELECT;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1690 mouse_get_xy (&x, &y);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1691 for (i = 0; i < statecount; i++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1692 if (state[i].x <= x && x < state[i].x + state[i].menu->width + 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1693 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1694 int dy = y - state[i].y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1695 if (0 <= dy && dy < state[i].menu->count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1696 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1697 if (!state[i].menu->submenu[dy])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1698 if (state[i].menu->panenumber[dy])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1699 result = XM_SUCCESS;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1700 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1701 result = XM_IA_SELECT;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1702 *pane = state[i].pane - 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1703 *selidx = dy;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1704 /* We hit some part of a menu, so drop extra menues that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1705 have been opened. That does not include an open and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1706 active submenu. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1707 if (i != statecount - 2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1708 || state[i].menu->submenu[dy] != state[i+1].menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1709 while (i != statecount - 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1710 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1711 statecount--;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1712 mouse_off ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1713 ScreenUpdate (state[statecount].screen_behind);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1714 xfree (state[statecount].screen_behind);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1715 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1716 if (i == statecount - 1 && state[i].menu->submenu[dy])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1717 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1718 IT_menu_display (state[i].menu,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1719 state[i].y,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1720 state[i].x,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1721 faces);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1722 state[statecount].menu = state[i].menu->submenu[dy];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1723 state[statecount].pane = state[i].menu->panenumber[dy];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1724 mouse_off ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1725 ScreenRetrieve (state[statecount].screen_behind
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1726 = xmalloc (screensize));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1727 state[statecount].x
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1728 = state[i].x + state[i].menu->width + 2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1729 state[statecount].y = y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1730 statecount++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1731 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1732 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1733 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1734 IT_menu_display (state[statecount - 1].menu,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1735 state[statecount - 1].y,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1736 state[statecount - 1].x,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1737 faces);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1738 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1739 for (b = 0; b < mouse_button_count; b++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1740 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1741 (void) mouse_pressed (b, &x, &y);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1742 if (mouse_released (b, &x, &y))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1743 leave = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1744 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1745 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1746
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1747 mouse_off ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1748 ScreenUpdate (state[0].screen_behind);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1749 while (statecount--)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1750 xfree (state[statecount].screen_behind);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1751 return result;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1752 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1753
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1754 /* Dispose of a menu. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1755
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1756 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1757 XMenuDestroy (Display *foo, XMenu *menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1758 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1759 int i;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1760 if (menu->allocated)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1761 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1762 for (i = 0; i < menu->count; i++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1763 if (menu->submenu[i])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1764 XMenuDestroy (foo, menu->submenu[i]);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1765 xfree (menu->text);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1766 xfree (menu->submenu);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1767 xfree (menu->panenumber);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1768 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1769 xfree (menu);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1770 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1771
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1772 int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1773 x_pixel_width (struct frame *f)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1774 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1775 return FRAME_WIDTH (f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1776 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1777
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1778 int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1779 x_pixel_height (struct frame *f)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1780 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1781 return FRAME_HEIGHT (f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1782 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1783 #endif /* !HAVE_X_WINDOWS */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1784
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1785
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1786 /* ----------------------- DOS / UNIX conversion --------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1787
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1788 /* Destructively turn backslashes into slashes. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1789
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1790 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1791 dostounix_filename (REGISTER char *p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1792 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1793 while (*p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1794 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1795 if (*p == '\\')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1796 *p = '/';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1797 p++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1798 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1799 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1800
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1801 /* Destructively turn slashes into backslashes. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1802
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1803 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1804 unixtodos_filename (REGISTER char *p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1805 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1806 while (*p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1807 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1808 if (*p == '/')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1809 *p = '\\';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1810 p++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1811 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1812 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1813
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1814 /* Get the default directory for a given drive. 0=def, 1=A, 2=B, ... */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1815
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1816 int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1817 getdefdir (int drive, char *dst)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1818 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1819 union REGS regs;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1820
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1821 *dst++ = '/';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1822 regs.h.dl = drive;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1823 regs.x.si = (int) dst;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1824 regs.h.ah = 0x47;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1825 intdos (&regs, &regs);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1826 return !regs.x.cflag;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1827 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1828
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1829 /* Remove all CR's that are followed by a LF. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1830
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1831 int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1832 crlf_to_lf (REGISTER int n, REGISTER unsigned char *buf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1833 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1834 unsigned char *np = buf;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1835 unsigned char *startp = buf;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1836 unsigned char *endp = buf + n;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1837 unsigned char c;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1838
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1839 if (n == 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1840 return n;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1841 while (buf < endp - 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1842 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1843 if (*buf == 0x0d)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1844 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1845 if (*(++buf) != 0x0a)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1846 *np++ = 0x0d;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1847 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1848 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1849 *np++ = *buf++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1850 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1851 if (buf < endp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1852 *np++ = *buf++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1853 return np - startp;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1854 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1855
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1856 /* The Emacs root directory as determined by init_environment. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1857
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1858 static char emacsroot[MAXPATHLEN];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1859
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1860 char *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1861 rootrelativepath (char *rel)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1862 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1863 static char result[MAXPATHLEN + 10];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1864
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1865 strcpy (result, emacsroot);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1866 strcat (result, "/");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1867 strcat (result, rel);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1868 return result;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1869 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1870
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1871 /* Define a lot of environment variables if not already defined. Don't
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1872 remove anything unless you know what you're doing -- lots of code will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1873 break if one or more of these are missing. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1874
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1875 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1876 init_environment (int argc, char **argv, int skip_args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1877 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1878 char *s, *t, *root;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1879 int len;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1880
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1881 if (!initialized)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1882 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1883
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1884 /* Find our root from argv[0]. Assuming argv[0] is, say,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1885 "c:/emacs/bin/emacs.exe" our root will be "c:/emacs". */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1886 root = alloca (MAXPATHLEN + 20);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1887 _fixpath (argv[0], root);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1888 strlwr (root);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1889 len = strlen (root);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1890 while (len > 0 && root[len] != '/' && root[len] != ':')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1891 len--;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1892 root[len] = '\0';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1893 if (len > 4 && strcmp (root + len - 4, "/bin") == 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1894 root[len - 4] = '\0';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1895 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1896 strcpy (root, "c:/emacs"); /* Only under debuggers, I think. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1897 len = strlen (root);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1898 strcpy (emacsroot, root);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1899
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1900 /* We default HOME to our root. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1901 setenv ("HOME", root, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1902
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1903 /* We default EMACSPATH to root + "/bin". */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1904 strcpy (root + len, "/bin");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1905 setenv ("EMACSPATH", root, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1906
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1907 /* I don't expect anybody to ever use other terminals so the internal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1908 terminal is the default. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1909 setenv ("TERM", "internal", 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1910
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1911 #ifdef HAVE_X_WINDOWS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1912 /* Emacs expects DISPLAY to be set. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1913 setenv ("DISPLAY", "unix:0.0", 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1914 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1915
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1916 /* SHELL is a bit tricky -- COMSPEC is the closest we come, but we must
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1917 downcase it and mirror the backslashes. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1918 s = getenv ("COMSPEC");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1919 if (!s) s = "c:/command.com";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1920 t = alloca (strlen (s) + 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1921 strcpy (t, s);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1922 strlwr (t);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1923 dostounix_filename (t);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1924 setenv ("SHELL", t, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1925
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1926 /* PATH is also downcased and backslashes mirrored. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1927 s = getenv ("PATH");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1928 if (!s) s = "";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1929 t = alloca (strlen (s) + 3);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1930 /* Current directory is always considered part of MsDos's path but it is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1931 not normally mentioned. Now it is. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1932 strcat (strcpy (t, ".;"), s);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1933 strlwr (t);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1934 dostounix_filename (t); /* Not a single file name, but this should work. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1935 setenv ("PATH", t, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1936
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1937 /* In some sense all dos users have root privileges, so... */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1938 setenv ("USER", "root", 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1939 setenv ("NAME", getenv ("USER"), 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1940
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1941 /* Time zone determined from country code. To make this possible, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1942 country code may not span more than one time zone. In other words,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1943 in the USA, you lose. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1944 if (!getenv ("TZ"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1945 switch (dos_country_code)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1946 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1947 case 31: /* Belgium */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1948 case 32: /* The Netherlands */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1949 case 33: /* France */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1950 case 34: /* Spain */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1951 case 36: /* Hungary */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1952 case 38: /* Yugoslavia (or what's left of it?) */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1953 case 39: /* Italy */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1954 case 41: /* Switzerland */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1955 case 42: /* Tjekia */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1956 case 45: /* Denmark */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1957 case 46: /* Sweden */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1958 case 47: /* Norway */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1959 case 48: /* Poland */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1960 case 49: /* Germany */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1961 /* Daylight saving from last Sunday in March to last Sunday in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1962 September, both at 2AM. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1963 setenv ("TZ", "MET-01METDST-02,M3.5.0/02:00,M9.5.0/02:00", 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1964 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1965 case 44: /* United Kingdom */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1966 case 351: /* Portugal */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1967 case 354: /* Iceland */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1968 setenv ("TZ", "GMT+00", 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1969 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1970 case 81: /* Japan */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1971 case 82: /* Korea */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1972 setenv ("TZ", "JST-09", 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1973 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1974 case 90: /* Turkey */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1975 case 358: /* Finland */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1976 setenv ("TZ", "EET-02", 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1977 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1978 case 972: /* Israel */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1979 /* This is an approximation. (For exact rules, use the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1980 `zoneinfo/israel' file which comes with DJGPP, but you need
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1981 to install it in `/usr/share/zoneinfo/' directory first.) */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1982 setenv ("TZ", "IST-02IDT-03,M4.1.6/00:00,M9.5.6/01:00", 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1983 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1984 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1985 init_gettimeofday ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1986 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1987
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1988
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1989
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1990 static int break_stat; /* BREAK check mode status. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1991 static int stdin_stat; /* stdin IOCTL status. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1992
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1993 /* These must be global. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1994 static _go32_dpmi_seginfo ctrl_break_vector;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1995 static _go32_dpmi_registers ctrl_break_regs;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1996 static int ctrlbreakinstalled = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1997
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1998 /* Interrupt level detection of Ctrl-Break. Don't do anything fancy here! */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1999
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2000 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2001 ctrl_break_func (_go32_dpmi_registers *regs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2002 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2003 Vquit_flag = Qt;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2004 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2005
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2006 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2007 install_ctrl_break_check (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2008 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2009 if (!ctrlbreakinstalled)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2010 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2011 /* Don't press Ctrl-Break if you don't have either DPMI or Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2012 was compiler with Djgpp 1.11 maintenance level 5 or later! */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2013 ctrlbreakinstalled = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2014 ctrl_break_vector.pm_offset = (int) ctrl_break_func;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2015 _go32_dpmi_allocate_real_mode_callback_iret (&ctrl_break_vector,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2016 &ctrl_break_regs);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2017 _go32_dpmi_set_real_mode_interrupt_vector (0x1b, &ctrl_break_vector);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2018 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2019 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2020
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2021 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2022 * Turn off Dos' Ctrl-C checking and inhibit interpretation of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2023 * control chars by Dos.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2024 * Determine the keyboard type.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2025 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2026
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2027 int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2028 dos_ttraw (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2029 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2030 union REGS inregs, outregs;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2031 static int first_time = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2032
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2033 break_stat = getcbrk ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2034 setcbrk (0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2035 install_ctrl_break_check ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2036
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2037 if (first_time)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2038 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2039 inregs.h.ah = 0xc0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2040 int86 (0x15, &inregs, &outregs);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2041 extended_kbd = (!outregs.x.cflag) && (outregs.h.ah == 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2042
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2043 have_mouse = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2044
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2045 if (internal_terminal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2046 #ifdef HAVE_X_WINDOWS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2047 && inhibit_window_system
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2048 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2049 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2050 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2051 inregs.x.ax = 0x0021;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2052 int86 (0x33, &inregs, &outregs);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2053 have_mouse = (outregs.x.ax & 0xffff) == 0xffff;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2054 if (!have_mouse)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2055 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2056 /* Reportedly, the above doesn't work for some mouse drivers. There
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2057 is an additional detection method that should work, but might be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2058 a little slower. Use that as an alternative. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2059 inregs.x.ax = 0x0000;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2060 int86 (0x33, &inregs, &outregs);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2061 have_mouse = (outregs.x.ax & 0xffff) == 0xffff;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2062 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2063
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2064 if (have_mouse)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2065 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2066 have_mouse = 1; /* enable mouse */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2067 mouse_visible = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2068
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2069 if (outregs.x.bx == 3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2070 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2071 mouse_button_count = 3;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2072 mouse_button_translate[0] = 0; /* Left */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2073 mouse_button_translate[1] = 2; /* Middle */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2074 mouse_button_translate[2] = 1; /* Right */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2075 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2076 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2077 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2078 mouse_button_count = 2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2079 mouse_button_translate[0] = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2080 mouse_button_translate[1] = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2081 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2082 mouse_position_hook = &mouse_get_pos;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2083 mouse_init ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2084 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2085 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2086
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2087 first_time = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2088 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2089
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2090 inregs.x.ax = 0x4400; /* Get IOCTL status. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2091 inregs.x.bx = 0x00; /* 0 = stdin. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2092 intdos (&inregs, &outregs);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2093 stdin_stat = outregs.h.dl;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2094
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2095 inregs.x.dx = stdin_stat | 0x0020; /* raw mode */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2096 inregs.x.ax = 0x4401; /* Set IOCTL status */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2097 intdos (&inregs, &outregs);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2098 return !outregs.x.cflag;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2099 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2100
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2101 /* Restore status of standard input and Ctrl-C checking. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2102 int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2103 dos_ttcooked (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2104 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2105 union REGS inregs, outregs;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2106
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2107 setcbrk (break_stat);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2108 mouse_off ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2109
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2110 inregs.x.ax = 0x4401; /* Set IOCTL status. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2111 inregs.x.bx = 0x00; /* 0 = stdin. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2112 inregs.x.dx = stdin_stat;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2113 intdos (&inregs, &outregs);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2114 return !outregs.x.cflag;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2115 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2116
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2117
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2118 /* Run command as specified by ARGV in directory DIR.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2119 The command is run with input from TEMPIN and output to file TEMPOUT. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2120 int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2121 run_msdos_command (unsigned char **argv, Lisp_Object dir,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2122 int tempin, int tempout)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2123 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2124 char *saveargv1, *saveargv2, **envv;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2125 char oldwd[MAXPATHLEN + 1]; /* Fixed size is safe on MSDOS. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2126 int msshell, result = -1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2127 int in, out, inbak, outbak, errbak;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2128 int x, y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2129 Lisp_Object cmd;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2130
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2131 /* Get current directory as MSDOS cwd is not per-process. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2132 getwd (oldwd);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2133
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2134 cmd = Ffile_name_nondirectory (build_string (argv[0]));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2135 msshell = !NILP (Fmember (cmd, Fsymbol_value (intern ("msdos-shells"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2136 && !strcmp ("-c", argv[1]);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2137 if (msshell)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2138 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2139 saveargv1 = argv[1];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2140 saveargv2 = argv[2];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2141 argv[1] = "/c";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2142 if (argv[2])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2143 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2144 char *p = alloca (strlen (argv[2]) + 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2145
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2146 strcpy (argv[2] = p, saveargv2);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2147 while (*p && isspace ((unsigned char) *p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2148 p++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2149 while (*p && !isspace ((unsigned char) *p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2150 if (*p == '/')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2151 *p++ = '\\';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2152 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2153 p++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2154 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2155 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2156
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2157 /* Build the environment array. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2158 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2159 extern Lisp_Object Vprocess_environment;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2160 Lisp_Object tmp, lst;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2161 int i, len;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2162
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2163 lst = Vprocess_environment;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2164 len = XINT (Flength (lst));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2165
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2166 envv = alloca ((len + 1) * sizeof (char *));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2167 for (i = 0; i < len; i++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2168 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2169 tmp = Fcar (lst);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2170 lst = Fcdr (lst);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2171 CHECK_STRING (tmp);
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
2172 envv[i] = alloca (XSTRING_LENGTH (tmp) + 1);
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
2173 strcpy (envv[i], XSTRING_DATA (tmp));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2174 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2175 envv[len] = (char *) 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2176 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2177
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2178 if (STRINGP (dir))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
2179 chdir (XSTRING_DATA (dir));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2180 inbak = dup (0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2181 outbak = dup (1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2182 errbak = dup (2);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2183 if (inbak < 0 || outbak < 0 || errbak < 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2184 goto done; /* Allocation might fail due to lack of descriptors. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2185
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2186 if (have_mouse > 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2187 mouse_get_xy (&x, &y);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2188
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2189 dos_ttcooked (); /* do it here while 0 = stdin */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2190
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2191 dup2 (tempin, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2192 dup2 (tempout, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2193 dup2 (tempout, 2);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2194
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2195 result = spawnve (P_WAIT, argv[0], argv, envv);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2196
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2197 dup2 (inbak, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2198 dup2 (outbak, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2199 dup2 (errbak, 2);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2200 close (inbak);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2201 close (outbak);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2202 close (errbak);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2203
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2204 dos_ttraw ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2205 if (have_mouse > 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2206 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2207 mouse_init ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2208 mouse_moveto (x, y);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2209 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2210
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2211 done:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2212 chdir (oldwd);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2213 if (msshell)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2214 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2215 argv[1] = saveargv1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2216 argv[2] = saveargv2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2217 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2218 return result;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2219 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2220
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2221 croak (char *badfunc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2222 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2223 stderr_out ("%s not yet implemented\r\n", badfunc);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2224 reset_sys_modes ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2225 exit (1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2226 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2227
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2228
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2229 /* ------------------------- Compatibility functions -------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2230 * gethostname
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2231 * gettimeofday
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2232 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2233
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2234 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2235 * Hostnames for a pc are not really funny,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2236 * but they are used in change log so we emulate the best we can.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2237 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2238
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2239 gethostname (char *p, int size)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2240 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2241 char *q = egetenv ("HOSTNAME");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2242
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2243 if (!q) q = "pc";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2244 strcpy (p, q);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2245 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2246 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2247
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2248 /* When time zones are set from Ms-Dos too many C-libraries are playing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2249 tricks with time values. We solve this by defining our own version
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2250 of `gettimeofday' bypassing GO32. Our version needs to be initialized
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2251 once and after each call to `tzset' with TZ changed. That is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2252 accomplished by aliasing tzset to init_gettimeofday. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2253
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2254 static struct tm time_rec;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2255
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2256 int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2257 gettimeofday (struct timeval *tp, struct timezone *tzp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2258 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2259 if (tp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2260 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2261 struct time t;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2262 struct tm tm;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2263
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2264 gettime (&t);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2265 if (t.ti_hour < time_rec.tm_hour) /* midnight wrap */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2266 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2267 struct date d;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2268 getdate (&d);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2269 time_rec.tm_year = d.da_year - 1900;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2270 time_rec.tm_mon = d.da_mon - 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2271 time_rec.tm_mday = d.da_day;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2272 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2273
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2274 time_rec.tm_hour = t.ti_hour;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2275 time_rec.tm_min = t.ti_min;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2276 time_rec.tm_sec = t.ti_sec;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2277
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2278 tm = time_rec;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2279 tm.tm_gmtoff = dos_timezone_offset;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2280
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2281 tp->tv_sec = mktime (&tm); /* may modify tm */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2282 tp->tv_usec = t.ti_hund * (1000000 / 100);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2283 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2284 /* Ignore tzp; it's obsolescent. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2285 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2286 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2287
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2288
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2289 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2290 * A list of unimplemented functions that we silently ignore.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2291 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2292
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2293 unsigned alarm (unsigned int s) {}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2294 fork (void) { return 0; }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2295 int kill (int x, int y) { return -1; }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2296 nice (int p) {}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2297 void volatile pause (void) {}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2298 request_sigio (void) {}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2299 setpgrp (void) {return 0; }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2300 setpriority (int x, int y, int z) { return 0; }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2301 sigsetmask (int x) { return 0; }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2302 unrequest_sigio (void) {}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2303
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2304 int run_dos_timer_hooks = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2305
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2306 #ifndef HAVE_SELECT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2307 #include "sysselect.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2308
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2309 static int last_ti_sec = -1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2310 static int dos_menubar_clock_displayed = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2311
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2312 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2313 check_timer (struct time *t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2314 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2315 gettime (t);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2316
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2317 if (t->ti_sec == last_ti_sec)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2318 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2319 last_ti_sec = t->ti_sec;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2320
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2321 if (!NILP (Vdos_menubar_clock))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2322 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2323 char clock_str[16];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2324 int len;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2325 int min = t->ti_min;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2326 int hour = t->ti_hour;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2327
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2328 if (dos_timezone_offset)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2329 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2330 int tz = dos_timezone_offset;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2331 min -= tz % 60;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2332 if (min < 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2333 min += 60, hour--;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2334 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2335 if (min >= 60)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2336 min -= 60, hour++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2337
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2338 if ((hour -= (tz / 60)) < 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2339 hour += 24;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2340 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2341 hour %= 24;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2342 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2343
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2344 if ((dos_country_info[0x11] & 0x01) == 0) /* 12 hour clock */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2345 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2346 hour %= 12;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2347 if (hour == 0) hour = 12;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2348 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2349
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2350 len = sprintf (clock_str, "%2d.%02d.%02d", hour, min, t->ti_sec);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2351 dos_direct_output (0, screen_size_X - len - 1, clock_str, len);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2352 dos_menubar_clock_displayed = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2353 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2354 else if (dos_menubar_clock_displayed)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2355 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2356 /* Erase last displayed time. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2357 dos_direct_output (0, screen_size_X - 9, " ", 8);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2358 dos_menubar_clock_displayed = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2359 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2360
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2361 if (!NILP (Vdos_timer_hooks))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2362 run_dos_timer_hooks++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2363 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2364
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2365 /* Only event queue is checked. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2366 int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2367 sys_select (int nfds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2368 EMACS_TIME *timeout)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2369 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2370 int check_input;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2371 long timeoutval, clnow, cllast;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2372 struct time t;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2373
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2374 check_input = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2375 if (rfds)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2376 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2377 check_input = FD_ISSET (0, rfds);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2378 FD_ZERO (rfds);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2379 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2380 if (wfds)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2381 FD_ZERO (wfds);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2382 if (efds)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2383 FD_ZERO (efds);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2384
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2385 if (nfds != 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2386 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2387
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2388 /* If we are looking only for the terminal, with no timeout,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2389 just read it and wait -- that's more efficient. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2390 if (!timeout)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2391 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2392 while (! detect_input_pending ())
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2393 check_timer (&t);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2394 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2395 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2396 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2397 timeoutval = EMACS_SECS (*timeout) * 100 + EMACS_USECS (*timeout) / 10000;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2398 check_timer (&t);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2399 cllast = t.ti_sec * 100 + t.ti_hund;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2400
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2401 while (!check_input || !detect_input_pending ())
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2402 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2403 check_timer (&t);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2404 clnow = t.ti_sec * 100 + t.ti_hund;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2405 if (clnow < cllast) /* time wrap */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2406 timeoutval -= clnow + 6000 - cllast;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2407 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2408 timeoutval -= clnow - cllast;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2409 if (timeoutval <= 0) /* Stop on timer being cleared */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2410 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2411 cllast = clnow;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2412 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2413 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2414
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2415 FD_SET (0, rfds);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2416 return 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2417 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2418 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2419
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2420 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2421 * Define overlayed functions:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2422 *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2423 * chdir -> sys_chdir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2424 * tzset -> init_gettimeofday
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2425 * abort -> dos_abort
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2426 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2427
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2428 #ifdef chdir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2429 #undef chdir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2430 extern int chdir (CONST char *);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2431
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2432 int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2433 sys_chdir (CONST char* path)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2434 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2435 int len = strlen (path);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2436 char *tmp = (char *)path;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2437
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2438 if (*tmp && tmp[1] == ':')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2439 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2440 if (getdisk () != tolower (tmp[0]) - 'a')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2441 setdisk (tolower (tmp[0]) - 'a');
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2442 tmp += 2; /* strip drive: KFS 1995-07-06 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2443 len -= 2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2444 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2445
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2446 if (len > 1 && (tmp[len - 1] == '/'))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2447 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2448 char *tmp1 = (char *) alloca (len + 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2449 strcpy (tmp1, tmp);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2450 tmp1[len - 1] = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2451 tmp = tmp1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2452 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2453 return chdir (tmp);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2454 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2455 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2456
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2457 #ifdef tzset
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2458 #undef tzset
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2459 extern void tzset (void);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2460
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2461 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2462 init_gettimeofday (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2463 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2464 time_t ltm, gtm;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2465 struct tm *lstm;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2466
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2467 tzset ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2468 ltm = gtm = time (NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2469 ltm = mktime (lstm = localtime (&ltm));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2470 gtm = mktime (gmtime (&gtm));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2471 time_rec.tm_hour = 99; /* force gettimeofday to get date */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2472 time_rec.tm_isdst = lstm->tm_isdst;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2473 dos_timezone_offset = time_rec.tm_gmtoff = (int)(gtm - ltm) / 60;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2474 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2475 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2476
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2477 #ifdef abort
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2478 #undef abort
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2479 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2480 dos_abort (char *file, int line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2481 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2482 char buffer1[200], buffer2[400];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2483 int i, j;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2484
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2485 sprintf (buffer1, "<EMACS FATAL ERROR IN %s LINE %d>", file, line);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2486 for (i = j = 0; buffer1[i]; i++) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2487 buffer2[j++] = buffer1[i];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2488 buffer2[j++] = 0x70;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2489 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2490 dosmemput (buffer2, j, (int)ScreenPrimary);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2491 ScreenSetCursor (2, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2492 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2493 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2494 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2495
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2496 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2497 syms_of_msdos (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2498 {
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2499 DEFSUBR (Frecent_doskeys);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2500 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2501
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2502 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2503 vars_of_msdos (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2504 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2505 recent_doskeys = Fmake_vector (make_int (NUM_RECENT_DOSKEYS), Qnil);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2506 staticpro (&recent_doskeys);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2507
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2508 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2509
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2510 #endif /* MSDOS */