Mercurial > emacs
annotate src/msdos.c @ 16827:6f4bc15744a4
(real_install): Create site-lisp in installation dir.
| author | Geoff Voelker <voelker@cs.washington.edu> |
|---|---|
| date | Sun, 05 Jan 1997 02:14:28 +0000 |
| parents | e4f0f7fe8304 |
| children | 7370bcad5cb1 |
| rev | line source |
|---|---|
|
7666
13a977e6777a
(dos_rawgetc): Doc fix. Make C-, S-, and M- modifiers
Richard M. Stallman <rms@gnu.org>
parents:
7523
diff
changeset
|
1 /* MS-DOS specific C utilities. |
|
14413
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
2 Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc. |
| 5503 | 3 |
| 4 This file is part of GNU Emacs. | |
| 5 | |
| 6 GNU Emacs is free software; you can redistribute it and/or modify | |
| 7 it under the terms of the GNU General Public License as published by | |
| 10504 | 8 the Free Software Foundation; either version 2, or (at your option) |
| 5503 | 9 any later version. |
| 10 | |
| 11 GNU Emacs is distributed in the hope that it will be useful, | |
| 12 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 GNU General Public License for more details. | |
| 15 | |
| 16 You should have received a copy of the GNU General Public License | |
| 17 along with GNU Emacs; see the file COPYING. If not, write to | |
|
14186
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
14157
diff
changeset
|
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
|
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
14157
diff
changeset
|
19 Boston, MA 02111-1307, USA. */ |
| 5503 | 20 |
|
7666
13a977e6777a
(dos_rawgetc): Doc fix. Make C-, S-, and M- modifiers
Richard M. Stallman <rms@gnu.org>
parents:
7523
diff
changeset
|
21 /* Contributed by Morten Welinder */ |
| 13179 | 22 /* New display, keyboard, and mouse control by Kim F. Storm */ |
|
7666
13a977e6777a
(dos_rawgetc): Doc fix. Make C-, S-, and M- modifiers
Richard M. Stallman <rms@gnu.org>
parents:
7523
diff
changeset
|
23 |
| 5503 | 24 /* Note: some of the stuff here was taken from end of sysdep.c in demacs. */ |
| 25 | |
| 5980 | 26 #include <config.h> |
| 5503 | 27 |
| 28 #ifdef MSDOS | |
| 29 #include "lisp.h" | |
| 30 #include <stdio.h> | |
| 31 #include <stdlib.h> | |
| 32 #include <sys/param.h> | |
| 33 #include <sys/time.h> | |
| 34 #include <dos.h> | |
|
15125
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
35 #include <errno.h> |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
36 #include <sys/stat.h> /* for _fixpath */ |
|
14974
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
37 #if __DJGPP__ >= 2 |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
38 #include <fcntl.h> |
|
16598
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
39 #include <dpmi.h> /* for __dpmi_xxx stuff */ |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
40 #include <sys/farptr.h> /* for _farsetsel, _farnspokeb */ |
|
15125
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
41 #include <libc/dosio.h> /* for _USE_LFN */ |
|
14974
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
42 #endif |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
43 |
| 5503 | 44 #include "dosfns.h" |
| 45 #include "msdos.h" | |
| 46 #include "systime.h" | |
| 47 #include "termhooks.h" | |
| 9572 | 48 #include "dispextern.h" |
| 49 #include "termopts.h" | |
| 5503 | 50 #include "frame.h" |
| 9572 | 51 #include "window.h" |
|
16598
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
52 #include "buffer.h" |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
53 #include "commands.h" |
| 5503 | 54 #include <go32.h> |
| 55 #include <pc.h> | |
| 56 #include <ctype.h> | |
| 57 /* #include <process.h> */ | |
| 58 /* Damn that local process.h! Instead we can define P_WAIT ourselves. */ | |
| 59 #define P_WAIT 1 | |
| 60 | |
|
15125
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
61 #ifndef _USE_LFN |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
62 #define _USE_LFN 0 |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
63 #endif |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
64 |
|
14974
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
65 #if __DJGPP__ > 1 |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
66 |
| 14999 | 67 #include <signal.h> |
| 68 | |
|
14974
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
69 #ifndef SYSTEM_MALLOC |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
70 |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
71 #ifdef GNU_MALLOC |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
72 |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
73 /* If other `malloc' than ours is used, force our `sbrk' behave like |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
74 Unix programs expect (resize memory blocks to keep them contiguous). |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
75 If `sbrk' from `ralloc.c' is NOT used, also zero-out sbrk'ed memory, |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
76 because that's what `gmalloc' expects to get. */ |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
77 #include <crt0.h> |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
78 |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
79 #ifdef REL_ALLOC |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
80 int _crt0_startup_flags = _CRT0_FLAG_UNIX_SBRK; |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
81 #else /* not REL_ALLOC */ |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
82 int _crt0_startup_flags = (_CRT0_FLAG_UNIX_SBRK | _CRT0_FLAG_FILL_SBRK_MEMORY); |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
83 #endif /* not REL_ALLOC */ |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
84 #endif /* GNU_MALLOC */ |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
85 |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
86 #endif /* not SYSTEM_MALLOC */ |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
87 #endif /* __DJGPP__ > 1 */ |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
88 |
|
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
89 static unsigned long |
|
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
90 event_timestamp () |
|
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
91 { |
|
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
92 struct time t; |
|
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
93 unsigned long s; |
| 13179 | 94 |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
95 gettime (&t); |
|
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
96 s = t.ti_min; |
|
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
97 s *= 60; |
|
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
98 s += t.ti_sec; |
|
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
99 s *= 1000; |
|
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
100 s += t.ti_hund * 10; |
| 13179 | 101 |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
102 return s; |
|
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
103 } |
|
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
104 |
| 13179 | 105 |
| 106 /* ------------------------ Mouse control --------------------------- | |
| 107 * | |
| 108 * Coordinates are in screen positions and zero based. | |
| 109 * Mouse buttons are numbered from left to right and also zero based. | |
| 110 */ | |
| 5503 | 111 |
| 13179 | 112 int have_mouse; /* 0: no, 1: enabled, -1: disabled */ |
| 113 static int mouse_visible; | |
| 5503 | 114 |
| 13179 | 115 static int mouse_last_x; |
| 116 static int mouse_last_y; | |
| 5503 | 117 |
| 13179 | 118 static int mouse_button_translate[NUM_MOUSE_BUTTONS]; |
| 119 static int mouse_button_count; | |
| 5503 | 120 |
| 13179 | 121 void |
| 122 mouse_on () | |
| 123 { | |
| 124 union REGS regs; | |
| 5503 | 125 |
| 13179 | 126 if (have_mouse > 0 && !mouse_visible) |
| 127 { | |
| 128 if (termscript) | |
| 129 fprintf (termscript, "<M_ON>"); | |
| 130 regs.x.ax = 0x0001; | |
| 131 int86 (0x33, ®s, ®s); | |
| 132 mouse_visible = 1; | |
| 5503 | 133 } |
| 134 } | |
| 135 | |
| 13179 | 136 void |
| 137 mouse_off () | |
| 5503 | 138 { |
| 13179 | 139 union REGS regs; |
| 5503 | 140 |
| 13179 | 141 if (have_mouse > 0 && mouse_visible) |
| 5503 | 142 { |
| 13179 | 143 if (termscript) |
| 144 fprintf (termscript, "<M_OFF>"); | |
| 145 regs.x.ax = 0x0002; | |
| 146 int86 (0x33, ®s, ®s); | |
| 147 mouse_visible = 0; | |
| 5503 | 148 } |
| 149 } | |
| 150 | |
| 151 void | |
| 13179 | 152 mouse_moveto (x, y) |
| 153 int x, y; | |
| 5503 | 154 { |
| 13179 | 155 union REGS regs; |
| 156 | |
| 157 if (termscript) | |
| 158 fprintf (termscript, "<M_XY=%dx%d>", x, y); | |
| 159 regs.x.ax = 0x0004; | |
| 160 mouse_last_x = regs.x.cx = x * 8; | |
| 161 mouse_last_y = regs.x.dx = y * 8; | |
| 162 int86 (0x33, ®s, ®s); | |
| 5503 | 163 } |
| 164 | |
| 13179 | 165 static int |
| 166 mouse_pressed (b, xp, yp) | |
| 167 int b, *xp, *yp; | |
| 168 { | |
| 169 union REGS regs; | |
| 170 | |
| 171 if (b >= mouse_button_count) | |
| 172 return 0; | |
| 173 regs.x.ax = 0x0005; | |
| 174 regs.x.bx = mouse_button_translate[b]; | |
| 175 int86 (0x33, ®s, ®s); | |
| 176 if (regs.x.bx) | |
| 177 *xp = regs.x.cx / 8, *yp = regs.x.dx / 8; | |
| 178 return (regs.x.bx != 0); | |
| 179 } | |
| 180 | |
| 181 static int | |
| 182 mouse_released (b, xp, yp) | |
| 183 int b, *xp, *yp; | |
| 184 { | |
| 185 union REGS regs; | |
| 186 | |
| 187 if (b >= mouse_button_count) | |
| 188 return 0; | |
| 189 regs.x.ax = 0x0006; | |
| 190 regs.x.bx = mouse_button_translate[b]; | |
| 191 int86 (0x33, ®s, ®s); | |
| 192 if (regs.x.bx) | |
| 193 *xp = regs.x.cx / 8, *yp = regs.x.dx / 8; | |
| 194 return (regs.x.bx != 0); | |
| 195 } | |
| 196 | |
| 197 static void | |
| 198 mouse_get_xy (int *x, int *y) | |
| 5503 | 199 { |
| 200 union REGS regs; | |
| 201 | |
| 13179 | 202 regs.x.ax = 0x0003; |
| 203 int86 (0x33, ®s, ®s); | |
| 204 *x = regs.x.cx / 8; | |
| 205 *y = regs.x.dx / 8; | |
| 206 } | |
| 207 | |
| 208 void | |
| 209 mouse_get_pos (f, insist, bar_window, part, x, y, time) | |
| 210 FRAME_PTR *f; | |
| 211 int insist; | |
| 212 Lisp_Object *bar_window, *x, *y; | |
| 213 enum scroll_bar_part *part; | |
| 214 unsigned long *time; | |
| 215 { | |
| 216 int ix, iy; | |
| 217 union REGS regs; | |
| 218 | |
| 219 regs.x.ax = 0x0003; | |
| 220 int86 (0x33, ®s, ®s); | |
| 221 *f = selected_frame; | |
| 222 *bar_window = Qnil; | |
| 223 mouse_get_xy (&ix, &iy); | |
| 224 selected_frame->mouse_moved = 0; | |
| 225 *x = make_number (ix); | |
| 226 *y = make_number (iy); | |
| 227 *time = event_timestamp (); | |
| 228 } | |
| 229 | |
| 230 static void | |
| 231 mouse_check_moved () | |
| 232 { | |
| 233 int x, y; | |
| 234 | |
| 235 mouse_get_xy (&x, &y); | |
| 236 selected_frame->mouse_moved |= (x != mouse_last_x || y != mouse_last_y); | |
| 237 mouse_last_x = x; | |
| 238 mouse_last_y = y; | |
| 5503 | 239 } |
| 240 | |
| 13179 | 241 void |
| 242 mouse_init () | |
| 5503 | 243 { |
| 13179 | 244 union REGS regs; |
| 245 | |
| 246 if (termscript) | |
| 247 fprintf (termscript, "<M_INIT>"); | |
| 248 | |
| 249 regs.x.ax = 0x0021; | |
| 250 int86 (0x33, ®s, ®s); | |
| 251 | |
| 252 regs.x.ax = 0x0007; | |
| 253 regs.x.cx = 0; | |
| 254 regs.x.dx = 8 * (ScreenCols () - 1); | |
| 255 int86 (0x33, ®s, ®s); | |
| 256 | |
| 257 regs.x.ax = 0x0008; | |
| 258 regs.x.cx = 0; | |
| 259 regs.x.dx = 8 * (ScreenRows () - 1); | |
| 260 int86 (0x33, ®s, ®s); | |
| 261 | |
| 262 mouse_moveto (0, 0); | |
| 263 mouse_visible = 0; | |
| 264 } | |
|
13848
5f38596d591e
(have_menus_p): Defined.
Richard M. Stallman <rms@gnu.org>
parents:
13744
diff
changeset
|
265 |
| 13179 | 266 /* ------------------------- Screen control ---------------------- |
| 267 * | |
| 268 */ | |
| 5503 | 269 |
| 13179 | 270 static int internal_terminal = 0; |
| 271 | |
| 272 #ifndef HAVE_X_WINDOWS | |
| 273 extern unsigned char ScreenAttrib; | |
| 274 static int screen_face; | |
| 275 static int highlight; | |
| 276 | |
| 277 static int screen_size_X; | |
| 278 static int screen_size_Y; | |
| 279 static int screen_size; | |
| 280 | |
| 281 static int current_pos_X; | |
| 282 static int current_pos_Y; | |
| 283 static int new_pos_X; | |
| 284 static int new_pos_Y; | |
| 285 | |
| 286 static void *startup_screen_buffer; | |
| 287 static int startup_screen_size_X; | |
| 288 static int startup_screen_size_Y; | |
| 289 static int startup_pos_X; | |
| 290 static int startup_pos_Y; | |
|
13717
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
291 static unsigned char startup_screen_attrib; |
| 13179 | 292 |
| 293 static int term_setup_done; | |
| 294 | |
| 295 /* Similar to the_only_frame. */ | |
|
13394
c4549fcdd5f3
(the_only_x_display): Type is now struct x_output.
Karl Heuer <kwzh@gnu.org>
parents:
13305
diff
changeset
|
296 struct x_output the_only_x_display; |
| 13179 | 297 |
| 298 /* This is never dereferenced. */ | |
| 299 Display *x_current_display; | |
| 5503 | 300 |
| 13179 | 301 static |
| 302 dos_direct_output (y, x, buf, len) | |
| 303 int y; | |
| 304 int x; | |
| 305 char *buf; | |
| 306 int len; | |
| 5503 | 307 { |
| 13179 | 308 int t = (int) ScreenPrimary + 2 * (x + y * screen_size_X); |
|
16598
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
309 |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
310 #if (__DJGPP__ < 2) |
| 13179 | 311 while (--len >= 0) { |
| 312 dosmemput (buf++, 1, t); | |
| 313 t += 2; | |
| 314 } | |
|
16598
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
315 #else |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
316 /* This is faster. */ |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
317 for (_farsetsel (_dos_ds); --len >= 0; t += 2, buf++) |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
318 _farnspokeb (t, *buf); |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
319 #endif |
| 5503 | 320 } |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
321 #endif |
| 5503 | 322 |
| 323 /* Flash the screen as a substitute for BEEPs. */ | |
| 324 | |
| 13179 | 325 #if (__DJGPP__ < 2) |
|
7273
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
326 static void |
|
7667
bae9c0fa1c2f
(do_visible_bell): Renamed from visible_bell to avoid
Richard M. Stallman <rms@gnu.org>
parents:
7666
diff
changeset
|
327 do_visible_bell (xorattr) |
| 5503 | 328 unsigned char xorattr; |
| 329 { | |
|
7273
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
330 asm volatile |
|
8183
d35fd7fd0ef8
(install_ctrl_break_check): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
7821
diff
changeset
|
331 (" movb $1,%%dl |
| 5503 | 332 visible_bell_0: |
|
8183
d35fd7fd0ef8
(install_ctrl_break_check): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
7821
diff
changeset
|
333 movl _ScreenPrimary,%%eax |
|
7273
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
334 call dosmemsetup |
|
8183
d35fd7fd0ef8
(install_ctrl_break_check): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
7821
diff
changeset
|
335 movl %%eax,%%ebx |
|
d35fd7fd0ef8
(install_ctrl_break_check): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
7821
diff
changeset
|
336 movl %1,%%ecx |
|
d35fd7fd0ef8
(install_ctrl_break_check): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
7821
diff
changeset
|
337 movb %0,%%al |
|
d35fd7fd0ef8
(install_ctrl_break_check): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
7821
diff
changeset
|
338 incl %%ebx |
| 5503 | 339 visible_bell_1: |
|
8183
d35fd7fd0ef8
(install_ctrl_break_check): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
7821
diff
changeset
|
340 xorb %%al,%%gs:(%%ebx) |
|
d35fd7fd0ef8
(install_ctrl_break_check): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
7821
diff
changeset
|
341 addl $2,%%ebx |
|
d35fd7fd0ef8
(install_ctrl_break_check): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
7821
diff
changeset
|
342 decl %%ecx |
|
7273
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
343 jne visible_bell_1 |
|
8183
d35fd7fd0ef8
(install_ctrl_break_check): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
7821
diff
changeset
|
344 decb %%dl |
|
7273
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
345 jne visible_bell_3 |
| 5503 | 346 visible_bell_2: |
|
8183
d35fd7fd0ef8
(install_ctrl_break_check): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
7821
diff
changeset
|
347 movzwl %%ax,%%eax |
|
d35fd7fd0ef8
(install_ctrl_break_check): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
7821
diff
changeset
|
348 movzwl %%ax,%%eax |
|
d35fd7fd0ef8
(install_ctrl_break_check): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
7821
diff
changeset
|
349 movzwl %%ax,%%eax |
|
d35fd7fd0ef8
(install_ctrl_break_check): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
7821
diff
changeset
|
350 movzwl %%ax,%%eax |
|
d35fd7fd0ef8
(install_ctrl_break_check): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
7821
diff
changeset
|
351 decw %%cx |
|
7273
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
352 jne visible_bell_2 |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
353 jmp visible_bell_0 |
|
8183
d35fd7fd0ef8
(install_ctrl_break_check): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
7821
diff
changeset
|
354 visible_bell_3:" |
|
d35fd7fd0ef8
(install_ctrl_break_check): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
7821
diff
changeset
|
355 : /* no output */ |
| 13179 | 356 : "m" (xorattr), "g" (screen_size) |
|
8183
d35fd7fd0ef8
(install_ctrl_break_check): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
7821
diff
changeset
|
357 : "%eax", "%ebx", /* "%gs",*/ "%ecx", "%edx"); |
| 5503 | 358 } |
| 359 | |
| 13179 | 360 static void |
| 361 ScreenVisualBell (void) | |
| 362 { | |
| 363 /* This creates an xor-mask that will swap the default fore- and | |
| 364 background colors. */ | |
| 365 do_visible_bell (((the_only_x_display.foreground_pixel | |
| 366 ^ the_only_x_display.background_pixel) | |
| 367 * 0x11) & 0x7f); | |
| 368 } | |
| 369 #endif | |
| 370 | |
| 371 #ifndef HAVE_X_WINDOWS | |
| 372 | |
|
15341
8a0f5a5937e5
(bright_bg): New function, enables bright background colors.
Richard M. Stallman <rms@gnu.org>
parents:
15222
diff
changeset
|
373 /* Enable bright background colors. */ |
|
8a0f5a5937e5
(bright_bg): New function, enables bright background colors.
Richard M. Stallman <rms@gnu.org>
parents:
15222
diff
changeset
|
374 static void |
|
8a0f5a5937e5
(bright_bg): New function, enables bright background colors.
Richard M. Stallman <rms@gnu.org>
parents:
15222
diff
changeset
|
375 bright_bg (void) |
|
8a0f5a5937e5
(bright_bg): New function, enables bright background colors.
Richard M. Stallman <rms@gnu.org>
parents:
15222
diff
changeset
|
376 { |
|
8a0f5a5937e5
(bright_bg): New function, enables bright background colors.
Richard M. Stallman <rms@gnu.org>
parents:
15222
diff
changeset
|
377 union REGS regs; |
|
8a0f5a5937e5
(bright_bg): New function, enables bright background colors.
Richard M. Stallman <rms@gnu.org>
parents:
15222
diff
changeset
|
378 |
|
8a0f5a5937e5
(bright_bg): New function, enables bright background colors.
Richard M. Stallman <rms@gnu.org>
parents:
15222
diff
changeset
|
379 regs.h.bl = 0; |
|
8a0f5a5937e5
(bright_bg): New function, enables bright background colors.
Richard M. Stallman <rms@gnu.org>
parents:
15222
diff
changeset
|
380 regs.x.ax = 0x1003; |
|
8a0f5a5937e5
(bright_bg): New function, enables bright background colors.
Richard M. Stallman <rms@gnu.org>
parents:
15222
diff
changeset
|
381 int86 (0x10, ®s, ®s); |
|
8a0f5a5937e5
(bright_bg): New function, enables bright background colors.
Richard M. Stallman <rms@gnu.org>
parents:
15222
diff
changeset
|
382 } |
|
8a0f5a5937e5
(bright_bg): New function, enables bright background colors.
Richard M. Stallman <rms@gnu.org>
parents:
15222
diff
changeset
|
383 |
|
14284
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
384 /* Set the screen dimensions so that it can show no less than |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
385 ROWS x COLS frame. */ |
|
14413
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
386 |
|
14284
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
387 void |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
388 dos_set_window_size (rows, cols) |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
389 int *rows, *cols; |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
390 { |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
391 char video_name[30]; |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
392 Lisp_Object video_mode; |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
393 int video_mode_value; |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
394 int have_vga = 0; |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
395 union REGS regs; |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
396 int current_rows = ScreenRows (), current_cols = ScreenCols (); |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
397 |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
398 if (*rows == current_rows && *cols == current_cols) |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
399 return; |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
400 |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
401 /* Do we have a VGA? */ |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
402 regs.x.ax = 0x1a00; |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
403 int86 (0x10, ®s, ®s); |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
404 if (regs.h.al == 0x1a && regs.h.bl > 5 && regs.h.bl < 13) |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
405 have_vga = 1; |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
406 |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
407 mouse_off (); |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
408 |
|
14413
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
409 /* If the user specified a special video mode for these dimensions, |
|
14284
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
410 use that mode. */ |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
411 sprintf (video_name, "screen-dimensions-%dx%d", *rows, *cols); |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
412 video_mode = XSYMBOL (Fintern_soft (build_string (video_name), |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
413 Qnil))-> value; |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
414 |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
415 if (INTEGERP (video_mode) |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
416 && (video_mode_value = XINT (video_mode)) > 0) |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
417 { |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
418 regs.x.ax = video_mode_value; |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
419 int86 (0x10, ®s, ®s); |
|
14413
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
420 |
|
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
421 if (have_mouse) |
|
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
422 { |
|
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
423 /* Must hardware-reset the mouse, or else it won't update |
|
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
424 its notion of screen dimensions for some non-standard |
|
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
425 video modes. This is *painfully* slow... */ |
|
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
426 regs.x.ax = 0; |
|
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
427 int86 (0x33, ®s, ®s); |
|
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
428 } |
|
14284
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
429 } |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
430 |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
431 /* Find one of the dimensions supported by standard EGA/VGA |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
432 which gives us at least the required dimensions. */ |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
433 |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
434 #if __DJGPP__ > 1 |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
435 |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
436 else |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
437 { |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
438 static struct { |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
439 int rows; |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
440 int need_vga; |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
441 } std_dimension[] = { |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
442 {25, 0}, |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
443 {28, 1}, |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
444 {35, 0}, |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
445 {40, 1}, |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
446 {43, 0}, |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
447 {50, 1} |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
448 }; |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
449 int i = 0; |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
450 |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
451 while (i < sizeof (std_dimension) / sizeof (std_dimension[0])) |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
452 { |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
453 if (std_dimension[i].need_vga <= have_vga |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
454 && std_dimension[i].rows >= *rows) |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
455 { |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
456 if (std_dimension[i].rows != current_rows |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
457 || *cols != current_cols) |
|
14413
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
458 _set_screen_lines (std_dimension[i].rows); |
|
14284
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
459 break; |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
460 } |
|
14413
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
461 i++; |
|
14284
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
462 } |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
463 } |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
464 |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
465 #else /* not __DJGPP__ > 1 */ |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
466 |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
467 else if (*rows <= 25) |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
468 { |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
469 if (current_rows != 25 || current_cols != 80) |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
470 { |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
471 regs.x.ax = 3; |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
472 int86 (0x10, ®s, ®s); |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
473 regs.x.ax = 0x1101; |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
474 regs.h.bl = 0; |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
475 int86 (0x10, ®s, ®s); |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
476 regs.x.ax = 0x1200; |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
477 regs.h.bl = 32; |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
478 int86 (0x10, ®s, ®s); |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
479 regs.x.ax = 3; |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
480 int86 (0x10, ®s, ®s); |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
481 } |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
482 } |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
483 else if (*rows <= 50) |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
484 if (have_vga && (current_rows != 50 || current_cols != 80) |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
485 || *rows <= 43 && (current_rows != 43 || current_cols != 80)) |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
486 { |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
487 regs.x.ax = 3; |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
488 int86 (0x10, ®s, ®s); |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
489 regs.x.ax = 0x1112; |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
490 regs.h.bl = 0; |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
491 int86 (0x10, ®s, ®s); |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
492 regs.x.ax = 0x1200; |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
493 regs.h.bl = 32; |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
494 int86 (0x10, ®s, ®s); |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
495 regs.x.ax = 0x0100; |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
496 regs.x.cx = 7; |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
497 int86 (0x10, ®s, ®s); |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
498 } |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
499 #endif /* not __DJGPP__ > 1 */ |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
500 |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
501 if (have_mouse) |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
502 { |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
503 mouse_init (); |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
504 mouse_on (); |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
505 } |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
506 |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
507 /* Tell the caller what dimensions have been REALLY set. */ |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
508 *rows = ScreenRows (); |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
509 *cols = ScreenCols (); |
|
15341
8a0f5a5937e5
(bright_bg): New function, enables bright background colors.
Richard M. Stallman <rms@gnu.org>
parents:
15222
diff
changeset
|
510 |
|
8a0f5a5937e5
(bright_bg): New function, enables bright background colors.
Richard M. Stallman <rms@gnu.org>
parents:
15222
diff
changeset
|
511 /* Enable bright background colors. */ |
|
8a0f5a5937e5
(bright_bg): New function, enables bright background colors.
Richard M. Stallman <rms@gnu.org>
parents:
15222
diff
changeset
|
512 bright_bg (); |
|
14284
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
513 } |
|
0eaecdc13142
(dos_set_window_size): New function; switches the screen
Karl Heuer <kwzh@gnu.org>
parents:
14279
diff
changeset
|
514 |
|
14413
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
515 /* If we write a character in the position where the mouse is, |
|
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
516 the mouse cursor may need to be refreshed. */ |
|
7744
da18793f532d
(output_string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7667
diff
changeset
|
517 |
|
da18793f532d
(output_string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7667
diff
changeset
|
518 static void |
| 13179 | 519 mouse_off_maybe () |
|
7744
da18793f532d
(output_string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7667
diff
changeset
|
520 { |
| 13179 | 521 int x, y; |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
522 |
| 13179 | 523 if (!mouse_visible) |
| 524 return; | |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
525 |
| 13179 | 526 mouse_get_xy (&x, &y); |
| 527 if (y != new_pos_Y || x < new_pos_X) | |
| 528 return; | |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
529 |
|
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
530 mouse_off (); |
| 9572 | 531 } |
| 532 | |
| 533 static | |
| 534 IT_ring_bell () | |
| 535 { | |
| 536 if (visible_bell) | |
| 537 { | |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
538 mouse_off (); |
| 13179 | 539 ScreenVisualBell (); |
| 9572 | 540 } |
| 541 else | |
|
13305
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
542 { |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
543 union REGS inregs, outregs; |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
544 inregs.h.ah = 2; |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
545 inregs.h.dl = 7; |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
546 intdos (&inregs, &outregs); |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
547 } |
| 9572 | 548 } |
| 549 | |
| 550 static void | |
| 551 IT_set_face (int face) | |
| 552 { | |
| 553 struct face *fp; | |
| 554 extern struct face *intern_face (/* FRAME_PTR, struct face * */); | |
| 555 | |
| 556 if (face == 1 || (face == 0 && highlight)) | |
| 557 fp = FRAME_MODE_LINE_FACE (foo); | |
| 558 else if (face <= 0 || face >= FRAME_N_COMPUTED_FACES (foo)) | |
| 559 fp = FRAME_DEFAULT_FACE (foo); | |
| 560 else | |
| 561 fp = intern_face (selected_frame, FRAME_COMPUTED_FACES (foo)[face]); | |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
562 if (termscript) |
|
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
563 fprintf (termscript, "<FACE:%d:%d>", FACE_FOREGROUND (fp), FACE_BACKGROUND (fp)); |
| 13179 | 564 screen_face = face; |
| 565 ScreenAttrib = (FACE_BACKGROUND (fp) << 4) | FACE_FOREGROUND (fp); | |
| 9572 | 566 } |
| 567 | |
| 568 static | |
| 569 IT_write_glyphs (GLYPH *str, int len) | |
| 570 { | |
| 571 int newface; | |
| 13179 | 572 int ch, l = len; |
| 573 unsigned char *buf, *bp; | |
| 574 | |
| 575 if (len == 0) return; | |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
576 |
| 13179 | 577 buf = bp = alloca (len * 2); |
| 578 | |
| 579 while (--l >= 0) | |
| 9572 | 580 { |
| 581 newface = FAST_GLYPH_FACE (*str); | |
| 13179 | 582 if (newface != screen_face) |
| 583 IT_set_face (newface); | |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
584 ch = FAST_GLYPH_CHAR (*str); |
| 13179 | 585 *bp++ = (unsigned char)ch; |
| 586 *bp++ = ScreenAttrib; | |
| 587 | |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
588 if (termscript) |
|
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
589 fputc (ch, termscript); |
| 13179 | 590 str++; |
| 9572 | 591 } |
| 13179 | 592 |
| 593 mouse_off_maybe (); | |
| 594 dosmemput (buf, 2 * len, | |
| 595 (int)ScreenPrimary + 2 * (new_pos_X + screen_size_X * new_pos_Y)); | |
| 596 new_pos_X += len; | |
| 9572 | 597 } |
| 598 | |
| 599 static | |
| 600 IT_clear_end_of_line (first_unused) | |
| 601 { | |
| 13179 | 602 char *spaces, *sp; |
| 603 int i, j; | |
| 604 | |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
605 IT_set_face (0); |
|
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
606 if (termscript) |
|
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
607 fprintf (termscript, "<CLR:EOL>"); |
| 13179 | 608 i = (j = screen_size_X - new_pos_X) * 2; |
| 609 spaces = sp = alloca (i); | |
| 610 | |
| 611 while (--j >= 0) | |
| 612 { | |
| 613 *sp++ = ' '; | |
| 614 *sp++ = ScreenAttrib; | |
| 615 } | |
| 616 | |
| 617 mouse_off_maybe (); | |
| 618 dosmemput (spaces, i, | |
| 619 (int)ScreenPrimary + 2 * (new_pos_X + screen_size_X * new_pos_Y)); | |
| 620 } | |
| 621 | |
| 622 static | |
| 623 IT_clear_screen (void) | |
| 624 { | |
| 625 if (termscript) | |
| 626 fprintf (termscript, "<CLR:SCR>"); | |
| 627 IT_set_face (0); | |
| 628 mouse_off (); | |
| 629 ScreenClear (); | |
| 630 new_pos_X = new_pos_Y = 0; | |
| 631 } | |
| 632 | |
| 633 static | |
| 634 IT_clear_to_end (void) | |
| 635 { | |
| 636 if (termscript) | |
| 637 fprintf (termscript, "<CLR:EOS>"); | |
| 638 | |
| 639 while (new_pos_Y < screen_size_Y) { | |
| 640 new_pos_X = 0; | |
| 641 IT_clear_end_of_line (0); | |
| 642 new_pos_Y++; | |
| 643 } | |
| 9572 | 644 } |
| 645 | |
| 646 static | |
| 647 IT_cursor_to (int y, int x) | |
| 648 { | |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
649 if (termscript) |
|
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
650 fprintf (termscript, "\n<XY=%dx%d>", x, y); |
| 13179 | 651 new_pos_X = x; |
| 652 new_pos_Y = y; | |
| 9572 | 653 } |
| 654 | |
|
16598
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
655 static int cursor_cleared; |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
656 |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
657 static |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
658 IT_display_cursor (int on) |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
659 { |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
660 if (on && cursor_cleared) |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
661 { |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
662 ScreenSetCursor (current_pos_Y, current_pos_X); |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
663 cursor_cleared = 0; |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
664 } |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
665 else if (!on && !cursor_cleared) |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
666 { |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
667 ScreenSetCursor (-1, -1); |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
668 cursor_cleared = 1; |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
669 } |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
670 } |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
671 |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
672 /* Emacs calls cursor-movement functions a lot when it updates the |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
673 display (probably a legacy of old terminals where you cannot |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
674 update a screen line without first moving the cursor there). |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
675 However, cursor movement is expensive on MSDOS (it calls a slow |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
676 BIOS function and requires 2 mode switches), while actual screen |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
677 updates access the video memory directly and don't depend on |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
678 cursor position. To avoid slowing down the redisplay, we cheat: |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
679 all functions that move the cursor only set internal variables |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
680 which record the cursor position, whereas the cursor is only |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
681 moved to its final position whenever screen update is complete. |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
682 |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
683 `IT_cmgoto' is called from the keyboard reading loop and when the |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
684 frame update is complete. This means that we are ready for user |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
685 input, so we update the cursor position to show where the point is, |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
686 and also make the mouse pointer visible. |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
687 |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
688 Special treatment is required when the cursor is in the echo area, |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
689 to put the cursor at the end of the text displayed there. */ |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
690 |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
691 static |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
692 IT_cmgoto (f) |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
693 FRAME_PTR f; |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
694 { |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
695 /* Only set the cursor to where it should be if the display is |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
696 already in sync with the window contents. */ |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
697 int update_cursor_pos = MODIFF == unchanged_modified; |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
698 |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
699 /* If we are in the echo area, put the cursor at the end of text. */ |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
700 if (!update_cursor_pos |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
701 && XFASTINT (XWINDOW (FRAME_MINIBUF_WINDOW (f))->top) <= new_pos_Y) |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
702 { |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
703 new_pos_X = FRAME_DESIRED_GLYPHS (f)->used[new_pos_Y]; |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
704 update_cursor_pos = 1; |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
705 } |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
706 |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
707 if (update_cursor_pos |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
708 && (current_pos_X != new_pos_X || current_pos_Y != new_pos_Y)) |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
709 { |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
710 ScreenSetCursor (current_pos_Y = new_pos_Y, current_pos_X = new_pos_X); |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
711 if (termscript) |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
712 fprintf (termscript, "\n<CURSOR:%dx%d>", current_pos_X, current_pos_Y); |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
713 } |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
714 |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
715 /* Maybe cursor is invisible, so make it visible. */ |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
716 IT_display_cursor (1); |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
717 |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
718 /* Mouse pointer should be always visible if we are waiting for |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
719 keyboard input. */ |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
720 if (!mouse_visible) |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
721 mouse_on (); |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
722 } |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
723 |
| 13179 | 724 static |
| 9572 | 725 IT_reassert_line_highlight (new, vpos) |
| 726 int new, vpos; | |
| 727 { | |
| 728 highlight = new; | |
| 729 IT_set_face (0); /* To possibly clear the highlighting. */ | |
| 730 } | |
| 731 | |
| 732 static | |
| 733 IT_change_line_highlight (new_highlight, vpos, first_unused_hpos) | |
| 734 { | |
| 735 highlight = new_highlight; | |
| 736 IT_set_face (0); /* To possibly clear the highlighting. */ | |
| 737 IT_cursor_to (vpos, 0); | |
| 738 IT_clear_end_of_line (first_unused_hpos); | |
| 739 } | |
| 740 | |
| 741 static | |
| 742 IT_update_begin () | |
| 743 { | |
| 744 highlight = 0; | |
| 745 IT_set_face (0); /* To possibly clear the highlighting. */ | |
| 13179 | 746 screen_face = -1; |
| 747 } | |
| 748 | |
| 749 static | |
| 750 IT_update_end () | |
| 751 { | |
| 9572 | 752 } |
| 753 | |
|
15387
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
754 /* This was more or less copied from xterm.c |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
755 |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
756 Nowadays, the corresponding function under X is `x_set_menu_bar_lines_1' |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
757 on xfns.c */ |
|
14413
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
758 |
| 9572 | 759 static void |
| 760 IT_set_menu_bar_lines (window, n) | |
|
14413
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
761 Lisp_Object window; |
|
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
762 int n; |
| 9572 | 763 { |
| 764 struct window *w = XWINDOW (window); | |
| 765 | |
|
13646
7714b87119a3
(IT_set_menu_bar_lines): Clear last_modified field.
Richard M. Stallman <rms@gnu.org>
parents:
13642
diff
changeset
|
766 XSETFASTINT (w->last_modified, 0); |
|
16210
4c03f0e575d7
(IT_set_menu_bar_lines): Clear last_overlay_modified field.
Richard M. Stallman <rms@gnu.org>
parents:
15627
diff
changeset
|
767 XSETFASTINT (w->last_overlay_modified, 0); |
| 9572 | 768 XSETFASTINT (w->top, XFASTINT (w->top) + n); |
| 769 XSETFASTINT (w->height, XFASTINT (w->height) - n); | |
| 770 | |
| 771 /* Handle just the top child in a vertical split. */ | |
| 772 if (!NILP (w->vchild)) | |
| 773 IT_set_menu_bar_lines (w->vchild, n); | |
| 774 | |
| 775 /* Adjust all children in a horizontal split. */ | |
| 776 for (window = w->hchild; !NILP (window); window = w->next) | |
| 777 { | |
| 778 w = XWINDOW (window); | |
| 779 IT_set_menu_bar_lines (window, n); | |
| 780 } | |
| 781 } | |
| 782 | |
|
15387
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
783 /* This was copied from xfns.c */ |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
784 |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
785 void |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
786 x_set_menu_bar_lines (f, value, oldval) |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
787 struct frame *f; |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
788 Lisp_Object value, oldval; |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
789 { |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
790 int nlines; |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
791 int olines = FRAME_MENU_BAR_LINES (f); |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
792 |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
793 /* Right now, menu bars don't work properly in minibuf-only frames; |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
794 most of the commands try to apply themselves to the minibuffer |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
795 frame itslef, and get an error because you can't switch buffers |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
796 in or split the minibuffer window. */ |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
797 if (FRAME_MINIBUF_ONLY_P (f)) |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
798 return; |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
799 |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
800 if (INTEGERP (value)) |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
801 nlines = XINT (value); |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
802 else |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
803 nlines = 0; |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
804 |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
805 FRAME_MENU_BAR_LINES (f) = nlines; |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
806 IT_set_menu_bar_lines (f->root_window, nlines - olines); |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
807 } |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
808 |
|
14413
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
809 /* IT_set_terminal_modes is called when emacs is started, |
|
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
810 resumed, and whenever the screen is redrawn! */ |
| 13179 | 811 |
| 812 static | |
| 813 IT_set_terminal_modes (void) | |
| 814 { | |
| 815 char *colors; | |
| 816 FRAME_PTR f; | |
| 817 struct face *fp; | |
| 818 | |
| 819 if (termscript) | |
| 820 fprintf (termscript, "\n<SET_TERM>"); | |
| 821 highlight = 0; | |
| 822 | |
| 823 screen_size_X = ScreenCols (); | |
| 824 screen_size_Y = ScreenRows (); | |
| 825 screen_size = screen_size_X * screen_size_Y; | |
| 826 | |
| 827 new_pos_X = new_pos_Y = 0; | |
| 828 current_pos_X = current_pos_Y = -1; | |
| 829 | |
| 830 if (term_setup_done) | |
| 831 return; | |
| 832 term_setup_done = 1; | |
| 833 | |
| 834 startup_screen_size_X = screen_size_X; | |
| 835 startup_screen_size_Y = screen_size_Y; | |
|
13717
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
836 startup_screen_attrib = ScreenAttrib; |
| 13179 | 837 |
| 838 ScreenGetCursor (&startup_pos_Y, &startup_pos_X); | |
| 839 ScreenRetrieve (startup_screen_buffer = xmalloc (screen_size * 2)); | |
| 840 | |
| 841 if (termscript) | |
|
13717
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
842 fprintf (termscript, "<SCREEN SAVED (dimensions=%dx%d)>\n", |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
843 screen_size_X, screen_size_Y); |
|
15341
8a0f5a5937e5
(bright_bg): New function, enables bright background colors.
Richard M. Stallman <rms@gnu.org>
parents:
15222
diff
changeset
|
844 |
|
8a0f5a5937e5
(bright_bg): New function, enables bright background colors.
Richard M. Stallman <rms@gnu.org>
parents:
15222
diff
changeset
|
845 bright_bg (); |
| 13179 | 846 } |
| 847 | |
|
14413
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
848 /* IT_reset_terminal_modes is called when emacs is |
|
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
849 suspended or killed. */ |
| 13179 | 850 |
| 851 static | |
| 852 IT_reset_terminal_modes (void) | |
| 853 { | |
|
13717
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
854 int display_row_start = (int) ScreenPrimary; |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
855 int saved_row_len = startup_screen_size_X * 2; |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
856 int update_row_len = ScreenCols () * 2; |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
857 int current_rows = ScreenRows (); |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
858 int to_next_row = update_row_len; |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
859 unsigned char *saved_row = startup_screen_buffer; |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
860 int cursor_pos_X = ScreenCols () - 1; |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
861 int cursor_pos_Y = ScreenRows () - 1; |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
862 |
| 13179 | 863 if (termscript) |
| 13274 | 864 fprintf (termscript, "\n<RESET_TERM>"); |
| 13179 | 865 |
| 866 highlight = 0; | |
| 867 | |
| 868 if (!term_setup_done) | |
| 869 return; | |
| 870 | |
|
13717
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
871 mouse_off (); |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
872 |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
873 /* We have a situation here. |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
874 We cannot just do ScreenUpdate(startup_screen_buffer) because |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
875 the luser could have changed screen dimensions inside Emacs |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
876 and failed (or didn't want) to restore them before killing |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
877 Emacs. ScreenUpdate() uses the *current* screen dimensions and |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
878 thus will happily use memory outside what was allocated for |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
879 `startup_screen_buffer'. |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
880 Thus we only restore as much as the current screen dimensions |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
881 can hold, and clear the rest (if the saved screen is smaller than |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
882 the current) with the color attribute saved at startup. The cursor |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
883 is also restored within the visible dimensions. */ |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
884 |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
885 ScreenAttrib = startup_screen_attrib; |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
886 ScreenClear (); |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
887 |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
888 if (update_row_len > saved_row_len) |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
889 update_row_len = saved_row_len; |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
890 if (current_rows > startup_screen_size_Y) |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
891 current_rows = startup_screen_size_Y; |
| 13179 | 892 |
| 893 if (termscript) | |
|
13717
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
894 fprintf (termscript, "<SCREEN RESTORED (dimensions=%dx%d)>\n", |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
895 update_row_len / 2, current_rows); |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
896 |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
897 while (current_rows--) |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
898 { |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
899 dosmemput (saved_row, update_row_len, display_row_start); |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
900 saved_row += saved_row_len; |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
901 display_row_start += to_next_row; |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
902 } |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
903 if (startup_pos_X < cursor_pos_X) |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
904 cursor_pos_X = startup_pos_X; |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
905 if (startup_pos_Y < cursor_pos_Y) |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
906 cursor_pos_Y = startup_pos_Y; |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
907 |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
908 ScreenSetCursor (cursor_pos_Y, cursor_pos_X); |
|
d7bb4093a950
(IT_set_terminal_modes): Save screen color attribute
Karl Heuer <kwzh@gnu.org>
parents:
13714
diff
changeset
|
909 xfree (startup_screen_buffer); |
| 13179 | 910 |
| 911 term_setup_done = 0; | |
| 912 } | |
| 913 | |
| 914 static | |
| 915 IT_set_terminal_window (void) | |
| 916 { | |
| 917 } | |
| 918 | |
| 9572 | 919 void |
|
15387
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
920 IT_set_frame_parameters (f, alist) |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
921 FRAME_PTR f; |
| 9572 | 922 Lisp_Object alist; |
| 923 { | |
| 924 Lisp_Object tail; | |
| 925 int redraw; | |
| 926 extern unsigned long load_color (); | |
| 927 | |
| 928 redraw = 0; | |
| 929 for (tail = alist; CONSP (tail); tail = Fcdr (tail)) | |
| 930 { | |
| 931 Lisp_Object elt, prop, val; | |
| 932 | |
| 933 elt = Fcar (tail); | |
| 934 prop = Fcar (elt); | |
| 935 val = Fcdr (elt); | |
| 936 CHECK_SYMBOL (prop, 1); | |
| 937 | |
| 938 if (EQ (prop, intern ("foreground-color"))) | |
| 939 { | |
| 940 unsigned long new_color = load_color (f, val); | |
| 941 if (new_color != ~0) | |
| 942 { | |
| 943 FRAME_FOREGROUND_PIXEL (f) = new_color; | |
| 944 redraw = 1; | |
|
15341
8a0f5a5937e5
(bright_bg): New function, enables bright background colors.
Richard M. Stallman <rms@gnu.org>
parents:
15222
diff
changeset
|
945 if (termscript) |
|
8a0f5a5937e5
(bright_bg): New function, enables bright background colors.
Richard M. Stallman <rms@gnu.org>
parents:
15222
diff
changeset
|
946 fprintf (termscript, "<FGCOLOR %d>\n", new_color); |
| 9572 | 947 } |
| 948 } | |
| 949 else if (EQ (prop, intern ("background-color"))) | |
| 950 { | |
| 951 unsigned long new_color = load_color (f, val); | |
| 952 if (new_color != ~0) | |
| 953 { | |
|
15341
8a0f5a5937e5
(bright_bg): New function, enables bright background colors.
Richard M. Stallman <rms@gnu.org>
parents:
15222
diff
changeset
|
954 FRAME_BACKGROUND_PIXEL (f) = new_color; |
| 9572 | 955 redraw = 1; |
|
15341
8a0f5a5937e5
(bright_bg): New function, enables bright background colors.
Richard M. Stallman <rms@gnu.org>
parents:
15222
diff
changeset
|
956 if (termscript) |
|
8a0f5a5937e5
(bright_bg): New function, enables bright background colors.
Richard M. Stallman <rms@gnu.org>
parents:
15222
diff
changeset
|
957 fprintf (termscript, "<BGCOLOR %d>\n", new_color); |
| 9572 | 958 } |
| 959 } | |
| 960 else if (EQ (prop, intern ("menu-bar-lines"))) | |
|
15387
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
961 x_set_menu_bar_lines (f, val, 0); |
| 9572 | 962 } |
| 963 | |
| 964 if (redraw) | |
| 965 { | |
| 966 recompute_basic_faces (f); | |
|
15387
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
967 if (f == selected_frame) |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
968 redraw_frame (f); |
| 9572 | 969 } |
| 970 } | |
| 971 | |
| 13179 | 972 #endif /* !HAVE_X_WINDOWS */ |
| 9572 | 973 |
| 974 | |
|
14413
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
975 /* Do we need the internal terminal? */ |
|
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
976 |
| 5503 | 977 void |
| 978 internal_terminal_init () | |
| 979 { | |
| 980 char *term = getenv ("TERM"); | |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
981 char *colors; |
| 13179 | 982 |
| 9572 | 983 #ifdef HAVE_X_WINDOWS |
| 984 if (!inhibit_window_system) | |
| 985 return; | |
| 986 #endif | |
| 987 | |
| 5503 | 988 internal_terminal |
| 989 = (!noninteractive) && term && !strcmp (term, "internal"); | |
| 9572 | 990 |
| 13179 | 991 if (getenv ("EMACSTEST")) |
| 13274 | 992 termscript = fopen (getenv ("EMACSTEST"), "wt"); |
| 13179 | 993 |
| 9572 | 994 #ifndef HAVE_X_WINDOWS |
| 13179 | 995 if (!internal_terminal || inhibit_window_system) |
| 9572 | 996 { |
|
15387
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
997 selected_frame->output_method = output_termcap; |
| 13179 | 998 return; |
| 999 } | |
| 9572 | 1000 |
| 13179 | 1001 Vwindow_system = intern ("pc"); |
| 1002 Vwindow_system_version = make_number (1); | |
| 1003 | |
| 1004 bzero (&the_only_x_display, sizeof the_only_x_display); | |
| 1005 the_only_x_display.background_pixel = 7; /* White */ | |
| 1006 the_only_x_display.foreground_pixel = 0; /* Black */ | |
|
15341
8a0f5a5937e5
(bright_bg): New function, enables bright background colors.
Richard M. Stallman <rms@gnu.org>
parents:
15222
diff
changeset
|
1007 bright_bg (); |
| 13274 | 1008 colors = getenv ("EMACSCOLORS"); |
| 13179 | 1009 if (colors && strlen (colors) >= 2) |
| 1010 { | |
|
15341
8a0f5a5937e5
(bright_bg): New function, enables bright background colors.
Richard M. Stallman <rms@gnu.org>
parents:
15222
diff
changeset
|
1011 /* The colors use 4 bits each (we enable bright background). */ |
|
8a0f5a5937e5
(bright_bg): New function, enables bright background colors.
Richard M. Stallman <rms@gnu.org>
parents:
15222
diff
changeset
|
1012 if (isdigit (colors[0])) |
|
8a0f5a5937e5
(bright_bg): New function, enables bright background colors.
Richard M. Stallman <rms@gnu.org>
parents:
15222
diff
changeset
|
1013 colors[0] -= '0'; |
|
8a0f5a5937e5
(bright_bg): New function, enables bright background colors.
Richard M. Stallman <rms@gnu.org>
parents:
15222
diff
changeset
|
1014 else if (isxdigit (colors[0])) |
|
8a0f5a5937e5
(bright_bg): New function, enables bright background colors.
Richard M. Stallman <rms@gnu.org>
parents:
15222
diff
changeset
|
1015 colors[0] -= (isupper (colors[0]) ? 'A' : 'a') - 10; |
|
14974
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
1016 if (colors[0] >= 0 && colors[0] < 16) |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
1017 the_only_x_display.foreground_pixel = colors[0]; |
|
15341
8a0f5a5937e5
(bright_bg): New function, enables bright background colors.
Richard M. Stallman <rms@gnu.org>
parents:
15222
diff
changeset
|
1018 if (isdigit (colors[1])) |
|
8a0f5a5937e5
(bright_bg): New function, enables bright background colors.
Richard M. Stallman <rms@gnu.org>
parents:
15222
diff
changeset
|
1019 colors[1] -= '0'; |
|
8a0f5a5937e5
(bright_bg): New function, enables bright background colors.
Richard M. Stallman <rms@gnu.org>
parents:
15222
diff
changeset
|
1020 else if (isxdigit (colors[1])) |
|
8a0f5a5937e5
(bright_bg): New function, enables bright background colors.
Richard M. Stallman <rms@gnu.org>
parents:
15222
diff
changeset
|
1021 colors[1] -= (isupper (colors[1]) ? 'A' : 'a') - 10; |
|
8a0f5a5937e5
(bright_bg): New function, enables bright background colors.
Richard M. Stallman <rms@gnu.org>
parents:
15222
diff
changeset
|
1022 if (colors[1] >= 0 && colors[1] < 16) |
|
14974
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
1023 the_only_x_display.background_pixel = colors[1]; |
| 13179 | 1024 } |
| 1025 the_only_x_display.line_height = 1; | |
|
13625
397f07418271
(internal_terminal_init): Initialize the_only_x_display.font.
Richard M. Stallman <rms@gnu.org>
parents:
13624
diff
changeset
|
1026 the_only_x_display.font = (XFontStruct *)1; /* must *not* be zero */ |
| 9572 | 1027 |
|
15387
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
1028 init_frame_faces (selected_frame); |
| 13179 | 1029 |
| 1030 ring_bell_hook = IT_ring_bell; | |
| 1031 write_glyphs_hook = IT_write_glyphs; | |
| 1032 cursor_to_hook = raw_cursor_to_hook = IT_cursor_to; | |
| 1033 clear_to_end_hook = IT_clear_to_end; | |
| 1034 clear_end_of_line_hook = IT_clear_end_of_line; | |
| 1035 clear_frame_hook = IT_clear_screen; | |
| 1036 change_line_highlight_hook = IT_change_line_highlight; | |
| 1037 update_begin_hook = IT_update_begin; | |
| 1038 update_end_hook = IT_update_end; | |
| 1039 reassert_line_highlight_hook = IT_reassert_line_highlight; | |
|
16598
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
1040 frame_up_to_date_hook = IT_cmgoto; /* position cursor when update is done */ |
| 13179 | 1041 |
| 1042 /* These hooks are called by term.c without being checked. */ | |
| 1043 set_terminal_modes_hook = IT_set_terminal_modes; | |
| 1044 reset_terminal_modes_hook = IT_reset_terminal_modes; | |
| 1045 set_terminal_window_hook = IT_set_terminal_window; | |
| 9572 | 1046 #endif |
| 5503 | 1047 } |
| 13179 | 1048 |
| 1049 dos_get_saved_screen (screen, rows, cols) | |
| 1050 char **screen; | |
| 1051 int *rows; | |
| 1052 int *cols; | |
| 1053 { | |
| 1054 #ifndef HAVE_X_WINDOWS | |
| 1055 *screen = startup_screen_buffer; | |
| 1056 *cols = startup_screen_size_X; | |
| 1057 *rows = startup_screen_size_Y; | |
| 1058 return 1; | |
| 1059 #else | |
| 1060 return 0; | |
| 1061 #endif | |
| 1062 } | |
|
15387
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
1063 |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
1064 #ifndef HAVE_X_WINDOWS |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
1065 |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
1066 /* We are not X, but we can emulate it well enough for our needs... */ |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
1067 void |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
1068 check_x (void) |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
1069 { |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
1070 if (! FRAME_MSDOS_P (selected_frame)) |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
1071 error ("Not running under a windows system"); |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
1072 } |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
1073 |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
1074 #endif |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
1075 |
| 13274 | 1076 |
| 13179 | 1077 /* ----------------------- Keyboard control ---------------------- |
| 1078 * | |
| 1079 * Keymaps reflect the following keyboard layout: | |
| 1080 * | |
| 1081 * 0 1 2 3 4 5 6 7 8 9 10 11 12 BS | |
| 1082 * TAB 15 16 17 18 19 20 21 22 23 24 25 26 (41) | |
| 1083 * CLOK 30 31 32 33 34 35 36 37 38 39 40 (41) RET | |
| 1084 * SH () 45 46 47 48 49 50 51 52 53 54 SHIFT | |
| 1085 * SPACE | |
| 1086 */ | |
| 1087 | |
| 1088 static int extended_kbd; /* 101 (102) keyboard present. */ | |
| 1089 | |
| 1090 struct dos_keyboard_map | |
| 1091 { | |
| 1092 char *unshifted; | |
| 1093 char *shifted; | |
| 1094 char *alt_gr; | |
| 1095 }; | |
| 1096 | |
|
13040
169d50e2ee4c
(gettimeofday, init_gettimeofday, daylight, gmtoffset): Undo previous change.
Paul Eggert <eggert@twinsun.com>
parents:
13020
diff
changeset
|
1097 |
| 13179 | 1098 static struct dos_keyboard_map us_keyboard = { |
| 1099 /* 0 1 2 3 4 5 */ | |
| 1100 /* 01234567890123456789012345678901234567890 12345678901234 */ | |
| 1101 "`1234567890-= qwertyuiop[] asdfghjkl;'\\ zxcvbnm,./ ", | |
| 1102 /* 0123456789012345678901234567890123456789 012345678901234 */ | |
| 1103 "~!@#$%^&*()_+ QWERTYUIOP{} ASDFGHJKL:\"| ZXCVBNM<>? ", | |
| 1104 0 /* no Alt-Gr key */ | |
| 1105 }; | |
| 1106 | |
| 1107 static struct dos_keyboard_map fr_keyboard = { | |
| 1108 /* 0 1 2 3 4 5 */ | |
| 1109 /* 012 3456789012345678901234567890123456789012345678901234 */ | |
| 1110 "ý&‚\",(-Š_€…)= azertyuiop^$ qsdfghjklm—* wxcvbnm;:! ", | |
| 1111 /* 0123456789012345678901234567890123456789012345678901234 */ | |
| 1112 " 1234567890ø+ AZERTYUIOPùœ QSDFGHJKLM%æ WXCVBN?./õ ", | |
| 1113 /* 01234567 89012345678901234567890123456789012345678901234 */ | |
| 1114 " ~#{[|`\\^@]} Ï " | |
| 1115 }; | |
| 1116 | |
| 1117 static struct dos_keyboard_map dk_keyboard = { | |
| 1118 /* 0 1 2 3 4 5 */ | |
| 1119 /* 0123456789012345678901234567890123456789012345678901234 */ | |
| 1120 "«1234567890+| qwertyuiop†~ asdfghjkl‘›' zxcvbnm,.- ", | |
| 1121 /* 01 23456789012345678901234567890123456789012345678901234 */ | |
| 1122 "õ!\"#$%&/()=?` QWERTYUIOP^ ASDFGHJKL’* ZXCVBNM;:_ ", | |
| 1123 /* 0123456789012345678901234567890123456789012345678901234 */ | |
| 1124 " @œ$ {[]} | " | |
| 1125 }; | |
| 1126 | |
| 1127 static struct keyboard_layout_list | |
| 1128 { | |
| 1129 int country_code; | |
| 1130 struct dos_keyboard_map *keyboard_map; | |
| 13274 | 1131 } keyboard_layout_list[] = |
| 1132 { | |
| 1133 1, &us_keyboard, | |
| 1134 33, &fr_keyboard, | |
| 1135 45, &dk_keyboard | |
| 13179 | 1136 }; |
| 1137 | |
| 1138 static struct dos_keyboard_map *keyboard; | |
| 1139 static int keyboard_map_all; | |
|
16763
e4f0f7fe8304
(dos_set_keyboard): Test whether KEYB.COM is installed
Richard M. Stallman <rms@gnu.org>
parents:
16613
diff
changeset
|
1140 static int international_keyboard; |
|
7523
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
1141 |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
1142 int |
| 13179 | 1143 dos_set_keyboard (code, always) |
| 1144 int code; | |
| 1145 int always; | |
|
7523
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
1146 { |
| 13179 | 1147 int i; |
|
16763
e4f0f7fe8304
(dos_set_keyboard): Test whether KEYB.COM is installed
Richard M. Stallman <rms@gnu.org>
parents:
16613
diff
changeset
|
1148 union REGS regs; |
|
e4f0f7fe8304
(dos_set_keyboard): Test whether KEYB.COM is installed
Richard M. Stallman <rms@gnu.org>
parents:
16613
diff
changeset
|
1149 |
|
e4f0f7fe8304
(dos_set_keyboard): Test whether KEYB.COM is installed
Richard M. Stallman <rms@gnu.org>
parents:
16613
diff
changeset
|
1150 /* See if Keyb.Com is installed (for international keyboard support). */ |
|
e4f0f7fe8304
(dos_set_keyboard): Test whether KEYB.COM is installed
Richard M. Stallman <rms@gnu.org>
parents:
16613
diff
changeset
|
1151 regs.x.ax = 0xad80; |
|
e4f0f7fe8304
(dos_set_keyboard): Test whether KEYB.COM is installed
Richard M. Stallman <rms@gnu.org>
parents:
16613
diff
changeset
|
1152 int86 (0x2f, ®s, ®s); |
|
e4f0f7fe8304
(dos_set_keyboard): Test whether KEYB.COM is installed
Richard M. Stallman <rms@gnu.org>
parents:
16613
diff
changeset
|
1153 if (regs.h.al == 0xff) |
|
e4f0f7fe8304
(dos_set_keyboard): Test whether KEYB.COM is installed
Richard M. Stallman <rms@gnu.org>
parents:
16613
diff
changeset
|
1154 international_keyboard = 1; |
|
13624
47484dd9a970
(dos_set_keyboard): If CODE is not recognized,
Richard M. Stallman <rms@gnu.org>
parents:
13520
diff
changeset
|
1155 |
|
47484dd9a970
(dos_set_keyboard): If CODE is not recognized,
Richard M. Stallman <rms@gnu.org>
parents:
13520
diff
changeset
|
1156 /* Initialize to US settings, for countries that don't have their own. */ |
|
47484dd9a970
(dos_set_keyboard): If CODE is not recognized,
Richard M. Stallman <rms@gnu.org>
parents:
13520
diff
changeset
|
1157 keyboard = keyboard_layout_list[0].keyboard_map; |
|
47484dd9a970
(dos_set_keyboard): If CODE is not recognized,
Richard M. Stallman <rms@gnu.org>
parents:
13520
diff
changeset
|
1158 keyboard_map_all = always; |
|
47484dd9a970
(dos_set_keyboard): If CODE is not recognized,
Richard M. Stallman <rms@gnu.org>
parents:
13520
diff
changeset
|
1159 dos_keyboard_layout = 1; |
|
47484dd9a970
(dos_set_keyboard): If CODE is not recognized,
Richard M. Stallman <rms@gnu.org>
parents:
13520
diff
changeset
|
1160 |
| 13179 | 1161 for (i = 0; i < (sizeof (keyboard_layout_list)/sizeof (struct keyboard_layout_list)); i++) |
| 1162 if (code == keyboard_layout_list[i].country_code) | |
| 1163 { | |
| 1164 keyboard = keyboard_layout_list[i].keyboard_map; | |
| 1165 keyboard_map_all = always; | |
| 1166 dos_keyboard_layout = code; | |
| 1167 return 1; | |
| 1168 } | |
|
7523
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
1169 return 0; |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
1170 } |
| 13274 | 1171 |
| 13179 | 1172 #define Ignore 0x0000 |
| 1173 #define Normal 0x0000 /* normal key - alt changes scan-code */ | |
| 1174 #define FctKey 0x1000 /* func key if c == 0, else c */ | |
| 1175 #define Special 0x2000 /* func key even if c != 0 */ | |
| 1176 #define ModFct 0x3000 /* special if mod-keys, else 'c' */ | |
| 1177 #define Map 0x4000 /* alt scan-code, map to unshift/shift key */ | |
| 1178 #define KeyPad 0x5000 /* map to insert/kp-0 depending on c == 0xe0 */ | |
| 1179 #define Grey 0x6000 /* Grey keypad key */ | |
| 1180 | |
| 1181 #define Alt 0x0100 /* alt scan-code */ | |
| 1182 #define Ctrl 0x0200 /* ctrl scan-code */ | |
| 1183 #define Shift 0x0400 /* shift scan-code */ | |
| 1184 | |
| 1185 static struct | |
| 1186 { | |
| 1187 unsigned char char_code; /* normal code */ | |
| 1188 unsigned char meta_code; /* M- code */ | |
| 1189 unsigned char keypad_code; /* keypad code */ | |
| 1190 unsigned char editkey_code; /* edit key */ | |
| 1191 } keypad_translate_map[] = { | |
| 1192 '0', '0', 0xb0, /* kp-0 */ 0x63, /* insert */ | |
| 1193 '1', '1', 0xb1, /* kp-1 */ 0x57, /* end */ | |
| 1194 '2', '2', 0xb2, /* kp-2 */ 0x54, /* down */ | |
| 1195 '3', '3', 0xb3, /* kp-3 */ 0x56, /* next */ | |
| 1196 '4', '4', 0xb4, /* kp-4 */ 0x51, /* left */ | |
| 1197 '5', '5', 0xb5, /* kp-5 */ 0xb5, /* kp-5 */ | |
| 1198 '6', '6', 0xb6, /* kp-6 */ 0x53, /* right */ | |
| 1199 '7', '7', 0xb7, /* kp-7 */ 0x50, /* home */ | |
| 1200 '8', '8', 0xb8, /* kp-8 */ 0x52, /* up */ | |
| 1201 '9', '9', 0xb9, /* kp-9 */ 0x55, /* prior */ | |
| 1202 '.', '-', 0xae, /* kp-decimal */ 0xff /* delete */ | |
| 1203 }; | |
| 1204 | |
| 1205 static struct | |
| 1206 { | |
| 1207 unsigned char char_code; /* normal code */ | |
| 1208 unsigned char keypad_code; /* keypad code */ | |
| 1209 } grey_key_translate_map[] = { | |
| 1210 '/', 0xaf, /* kp-decimal */ | |
| 1211 '*', 0xaa, /* kp-multiply */ | |
| 1212 '-', 0xad, /* kp-subtract */ | |
| 1213 '+', 0xab, /* kp-add */ | |
| 1214 '\r', 0x8d /* kp-enter */ | |
| 1215 }; | |
| 1216 | |
| 1217 static unsigned short | |
| 1218 ibmpc_translate_map[] = | |
|
13040
169d50e2ee4c
(gettimeofday, init_gettimeofday, daylight, gmtoffset): Undo previous change.
Paul Eggert <eggert@twinsun.com>
parents:
13020
diff
changeset
|
1219 { |
| 13179 | 1220 /* --------------- 00 to 0f --------------- */ |
| 1221 Normal | 0xff, /* Ctrl Break + Alt-NNN */ | |
| 1222 Alt | ModFct | 0x1b, /* Escape */ | |
| 1223 Normal | 1, /* '1' */ | |
| 1224 Normal | 2, /* '2' */ | |
| 1225 Normal | 3, /* '3' */ | |
| 1226 Normal | 4, /* '4' */ | |
| 1227 Normal | 5, /* '5' */ | |
| 1228 Normal | 6, /* '6' */ | |
| 1229 Normal | 7, /* '7' */ | |
| 1230 Normal | 8, /* '8' */ | |
| 1231 Normal | 9, /* '9' */ | |
| 1232 Normal | 10, /* '0' */ | |
| 1233 Normal | 11, /* '-' */ | |
| 1234 Normal | 12, /* '=' */ | |
| 1235 Special | 0x08, /* Backspace */ | |
| 1236 ModFct | 0x74, /* Tab/Backtab */ | |
| 1237 | |
| 1238 /* --------------- 10 to 1f --------------- */ | |
| 1239 Map | 15, /* 'q' */ | |
| 1240 Map | 16, /* 'w' */ | |
| 1241 Map | 17, /* 'e' */ | |
| 1242 Map | 18, /* 'r' */ | |
| 1243 Map | 19, /* 't' */ | |
| 1244 Map | 20, /* 'y' */ | |
| 1245 Map | 21, /* 'u' */ | |
| 1246 Map | 22, /* 'i' */ | |
| 1247 Map | 23, /* 'o' */ | |
| 1248 Map | 24, /* 'p' */ | |
| 1249 Map | 25, /* '[' */ | |
| 1250 Map | 26, /* ']' */ | |
| 1251 ModFct | 0x0d, /* Return */ | |
| 1252 Ignore, /* Ctrl */ | |
| 1253 Map | 30, /* 'a' */ | |
| 1254 Map | 31, /* 's' */ | |
| 1255 | |
| 1256 /* --------------- 20 to 2f --------------- */ | |
| 1257 Map | 32, /* 'd' */ | |
| 1258 Map | 33, /* 'f' */ | |
| 1259 Map | 34, /* 'g' */ | |
| 1260 Map | 35, /* 'h' */ | |
| 1261 Map | 36, /* 'j' */ | |
| 1262 Map | 37, /* 'k' */ | |
| 1263 Map | 38, /* 'l' */ | |
| 1264 Map | 39, /* ';' */ | |
| 1265 Map | 40, /* '\'' */ | |
| 1266 Map | 0, /* '`' */ | |
| 1267 Ignore, /* Left shift */ | |
| 1268 Map | 41, /* '\\' */ | |
| 1269 Map | 45, /* 'z' */ | |
| 1270 Map | 46, /* 'x' */ | |
| 1271 Map | 47, /* 'c' */ | |
| 1272 Map | 48, /* 'v' */ | |
| 1273 | |
| 1274 /* --------------- 30 to 3f --------------- */ | |
| 1275 Map | 49, /* 'b' */ | |
| 1276 Map | 50, /* 'n' */ | |
| 1277 Map | 51, /* 'm' */ | |
| 1278 Map | 52, /* ',' */ | |
| 1279 Map | 53, /* '.' */ | |
| 1280 Map | 54, /* '/' */ | |
| 1281 Ignore, /* Right shift */ | |
| 1282 Grey | 1, /* Grey * */ | |
| 1283 Ignore, /* Alt */ | |
| 1284 Normal | ' ', /* ' ' */ | |
| 1285 Ignore, /* Caps Lock */ | |
| 1286 FctKey | 0xbe, /* F1 */ | |
| 1287 FctKey | 0xbf, /* F2 */ | |
| 1288 FctKey | 0xc0, /* F3 */ | |
| 1289 FctKey | 0xc1, /* F4 */ | |
| 1290 FctKey | 0xc2, /* F5 */ | |
| 1291 | |
| 1292 /* --------------- 40 to 4f --------------- */ | |
| 1293 FctKey | 0xc3, /* F6 */ | |
| 1294 FctKey | 0xc4, /* F7 */ | |
| 1295 FctKey | 0xc5, /* F8 */ | |
| 1296 FctKey | 0xc6, /* F9 */ | |
| 1297 FctKey | 0xc7, /* F10 */ | |
| 1298 Ignore, /* Num Lock */ | |
| 1299 Ignore, /* Scroll Lock */ | |
| 1300 KeyPad | 7, /* Home */ | |
| 1301 KeyPad | 8, /* Up */ | |
| 1302 KeyPad | 9, /* Page Up */ | |
| 1303 Grey | 2, /* Grey - */ | |
| 1304 KeyPad | 4, /* Left */ | |
| 1305 KeyPad | 5, /* Keypad 5 */ | |
| 1306 KeyPad | 6, /* Right */ | |
| 1307 Grey | 3, /* Grey + */ | |
| 1308 KeyPad | 1, /* End */ | |
| 1309 | |
| 1310 /* --------------- 50 to 5f --------------- */ | |
| 1311 KeyPad | 2, /* Down */ | |
| 1312 KeyPad | 3, /* Page Down */ | |
| 1313 KeyPad | 0, /* Insert */ | |
| 1314 KeyPad | 10, /* Delete */ | |
| 1315 Shift | FctKey | 0xbe, /* (Shift) F1 */ | |
| 1316 Shift | FctKey | 0xbf, /* (Shift) F2 */ | |
| 1317 Shift | FctKey | 0xc0, /* (Shift) F3 */ | |
| 1318 Shift | FctKey | 0xc1, /* (Shift) F4 */ | |
| 1319 Shift | FctKey | 0xc2, /* (Shift) F5 */ | |
| 1320 Shift | FctKey | 0xc3, /* (Shift) F6 */ | |
| 1321 Shift | FctKey | 0xc4, /* (Shift) F7 */ | |
| 1322 Shift | FctKey | 0xc5, /* (Shift) F8 */ | |
| 1323 Shift | FctKey | 0xc6, /* (Shift) F9 */ | |
| 1324 Shift | FctKey | 0xc7, /* (Shift) F10 */ | |
| 1325 Ctrl | FctKey | 0xbe, /* (Ctrl) F1 */ | |
| 1326 Ctrl | FctKey | 0xbf, /* (Ctrl) F2 */ | |
|
13040
169d50e2ee4c
(gettimeofday, init_gettimeofday, daylight, gmtoffset): Undo previous change.
Paul Eggert <eggert@twinsun.com>
parents:
13020
diff
changeset
|
1327 |
| 13179 | 1328 /* --------------- 60 to 6f --------------- */ |
| 1329 Ctrl | FctKey | 0xc0, /* (Ctrl) F3 */ | |
| 1330 Ctrl | FctKey | 0xc1, /* (Ctrl) F4 */ | |
| 1331 Ctrl | FctKey | 0xc2, /* (Ctrl) F5 */ | |
| 1332 Ctrl | FctKey | 0xc3, /* (Ctrl) F6 */ | |
| 1333 Ctrl | FctKey | 0xc4, /* (Ctrl) F7 */ | |
| 1334 Ctrl | FctKey | 0xc5, /* (Ctrl) F8 */ | |
| 1335 Ctrl | FctKey | 0xc6, /* (Ctrl) F9 */ | |
| 1336 Ctrl | FctKey | 0xc7, /* (Ctrl) F10 */ | |
| 1337 Alt | FctKey | 0xbe, /* (Alt) F1 */ | |
| 1338 Alt | FctKey | 0xbf, /* (Alt) F2 */ | |
| 1339 Alt | FctKey | 0xc0, /* (Alt) F3 */ | |
| 1340 Alt | FctKey | 0xc1, /* (Alt) F4 */ | |
| 1341 Alt | FctKey | 0xc2, /* (Alt) F5 */ | |
| 1342 Alt | FctKey | 0xc3, /* (Alt) F6 */ | |
| 1343 Alt | FctKey | 0xc4, /* (Alt) F7 */ | |
| 1344 Alt | FctKey | 0xc5, /* (Alt) F8 */ | |
| 1345 | |
| 1346 /* --------------- 70 to 7f --------------- */ | |
| 1347 Alt | FctKey | 0xc6, /* (Alt) F9 */ | |
| 1348 Alt | FctKey | 0xc7, /* (Alt) F10 */ | |
| 1349 Ctrl | FctKey | 0x6d, /* (Ctrl) Sys Rq */ | |
| 1350 Ctrl | KeyPad | 4, /* (Ctrl) Left */ | |
| 1351 Ctrl | KeyPad | 6, /* (Ctrl) Right */ | |
| 1352 Ctrl | KeyPad | 1, /* (Ctrl) End */ | |
| 1353 Ctrl | KeyPad | 3, /* (Ctrl) Page Down */ | |
| 1354 Ctrl | KeyPad | 7, /* (Ctrl) Home */ | |
| 1355 Alt | Map | 1, /* '1' */ | |
| 1356 Alt | Map | 2, /* '2' */ | |
| 1357 Alt | Map | 3, /* '3' */ | |
| 1358 Alt | Map | 4, /* '4' */ | |
| 1359 Alt | Map | 5, /* '5' */ | |
| 1360 Alt | Map | 6, /* '6' */ | |
| 1361 Alt | Map | 7, /* '7' */ | |
| 1362 Alt | Map | 8, /* '8' */ | |
| 1363 | |
| 1364 /* --------------- 80 to 8f --------------- */ | |
| 1365 Alt | Map | 9, /* '9' */ | |
| 1366 Alt | Map | 10, /* '0' */ | |
| 1367 Alt | Map | 11, /* '-' */ | |
| 1368 Alt | Map | 12, /* '=' */ | |
| 1369 Ctrl | KeyPad | 9, /* (Ctrl) Page Up */ | |
| 1370 FctKey | 0xc8, /* F11 */ | |
| 1371 FctKey | 0xc9, /* F12 */ | |
| 1372 Shift | FctKey | 0xc8, /* (Shift) F11 */ | |
| 1373 Shift | FctKey | 0xc9, /* (Shift) F12 */ | |
| 1374 Ctrl | FctKey | 0xc8, /* (Ctrl) F11 */ | |
| 1375 Ctrl | FctKey | 0xc9, /* (Ctrl) F12 */ | |
| 1376 Alt | FctKey | 0xc8, /* (Alt) F11 */ | |
| 1377 Alt | FctKey | 0xc9, /* (Alt) F12 */ | |
| 1378 Ctrl | KeyPad | 8, /* (Ctrl) Up */ | |
| 1379 Ctrl | Grey | 2, /* (Ctrl) Grey - */ | |
| 1380 Ctrl | KeyPad | 5, /* (Ctrl) Keypad 5 */ | |
| 1381 | |
| 1382 /* --------------- 90 to 9f --------------- */ | |
| 1383 Ctrl | Grey | 3, /* (Ctrl) Grey + */ | |
| 1384 Ctrl | KeyPad | 2, /* (Ctrl) Down */ | |
| 1385 Ctrl | KeyPad | 0, /* (Ctrl) Insert */ | |
| 1386 Ctrl | KeyPad | 10, /* (Ctrl) Delete */ | |
| 1387 Ctrl | FctKey | 0x09, /* (Ctrl) Tab */ | |
| 1388 Ctrl | Grey | 0, /* (Ctrl) Grey / */ | |
| 1389 Ctrl | Grey | 1, /* (Ctrl) Grey * */ | |
| 1390 Alt | FctKey | 0x50, /* (Alt) Home */ | |
| 1391 Alt | FctKey | 0x52, /* (Alt) Up */ | |
| 1392 Alt | FctKey | 0x55, /* (Alt) Page Up */ | |
| 1393 Ignore, /* NO KEY */ | |
| 1394 Alt | FctKey | 0x51, /* (Alt) Left */ | |
| 1395 Ignore, /* NO KEY */ | |
| 1396 Alt | FctKey | 0x53, /* (Alt) Right */ | |
| 1397 Ignore, /* NO KEY */ | |
| 1398 Alt | FctKey | 0x57, /* (Alt) End */ | |
| 1399 | |
| 1400 /* --------------- a0 to af --------------- */ | |
| 1401 Alt | KeyPad | 2, /* (Alt) Down */ | |
| 1402 Alt | KeyPad | 3, /* (Alt) Page Down */ | |
| 1403 Alt | KeyPad | 0, /* (Alt) Insert */ | |
| 1404 Alt | KeyPad | 10, /* (Alt) Delete */ | |
| 1405 Alt | Grey | 0, /* (Alt) Grey / */ | |
| 1406 Alt | FctKey | 0x09, /* (Alt) Tab */ | |
| 1407 Alt | Grey | 4 /* (Alt) Keypad Enter */ | |
| 1408 }; | |
| 13274 | 1409 |
| 13179 | 1410 /* These bit-positions corresponds to values returned by BIOS */ |
| 1411 #define SHIFT_P 0x0003 /* two bits! */ | |
| 1412 #define CTRL_P 0x0004 | |
| 1413 #define ALT_P 0x0008 | |
| 1414 #define SCRLOCK_P 0x0010 | |
| 1415 #define NUMLOCK_P 0x0020 | |
| 1416 #define CAPSLOCK_P 0x0040 | |
| 1417 #define ALT_GR_P 0x0800 | |
| 1418 #define SUPER_P 0x4000 /* pseudo */ | |
| 1419 #define HYPER_P 0x8000 /* pseudo */ | |
| 1420 | |
| 1421 static int | |
| 1422 dos_get_modifiers (keymask) | |
| 1423 int *keymask; | |
| 5503 | 1424 { |
| 13179 | 1425 union REGS regs; |
| 1426 int mask; | |
| 1427 int modifiers = 0; | |
| 1428 | |
| 1429 /* Calculate modifier bits */ | |
| 1430 regs.h.ah = extended_kbd ? 0x12 : 0x02; | |
| 1431 int86 (0x16, ®s, ®s); | |
| 1432 | |
| 1433 if (!extended_kbd) | |
| 1434 { | |
| 1435 mask = regs.h.al & (SHIFT_P | CTRL_P | ALT_P | | |
| 1436 SCRLOCK_P | NUMLOCK_P | CAPSLOCK_P); | |
| 1437 } | |
| 1438 else | |
| 1439 { | |
| 1440 mask = regs.h.al & (SHIFT_P | | |
| 1441 SCRLOCK_P | NUMLOCK_P | CAPSLOCK_P); | |
| 1442 | |
| 1443 /* Do not break international keyboard support. */ | |
| 1444 /* When Keyb.Com is loaded, the right Alt key is */ | |
| 1445 /* used for accessing characters like { and } */ | |
| 1446 if (regs.h.ah & 2) /* Left ALT pressed ? */ | |
| 1447 mask |= ALT_P; | |
| 1448 | |
| 1449 if ((regs.h.ah & 8) != 0) /* Right ALT pressed ? */ | |
| 1450 { | |
| 1451 mask |= ALT_GR_P; | |
| 1452 if (dos_hyper_key == 1) | |
| 1453 { | |
| 1454 mask |= HYPER_P; | |
| 1455 modifiers |= hyper_modifier; | |
| 1456 } | |
| 1457 else if (dos_super_key == 1) | |
| 1458 { | |
| 1459 mask |= SUPER_P; | |
| 1460 modifiers |= super_modifier; | |
| 1461 } | |
|
16763
e4f0f7fe8304
(dos_set_keyboard): Test whether KEYB.COM is installed
Richard M. Stallman <rms@gnu.org>
parents:
16613
diff
changeset
|
1462 else if (!international_keyboard) |
|
e4f0f7fe8304
(dos_set_keyboard): Test whether KEYB.COM is installed
Richard M. Stallman <rms@gnu.org>
parents:
16613
diff
changeset
|
1463 { |
|
e4f0f7fe8304
(dos_set_keyboard): Test whether KEYB.COM is installed
Richard M. Stallman <rms@gnu.org>
parents:
16613
diff
changeset
|
1464 /* If Keyb.Com is NOT installed, let Right Alt behave |
|
e4f0f7fe8304
(dos_set_keyboard): Test whether KEYB.COM is installed
Richard M. Stallman <rms@gnu.org>
parents:
16613
diff
changeset
|
1465 like the Left Alt. */ |
|
e4f0f7fe8304
(dos_set_keyboard): Test whether KEYB.COM is installed
Richard M. Stallman <rms@gnu.org>
parents:
16613
diff
changeset
|
1466 mask &= ~ALT_GR_P; |
|
e4f0f7fe8304
(dos_set_keyboard): Test whether KEYB.COM is installed
Richard M. Stallman <rms@gnu.org>
parents:
16613
diff
changeset
|
1467 mask |= ALT_P; |
|
e4f0f7fe8304
(dos_set_keyboard): Test whether KEYB.COM is installed
Richard M. Stallman <rms@gnu.org>
parents:
16613
diff
changeset
|
1468 } |
| 13179 | 1469 } |
| 1470 | |
|
15125
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
1471 if (regs.h.ah & 1) /* Left CTRL pressed ? */ |
| 13179 | 1472 mask |= CTRL_P; |
| 1473 | |
| 1474 if (regs.h.ah & 4) /* Right CTRL pressed ? */ | |
| 1475 { | |
| 1476 if (dos_hyper_key == 2) | |
| 1477 { | |
| 1478 mask |= HYPER_P; | |
| 1479 modifiers |= hyper_modifier; | |
| 1480 } | |
| 1481 else if (dos_super_key == 2) | |
| 1482 { | |
| 1483 mask |= SUPER_P; | |
| 1484 modifiers |= super_modifier; | |
| 1485 } | |
| 1486 else | |
| 1487 mask |= CTRL_P; | |
| 1488 } | |
| 1489 } | |
| 1490 | |
| 1491 if (mask & SHIFT_P) | |
| 1492 modifiers |= shift_modifier; | |
| 1493 if (mask & CTRL_P) | |
| 1494 modifiers |= ctrl_modifier; | |
| 1495 if (mask & ALT_P) | |
| 1496 modifiers |= meta_modifier; | |
| 1497 | |
| 1498 if (keymask) | |
| 1499 *keymask = mask; | |
| 1500 return modifiers; | |
| 5503 | 1501 } |
| 1502 | |
|
13305
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1503 #define NUM_RECENT_DOSKEYS (100) |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1504 int recent_doskeys_index; /* Index for storing next element into recent_doskeys */ |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1505 int total_doskeys; /* Total number of elements stored into recent_doskeys */ |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1506 Lisp_Object recent_doskeys; /* A vector, holding the last 100 keystrokes */ |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1507 |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1508 DEFUN ("recent-doskeys", Frecent_doskeys, Srecent_doskeys, 0, 0, 0, |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1509 "Return vector of last 100 keyboard input values seen in dos_rawgetc.\n\ |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1510 Each input key receives two values in this vector: first the ASCII code,\n\ |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1511 and then the scan code.") |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1512 () |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1513 { |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1514 Lisp_Object *keys = XVECTOR (recent_doskeys)->contents; |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1515 Lisp_Object val; |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1516 |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1517 if (total_doskeys < NUM_RECENT_DOSKEYS) |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1518 return Fvector (total_doskeys, keys); |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1519 else |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1520 { |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1521 val = Fvector (NUM_RECENT_DOSKEYS, keys); |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1522 bcopy (keys + recent_doskeys_index, |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1523 XVECTOR (val)->contents, |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1524 (NUM_RECENT_DOSKEYS - recent_doskeys_index) * sizeof (Lisp_Object)); |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1525 bcopy (keys, |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1526 XVECTOR (val)->contents + NUM_RECENT_DOSKEYS - recent_doskeys_index, |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1527 recent_doskeys_index * sizeof (Lisp_Object)); |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1528 return val; |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1529 } |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1530 } |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1531 |
| 13179 | 1532 /* Get a char from keyboard. Function keys are put into the event queue. */ |
|
14413
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
1533 |
| 13179 | 1534 static int |
| 1535 dos_rawgetc () | |
| 5503 | 1536 { |
| 13179 | 1537 struct input_event event; |
| 1538 union REGS regs; | |
| 1539 | |
| 1540 #ifndef HAVE_X_WINDOWS | |
|
16598
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
1541 /* Maybe put the cursor where it should be. */ |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
1542 IT_cmgoto (selected_frame); |
| 13179 | 1543 #endif |
|
16598
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
1544 |
| 13179 | 1545 /* The following condition is equivalent to `kbhit ()', except that |
| 1546 it uses the bios to do its job. This pleases DESQview/X. */ | |
| 1547 while ((regs.h.ah = extended_kbd ? 0x11 : 0x01), | |
| 1548 int86 (0x16, ®s, ®s), | |
| 1549 (regs.x.flags & 0x40) == 0) | |
| 5503 | 1550 { |
| 13179 | 1551 union REGS regs; |
| 1552 register unsigned char c; | |
| 1553 int sc, code, mask, kp_mode; | |
| 1554 int modifiers; | |
| 1555 | |
| 1556 regs.h.ah = extended_kbd ? 0x10 : 0x00; | |
| 1557 int86 (0x16, ®s, ®s); | |
| 1558 c = regs.h.al; | |
| 1559 sc = regs.h.ah; | |
| 5503 | 1560 |
|
13305
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1561 total_doskeys += 2; |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1562 XVECTOR (recent_doskeys)->contents[recent_doskeys_index++] |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1563 = make_number (c); |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1564 if (recent_doskeys_index == NUM_RECENT_DOSKEYS) |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1565 recent_doskeys_index = 0; |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1566 XVECTOR (recent_doskeys)->contents[recent_doskeys_index++] |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1567 = make_number (sc); |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1568 if (recent_doskeys_index == NUM_RECENT_DOSKEYS) |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1569 recent_doskeys_index = 0; |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1570 |
| 13274 | 1571 modifiers = dos_get_modifiers (&mask); |
| 13179 | 1572 |
| 1573 #ifndef HAVE_X_WINDOWS | |
| 13274 | 1574 if (!NILP (Vdos_display_scancodes)) |
| 13179 | 1575 { |
|
14157
38606398dfa6
(dos_rawgetc): Make buf longer.
Richard M. Stallman <rms@gnu.org>
parents:
14036
diff
changeset
|
1576 char buf[11]; |
| 13179 | 1577 sprintf (buf, "%02x:%02x*%04x", |
| 1578 (unsigned) (sc&0xff), (unsigned) c, mask); | |
| 1579 dos_direct_output (screen_size_Y - 2, screen_size_X - 12, buf, 10); | |
| 1580 } | |
| 1581 #endif | |
| 5503 | 1582 |
| 13179 | 1583 if (sc == 0xe0) |
| 1584 { | |
| 1585 switch (c) | |
| 1586 { | |
| 1587 case 10: /* Ctrl Grey Enter */ | |
| 1588 code = Ctrl | Grey | 4; | |
| 1589 break; | |
| 1590 case 13: /* Grey Enter */ | |
| 1591 code = Grey | 4; | |
| 1592 break; | |
| 1593 case '/': /* Grey / */ | |
| 1594 code = Grey | 0; | |
| 1595 break; | |
| 1596 default: | |
| 1597 continue; | |
| 1598 }; | |
| 1599 c = 0; | |
| 1600 } | |
| 1601 else | |
| 1602 { | |
| 1603 if (sc >= (sizeof (ibmpc_translate_map) / sizeof (short))) | |
| 1604 continue; | |
| 1605 if ((code = ibmpc_translate_map[sc]) == Ignore) | |
| 1606 continue; | |
| 1607 } | |
| 1608 | |
| 1609 if (c == 0) | |
| 1610 { | |
| 1611 if (code & Alt) | |
| 1612 modifiers |= meta_modifier; | |
| 1613 if (code & Ctrl) | |
| 1614 modifiers |= ctrl_modifier; | |
| 1615 if (code & Shift) | |
| 1616 modifiers |= shift_modifier; | |
| 1617 } | |
| 1618 | |
| 1619 switch (code & 0xf000) | |
| 1620 { | |
| 1621 case ModFct: | |
| 1622 if (c && !(mask & (SHIFT_P | ALT_P | CTRL_P | HYPER_P | SUPER_P))) | |
| 1623 return c; | |
| 1624 c = 0; /* Special */ | |
| 1625 | |
| 1626 case FctKey: | |
| 1627 if (c != 0) | |
| 1628 return c; | |
| 1629 | |
| 1630 case Special: | |
| 1631 code |= 0xff00; | |
| 1632 break; | |
| 1633 | |
| 1634 case Normal: | |
| 1635 if (sc == 0) | |
| 1636 { | |
| 1637 if (c == 0) /* ctrl-break */ | |
| 1638 continue; | |
| 1639 return c; /* ALT-nnn */ | |
| 1640 } | |
| 1641 if (!keyboard_map_all) | |
| 1642 { | |
| 1643 if (c != ' ') | |
| 1644 return c; | |
| 1645 code = c; | |
| 1646 break; | |
| 1647 } | |
| 1648 | |
| 1649 case Map: | |
| 1650 if (c && !(mask & ALT_P) && !((mask & SHIFT_P) && (mask & CTRL_P))) | |
| 1651 if (!keyboard_map_all) | |
| 1652 return c; | |
| 5503 | 1653 |
| 13179 | 1654 code &= 0xff; |
| 1655 if (mask & ALT_P && code <= 10 && code > 0 && dos_keypad_mode & 0x200) | |
| 1656 mask |= SHIFT_P; /* ALT-1 => M-! etc. */ | |
| 1657 | |
| 1658 if (mask & SHIFT_P) | |
| 1659 { | |
| 13274 | 1660 code = keyboard->shifted[code]; |
| 13179 | 1661 mask -= SHIFT_P; |
| 1662 modifiers &= ~shift_modifier; | |
| 1663 } | |
| 1664 else | |
| 13274 | 1665 if ((mask & ALT_GR_P) && keyboard->alt_gr && keyboard->alt_gr[code] != ' ') |
| 1666 code = keyboard->alt_gr[code]; | |
| 13179 | 1667 else |
| 13274 | 1668 code = keyboard->unshifted[code]; |
| 13179 | 1669 break; |
| 1670 | |
| 1671 case KeyPad: | |
| 1672 code &= 0xff; | |
| 1673 if (c == 0xe0) /* edit key */ | |
| 1674 kp_mode = 3; | |
| 1675 else | |
| 1676 if ((mask & (NUMLOCK_P|CTRL_P|SHIFT_P|ALT_P)) == NUMLOCK_P) /* numlock on */ | |
| 1677 kp_mode = dos_keypad_mode & 0x03; | |
| 1678 else | |
| 1679 kp_mode = (dos_keypad_mode >> 4) & 0x03; | |
| 1680 | |
| 1681 switch (kp_mode) | |
| 1682 { | |
| 1683 case 0: | |
| 1684 if (code == 10 && dos_decimal_point) | |
| 1685 return dos_decimal_point; | |
| 13274 | 1686 return keypad_translate_map[code].char_code; |
| 5503 | 1687 |
| 13179 | 1688 case 1: |
| 13274 | 1689 code = 0xff00 | keypad_translate_map[code].keypad_code; |
| 13179 | 1690 break; |
| 5503 | 1691 |
| 13179 | 1692 case 2: |
| 13274 | 1693 code = keypad_translate_map[code].meta_code; |
| 13179 | 1694 modifiers = meta_modifier; |
| 1695 break; | |
| 1696 | |
| 1697 case 3: | |
| 13274 | 1698 code = 0xff00 | keypad_translate_map[code].editkey_code; |
| 13179 | 1699 break; |
| 1700 } | |
| 1701 break; | |
| 1702 | |
| 1703 case Grey: | |
| 1704 code &= 0xff; | |
| 1705 kp_mode = ((mask & (NUMLOCK_P|CTRL_P|SHIFT_P|ALT_P)) == NUMLOCK_P) ? 0x04 : 0x40; | |
| 1706 if (dos_keypad_mode & kp_mode) | |
| 13274 | 1707 code = 0xff00 | grey_key_translate_map[code].keypad_code; |
| 13179 | 1708 else |
| 13274 | 1709 code = grey_key_translate_map[code].char_code; |
| 13179 | 1710 break; |
| 1711 } | |
| 1712 | |
| 1713 make_event: | |
| 1714 if (code == 0) | |
| 1715 continue; | |
| 1716 | |
| 1717 if (code >= 0x100) | |
| 1718 event.kind = non_ascii_keystroke; | |
| 1719 else | |
| 1720 event.kind = ascii_keystroke; | |
| 1721 event.code = code; | |
| 1722 event.modifiers = modifiers; | |
| 1723 XSETFRAME (event.frame_or_window, selected_frame); | |
| 1724 event.timestamp = event_timestamp (); | |
| 1725 kbd_buffer_store_event (&event); | |
| 1726 } | |
| 5503 | 1727 |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
1728 if (have_mouse > 0) |
|
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
1729 { |
| 13179 | 1730 int but, press, x, y, ok; |
| 5503 | 1731 |
| 13179 | 1732 /* Check for mouse movement *before* buttons. */ |
| 1733 mouse_check_moved (); | |
| 5503 | 1734 |
| 13179 | 1735 for (but = 0; but < NUM_MOUSE_BUTTONS; but++) |
| 1736 for (press = 0; press < 2; press++) | |
| 1737 { | |
|
14413
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
1738 int button_num = but; |
|
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
1739 |
| 13179 | 1740 if (press) |
| 1741 ok = mouse_pressed (but, &x, &y); | |
| 1742 else | |
| 1743 ok = mouse_released (but, &x, &y); | |
| 1744 if (ok) | |
| 1745 { | |
|
14413
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
1746 /* Allow a simultaneous press/release of Mouse-1 and |
|
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
1747 Mouse-2 to simulate Mouse-3 on two-button mice. */ |
|
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
1748 if (mouse_button_count == 2 && but < 2) |
|
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
1749 { |
|
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
1750 int x2, y2; /* don't clobber original coordinates */ |
|
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
1751 |
|
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
1752 /* If only one button is pressed, wait 100 msec and |
|
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
1753 check again. This way, Speedy Gonzales isn't |
|
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
1754 punished, while the slow get their chance. */ |
|
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
1755 if (press && mouse_pressed (1-but, &x2, &y2) |
|
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
1756 || !press && mouse_released (1-but, &x2, &y2)) |
|
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
1757 button_num = 2; |
|
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
1758 else |
|
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
1759 { |
|
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
1760 delay (100); |
|
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
1761 if (press && mouse_pressed (1-but, &x2, &y2) |
|
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
1762 || !press && mouse_released (1-but, &x2, &y2)) |
|
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
1763 button_num = 2; |
|
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
1764 } |
|
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
1765 } |
|
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
1766 |
| 13179 | 1767 event.kind = mouse_click; |
|
14413
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
1768 event.code = button_num; |
| 13179 | 1769 event.modifiers = dos_get_modifiers (0) |
| 1770 | (press ? down_modifier : up_modifier); | |
| 1771 event.x = x; | |
| 1772 event.y = y; | |
| 1773 XSETFRAME (event.frame_or_window, selected_frame); | |
| 1774 event.timestamp = event_timestamp (); | |
| 1775 kbd_buffer_store_event (&event); | |
| 1776 } | |
| 1777 } | |
| 1778 } | |
| 5503 | 1779 |
| 13179 | 1780 return -1; |
| 9572 | 1781 } |
| 1782 | |
| 13179 | 1783 static int prev_get_char = -1; |
| 5503 | 1784 |
| 13179 | 1785 /* Return 1 if a key is ready to be read without suspending execution. */ |
|
14413
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
1786 |
| 13179 | 1787 dos_keysns () |
| 5503 | 1788 { |
| 13179 | 1789 if (prev_get_char != -1) |
| 1790 return 1; | |
| 1791 else | |
| 1792 return ((prev_get_char = dos_rawgetc ()) != -1); | |
| 5503 | 1793 } |
| 1794 | |
| 13179 | 1795 /* Read a key. Return -1 if no key is ready. */ |
|
14413
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
1796 |
| 13179 | 1797 dos_keyread () |
| 5503 | 1798 { |
| 13179 | 1799 if (prev_get_char != -1) |
|
8246
d48c2b01fba5
(mouse_init1): Use alternate mouse detection for old mouse drivers.
Richard M. Stallman <rms@gnu.org>
parents:
8194
diff
changeset
|
1800 { |
| 13179 | 1801 int c = prev_get_char; |
| 1802 prev_get_char = -1; | |
| 1803 return c; | |
|
8246
d48c2b01fba5
(mouse_init1): Use alternate mouse detection for old mouse drivers.
Richard M. Stallman <rms@gnu.org>
parents:
8194
diff
changeset
|
1804 } |
| 13179 | 1805 else |
| 1806 return dos_rawgetc (); | |
| 1807 } | |
|
13305
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
1808 |
| 9572 | 1809 #ifndef HAVE_X_WINDOWS |
|
7273
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1810 /* See xterm.c for more info. */ |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1811 void |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1812 pixel_to_glyph_coords (f, pix_x, pix_y, x, y, bounds, noclip) |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1813 FRAME_PTR f; |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1814 register int pix_x, pix_y; |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1815 register int *x, *y; |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1816 void /* XRectangle */ *bounds; |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1817 int noclip; |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1818 { |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1819 if (bounds) abort (); |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1820 |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1821 /* Ignore clipping. */ |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1822 |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1823 *x = pix_x; |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1824 *y = pix_y; |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1825 } |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1826 |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1827 void |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1828 glyph_to_pixel_coords (f, x, y, pix_x, pix_y) |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1829 FRAME_PTR f; |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1830 register int x, y; |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1831 register int *pix_x, *pix_y; |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1832 { |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1833 *pix_x = x; |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1834 *pix_y = y; |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1835 } |
| 9572 | 1836 |
| 1837 /* Simulation of X's menus. Nothing too fancy here -- just make it work | |
| 1838 for now. | |
| 1839 | |
| 1840 Actually, I don't know the meaning of all the parameters of the functions | |
| 1841 here -- I only know how they are called by xmenu.c. I could of course | |
| 1842 grab the nearest Xlib manual (down the hall, second-to-last door on the | |
| 1843 left), but I don't think it's worth the effort. */ | |
| 1844 | |
| 1845 static XMenu * | |
| 1846 IT_menu_create () | |
| 1847 { | |
| 1848 XMenu *menu; | |
| 1849 | |
| 1850 menu = (XMenu *) xmalloc (sizeof (XMenu)); | |
| 1851 menu->allocated = menu->count = menu->panecount = menu->width = 0; | |
| 1852 return menu; | |
| 1853 } | |
| 1854 | |
| 1855 /* Allocate some (more) memory for MENU ensuring that there is room for one | |
| 1856 for item. */ | |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
1857 |
| 9572 | 1858 static void |
| 1859 IT_menu_make_room (XMenu *menu) | |
| 1860 { | |
| 1861 if (menu->allocated == 0) | |
| 1862 { | |
| 1863 int count = menu->allocated = 10; | |
| 1864 menu->text = (char **) xmalloc (count * sizeof (char *)); | |
| 1865 menu->submenu = (XMenu **) xmalloc (count * sizeof (XMenu *)); | |
| 1866 menu->panenumber = (int *) xmalloc (count * sizeof (int)); | |
| 1867 } | |
| 1868 else if (menu->allocated == menu->count) | |
| 1869 { | |
| 1870 int count = menu->allocated = menu->allocated + 10; | |
| 1871 menu->text | |
| 1872 = (char **) xrealloc (menu->text, count * sizeof (char *)); | |
| 1873 menu->submenu | |
| 1874 = (XMenu **) xrealloc (menu->submenu, count * sizeof (XMenu *)); | |
| 1875 menu->panenumber | |
| 1876 = (int *) xrealloc (menu->panenumber, count * sizeof (int)); | |
| 1877 } | |
| 1878 } | |
| 1879 | |
| 1880 /* Search the given menu structure for a given pane number. */ | |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
1881 |
| 9572 | 1882 static XMenu * |
| 1883 IT_menu_search_pane (XMenu *menu, int pane) | |
| 1884 { | |
| 1885 int i; | |
| 1886 XMenu *try; | |
| 1887 | |
| 1888 for (i = 0; i < menu->count; i++) | |
| 1889 if (menu->submenu[i]) | |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
1890 { |
|
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
1891 if (pane == menu->panenumber[i]) |
|
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
1892 return menu->submenu[i]; |
| 13179 | 1893 if ((try = IT_menu_search_pane (menu->submenu[i], pane))) |
| 9572 | 1894 return try; |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
1895 } |
| 9572 | 1896 return (XMenu *) 0; |
| 1897 } | |
| 1898 | |
| 1899 /* Determine how much screen space a given menu needs. */ | |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
1900 |
| 9572 | 1901 static void |
| 1902 IT_menu_calc_size (XMenu *menu, int *width, int *height) | |
| 1903 { | |
| 1904 int i, h2, w2, maxsubwidth, maxheight; | |
| 1905 | |
| 1906 maxsubwidth = 0; | |
| 1907 maxheight = menu->count; | |
| 1908 for (i = 0; i < menu->count; i++) | |
| 1909 { | |
| 1910 if (menu->submenu[i]) | |
| 1911 { | |
| 1912 IT_menu_calc_size (menu->submenu[i], &w2, &h2); | |
| 1913 if (w2 > maxsubwidth) maxsubwidth = w2; | |
| 1914 if (i + h2 > maxheight) maxheight = i + h2; | |
| 1915 } | |
| 1916 } | |
| 1917 *width = menu->width + maxsubwidth; | |
| 1918 *height = maxheight; | |
| 1919 } | |
| 1920 | |
|
14413
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
1921 /* Display MENU at (X,Y) using FACES. */ |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
1922 |
| 9572 | 1923 static void |
| 1924 IT_menu_display (XMenu *menu, int y, int x, int *faces) | |
| 1925 { | |
| 1926 int i, j, face, width; | |
| 1927 GLYPH *text, *p; | |
| 1928 char *q; | |
| 1929 int mx, my; | |
| 1930 int enabled, mousehere; | |
| 1931 int row, col; | |
| 1932 | |
| 1933 width = menu->width; | |
| 1934 text = (GLYPH *) xmalloc ((width + 2) * sizeof (GLYPH)); | |
| 1935 ScreenGetCursor (&row, &col); | |
| 1936 mouse_get_xy (&mx, &my); | |
| 13179 | 1937 IT_update_begin (); |
| 9572 | 1938 for (i = 0; i < menu->count; i++) |
| 1939 { | |
| 13179 | 1940 IT_cursor_to (y + i, x); |
| 9572 | 1941 enabled |
| 1942 = (!menu->submenu[i] && menu->panenumber[i]) || (menu->submenu[i]); | |
| 1943 mousehere = (y + i == my && x <= mx && mx < x + width + 2); | |
| 1944 face = faces[enabled + mousehere * 2]; | |
| 1945 p = text; | |
| 1946 *p++ = FAST_MAKE_GLYPH (' ', face); | |
| 1947 for (j = 0, q = menu->text[i]; *q; j++) | |
|
15627
c5c4d478c78d
(IT_menu_display): Display control characters as ^X.
Karl Heuer <kwzh@gnu.org>
parents:
15618
diff
changeset
|
1948 { |
|
c5c4d478c78d
(IT_menu_display): Display control characters as ^X.
Karl Heuer <kwzh@gnu.org>
parents:
15618
diff
changeset
|
1949 if (*q > 26) |
|
c5c4d478c78d
(IT_menu_display): Display control characters as ^X.
Karl Heuer <kwzh@gnu.org>
parents:
15618
diff
changeset
|
1950 *p++ = FAST_MAKE_GLYPH (*q++, face); |
|
c5c4d478c78d
(IT_menu_display): Display control characters as ^X.
Karl Heuer <kwzh@gnu.org>
parents:
15618
diff
changeset
|
1951 else /* make '^x' */ |
|
c5c4d478c78d
(IT_menu_display): Display control characters as ^X.
Karl Heuer <kwzh@gnu.org>
parents:
15618
diff
changeset
|
1952 { |
|
c5c4d478c78d
(IT_menu_display): Display control characters as ^X.
Karl Heuer <kwzh@gnu.org>
parents:
15618
diff
changeset
|
1953 *p++ = FAST_MAKE_GLYPH ('^', face); |
|
c5c4d478c78d
(IT_menu_display): Display control characters as ^X.
Karl Heuer <kwzh@gnu.org>
parents:
15618
diff
changeset
|
1954 j++; |
|
c5c4d478c78d
(IT_menu_display): Display control characters as ^X.
Karl Heuer <kwzh@gnu.org>
parents:
15618
diff
changeset
|
1955 *p++ = FAST_MAKE_GLYPH (*q++ + 64, face); |
|
c5c4d478c78d
(IT_menu_display): Display control characters as ^X.
Karl Heuer <kwzh@gnu.org>
parents:
15618
diff
changeset
|
1956 } |
|
c5c4d478c78d
(IT_menu_display): Display control characters as ^X.
Karl Heuer <kwzh@gnu.org>
parents:
15618
diff
changeset
|
1957 } |
|
c5c4d478c78d
(IT_menu_display): Display control characters as ^X.
Karl Heuer <kwzh@gnu.org>
parents:
15618
diff
changeset
|
1958 |
| 9572 | 1959 for (; j < width; j++) |
| 1960 *p++ = FAST_MAKE_GLYPH (' ', face); | |
| 1961 *p++ = FAST_MAKE_GLYPH (menu->submenu[i] ? 16 : ' ', face); | |
| 13179 | 1962 IT_write_glyphs (text, width + 2); |
| 9572 | 1963 } |
| 13179 | 1964 IT_update_end (); |
| 1965 IT_cursor_to (row, col); | |
| 9572 | 1966 xfree (text); |
| 1967 } | |
|
13848
5f38596d591e
(have_menus_p): Defined.
Richard M. Stallman <rms@gnu.org>
parents:
13744
diff
changeset
|
1968 |
|
5f38596d591e
(have_menus_p): Defined.
Richard M. Stallman <rms@gnu.org>
parents:
13744
diff
changeset
|
1969 /* --------------------------- X Menu emulation ---------------------- */ |
| 9572 | 1970 |
|
13848
5f38596d591e
(have_menus_p): Defined.
Richard M. Stallman <rms@gnu.org>
parents:
13744
diff
changeset
|
1971 /* Report availability of menus. */ |
|
5f38596d591e
(have_menus_p): Defined.
Richard M. Stallman <rms@gnu.org>
parents:
13744
diff
changeset
|
1972 |
|
5f38596d591e
(have_menus_p): Defined.
Richard M. Stallman <rms@gnu.org>
parents:
13744
diff
changeset
|
1973 int |
|
5f38596d591e
(have_menus_p): Defined.
Richard M. Stallman <rms@gnu.org>
parents:
13744
diff
changeset
|
1974 have_menus_p () |
|
5f38596d591e
(have_menus_p): Defined.
Richard M. Stallman <rms@gnu.org>
parents:
13744
diff
changeset
|
1975 { |
|
5f38596d591e
(have_menus_p): Defined.
Richard M. Stallman <rms@gnu.org>
parents:
13744
diff
changeset
|
1976 return 1; |
|
5f38596d591e
(have_menus_p): Defined.
Richard M. Stallman <rms@gnu.org>
parents:
13744
diff
changeset
|
1977 } |
| 13179 | 1978 |
| 9572 | 1979 /* Create a brand new menu structure. */ |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
1980 |
| 9572 | 1981 XMenu * |
|
10501
19c4a9ef23e5
(XMenuCreate, XMenuAddPane, XMenuAddSelection, XMenuLocate,
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
1982 XMenuCreate (Display *foo1, Window foo2, char *foo3) |
| 9572 | 1983 { |
| 1984 return IT_menu_create (); | |
| 1985 } | |
| 1986 | |
| 1987 /* Create a new pane and place it on the outer-most level. It is not | |
| 1988 clear that it should be placed out there, but I don't know what else | |
| 1989 to do. */ | |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
1990 |
| 9572 | 1991 int |
|
10501
19c4a9ef23e5
(XMenuCreate, XMenuAddPane, XMenuAddSelection, XMenuLocate,
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
1992 XMenuAddPane (Display *foo, XMenu *menu, char *txt, int enable) |
| 9572 | 1993 { |
| 1994 int len; | |
|
15627
c5c4d478c78d
(IT_menu_display): Display control characters as ^X.
Karl Heuer <kwzh@gnu.org>
parents:
15618
diff
changeset
|
1995 char *p; |
| 9572 | 1996 |
| 1997 if (!enable) | |
| 1998 abort (); | |
| 1999 | |
| 2000 IT_menu_make_room (menu); | |
| 2001 menu->submenu[menu->count] = IT_menu_create (); | |
| 2002 menu->text[menu->count] = txt; | |
| 2003 menu->panenumber[menu->count] = ++menu->panecount; | |
| 2004 menu->count++; | |
|
15627
c5c4d478c78d
(IT_menu_display): Display control characters as ^X.
Karl Heuer <kwzh@gnu.org>
parents:
15618
diff
changeset
|
2005 |
|
c5c4d478c78d
(IT_menu_display): Display control characters as ^X.
Karl Heuer <kwzh@gnu.org>
parents:
15618
diff
changeset
|
2006 /* Adjust length for possible control characters (which will |
|
c5c4d478c78d
(IT_menu_display): Display control characters as ^X.
Karl Heuer <kwzh@gnu.org>
parents:
15618
diff
changeset
|
2007 be written as ^x). */ |
|
c5c4d478c78d
(IT_menu_display): Display control characters as ^X.
Karl Heuer <kwzh@gnu.org>
parents:
15618
diff
changeset
|
2008 for (len = strlen (txt), p = txt; *p; p++) |
|
c5c4d478c78d
(IT_menu_display): Display control characters as ^X.
Karl Heuer <kwzh@gnu.org>
parents:
15618
diff
changeset
|
2009 if (*p < 27) |
|
c5c4d478c78d
(IT_menu_display): Display control characters as ^X.
Karl Heuer <kwzh@gnu.org>
parents:
15618
diff
changeset
|
2010 len++; |
|
c5c4d478c78d
(IT_menu_display): Display control characters as ^X.
Karl Heuer <kwzh@gnu.org>
parents:
15618
diff
changeset
|
2011 |
|
c5c4d478c78d
(IT_menu_display): Display control characters as ^X.
Karl Heuer <kwzh@gnu.org>
parents:
15618
diff
changeset
|
2012 if (len > menu->width) |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
2013 menu->width = len; |
|
15627
c5c4d478c78d
(IT_menu_display): Display control characters as ^X.
Karl Heuer <kwzh@gnu.org>
parents:
15618
diff
changeset
|
2014 |
| 9572 | 2015 return menu->panecount; |
| 2016 } | |
| 2017 | |
| 2018 /* Create a new item in a menu pane. */ | |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
2019 |
| 9572 | 2020 int |
|
10501
19c4a9ef23e5
(XMenuCreate, XMenuAddPane, XMenuAddSelection, XMenuLocate,
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2021 XMenuAddSelection (Display *bar, XMenu *menu, int pane, |
|
19c4a9ef23e5
(XMenuCreate, XMenuAddPane, XMenuAddSelection, XMenuLocate,
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2022 int foo, char *txt, int enable) |
| 9572 | 2023 { |
| 2024 int len; | |
|
15627
c5c4d478c78d
(IT_menu_display): Display control characters as ^X.
Karl Heuer <kwzh@gnu.org>
parents:
15618
diff
changeset
|
2025 char *p; |
| 9572 | 2026 |
| 2027 if (pane) | |
| 2028 if (!(menu = IT_menu_search_pane (menu, pane))) | |
| 2029 return XM_FAILURE; | |
| 2030 IT_menu_make_room (menu); | |
| 2031 menu->submenu[menu->count] = (XMenu *) 0; | |
| 2032 menu->text[menu->count] = txt; | |
| 2033 menu->panenumber[menu->count] = enable; | |
| 2034 menu->count++; | |
|
15627
c5c4d478c78d
(IT_menu_display): Display control characters as ^X.
Karl Heuer <kwzh@gnu.org>
parents:
15618
diff
changeset
|
2035 |
|
c5c4d478c78d
(IT_menu_display): Display control characters as ^X.
Karl Heuer <kwzh@gnu.org>
parents:
15618
diff
changeset
|
2036 /* Adjust length for possible control characters (which will |
|
c5c4d478c78d
(IT_menu_display): Display control characters as ^X.
Karl Heuer <kwzh@gnu.org>
parents:
15618
diff
changeset
|
2037 be written as ^x). */ |
|
c5c4d478c78d
(IT_menu_display): Display control characters as ^X.
Karl Heuer <kwzh@gnu.org>
parents:
15618
diff
changeset
|
2038 for (len = strlen (txt), p = txt; *p; p++) |
|
c5c4d478c78d
(IT_menu_display): Display control characters as ^X.
Karl Heuer <kwzh@gnu.org>
parents:
15618
diff
changeset
|
2039 if (*p < 27) |
|
c5c4d478c78d
(IT_menu_display): Display control characters as ^X.
Karl Heuer <kwzh@gnu.org>
parents:
15618
diff
changeset
|
2040 len++; |
|
c5c4d478c78d
(IT_menu_display): Display control characters as ^X.
Karl Heuer <kwzh@gnu.org>
parents:
15618
diff
changeset
|
2041 |
|
c5c4d478c78d
(IT_menu_display): Display control characters as ^X.
Karl Heuer <kwzh@gnu.org>
parents:
15618
diff
changeset
|
2042 if (len > menu->width) |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
2043 menu->width = len; |
|
15627
c5c4d478c78d
(IT_menu_display): Display control characters as ^X.
Karl Heuer <kwzh@gnu.org>
parents:
15618
diff
changeset
|
2044 |
| 9572 | 2045 return XM_SUCCESS; |
| 2046 } | |
| 2047 | |
| 2048 /* Decide where the menu would be placed if requested at (X,Y). */ | |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
2049 |
|
10501
19c4a9ef23e5
(XMenuCreate, XMenuAddPane, XMenuAddSelection, XMenuLocate,
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2050 void |
|
19c4a9ef23e5
(XMenuCreate, XMenuAddPane, XMenuAddSelection, XMenuLocate,
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2051 XMenuLocate (Display *foo0, XMenu *menu, int foo1, int foo2, int x, int y, |
| 9572 | 2052 int *ulx, int *uly, int *width, int *height) |
| 2053 { | |
|
13714
45e71ea63d71
(XMenuActivate): Display the menu pane title.
Karl Heuer <kwzh@gnu.org>
parents:
13657
diff
changeset
|
2054 IT_menu_calc_size (menu, width, height); |
| 9572 | 2055 *ulx = x + 1; |
| 2056 *uly = y; | |
| 2057 *width += 2; | |
| 2058 } | |
| 2059 | |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
2060 struct IT_menu_state |
| 9572 | 2061 { |
| 2062 void *screen_behind; | |
| 2063 XMenu *menu; | |
| 2064 int pane; | |
| 2065 int x, y; | |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
2066 }; |
| 9572 | 2067 |
| 2068 | |
| 2069 /* Display menu, wait for user's response, and return that response. */ | |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
2070 |
| 9572 | 2071 int |
|
10501
19c4a9ef23e5
(XMenuCreate, XMenuAddPane, XMenuAddSelection, XMenuLocate,
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2072 XMenuActivate (Display *foo, XMenu *menu, int *pane, int *selidx, |
| 9572 | 2073 int x0, int y0, unsigned ButtonMask, char **txt) |
| 2074 { | |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
2075 struct IT_menu_state *state; |
| 9572 | 2076 int statecount; |
| 2077 int x, y, i, b; | |
| 2078 int screensize; | |
| 2079 int faces[4], selectface; | |
| 2080 int leave, result, onepane; | |
|
13860
659a54e026bb
(XMenuActivate): Make sure the menu title is always
Richard M. Stallman <rms@gnu.org>
parents:
13848
diff
changeset
|
2081 int title_faces[4]; /* face to display the menu title */ |
|
15387
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
2082 int buffers_num_deleted = 0; |
| 9572 | 2083 |
| 2084 /* Just in case we got here without a mouse present... */ | |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
2085 if (have_mouse <= 0) |
| 9572 | 2086 return XM_IA_SELECT; |
| 2087 | |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
2088 state = alloca (menu->panecount * sizeof (struct IT_menu_state)); |
| 13179 | 2089 screensize = screen_size * 2; |
| 9572 | 2090 faces[0] |
|
15387
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
2091 = compute_glyph_face (selected_frame, |
| 9572 | 2092 face_name_id_number |
|
15387
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
2093 (selected_frame, |
| 9572 | 2094 intern ("msdos-menu-passive-face")), |
| 2095 0); | |
| 2096 faces[1] | |
|
15387
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
2097 = compute_glyph_face (selected_frame, |
| 9572 | 2098 face_name_id_number |
|
15387
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
2099 (selected_frame, |
| 9572 | 2100 intern ("msdos-menu-active-face")), |
| 2101 0); | |
| 2102 selectface | |
|
15387
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
2103 = face_name_id_number (selected_frame, intern ("msdos-menu-select-face")); |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
2104 faces[2] = compute_glyph_face (selected_frame, selectface, faces[0]); |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
2105 faces[3] = compute_glyph_face (selected_frame, selectface, faces[1]); |
| 9572 | 2106 |
|
13860
659a54e026bb
(XMenuActivate): Make sure the menu title is always
Richard M. Stallman <rms@gnu.org>
parents:
13848
diff
changeset
|
2107 /* Make sure the menu title is always displayed with |
|
659a54e026bb
(XMenuActivate): Make sure the menu title is always
Richard M. Stallman <rms@gnu.org>
parents:
13848
diff
changeset
|
2108 `msdos-menu-active-face', no matter where the mouse pointer is. */ |
|
659a54e026bb
(XMenuActivate): Make sure the menu title is always
Richard M. Stallman <rms@gnu.org>
parents:
13848
diff
changeset
|
2109 for (i = 0; i < 4; i++) |
|
659a54e026bb
(XMenuActivate): Make sure the menu title is always
Richard M. Stallman <rms@gnu.org>
parents:
13848
diff
changeset
|
2110 title_faces[i] = faces[3]; |
|
659a54e026bb
(XMenuActivate): Make sure the menu title is always
Richard M. Stallman <rms@gnu.org>
parents:
13848
diff
changeset
|
2111 |
| 9572 | 2112 statecount = 1; |
|
15387
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
2113 |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
2114 /* Don't let the title for the "Buffers" popup menu include a |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
2115 digit (which is ugly). |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
2116 |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
2117 This is a terrible kludge, but I think the "Buffers" case is |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
2118 the only one where the title includes a number, so it doesn't |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
2119 seem to be necessary to make this more general. */ |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
2120 if (strncmp (menu->text[0], "Buffers 1", 9) == 0) |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
2121 { |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
2122 menu->text[0][7] = '\0'; |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
2123 buffers_num_deleted = 1; |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
2124 } |
| 9572 | 2125 state[0].menu = menu; |
| 2126 mouse_off (); | |
| 2127 ScreenRetrieve (state[0].screen_behind = xmalloc (screensize)); | |
|
13714
45e71ea63d71
(XMenuActivate): Display the menu pane title.
Karl Heuer <kwzh@gnu.org>
parents:
13657
diff
changeset
|
2128 |
|
16598
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
2129 /* Turn off the cursor. Otherwise it shows through the menu |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
2130 panes, which is ugly. */ |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
2131 IT_display_cursor (0); |
|
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
2132 |
|
13860
659a54e026bb
(XMenuActivate): Make sure the menu title is always
Richard M. Stallman <rms@gnu.org>
parents:
13848
diff
changeset
|
2133 IT_menu_display (menu, y0 - 1, x0 - 1, title_faces); /* display menu title */ |
|
15387
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
2134 if (buffers_num_deleted) |
|
9ac116f47f33
(check_x): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
15341
diff
changeset
|
2135 menu->text[0][7] = ' '; |
| 9572 | 2136 if ((onepane = menu->count == 1 && menu->submenu[0])) |
| 2137 { | |
| 2138 menu->width = menu->submenu[0]->width; | |
| 2139 state[0].menu = menu->submenu[0]; | |
| 2140 } | |
| 2141 else | |
| 2142 { | |
| 2143 state[0].menu = menu; | |
| 2144 } | |
| 2145 state[0].x = x0 - 1; | |
| 2146 state[0].y = y0; | |
| 2147 state[0].pane = onepane; | |
| 2148 | |
| 2149 mouse_last_x = -1; /* A hack that forces display. */ | |
| 2150 leave = 0; | |
| 2151 while (!leave) | |
| 2152 { | |
| 13179 | 2153 if (!mouse_visible) mouse_on (); |
| 9572 | 2154 mouse_check_moved (); |
|
12573
f8193b0f95ed
(mouse_get_pos, mouse_check_moved, XMenuActivate):
Karl Heuer <kwzh@gnu.org>
parents:
11124
diff
changeset
|
2155 if (selected_frame->mouse_moved) |
| 9572 | 2156 { |
|
12573
f8193b0f95ed
(mouse_get_pos, mouse_check_moved, XMenuActivate):
Karl Heuer <kwzh@gnu.org>
parents:
11124
diff
changeset
|
2157 selected_frame->mouse_moved = 0; |
| 9572 | 2158 result = XM_IA_SELECT; |
| 2159 mouse_get_xy (&x, &y); | |
| 2160 for (i = 0; i < statecount; i++) | |
| 2161 if (state[i].x <= x && x < state[i].x + state[i].menu->width + 2) | |
| 2162 { | |
| 2163 int dy = y - state[i].y; | |
| 2164 if (0 <= dy && dy < state[i].menu->count) | |
| 2165 { | |
| 2166 if (!state[i].menu->submenu[dy]) | |
| 2167 if (state[i].menu->panenumber[dy]) | |
| 2168 result = XM_SUCCESS; | |
| 2169 else | |
| 2170 result = XM_IA_SELECT; | |
| 2171 *pane = state[i].pane - 1; | |
| 2172 *selidx = dy; | |
| 14036 | 2173 /* We hit some part of a menu, so drop extra menus that |
| 9572 | 2174 have been opened. That does not include an open and |
| 2175 active submenu. */ | |
| 2176 if (i != statecount - 2 | |
| 2177 || state[i].menu->submenu[dy] != state[i+1].menu) | |
| 2178 while (i != statecount - 1) | |
| 2179 { | |
| 2180 statecount--; | |
| 2181 mouse_off (); | |
| 2182 ScreenUpdate (state[statecount].screen_behind); | |
| 2183 xfree (state[statecount].screen_behind); | |
| 2184 } | |
| 2185 if (i == statecount - 1 && state[i].menu->submenu[dy]) | |
| 2186 { | |
| 2187 IT_menu_display (state[i].menu, | |
| 2188 state[i].y, | |
| 2189 state[i].x, | |
| 2190 faces); | |
| 2191 state[statecount].menu = state[i].menu->submenu[dy]; | |
| 2192 state[statecount].pane = state[i].menu->panenumber[dy]; | |
| 2193 mouse_off (); | |
| 2194 ScreenRetrieve (state[statecount].screen_behind | |
| 2195 = xmalloc (screensize)); | |
| 2196 state[statecount].x | |
| 2197 = state[i].x + state[i].menu->width + 2; | |
| 2198 state[statecount].y = y; | |
| 2199 statecount++; | |
| 2200 } | |
| 2201 } | |
| 2202 } | |
| 2203 IT_menu_display (state[statecount - 1].menu, | |
| 2204 state[statecount - 1].y, | |
| 2205 state[statecount - 1].x, | |
| 2206 faces); | |
| 2207 } | |
| 2208 for (b = 0; b < mouse_button_count; b++) | |
| 2209 { | |
| 2210 (void) mouse_pressed (b, &x, &y); | |
| 2211 if (mouse_released (b, &x, &y)) | |
| 2212 leave = 1; | |
| 2213 } | |
| 2214 } | |
| 2215 | |
| 2216 mouse_off (); | |
| 2217 ScreenUpdate (state[0].screen_behind); | |
| 2218 while (statecount--) | |
| 2219 xfree (state[statecount].screen_behind); | |
|
16598
4b0b6719bbd2
[__DJGPP__ >= 2] (dos_direct_output): Faster method of
Karl Heuer <kwzh@gnu.org>
parents:
16524
diff
changeset
|
2220 IT_display_cursor (1); /* turn cursor back on */ |
| 9572 | 2221 return result; |
| 2222 } | |
| 2223 | |
| 2224 /* Dispose of a menu. */ | |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
2225 |
|
10501
19c4a9ef23e5
(XMenuCreate, XMenuAddPane, XMenuAddSelection, XMenuLocate,
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2226 void |
|
19c4a9ef23e5
(XMenuCreate, XMenuAddPane, XMenuAddSelection, XMenuLocate,
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2227 XMenuDestroy (Display *foo, XMenu *menu) |
| 9572 | 2228 { |
| 2229 int i; | |
| 2230 if (menu->allocated) | |
| 2231 { | |
| 2232 for (i = 0; i < menu->count; i++) | |
| 2233 if (menu->submenu[i]) | |
|
10501
19c4a9ef23e5
(XMenuCreate, XMenuAddPane, XMenuAddSelection, XMenuLocate,
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2234 XMenuDestroy (foo, menu->submenu[i]); |
| 9572 | 2235 xfree (menu->text); |
| 2236 xfree (menu->submenu); | |
| 2237 xfree (menu->panenumber); | |
| 2238 } | |
| 2239 xfree (menu); | |
| 2240 } | |
| 2241 | |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
2242 int |
|
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
2243 x_pixel_width (struct frame *f) |
| 9572 | 2244 { |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
2245 return FRAME_WIDTH (f); |
| 9572 | 2246 } |
| 2247 | |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
2248 int |
|
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
2249 x_pixel_height (struct frame *f) |
| 9572 | 2250 { |
|
12995
a3620c5ffad7
(putchar): Call internal_flush instead of _flsbuf.
Richard M. Stallman <rms@gnu.org>
parents:
12614
diff
changeset
|
2251 return FRAME_HEIGHT (f); |
| 9572 | 2252 } |
| 2253 #endif /* !HAVE_X_WINDOWS */ | |
|
13848
5f38596d591e
(have_menus_p): Defined.
Richard M. Stallman <rms@gnu.org>
parents:
13744
diff
changeset
|
2254 |
| 13179 | 2255 /* ----------------------- DOS / UNIX conversion --------------------- */ |
| 2256 | |
|
15618
5da6a61ce827
(dostounix_filename): On caseless filesystems, downcase the filename.
Miles Bader <miles@gnu.org>
parents:
15588
diff
changeset
|
2257 void msdos_downcase_filename (unsigned char *); |
|
5da6a61ce827
(dostounix_filename): On caseless filesystems, downcase the filename.
Miles Bader <miles@gnu.org>
parents:
15588
diff
changeset
|
2258 |
| 13179 | 2259 /* Destructively turn backslashes into slashes. */ |
| 2260 | |
| 2261 void | |
| 2262 dostounix_filename (p) | |
| 2263 register char *p; | |
| 2264 { | |
|
15618
5da6a61ce827
(dostounix_filename): On caseless filesystems, downcase the filename.
Miles Bader <miles@gnu.org>
parents:
15588
diff
changeset
|
2265 msdos_downcase_filename (p); |
|
5da6a61ce827
(dostounix_filename): On caseless filesystems, downcase the filename.
Miles Bader <miles@gnu.org>
parents:
15588
diff
changeset
|
2266 |
| 13179 | 2267 while (*p) |
| 2268 { | |
| 2269 if (*p == '\\') | |
| 2270 *p = '/'; | |
| 2271 p++; | |
| 2272 } | |
| 2273 } | |
| 2274 | |
| 2275 /* Destructively turn slashes into backslashes. */ | |
| 2276 | |
| 2277 void | |
| 2278 unixtodos_filename (p) | |
| 2279 register char *p; | |
| 2280 { | |
|
15618
5da6a61ce827
(dostounix_filename): On caseless filesystems, downcase the filename.
Miles Bader <miles@gnu.org>
parents:
15588
diff
changeset
|
2281 if (p[1] == ':' && *p >= 'A' && *p <= 'Z') |
|
5da6a61ce827
(dostounix_filename): On caseless filesystems, downcase the filename.
Miles Bader <miles@gnu.org>
parents:
15588
diff
changeset
|
2282 { |
|
5da6a61ce827
(dostounix_filename): On caseless filesystems, downcase the filename.
Miles Bader <miles@gnu.org>
parents:
15588
diff
changeset
|
2283 *p += 'a' - 'A'; |
|
5da6a61ce827
(dostounix_filename): On caseless filesystems, downcase the filename.
Miles Bader <miles@gnu.org>
parents:
15588
diff
changeset
|
2284 p += 2; |
|
5da6a61ce827
(dostounix_filename): On caseless filesystems, downcase the filename.
Miles Bader <miles@gnu.org>
parents:
15588
diff
changeset
|
2285 } |
|
5da6a61ce827
(dostounix_filename): On caseless filesystems, downcase the filename.
Miles Bader <miles@gnu.org>
parents:
15588
diff
changeset
|
2286 |
| 13179 | 2287 while (*p) |
| 2288 { | |
| 2289 if (*p == '/') | |
| 2290 *p = '\\'; | |
| 2291 p++; | |
| 2292 } | |
| 2293 } | |
| 2294 | |
| 2295 /* Get the default directory for a given drive. 0=def, 1=A, 2=B, ... */ | |
| 2296 | |
| 2297 int | |
| 2298 getdefdir (drive, dst) | |
| 2299 int drive; | |
| 2300 char *dst; | |
| 2301 { | |
|
15125
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2302 char in_path[4], *p = in_path; |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2303 int e = errno; |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2304 |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2305 /* Generate "X:." (when drive is X) or "." (when drive is 0). */ |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2306 if (drive != 0) |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2307 { |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2308 *p++ = drive + 'A' - 1; |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2309 *p++ = ':'; |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2310 } |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2311 |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2312 *p++ = '.'; |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2313 *p = '\0'; |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2314 errno = 0; |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2315 _fixpath (in_path, dst); |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2316 if (errno) |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2317 return 0; |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2318 |
|
15219
a800d1a0f07e
(msdos_downcase_filename): New function to convert case in filenames.
Richard M. Stallman <rms@gnu.org>
parents:
15186
diff
changeset
|
2319 msdos_downcase_filename (dst); |
|
15125
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2320 |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2321 errno = e; |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2322 return 1; |
| 13179 | 2323 } |
| 2324 | |
| 2325 /* Remove all CR's that are followed by a LF. */ | |
| 2326 | |
| 2327 int | |
| 2328 crlf_to_lf (n, buf) | |
| 2329 register int n; | |
| 2330 register unsigned char *buf; | |
| 2331 { | |
| 2332 unsigned char *np = buf; | |
| 2333 unsigned char *startp = buf; | |
| 2334 unsigned char *endp = buf + n; | |
| 2335 unsigned char c; | |
| 2336 | |
| 2337 if (n == 0) | |
| 2338 return n; | |
| 2339 while (buf < endp - 1) | |
| 2340 { | |
| 2341 if (*buf == 0x0d) | |
| 2342 { | |
| 2343 if (*(++buf) != 0x0a) | |
| 2344 *np++ = 0x0d; | |
| 2345 } | |
| 2346 else | |
| 2347 *np++ = *buf++; | |
| 2348 } | |
| 2349 if (buf < endp) | |
| 2350 *np++ = *buf++; | |
| 2351 return np - startp; | |
| 2352 } | |
| 14999 | 2353 |
| 2354 #if defined(__DJGPP__) && __DJGPP__ == 2 && __DJGPP_MINOR__ == 0 | |
| 2355 | |
| 2356 /* In DJGPP v2.0, library `write' can call `malloc', which might | |
| 2357 cause relocation of the buffer whose address we get in ADDR. | |
| 2358 Here is a version of `write' that avoids calling `malloc', | |
| 2359 to serve us until such time as the library is fixed. | |
| 2360 Actually, what we define here is called `__write', because | |
| 2361 `write' is a stub that just jmp's to `__write' (to be | |
| 2362 POSIXLY-correct with respect to the global name-space). */ | |
| 2363 | |
| 2364 #include <io.h> /* for _write */ | |
| 2365 #include <libc/dosio.h> /* for __file_handle_modes[] */ | |
| 2366 | |
| 2367 static char xbuf[64 * 1024]; /* DOS cannot write more in one chunk */ | |
| 2368 | |
| 2369 #define XBUF_END (xbuf + sizeof (xbuf) - 1) | |
| 2370 | |
| 2371 int | |
| 2372 __write (int handle, const void *buffer, size_t count) | |
| 2373 { | |
| 2374 if (count == 0) | |
| 2375 return 0; | |
| 2376 | |
| 2377 if(__file_handle_modes[handle] & O_BINARY) | |
| 2378 return _write (handle, buffer, count); | |
| 2379 else | |
| 2380 { | |
| 2381 char *xbp = xbuf; | |
| 2382 const char *bp = buffer; | |
| 2383 int total_written = 0; | |
| 2384 int nmoved = 0, ncr = 0; | |
| 2385 | |
| 2386 while (count) | |
| 2387 { | |
| 2388 /* The next test makes sure there's space for at least 2 more | |
| 2389 characters in xbuf[], so both CR and LF can be put there. */ | |
| 2390 if (xbp < XBUF_END) | |
| 2391 { | |
| 2392 if (*bp == '\n') | |
| 2393 { | |
| 2394 ncr++; | |
| 2395 *xbp++ = '\r'; | |
| 2396 } | |
| 2397 *xbp++ = *bp++; | |
| 2398 nmoved++; | |
| 2399 count--; | |
| 2400 } | |
| 2401 if (xbp >= XBUF_END || !count) | |
| 2402 { | |
| 2403 size_t to_write = nmoved + ncr; | |
| 2404 int written = _write (handle, xbuf, to_write); | |
| 2405 | |
| 2406 if (written == -1) | |
| 2407 return -1; | |
| 2408 else | |
| 2409 total_written += nmoved; /* CRs aren't counted in ret value */ | |
| 2410 | |
| 2411 /* If some, but not all were written (disk full?), return | |
| 2412 an estimate of the total written bytes not counting CRs. */ | |
| 2413 if (written < to_write) | |
| 2414 return total_written - (to_write - written) * nmoved/to_write; | |
| 2415 | |
| 2416 nmoved = 0; | |
| 2417 ncr = 0; | |
| 2418 xbp = xbuf; | |
| 2419 } | |
| 2420 } | |
| 2421 return total_written; | |
| 2422 } | |
| 2423 } | |
| 2424 | |
|
16524
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2425 /* A low-level file-renaming function which works around Windows 95 bug. |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2426 This is pulled directly out of DJGPP v2.01 library sources, and only |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2427 used when you compile with DJGPP v2.0. */ |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2428 |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2429 #include <io.h> |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2430 |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2431 int _rename(const char *old, const char *new) |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2432 { |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2433 __dpmi_regs r; |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2434 int olen = strlen(old) + 1; |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2435 int i; |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2436 int use_lfn = _USE_LFN; |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2437 char tempfile[FILENAME_MAX]; |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2438 const char *orig = old; |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2439 int lfn_fd = -1; |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2440 |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2441 r.x.dx = __tb_offset; |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2442 r.x.di = __tb_offset + olen; |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2443 r.x.ds = r.x.es = __tb_segment; |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2444 |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2445 if (use_lfn) |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2446 { |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2447 /* Windows 95 bug: for some filenames, when you rename |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2448 file -> file~ (as in Emacs, to leave a backup), the |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2449 short 8+3 alias doesn't change, which effectively |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2450 makes OLD and NEW the same file. We must rename |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2451 through a temporary file to work around this. */ |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2452 |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2453 char *pbase = 0, *p; |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2454 static char try_char[] = "abcdefghijklmnopqrstuvwxyz012345789"; |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2455 int idx = sizeof(try_char) - 1; |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2456 |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2457 /* Generate a temporary name. Can't use `tmpnam', since $TMPDIR |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2458 might point to another drive, which will fail the DOS call. */ |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2459 strcpy(tempfile, old); |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2460 for (p = tempfile; *p; p++) /* ensure temporary is on the same drive */ |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2461 if (*p == '/' || *p == '\\' || *p == ':') |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2462 pbase = p; |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2463 if (pbase) |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2464 pbase++; |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2465 else |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2466 pbase = tempfile; |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2467 strcpy(pbase, "X$$djren$$.$$temp$$"); |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2468 |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2469 do |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2470 { |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2471 if (idx <= 0) |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2472 return -1; |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2473 *pbase = try_char[--idx]; |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2474 } while (_chmod(tempfile, 0) != -1); |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2475 |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2476 r.x.ax = 0x7156; |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2477 _put_path2(tempfile, olen); |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2478 _put_path(old); |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2479 __dpmi_int(0x21, &r); |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2480 if (r.x.flags & 1) |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2481 { |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2482 errno = __doserr_to_errno(r.x.ax); |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2483 return -1; |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2484 } |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2485 |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2486 /* Now create a file with the original name. This will |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2487 ensure that NEW will always have a 8+3 alias |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2488 different from that of OLD. (Seems to be required |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2489 when NameNumericTail in the Registry is set to 0.) */ |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2490 lfn_fd = _creat(old, 0); |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2491 |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2492 olen = strlen(tempfile) + 1; |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2493 old = tempfile; |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2494 r.x.di = __tb_offset + olen; |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2495 } |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2496 |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2497 for (i=0; i<2; i++) |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2498 { |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2499 if(use_lfn) |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2500 r.x.ax = 0x7156; |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2501 else |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2502 r.h.ah = 0x56; |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2503 _put_path2(new, olen); |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2504 _put_path(old); |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2505 __dpmi_int(0x21, &r); |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2506 if(r.x.flags & 1) |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2507 { |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2508 if (r.x.ax == 5 && i == 0) /* access denied */ |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2509 remove(new); /* and try again */ |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2510 else |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2511 { |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2512 errno = __doserr_to_errno(r.x.ax); |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2513 |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2514 /* Restore to original name if we renamed it to temporary. */ |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2515 if (use_lfn) |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2516 { |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2517 if (lfn_fd != -1) |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2518 { |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2519 _close (lfn_fd); |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2520 remove (orig); |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2521 } |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2522 _put_path2(orig, olen); |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2523 _put_path(tempfile); |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2524 r.x.ax = 0x7156; |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2525 __dpmi_int(0x21, &r); |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2526 } |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2527 return -1; |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2528 } |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2529 } |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2530 else |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2531 break; |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2532 } |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2533 |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2534 /* Success. Delete the file possibly created to work |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2535 around the Windows 95 bug. */ |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2536 if (lfn_fd != -1) |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2537 return (_close (lfn_fd) == 0) ? remove (orig) : -1; |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2538 return 0; |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2539 } |
|
84440bd95727
[__DJGPP_MINOR__ == 0] (_rename): New function, a
Richard M. Stallman <rms@gnu.org>
parents:
16310
diff
changeset
|
2540 |
| 14999 | 2541 #endif /* __DJGPP__ == 2 && __DJGPP_MINOR__ == 0 */ |
| 2542 | |
|
15174
08937f70419e
(Fmsdos_long_file_names): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15125
diff
changeset
|
2543 DEFUN ("msdos-long-file-names", Fmsdos_long_file_names, Smsdos_long_file_names, |
|
08937f70419e
(Fmsdos_long_file_names): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15125
diff
changeset
|
2544 0, 0, 0, |
|
08937f70419e
(Fmsdos_long_file_names): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15125
diff
changeset
|
2545 "Return non-nil if long file names are supported on MSDOS.") |
|
08937f70419e
(Fmsdos_long_file_names): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15125
diff
changeset
|
2546 () |
|
08937f70419e
(Fmsdos_long_file_names): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15125
diff
changeset
|
2547 { |
|
08937f70419e
(Fmsdos_long_file_names): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15125
diff
changeset
|
2548 return (_USE_LFN ? Qt : Qnil); |
|
08937f70419e
(Fmsdos_long_file_names): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15125
diff
changeset
|
2549 } |
|
15219
a800d1a0f07e
(msdos_downcase_filename): New function to convert case in filenames.
Richard M. Stallman <rms@gnu.org>
parents:
15186
diff
changeset
|
2550 |
|
a800d1a0f07e
(msdos_downcase_filename): New function to convert case in filenames.
Richard M. Stallman <rms@gnu.org>
parents:
15186
diff
changeset
|
2551 /* Convert alphabetic characters in a filename to lower-case. */ |
|
a800d1a0f07e
(msdos_downcase_filename): New function to convert case in filenames.
Richard M. Stallman <rms@gnu.org>
parents:
15186
diff
changeset
|
2552 |
|
a800d1a0f07e
(msdos_downcase_filename): New function to convert case in filenames.
Richard M. Stallman <rms@gnu.org>
parents:
15186
diff
changeset
|
2553 void |
|
a800d1a0f07e
(msdos_downcase_filename): New function to convert case in filenames.
Richard M. Stallman <rms@gnu.org>
parents:
15186
diff
changeset
|
2554 msdos_downcase_filename (p) |
|
a800d1a0f07e
(msdos_downcase_filename): New function to convert case in filenames.
Richard M. Stallman <rms@gnu.org>
parents:
15186
diff
changeset
|
2555 register unsigned char *p; |
|
a800d1a0f07e
(msdos_downcase_filename): New function to convert case in filenames.
Richard M. Stallman <rms@gnu.org>
parents:
15186
diff
changeset
|
2556 { |
| 15588 | 2557 /* Always lower-case drive letters a-z, even if the filesystem |
| 2558 preserves case in filenames. | |
| 2559 This is so MSDOS filenames could be compared by string comparison | |
| 2560 functions that are case-sensitive. Even case-preserving filesystems | |
| 2561 do not distinguish case in drive letters. */ | |
| 2562 if (p[1] == ':' && *p >= 'A' && *p <= 'Z') | |
| 2563 { | |
| 2564 *p += 'a' - 'A'; | |
| 2565 p += 2; | |
| 2566 } | |
| 2567 | |
|
15219
a800d1a0f07e
(msdos_downcase_filename): New function to convert case in filenames.
Richard M. Stallman <rms@gnu.org>
parents:
15186
diff
changeset
|
2568 /* Under LFN we expect to get pathnames in their true case. */ |
|
a800d1a0f07e
(msdos_downcase_filename): New function to convert case in filenames.
Richard M. Stallman <rms@gnu.org>
parents:
15186
diff
changeset
|
2569 if (NILP (Fmsdos_long_file_names ())) |
|
a800d1a0f07e
(msdos_downcase_filename): New function to convert case in filenames.
Richard M. Stallman <rms@gnu.org>
parents:
15186
diff
changeset
|
2570 for ( ; *p; p++) |
|
a800d1a0f07e
(msdos_downcase_filename): New function to convert case in filenames.
Richard M. Stallman <rms@gnu.org>
parents:
15186
diff
changeset
|
2571 if (*p >= 'A' && *p <= 'Z') |
|
a800d1a0f07e
(msdos_downcase_filename): New function to convert case in filenames.
Richard M. Stallman <rms@gnu.org>
parents:
15186
diff
changeset
|
2572 *p += 'a' - 'A'; |
|
a800d1a0f07e
(msdos_downcase_filename): New function to convert case in filenames.
Richard M. Stallman <rms@gnu.org>
parents:
15186
diff
changeset
|
2573 } |
|
a800d1a0f07e
(msdos_downcase_filename): New function to convert case in filenames.
Richard M. Stallman <rms@gnu.org>
parents:
15186
diff
changeset
|
2574 |
|
a800d1a0f07e
(msdos_downcase_filename): New function to convert case in filenames.
Richard M. Stallman <rms@gnu.org>
parents:
15186
diff
changeset
|
2575 DEFUN ("msdos-downcase-filename", Fmsdos_downcase_filename, Smsdos_downcase_filename, |
|
a800d1a0f07e
(msdos_downcase_filename): New function to convert case in filenames.
Richard M. Stallman <rms@gnu.org>
parents:
15186
diff
changeset
|
2576 1, 1, 0, |
|
a800d1a0f07e
(msdos_downcase_filename): New function to convert case in filenames.
Richard M. Stallman <rms@gnu.org>
parents:
15186
diff
changeset
|
2577 "Convert alphabetic characters in FILENAME to lower case and return that.\n\ |
|
15222
cc264dd966cd
(Fmsdos_downcase_filename): Don't change the argument, return a copy.
Richard M. Stallman <rms@gnu.org>
parents:
15219
diff
changeset
|
2578 When long filenames are supported, doesn't change FILENAME.\n\ |
|
cc264dd966cd
(Fmsdos_downcase_filename): Don't change the argument, return a copy.
Richard M. Stallman <rms@gnu.org>
parents:
15219
diff
changeset
|
2579 If FILENAME is not a string, returns nil.\n\ |
|
cc264dd966cd
(Fmsdos_downcase_filename): Don't change the argument, return a copy.
Richard M. Stallman <rms@gnu.org>
parents:
15219
diff
changeset
|
2580 The argument object is never altered--the value is a copy.") |
|
15219
a800d1a0f07e
(msdos_downcase_filename): New function to convert case in filenames.
Richard M. Stallman <rms@gnu.org>
parents:
15186
diff
changeset
|
2581 (filename) |
|
a800d1a0f07e
(msdos_downcase_filename): New function to convert case in filenames.
Richard M. Stallman <rms@gnu.org>
parents:
15186
diff
changeset
|
2582 Lisp_Object filename; |
|
a800d1a0f07e
(msdos_downcase_filename): New function to convert case in filenames.
Richard M. Stallman <rms@gnu.org>
parents:
15186
diff
changeset
|
2583 { |
|
15222
cc264dd966cd
(Fmsdos_downcase_filename): Don't change the argument, return a copy.
Richard M. Stallman <rms@gnu.org>
parents:
15219
diff
changeset
|
2584 char *fname; |
|
cc264dd966cd
(Fmsdos_downcase_filename): Don't change the argument, return a copy.
Richard M. Stallman <rms@gnu.org>
parents:
15219
diff
changeset
|
2585 Lisp_Object tem; |
|
cc264dd966cd
(Fmsdos_downcase_filename): Don't change the argument, return a copy.
Richard M. Stallman <rms@gnu.org>
parents:
15219
diff
changeset
|
2586 |
|
cc264dd966cd
(Fmsdos_downcase_filename): Don't change the argument, return a copy.
Richard M. Stallman <rms@gnu.org>
parents:
15219
diff
changeset
|
2587 if (! STRINGP (filename)) |
|
cc264dd966cd
(Fmsdos_downcase_filename): Don't change the argument, return a copy.
Richard M. Stallman <rms@gnu.org>
parents:
15219
diff
changeset
|
2588 return Qnil; |
|
cc264dd966cd
(Fmsdos_downcase_filename): Don't change the argument, return a copy.
Richard M. Stallman <rms@gnu.org>
parents:
15219
diff
changeset
|
2589 |
|
cc264dd966cd
(Fmsdos_downcase_filename): Don't change the argument, return a copy.
Richard M. Stallman <rms@gnu.org>
parents:
15219
diff
changeset
|
2590 tem = Fcopy_sequence (filename); |
|
cc264dd966cd
(Fmsdos_downcase_filename): Don't change the argument, return a copy.
Richard M. Stallman <rms@gnu.org>
parents:
15219
diff
changeset
|
2591 msdos_downcase_filename (XSTRING (tem)->data); |
|
cc264dd966cd
(Fmsdos_downcase_filename): Don't change the argument, return a copy.
Richard M. Stallman <rms@gnu.org>
parents:
15219
diff
changeset
|
2592 return tem; |
|
15219
a800d1a0f07e
(msdos_downcase_filename): New function to convert case in filenames.
Richard M. Stallman <rms@gnu.org>
parents:
15186
diff
changeset
|
2593 } |
| 13179 | 2594 |
| 2595 /* The Emacs root directory as determined by init_environment. */ | |
| 2596 | |
| 2597 static char emacsroot[MAXPATHLEN]; | |
| 2598 | |
| 2599 char * | |
| 2600 rootrelativepath (rel) | |
| 2601 char *rel; | |
| 2602 { | |
| 2603 static char result[MAXPATHLEN + 10]; | |
| 2604 | |
| 2605 strcpy (result, emacsroot); | |
| 2606 strcat (result, "/"); | |
| 2607 strcat (result, rel); | |
| 2608 return result; | |
| 2609 } | |
| 2610 | |
| 2611 /* Define a lot of environment variables if not already defined. Don't | |
| 2612 remove anything unless you know what you're doing -- lots of code will | |
| 2613 break if one or more of these are missing. */ | |
| 2614 | |
| 2615 void | |
| 2616 init_environment (argc, argv, skip_args) | |
| 2617 int argc; | |
| 2618 char **argv; | |
| 2619 int skip_args; | |
| 2620 { | |
| 2621 char *s, *t, *root; | |
| 2622 int len; | |
| 2623 | |
| 2624 /* Find our root from argv[0]. Assuming argv[0] is, say, | |
| 2625 "c:/emacs/bin/emacs.exe" our root will be "c:/emacs". */ | |
| 2626 root = alloca (MAXPATHLEN + 20); | |
| 2627 _fixpath (argv[0], root); | |
|
15618
5da6a61ce827
(dostounix_filename): On caseless filesystems, downcase the filename.
Miles Bader <miles@gnu.org>
parents:
15588
diff
changeset
|
2628 msdos_downcase_filename (root); |
| 13179 | 2629 len = strlen (root); |
| 2630 while (len > 0 && root[len] != '/' && root[len] != ':') | |
| 2631 len--; | |
| 2632 root[len] = '\0'; | |
| 2633 if (len > 4 && strcmp (root + len - 4, "/bin") == 0) | |
| 2634 root[len - 4] = '\0'; | |
| 2635 else | |
| 2636 strcpy (root, "c:/emacs"); /* Only under debuggers, I think. */ | |
| 2637 len = strlen (root); | |
| 2638 strcpy (emacsroot, root); | |
| 2639 | |
| 2640 /* We default HOME to our root. */ | |
| 2641 setenv ("HOME", root, 0); | |
| 2642 | |
| 2643 /* We default EMACSPATH to root + "/bin". */ | |
| 2644 strcpy (root + len, "/bin"); | |
| 2645 setenv ("EMACSPATH", root, 0); | |
| 2646 | |
| 2647 /* I don't expect anybody to ever use other terminals so the internal | |
| 2648 terminal is the default. */ | |
| 2649 setenv ("TERM", "internal", 0); | |
| 2650 | |
| 2651 #ifdef HAVE_X_WINDOWS | |
| 2652 /* Emacs expects DISPLAY to be set. */ | |
| 2653 setenv ("DISPLAY", "unix:0.0", 0); | |
| 2654 #endif | |
| 2655 | |
| 2656 /* SHELL is a bit tricky -- COMSPEC is the closest we come, but we must | |
| 2657 downcase it and mirror the backslashes. */ | |
| 2658 s = getenv ("COMSPEC"); | |
| 2659 if (!s) s = "c:/command.com"; | |
| 2660 t = alloca (strlen (s) + 1); | |
| 2661 strcpy (t, s); | |
| 2662 dostounix_filename (t); | |
| 2663 setenv ("SHELL", t, 0); | |
| 2664 | |
| 2665 /* PATH is also downcased and backslashes mirrored. */ | |
| 2666 s = getenv ("PATH"); | |
| 2667 if (!s) s = ""; | |
| 2668 t = alloca (strlen (s) + 3); | |
| 2669 /* Current directory is always considered part of MsDos's path but it is | |
| 2670 not normally mentioned. Now it is. */ | |
| 2671 strcat (strcpy (t, ".;"), s); | |
| 2672 dostounix_filename (t); /* Not a single file name, but this should work. */ | |
| 2673 setenv ("PATH", t, 1); | |
| 2674 | |
| 2675 /* In some sense all dos users have root privileges, so... */ | |
| 2676 setenv ("USER", "root", 0); | |
| 2677 setenv ("NAME", getenv ("USER"), 0); | |
| 2678 | |
| 2679 /* Time zone determined from country code. To make this possible, the | |
| 2680 country code may not span more than one time zone. In other words, | |
| 2681 in the USA, you lose. */ | |
| 13274 | 2682 if (!getenv ("TZ")) |
| 13179 | 2683 switch (dos_country_code) |
| 2684 { | |
| 2685 case 31: /* Belgium */ | |
| 2686 case 32: /* The Netherlands */ | |
| 2687 case 33: /* France */ | |
| 2688 case 34: /* Spain */ | |
| 2689 case 36: /* Hungary */ | |
| 2690 case 38: /* Yugoslavia (or what's left of it?) */ | |
| 2691 case 39: /* Italy */ | |
| 2692 case 41: /* Switzerland */ | |
| 2693 case 42: /* Tjekia */ | |
| 2694 case 45: /* Denmark */ | |
| 2695 case 46: /* Sweden */ | |
| 2696 case 47: /* Norway */ | |
| 2697 case 48: /* Poland */ | |
| 2698 case 49: /* Germany */ | |
| 2699 /* Daylight saving from last Sunday in March to last Sunday in | |
| 2700 September, both at 2AM. */ | |
|
13394
c4549fcdd5f3
(the_only_x_display): Type is now struct x_output.
Karl Heuer <kwzh@gnu.org>
parents:
13305
diff
changeset
|
2701 setenv ("TZ", "MET-01METDST-02,M3.5.0/02:00,M9.5.0/02:00", 0); |
| 13179 | 2702 break; |
| 2703 case 44: /* United Kingdom */ | |
| 2704 case 351: /* Portugal */ | |
| 2705 case 354: /* Iceland */ | |
|
13394
c4549fcdd5f3
(the_only_x_display): Type is now struct x_output.
Karl Heuer <kwzh@gnu.org>
parents:
13305
diff
changeset
|
2706 setenv ("TZ", "GMT+00", 0); |
| 13179 | 2707 break; |
| 2708 case 81: /* Japan */ | |
| 2709 case 82: /* Korea */ | |
|
13394
c4549fcdd5f3
(the_only_x_display): Type is now struct x_output.
Karl Heuer <kwzh@gnu.org>
parents:
13305
diff
changeset
|
2710 setenv ("TZ", "JST-09", 0); |
| 13179 | 2711 break; |
| 2712 case 90: /* Turkey */ | |
| 2713 case 358: /* Finland */ | |
|
13394
c4549fcdd5f3
(the_only_x_display): Type is now struct x_output.
Karl Heuer <kwzh@gnu.org>
parents:
13305
diff
changeset
|
2714 setenv ("TZ", "EET-02", 0); |
|
c4549fcdd5f3
(the_only_x_display): Type is now struct x_output.
Karl Heuer <kwzh@gnu.org>
parents:
13305
diff
changeset
|
2715 break; |
| 13179 | 2716 case 972: /* Israel */ |
|
13394
c4549fcdd5f3
(the_only_x_display): Type is now struct x_output.
Karl Heuer <kwzh@gnu.org>
parents:
13305
diff
changeset
|
2717 /* This is an approximation. (For exact rules, use the |
|
c4549fcdd5f3
(the_only_x_display): Type is now struct x_output.
Karl Heuer <kwzh@gnu.org>
parents:
13305
diff
changeset
|
2718 `zoneinfo/israel' file which comes with DJGPP, but you need |
|
c4549fcdd5f3
(the_only_x_display): Type is now struct x_output.
Karl Heuer <kwzh@gnu.org>
parents:
13305
diff
changeset
|
2719 to install it in `/usr/share/zoneinfo/' directory first.) */ |
|
c4549fcdd5f3
(the_only_x_display): Type is now struct x_output.
Karl Heuer <kwzh@gnu.org>
parents:
13305
diff
changeset
|
2720 setenv ("TZ", "IST-02IDT-03,M4.1.6/00:00,M9.5.6/01:00", 0); |
| 13179 | 2721 break; |
| 2722 } | |
|
14974
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
2723 tzset (); |
| 13179 | 2724 } |
| 2725 | |
| 2726 | |
| 2727 | |
| 2728 static int break_stat; /* BREAK check mode status. */ | |
| 2729 static int stdin_stat; /* stdin IOCTL status. */ | |
| 2730 | |
|
14974
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
2731 #if __DJGPP__ < 2 |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
2732 |
| 13179 | 2733 /* These must be global. */ |
| 2734 static _go32_dpmi_seginfo ctrl_break_vector; | |
| 2735 static _go32_dpmi_registers ctrl_break_regs; | |
| 2736 static int ctrlbreakinstalled = 0; | |
| 2737 | |
| 2738 /* Interrupt level detection of Ctrl-Break. Don't do anything fancy here! */ | |
| 2739 | |
| 2740 void | |
| 2741 ctrl_break_func (regs) | |
| 2742 _go32_dpmi_registers *regs; | |
| 2743 { | |
| 2744 Vquit_flag = Qt; | |
| 2745 } | |
| 2746 | |
| 2747 void | |
| 2748 install_ctrl_break_check () | |
| 2749 { | |
| 2750 if (!ctrlbreakinstalled) | |
| 2751 { | |
| 2752 /* Don't press Ctrl-Break if you don't have either DPMI or Emacs | |
| 2753 was compiler with Djgpp 1.11 maintenance level 5 or later! */ | |
| 2754 ctrlbreakinstalled = 1; | |
| 2755 ctrl_break_vector.pm_offset = (int) ctrl_break_func; | |
| 2756 _go32_dpmi_allocate_real_mode_callback_iret (&ctrl_break_vector, | |
| 2757 &ctrl_break_regs); | |
| 2758 _go32_dpmi_set_real_mode_interrupt_vector (0x1b, &ctrl_break_vector); | |
| 2759 } | |
| 2760 } | |
| 2761 | |
|
14974
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
2762 #endif /* __DJGPP__ < 2 */ |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
2763 |
|
14413
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
2764 /* Turn off Dos' Ctrl-C checking and inhibit interpretation of |
|
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
2765 control chars by DOS. Determine the keyboard type. */ |
| 13179 | 2766 |
| 2767 int | |
| 2768 dos_ttraw () | |
| 2769 { | |
| 2770 union REGS inregs, outregs; | |
| 2771 static int first_time = 1; | |
| 2772 | |
| 2773 break_stat = getcbrk (); | |
| 2774 setcbrk (0); | |
|
14974
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
2775 #if __DJGPP__ < 2 |
| 13179 | 2776 install_ctrl_break_check (); |
|
14974
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
2777 #endif |
| 13179 | 2778 |
| 2779 if (first_time) | |
| 2780 { | |
| 2781 inregs.h.ah = 0xc0; | |
| 2782 int86 (0x15, &inregs, &outregs); | |
| 2783 extended_kbd = (!outregs.x.cflag) && (outregs.h.ah == 0); | |
| 2784 | |
| 2785 have_mouse = 0; | |
| 2786 | |
| 2787 if (internal_terminal | |
| 2788 #ifdef HAVE_X_WINDOWS | |
| 2789 && inhibit_window_system | |
| 2790 #endif | |
| 2791 ) | |
| 2792 { | |
| 2793 inregs.x.ax = 0x0021; | |
| 2794 int86 (0x33, &inregs, &outregs); | |
| 2795 have_mouse = (outregs.x.ax & 0xffff) == 0xffff; | |
| 2796 if (!have_mouse) | |
| 2797 { | |
| 2798 /* Reportedly, the above doesn't work for some mouse drivers. There | |
| 2799 is an additional detection method that should work, but might be | |
| 2800 a little slower. Use that as an alternative. */ | |
| 2801 inregs.x.ax = 0x0000; | |
| 2802 int86 (0x33, &inregs, &outregs); | |
| 2803 have_mouse = (outregs.x.ax & 0xffff) == 0xffff; | |
| 2804 } | |
| 2805 | |
| 2806 if (have_mouse) | |
| 2807 { | |
| 2808 have_mouse = 1; /* enable mouse */ | |
| 2809 mouse_visible = 0; | |
| 2810 | |
| 2811 if (outregs.x.bx == 3) | |
| 2812 { | |
| 2813 mouse_button_count = 3; | |
| 2814 mouse_button_translate[0] = 0; /* Left */ | |
| 2815 mouse_button_translate[1] = 2; /* Middle */ | |
| 2816 mouse_button_translate[2] = 1; /* Right */ | |
| 2817 } | |
| 2818 else | |
| 2819 { | |
| 2820 mouse_button_count = 2; | |
| 2821 mouse_button_translate[0] = 0; | |
| 2822 mouse_button_translate[1] = 1; | |
| 2823 } | |
| 2824 mouse_position_hook = &mouse_get_pos; | |
| 2825 mouse_init (); | |
| 2826 } | |
| 2827 } | |
|
14974
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
2828 |
| 13179 | 2829 first_time = 0; |
|
14974
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
2830 |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
2831 #if __DJGPP__ >= 2 |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
2832 |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
2833 stdin_stat = setmode (fileno (stdin), O_BINARY); |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
2834 return (stdin_stat != -1); |
| 13179 | 2835 } |
|
14974
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
2836 else |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
2837 return (setmode (fileno (stdin), O_BINARY) != -1); |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
2838 |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
2839 #else /* __DJGPP__ < 2 */ |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
2840 |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
2841 } |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
2842 |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
2843 /* I think it is wrong to overwrite `stdin_stat' every time |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
2844 but the first one this function is called, but I don't |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
2845 want to change the way it used to work in v1.x.--EZ */ |
| 13179 | 2846 |
| 2847 inregs.x.ax = 0x4400; /* Get IOCTL status. */ | |
| 2848 inregs.x.bx = 0x00; /* 0 = stdin. */ | |
| 2849 intdos (&inregs, &outregs); | |
| 2850 stdin_stat = outregs.h.dl; | |
| 2851 | |
| 2852 inregs.x.dx = stdin_stat | 0x0020; /* raw mode */ | |
| 2853 inregs.x.ax = 0x4401; /* Set IOCTL status */ | |
| 2854 intdos (&inregs, &outregs); | |
| 2855 return !outregs.x.cflag; | |
|
14974
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
2856 |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
2857 #endif /* __DJGPP__ < 2 */ |
| 13179 | 2858 } |
| 2859 | |
| 2860 /* Restore status of standard input and Ctrl-C checking. */ | |
|
14413
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
2861 |
| 13179 | 2862 int |
| 2863 dos_ttcooked () | |
| 2864 { | |
| 2865 union REGS inregs, outregs; | |
| 2866 | |
| 2867 setcbrk (break_stat); | |
| 2868 mouse_off (); | |
| 2869 | |
|
14974
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
2870 #if __DJGPP__ >= 2 |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
2871 |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
2872 return (setmode (fileno (stdin), stdin_stat) != -1); |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
2873 |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
2874 #else /* not __DJGPP__ >= 2 */ |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
2875 |
| 13179 | 2876 inregs.x.ax = 0x4401; /* Set IOCTL status. */ |
| 2877 inregs.x.bx = 0x00; /* 0 = stdin. */ | |
| 2878 inregs.x.dx = stdin_stat; | |
| 2879 intdos (&inregs, &outregs); | |
| 2880 return !outregs.x.cflag; | |
|
14974
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
2881 |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
2882 #endif /* not __DJGPP__ >= 2 */ |
| 13179 | 2883 } |
| 2884 | |
| 2885 | |
| 2886 /* Run command as specified by ARGV in directory DIR. | |
|
13718
e1b33f87545f
(run_msdos_command): Support redirection of stderr.
Karl Heuer <kwzh@gnu.org>
parents:
13717
diff
changeset
|
2887 The command is run with input from TEMPIN, output to |
|
e1b33f87545f
(run_msdos_command): Support redirection of stderr.
Karl Heuer <kwzh@gnu.org>
parents:
13717
diff
changeset
|
2888 file TEMPOUT and stderr to TEMPERR. */ |
|
14413
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
2889 |
| 13179 | 2890 int |
|
13718
e1b33f87545f
(run_msdos_command): Support redirection of stderr.
Karl Heuer <kwzh@gnu.org>
parents:
13717
diff
changeset
|
2891 run_msdos_command (argv, dir, tempin, tempout, temperr) |
| 13179 | 2892 unsigned char **argv; |
| 2893 Lisp_Object dir; | |
|
13718
e1b33f87545f
(run_msdos_command): Support redirection of stderr.
Karl Heuer <kwzh@gnu.org>
parents:
13717
diff
changeset
|
2894 int tempin, tempout, temperr; |
| 13179 | 2895 { |
|
16310
c987c025d448
(run_msdos_command): When testing whether a shell
Richard M. Stallman <rms@gnu.org>
parents:
16210
diff
changeset
|
2896 char *saveargv1, *saveargv2, **envv, *lowcase_argv0, *pa, *pl; |
| 13179 | 2897 char oldwd[MAXPATHLEN + 1]; /* Fixed size is safe on MSDOS. */ |
| 2898 int msshell, result = -1; | |
| 2899 int in, out, inbak, outbak, errbak; | |
| 2900 int x, y; | |
| 2901 Lisp_Object cmd; | |
| 2902 | |
| 2903 /* Get current directory as MSDOS cwd is not per-process. */ | |
| 2904 getwd (oldwd); | |
| 2905 | |
|
16310
c987c025d448
(run_msdos_command): When testing whether a shell
Richard M. Stallman <rms@gnu.org>
parents:
16210
diff
changeset
|
2906 /* If argv[0] is the shell, it might come in any lettercase. |
|
c987c025d448
(run_msdos_command): When testing whether a shell
Richard M. Stallman <rms@gnu.org>
parents:
16210
diff
changeset
|
2907 Since `Fmember' is case-sensitive, we need to downcase |
|
c987c025d448
(run_msdos_command): When testing whether a shell
Richard M. Stallman <rms@gnu.org>
parents:
16210
diff
changeset
|
2908 argv[0], even if we are on case-preserving filesystems. */ |
|
c987c025d448
(run_msdos_command): When testing whether a shell
Richard M. Stallman <rms@gnu.org>
parents:
16210
diff
changeset
|
2909 lowcase_argv0 = alloca (strlen (argv[0]) + 1); |
|
c987c025d448
(run_msdos_command): When testing whether a shell
Richard M. Stallman <rms@gnu.org>
parents:
16210
diff
changeset
|
2910 for (pa = argv[0], pl = lowcase_argv0; *pa; pl++) |
|
c987c025d448
(run_msdos_command): When testing whether a shell
Richard M. Stallman <rms@gnu.org>
parents:
16210
diff
changeset
|
2911 { |
|
c987c025d448
(run_msdos_command): When testing whether a shell
Richard M. Stallman <rms@gnu.org>
parents:
16210
diff
changeset
|
2912 *pl = *pa++; |
|
c987c025d448
(run_msdos_command): When testing whether a shell
Richard M. Stallman <rms@gnu.org>
parents:
16210
diff
changeset
|
2913 if (*pl >= 'A' && *pl <= 'Z') |
|
c987c025d448
(run_msdos_command): When testing whether a shell
Richard M. Stallman <rms@gnu.org>
parents:
16210
diff
changeset
|
2914 *pl += 'a' - 'A'; |
|
c987c025d448
(run_msdos_command): When testing whether a shell
Richard M. Stallman <rms@gnu.org>
parents:
16210
diff
changeset
|
2915 } |
|
c987c025d448
(run_msdos_command): When testing whether a shell
Richard M. Stallman <rms@gnu.org>
parents:
16210
diff
changeset
|
2916 *pl = '\0'; |
|
c987c025d448
(run_msdos_command): When testing whether a shell
Richard M. Stallman <rms@gnu.org>
parents:
16210
diff
changeset
|
2917 |
|
c987c025d448
(run_msdos_command): When testing whether a shell
Richard M. Stallman <rms@gnu.org>
parents:
16210
diff
changeset
|
2918 cmd = Ffile_name_nondirectory (build_string (lowcase_argv0)); |
| 13179 | 2919 msshell = !NILP (Fmember (cmd, Fsymbol_value (intern ("msdos-shells")))) |
| 2920 && !strcmp ("-c", argv[1]); | |
| 2921 if (msshell) | |
| 2922 { | |
| 2923 saveargv1 = argv[1]; | |
| 2924 saveargv2 = argv[2]; | |
| 2925 argv[1] = "/c"; | |
| 2926 if (argv[2]) | |
| 2927 { | |
| 2928 char *p = alloca (strlen (argv[2]) + 1); | |
| 2929 | |
| 2930 strcpy (argv[2] = p, saveargv2); | |
| 2931 while (*p && isspace (*p)) | |
| 2932 p++; | |
| 2933 while (*p && !isspace (*p)) | |
| 2934 if (*p == '/') | |
| 2935 *p++ = '\\'; | |
| 2936 else | |
| 2937 p++; | |
| 2938 } | |
| 2939 } | |
| 2940 | |
| 2941 /* Build the environment array. */ | |
| 2942 { | |
| 2943 extern Lisp_Object Vprocess_environment; | |
| 2944 Lisp_Object tmp, lst; | |
| 2945 int i, len; | |
| 2946 | |
| 2947 lst = Vprocess_environment; | |
| 2948 len = XFASTINT (Flength (lst)); | |
| 2949 | |
| 2950 envv = alloca ((len + 1) * sizeof (char *)); | |
| 2951 for (i = 0; i < len; i++) | |
| 2952 { | |
| 2953 tmp = Fcar (lst); | |
| 2954 lst = Fcdr (lst); | |
| 2955 CHECK_STRING (tmp, 0); | |
| 2956 envv[i] = alloca (XSTRING (tmp)->size + 1); | |
| 2957 strcpy (envv[i], XSTRING (tmp)->data); | |
| 2958 } | |
| 2959 envv[len] = (char *) 0; | |
| 2960 } | |
| 2961 | |
| 2962 if (STRINGP (dir)) | |
| 2963 chdir (XSTRING (dir)->data); | |
| 2964 inbak = dup (0); | |
| 2965 outbak = dup (1); | |
| 2966 errbak = dup (2); | |
| 2967 if (inbak < 0 || outbak < 0 || errbak < 0) | |
| 2968 goto done; /* Allocation might fail due to lack of descriptors. */ | |
| 2969 | |
| 2970 if (have_mouse > 0) | |
| 2971 mouse_get_xy (&x, &y); | |
| 2972 | |
| 2973 dos_ttcooked (); /* do it here while 0 = stdin */ | |
| 2974 | |
| 2975 dup2 (tempin, 0); | |
| 2976 dup2 (tempout, 1); | |
|
13718
e1b33f87545f
(run_msdos_command): Support redirection of stderr.
Karl Heuer <kwzh@gnu.org>
parents:
13717
diff
changeset
|
2977 dup2 (temperr, 2); |
| 13179 | 2978 |
|
15125
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2979 #if __DJGPP__ > 1 |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2980 |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2981 if (msshell && !argv[3]) |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2982 { |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2983 /* MS-DOS native shells are too restrictive. For starters, they |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2984 cannot grok commands longer than 126 characters. In DJGPP v2 |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2985 and later, `system' is much smarter, so we'll call it instead. */ |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2986 |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2987 extern char **environ; |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2988 environ = envv; |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2989 |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2990 /* A shell gets a single argument--its full command |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2991 line--whose original was saved in `saveargv2'. */ |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2992 result = system (saveargv2); |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2993 } |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2994 else |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2995 |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2996 #endif /* __DJGPP__ > 1 */ |
|
4dc406e38d68
(dos_get_modifiers): Restore missing comment terminator.
Richard M. Stallman <rms@gnu.org>
parents:
15096
diff
changeset
|
2997 |
| 13179 | 2998 result = spawnve (P_WAIT, argv[0], argv, envv); |
| 2999 | |
| 3000 dup2 (inbak, 0); | |
| 3001 dup2 (outbak, 1); | |
| 3002 dup2 (errbak, 2); | |
| 3003 close (inbak); | |
| 3004 close (outbak); | |
| 3005 close (errbak); | |
| 3006 | |
| 13274 | 3007 dos_ttraw (); |
| 13179 | 3008 if (have_mouse > 0) |
| 3009 { | |
| 3010 mouse_init (); | |
| 3011 mouse_moveto (x, y); | |
| 3012 } | |
| 3013 | |
| 3014 done: | |
| 3015 chdir (oldwd); | |
| 3016 if (msshell) | |
| 3017 { | |
| 3018 argv[1] = saveargv1; | |
| 3019 argv[2] = saveargv2; | |
| 3020 } | |
| 3021 return result; | |
| 3022 } | |
| 3023 | |
| 3024 croak (badfunc) | |
| 3025 char *badfunc; | |
| 3026 { | |
| 3027 fprintf (stderr, "%s not yet implemented\r\n", badfunc); | |
| 3028 reset_sys_modes (); | |
| 3029 exit (1); | |
| 3030 } | |
|
13848
5f38596d591e
(have_menus_p): Defined.
Richard M. Stallman <rms@gnu.org>
parents:
13744
diff
changeset
|
3031 |
|
14974
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
3032 #if __DJGPP__ < 2 |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
3033 |
| 13179 | 3034 /* ------------------------- Compatibility functions ------------------- |
| 3035 * gethostname | |
| 3036 * gettimeofday | |
| 3037 */ | |
| 3038 | |
|
14413
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
3039 /* Hostnames for a pc are not really funny, |
|
77ed54321a41
(dos_rawgetc): Allow simulation of `Mouse-3' by
Richard M. Stallman <rms@gnu.org>
parents:
14284
diff
changeset
|
3040 but they are used in change log so we emulate the best we can. */ |
| 13179 | 3041 |
| 3042 gethostname (p, size) | |
| 3043 char *p; | |
| 3044 int size; | |
| 3045 { | |
| 3046 char *q = egetenv ("HOSTNAME"); | |
| 3047 | |
| 3048 if (!q) q = "pc"; | |
| 3049 strcpy (p, q); | |
| 3050 return 0; | |
| 3051 } | |
| 3052 | |
|
13394
c4549fcdd5f3
(the_only_x_display): Type is now struct x_output.
Karl Heuer <kwzh@gnu.org>
parents:
13305
diff
changeset
|
3053 /* When time zones are set from Ms-Dos too many C-libraries are playing |
| 13179 | 3054 tricks with time values. We solve this by defining our own version |
| 3055 of `gettimeofday' bypassing GO32. Our version needs to be initialized | |
| 3056 once and after each call to `tzset' with TZ changed. That is | |
| 3057 accomplished by aliasing tzset to init_gettimeofday. */ | |
| 3058 | |
| 3059 static struct tm time_rec; | |
| 3060 | |
| 3061 int | |
| 3062 gettimeofday (struct timeval *tp, struct timezone *tzp) | |
| 3063 { | |
| 3064 if (tp) | |
| 3065 { | |
| 3066 struct time t; | |
| 3067 struct tm tm; | |
| 3068 | |
| 3069 gettime (&t); | |
| 3070 if (t.ti_hour < time_rec.tm_hour) /* midnight wrap */ | |
| 3071 { | |
| 3072 struct date d; | |
| 3073 getdate (&d); | |
| 3074 time_rec.tm_year = d.da_year - 1900; | |
| 3075 time_rec.tm_mon = d.da_mon - 1; | |
| 3076 time_rec.tm_mday = d.da_day; | |
| 3077 } | |
| 3078 | |
| 3079 time_rec.tm_hour = t.ti_hour; | |
| 3080 time_rec.tm_min = t.ti_min; | |
| 3081 time_rec.tm_sec = t.ti_sec; | |
| 3082 | |
| 3083 tm = time_rec; | |
| 3084 tm.tm_gmtoff = dos_timezone_offset; | |
| 3085 | |
| 3086 tp->tv_sec = mktime (&tm); /* may modify tm */ | |
| 3087 tp->tv_usec = t.ti_hund * (1000000 / 100); | |
| 3088 } | |
| 3089 /* Ignore tzp; it's obsolescent. */ | |
| 3090 return 0; | |
| 3091 } | |
| 3092 | |
|
14974
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
3093 #endif /* __DJGPP__ < 2 */ |
| 13179 | 3094 |
| 3095 /* | |
| 3096 * A list of unimplemented functions that we silently ignore. | |
| 3097 */ | |
| 3098 | |
|
14974
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
3099 #if __DJGPP__ < 2 |
| 13179 | 3100 unsigned alarm (s) unsigned s; {} |
| 3101 fork () { return 0; } | |
| 3102 int kill (x, y) int x, y; { return -1; } | |
| 3103 nice (p) int p; {} | |
| 3104 void volatile pause () {} | |
|
14974
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
3105 sigsetmask (x) int x; { return 0; } |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
3106 #endif |
|
b99490300747
[MSDOS]: If DJGPP version 2, include fcntl.h.
Richard M. Stallman <rms@gnu.org>
parents:
14783
diff
changeset
|
3107 |
| 13179 | 3108 request_sigio () {} |
| 3109 setpgrp () {return 0; } | |
| 3110 setpriority (x,y,z) int x,y,z; { return 0; } | |
|
14262
ef10a42c21f4
(sigblock): New (dummy) function.
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
3111 sigblock (mask) int mask; { return 0; } |
| 13179 | 3112 unrequest_sigio () {} |
| 3113 | |
| 3114 #ifndef HAVE_SELECT | |
| 3115 #include "sysselect.h" | |
| 3116 | |
|
14279
085bc709c11d
(sys_select): Use time macros to prevent time values
Karl Heuer <kwzh@gnu.org>
parents:
14262
diff
changeset
|
3117 #ifndef EMACS_TIME_ZERO_OR_NEG_P |
|
085bc709c11d
(sys_select): Use time macros to prevent time values
Karl Heuer <kwzh@gnu.org>
parents:
14262
diff
changeset
|
3118 #define EMACS_TIME_ZERO_OR_NEG_P(time) \ |
|
085bc709c11d
(sys_select): Use time macros to prevent time values
Karl Heuer <kwzh@gnu.org>
parents:
14262
diff
changeset
|
3119 ((long)(time).tv_sec < 0 \ |
|
085bc709c11d
(sys_select): Use time macros to prevent time values
Karl Heuer <kwzh@gnu.org>
parents:
14262
diff
changeset
|
3120 || ((time).tv_sec == 0 \ |
|
085bc709c11d
(sys_select): Use time macros to prevent time values
Karl Heuer <kwzh@gnu.org>
parents:
14262
diff
changeset
|
3121 && (long)(time).tv_usec <= 0)) |
|
085bc709c11d
(sys_select): Use time macros to prevent time values
Karl Heuer <kwzh@gnu.org>
parents:
14262
diff
changeset
|
3122 #endif |
|
085bc709c11d
(sys_select): Use time macros to prevent time values
Karl Heuer <kwzh@gnu.org>
parents:
14262
diff
changeset
|
3123 |
|
085bc709c11d
(sys_select): Use time macros to prevent time values
Karl Heuer <kwzh@gnu.org>
parents:
14262
diff
changeset
|
3124 |
| 13179 | 3125 /* Only event queue is checked. */ |
| 14999 | 3126 /* We don't have to call timer_check here |
| 3127 because wait_reading_process_input takes care of that. */ | |
| 13179 | 3128 int |
| 3129 sys_select (nfds, rfds, wfds, efds, timeout) | |
| 3130 int nfds; | |
| 3131 SELECT_TYPE *rfds, *wfds, *efds; | |
| 3132 EMACS_TIME *timeout; | |
| 3133 { | |
| 3134 int check_input; | |
| 3135 struct time t; | |
| 3136 | |
| 3137 check_input = 0; | |
| 3138 if (rfds) | |
| 3139 { | |
| 3140 check_input = FD_ISSET (0, rfds); | |
| 3141 FD_ZERO (rfds); | |
| 3142 } | |
| 3143 if (wfds) | |
| 3144 FD_ZERO (wfds); | |
| 3145 if (efds) | |
| 3146 FD_ZERO (efds); | |
| 3147 | |
| 3148 if (nfds != 1) | |
| 3149 abort (); | |
| 3150 | |
| 3151 /* If we are looking only for the terminal, with no timeout, | |
| 3152 just read it and wait -- that's more efficient. */ | |
| 3153 if (!timeout) | |
| 3154 { | |
|
15033
9e174c2b4ba6
(check_timer): Removed; use gettime instead.
Richard M. Stallman <rms@gnu.org>
parents:
14999
diff
changeset
|
3155 while (!detect_input_pending ()) |
|
9e174c2b4ba6
(check_timer): Removed; use gettime instead.
Richard M. Stallman <rms@gnu.org>
parents:
14999
diff
changeset
|
3156 { |
|
9e174c2b4ba6
(check_timer): Removed; use gettime instead.
Richard M. Stallman <rms@gnu.org>
parents:
14999
diff
changeset
|
3157 #if __DJGPP__ >= 2 |
|
9e174c2b4ba6
(check_timer): Removed; use gettime instead.
Richard M. Stallman <rms@gnu.org>
parents:
14999
diff
changeset
|
3158 __dpmi_yield (); |
|
9e174c2b4ba6
(check_timer): Removed; use gettime instead.
Richard M. Stallman <rms@gnu.org>
parents:
14999
diff
changeset
|
3159 #endif |
|
9e174c2b4ba6
(check_timer): Removed; use gettime instead.
Richard M. Stallman <rms@gnu.org>
parents:
14999
diff
changeset
|
3160 } |
| 13179 | 3161 } |
| 3162 else | |
| 3163 { | |
|
14279
085bc709c11d
(sys_select): Use time macros to prevent time values
Karl Heuer <kwzh@gnu.org>
parents:
14262
diff
changeset
|
3164 EMACS_TIME clnow, cllast, cldiff; |
|
085bc709c11d
(sys_select): Use time macros to prevent time values
Karl Heuer <kwzh@gnu.org>
parents:
14262
diff
changeset
|
3165 |
|
15033
9e174c2b4ba6
(check_timer): Removed; use gettime instead.
Richard M. Stallman <rms@gnu.org>
parents:
14999
diff
changeset
|
3166 gettime (&t); |
|
14279
085bc709c11d
(sys_select): Use time macros to prevent time values
Karl Heuer <kwzh@gnu.org>
parents:
14262
diff
changeset
|
3167 EMACS_SET_SECS_USECS (cllast, t.ti_sec, t.ti_hund * 10000L); |
| 13179 | 3168 |
| 3169 while (!check_input || !detect_input_pending ()) | |
| 3170 { | |
|
15033
9e174c2b4ba6
(check_timer): Removed; use gettime instead.
Richard M. Stallman <rms@gnu.org>
parents:
14999
diff
changeset
|
3171 gettime (&t); |
|
14279
085bc709c11d
(sys_select): Use time macros to prevent time values
Karl Heuer <kwzh@gnu.org>
parents:
14262
diff
changeset
|
3172 EMACS_SET_SECS_USECS (clnow, t.ti_sec, t.ti_hund * 10000L); |
|
085bc709c11d
(sys_select): Use time macros to prevent time values
Karl Heuer <kwzh@gnu.org>
parents:
14262
diff
changeset
|
3173 EMACS_SUB_TIME (cldiff, clnow, cllast); |
|
085bc709c11d
(sys_select): Use time macros to prevent time values
Karl Heuer <kwzh@gnu.org>
parents:
14262
diff
changeset
|
3174 |
|
085bc709c11d
(sys_select): Use time macros to prevent time values
Karl Heuer <kwzh@gnu.org>
parents:
14262
diff
changeset
|
3175 /* When seconds wrap around, we assume that no more than |
|
15033
9e174c2b4ba6
(check_timer): Removed; use gettime instead.
Richard M. Stallman <rms@gnu.org>
parents:
14999
diff
changeset
|
3176 1 minute passed since last `gettime'. */ |
|
14279
085bc709c11d
(sys_select): Use time macros to prevent time values
Karl Heuer <kwzh@gnu.org>
parents:
14262
diff
changeset
|
3177 if (EMACS_TIME_NEG_P (cldiff)) |
|
085bc709c11d
(sys_select): Use time macros to prevent time values
Karl Heuer <kwzh@gnu.org>
parents:
14262
diff
changeset
|
3178 EMACS_SET_SECS (cldiff, EMACS_SECS (cldiff) + 60); |
|
085bc709c11d
(sys_select): Use time macros to prevent time values
Karl Heuer <kwzh@gnu.org>
parents:
14262
diff
changeset
|
3179 EMACS_SUB_TIME (*timeout, *timeout, cldiff); |
|
085bc709c11d
(sys_select): Use time macros to prevent time values
Karl Heuer <kwzh@gnu.org>
parents:
14262
diff
changeset
|
3180 |
|
085bc709c11d
(sys_select): Use time macros to prevent time values
Karl Heuer <kwzh@gnu.org>
parents:
14262
diff
changeset
|
3181 /* Stop when timeout value crosses zero. */ |
|
085bc709c11d
(sys_select): Use time macros to prevent time values
Karl Heuer <kwzh@gnu.org>
parents:
14262
diff
changeset
|
3182 if (EMACS_TIME_ZERO_OR_NEG_P (*timeout)) |
| 13179 | 3183 return 0; |
| 3184 cllast = clnow; | |
|
15033
9e174c2b4ba6
(check_timer): Removed; use gettime instead.
Richard M. Stallman <rms@gnu.org>
parents:
14999
diff
changeset
|
3185 #if __DJGPP__ >= 2 |
|
9e174c2b4ba6
(check_timer): Removed; use gettime instead.
Richard M. Stallman <rms@gnu.org>
parents:
14999
diff
changeset
|
3186 __dpmi_yield (); |
|
9e174c2b4ba6
(check_timer): Removed; use gettime instead.
Richard M. Stallman <rms@gnu.org>
parents:
14999
diff
changeset
|
3187 #endif |
| 13179 | 3188 } |
| 3189 } | |
| 3190 | |
| 3191 FD_SET (0, rfds); | |
| 3192 return 1; | |
| 3193 } | |
| 3194 #endif | |
| 3195 | |
| 3196 /* | |
| 14036 | 3197 * Define overlaid functions: |
| 13179 | 3198 * |
| 3199 * chdir -> sys_chdir | |
| 3200 * tzset -> init_gettimeofday | |
| 3201 * abort -> dos_abort | |
| 3202 */ | |
| 3203 | |
| 3204 #ifdef chdir | |
| 3205 #undef chdir | |
| 3206 extern int chdir (); | |
| 3207 | |
| 3208 int | |
| 3209 sys_chdir (path) | |
| 3210 const char* path; | |
| 3211 { | |
| 3212 int len = strlen (path); | |
| 3213 char *tmp = (char *)path; | |
| 3214 | |
| 3215 if (*tmp && tmp[1] == ':') | |
| 3216 { | |
| 3217 if (getdisk () != tolower (tmp[0]) - 'a') | |
| 3218 setdisk (tolower (tmp[0]) - 'a'); | |
| 3219 tmp += 2; /* strip drive: KFS 1995-07-06 */ | |
| 3220 len -= 2; | |
| 3221 } | |
| 3222 | |
| 3223 if (len > 1 && (tmp[len - 1] == '/')) | |
| 3224 { | |
| 3225 char *tmp1 = (char *) alloca (len + 1); | |
| 3226 strcpy (tmp1, tmp); | |
| 3227 tmp1[len - 1] = 0; | |
| 3228 tmp = tmp1; | |
| 3229 } | |
| 3230 return chdir (tmp); | |
| 3231 } | |
| 3232 #endif | |
| 3233 | |
| 3234 #ifdef tzset | |
| 3235 #undef tzset | |
| 3236 extern void tzset (void); | |
| 3237 | |
| 3238 void | |
| 3239 init_gettimeofday () | |
| 3240 { | |
| 3241 time_t ltm, gtm; | |
| 3242 struct tm *lstm; | |
| 3243 | |
| 3244 tzset (); | |
| 3245 ltm = gtm = time (NULL); | |
| 3246 ltm = mktime (lstm = localtime (<m)); | |
| 3247 gtm = mktime (gmtime (>m)); | |
| 3248 time_rec.tm_hour = 99; /* force gettimeofday to get date */ | |
| 3249 time_rec.tm_isdst = lstm->tm_isdst; | |
| 3250 dos_timezone_offset = time_rec.tm_gmtoff = (int)(gtm - ltm) / 60; | |
| 3251 } | |
| 3252 #endif | |
| 3253 | |
| 3254 #ifdef abort | |
| 3255 #undef abort | |
| 3256 void | |
| 3257 dos_abort (file, line) | |
| 3258 char *file; | |
| 3259 int line; | |
| 3260 { | |
| 3261 char buffer1[200], buffer2[400]; | |
| 3262 int i, j; | |
| 3263 | |
| 3264 sprintf (buffer1, "<EMACS FATAL ERROR IN %s LINE %d>", file, line); | |
| 3265 for (i = j = 0; buffer1[i]; i++) { | |
| 3266 buffer2[j++] = buffer1[i]; | |
| 3267 buffer2[j++] = 0x70; | |
| 3268 } | |
| 3269 dosmemput (buffer2, j, (int)ScreenPrimary); | |
| 3270 ScreenSetCursor (2, 0); | |
| 3271 abort (); | |
| 3272 } | |
|
13744
120c884de8a2
(check_timer): get rid of the DOS-specific menubar clock
Karl Heuer <kwzh@gnu.org>
parents:
13718
diff
changeset
|
3273 #else |
|
120c884de8a2
(check_timer): get rid of the DOS-specific menubar clock
Karl Heuer <kwzh@gnu.org>
parents:
13718
diff
changeset
|
3274 void |
|
120c884de8a2
(check_timer): get rid of the DOS-specific menubar clock
Karl Heuer <kwzh@gnu.org>
parents:
13718
diff
changeset
|
3275 abort () |
|
120c884de8a2
(check_timer): get rid of the DOS-specific menubar clock
Karl Heuer <kwzh@gnu.org>
parents:
13718
diff
changeset
|
3276 { |
|
120c884de8a2
(check_timer): get rid of the DOS-specific menubar clock
Karl Heuer <kwzh@gnu.org>
parents:
13718
diff
changeset
|
3277 dos_ttcooked (); |
|
120c884de8a2
(check_timer): get rid of the DOS-specific menubar clock
Karl Heuer <kwzh@gnu.org>
parents:
13718
diff
changeset
|
3278 ScreenSetCursor (10, 0); |
|
120c884de8a2
(check_timer): get rid of the DOS-specific menubar clock
Karl Heuer <kwzh@gnu.org>
parents:
13718
diff
changeset
|
3279 cputs ("\r\n\nEmacs aborted!\r\n"); |
| 14999 | 3280 #if __DJGPP__ > 1 |
| 3281 /* Generate traceback, so we could tell whodunit. */ | |
| 3282 signal (SIGINT, SIG_DFL); | |
| 3283 __asm__ __volatile__ ("movb $0x1b,%al;call ___djgpp_hw_exception"); | |
| 3284 #endif | |
|
13744
120c884de8a2
(check_timer): get rid of the DOS-specific menubar clock
Karl Heuer <kwzh@gnu.org>
parents:
13718
diff
changeset
|
3285 exit (2); |
|
120c884de8a2
(check_timer): get rid of the DOS-specific menubar clock
Karl Heuer <kwzh@gnu.org>
parents:
13718
diff
changeset
|
3286 } |
| 13179 | 3287 #endif |
| 3288 | |
|
13305
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
3289 syms_of_msdos () |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
3290 { |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
3291 recent_doskeys = Fmake_vector (make_number (NUM_RECENT_DOSKEYS), Qnil); |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
3292 staticpro (&recent_doskeys); |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
3293 |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
3294 defsubr (&Srecent_doskeys); |
|
15186
242bddc25e5a
(syms_of_msdos): Fix typo.
Richard M. Stallman <rms@gnu.org>
parents:
15174
diff
changeset
|
3295 defsubr (&Smsdos_long_file_names); |
|
15219
a800d1a0f07e
(msdos_downcase_filename): New function to convert case in filenames.
Richard M. Stallman <rms@gnu.org>
parents:
15186
diff
changeset
|
3296 defsubr (&Smsdos_downcase_filename); |
|
13305
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
3297 } |
|
63a43c4b29b2
(IT_ring_bell): Use intdos, not write.
Richard M. Stallman <rms@gnu.org>
parents:
13274
diff
changeset
|
3298 |
| 5503 | 3299 #endif /* MSDOS */ |
