Mercurial > emacs
annotate src/msdos.c @ 7667:bae9c0fa1c2f
(do_visible_bell): Renamed from visible_bell to avoid
potential conflict with variable of the same name. Caller changed.
(internal_flush): Code for audio bell inserted.
| author | Richard M. Stallman <rms@gnu.org> |
|---|---|
| date | Tue, 24 May 1994 19:50:04 +0000 |
| parents | 13a977e6777a |
| children | da18793f532d |
| 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. |
|
13a977e6777a
(dos_rawgetc): Doc fix. Make C-, S-, and M- modifiers
Richard M. Stallman <rms@gnu.org>
parents:
7523
diff
changeset
|
2 Copyright (C) 1993, 1994 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 | |
| 8 the Free Software Foundation; either version 1, or (at your option) | |
| 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 | |
| 18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
| 19 | |
|
7666
13a977e6777a
(dos_rawgetc): Doc fix. Make C-, S-, and M- modifiers
Richard M. Stallman <rms@gnu.org>
parents:
7523
diff
changeset
|
20 /* Contributed by Morten Welinder */ |
|
13a977e6777a
(dos_rawgetc): Doc fix. Make C-, S-, and M- modifiers
Richard M. Stallman <rms@gnu.org>
parents:
7523
diff
changeset
|
21 |
| 5503 | 22 /* Note: some of the stuff here was taken from end of sysdep.c in demacs. */ |
| 23 | |
| 5980 | 24 #include <config.h> |
| 5503 | 25 |
| 26 #ifdef MSDOS | |
| 27 #include "lisp.h" | |
| 28 #include <stdio.h> | |
| 29 #include <stdlib.h> | |
| 30 #include <sys/param.h> | |
| 31 #include <sys/time.h> | |
| 32 #include <dos.h> | |
| 33 #include "dosfns.h" | |
| 34 #include "msdos.h" | |
| 35 #include "systime.h" | |
| 36 #include "termhooks.h" | |
| 37 #include "frame.h" | |
| 38 #include <go32.h> | |
| 39 #include <pc.h> | |
| 40 #include <ctype.h> | |
| 41 /* #include <process.h> */ | |
| 42 /* Damn that local process.h! Instead we can define P_WAIT ourselves. */ | |
| 43 #define P_WAIT 1 | |
| 44 | |
| 45 static int break_stat; /* BREAK check mode status. */ | |
| 46 static int stdin_stat; /* stdin IOCTL status. */ | |
| 47 static int extended_kbd; /* 101 (102) keyboard present. */ | |
| 48 | |
| 49 int have_mouse; /* Mouse present? */ | |
| 50 static int mouse_last_x; | |
| 51 static int mouse_last_y; | |
| 52 | |
| 53 /* Turn off Dos' Ctrl-C checking and inhibit interpretation of control chars | |
| 54 by Dos. Determine the keyboard type. */ | |
| 55 int | |
| 56 dos_ttraw () | |
| 57 { | |
| 58 union REGS inregs, outregs; | |
| 59 | |
| 60 inregs.h.ah = 0xc0; | |
| 61 int86 (0x15, &inregs, &outregs); | |
| 62 extended_kbd = (!outregs.x.cflag) && (outregs.h.ah == 0); | |
| 63 | |
| 64 break_stat = getcbrk (); | |
| 65 setcbrk (0); | |
| 66 install_ctrl_break_check (); | |
|
7273
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
67 have_mouse = mouse_init1 (); |
| 5503 | 68 |
| 69 inregs.x.ax = 0x4400; /* Get IOCTL status. */ | |
| 70 inregs.x.bx = 0x00; /* 0 = stdin. */ | |
| 71 intdos (&inregs, &outregs); | |
| 72 stdin_stat = outregs.h.dl; | |
| 73 | |
| 74 inregs.x.dx = (outregs.x.dx | 0x0020) & 0x0027; /* raw mode */ | |
| 75 inregs.h.al = 0x01; | |
| 76 intdos (&inregs, &outregs); | |
| 77 return !outregs.x.cflag; | |
| 78 } | |
| 79 | |
| 80 /* Restore status of standard input and Ctrl-C checking. */ | |
| 81 int | |
| 82 dos_ttcooked () | |
| 83 { | |
| 84 union REGS inregs, outregs; | |
| 85 | |
| 86 setcbrk (break_stat); | |
|
7273
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
87 if (have_mouse) mouse_off (); |
| 5503 | 88 |
| 89 inregs.x.ax = 0x4401; /* Set IOCTL status. */ | |
| 90 inregs.x.bx = 0x00; /* 0 = stdin. */ | |
| 91 inregs.x.dx = stdin_stat; | |
| 92 intdos (&inregs, &outregs); | |
| 93 return !outregs.x.cflag; | |
| 94 } | |
| 95 | |
| 96 static unsigned short | |
| 97 ibmpc_translate_map[] = | |
| 98 { | |
| 99 /* --------------- 00 to 0f --------------- */ | |
| 100 0, /* Ctrl Break */ | |
| 101 0xff1b, /* Escape */ | |
| 102 0xffb1, /* Keypad 1 */ | |
| 103 0xffb2, /* Keypad 2 */ | |
| 104 0xffb3, /* Keypad 3 */ | |
| 105 0xffb4, /* Keypad 4 */ | |
| 106 0xffb5, /* Keypad 5 */ | |
| 107 0xffb6, /* Keypad 6 */ | |
| 108 0xffb7, /* Keypad 7 */ | |
| 109 0xffb8, /* Keypad 8 */ | |
| 110 0xffb9, /* Keypad 9 */ | |
| 111 0xffb0, /* Keypad 0 */ | |
| 112 '-', '=', | |
| 113 0xff08, /* Backspace */ | |
| 114 0xff74, /* (Shift) Tab [Tab doesn't use this table] */ | |
| 115 | |
| 116 /* --------------- 10 to 1f --------------- */ | |
| 117 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', | |
| 118 0xff8d, /* Keypad Enter */ | |
| 119 0, /* Ctrl */ | |
| 120 'a', 's', | |
| 121 | |
| 122 /* --------------- 20 to 2f --------------- */ | |
| 123 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'', '`', | |
| 124 0, /* Left shift */ | |
| 125 '\\', 'z', 'x', 'c', 'v', | |
| 126 | |
| 127 /* --------------- 30 to 3f --------------- */ | |
| 128 'b', 'n', 'm', ',', '.', | |
| 129 0xffaf, /* Grey / */ | |
| 130 0, /* Right shift */ | |
| 131 0xffaa, /* Grey * */ | |
| 132 0, /* Alt */ | |
| 133 ' ', | |
| 134 0, /* Caps Lock */ | |
| 135 0xffbe, /* F1 */ | |
| 136 0xffbf, /* F2 */ | |
| 137 0xffc0, /* F3 */ | |
| 138 0xffc1, /* F4 */ | |
| 139 0xffc2, /* F5 */ | |
| 140 | |
| 141 /* --------------- 40 to 4f --------------- */ | |
| 142 0xffc3, /* F6 */ | |
| 143 0xffc4, /* F7 */ | |
| 144 0xffc5, /* F8 */ | |
| 145 0xffc6, /* F9 */ | |
| 146 0xffc7, /* F10 */ | |
| 147 0, /* Num Lock */ | |
| 148 0, /* Scroll Lock */ | |
| 149 0xff50, /* Home */ | |
| 150 0xff52, /* Up */ | |
| 151 0xff55, /* Page Up */ | |
| 152 0xffad, /* Grey - */ | |
| 153 0xff51, /* Left */ | |
| 154 0xffb5, /* Keypad 5 */ | |
| 155 0xff53, /* Right */ | |
| 156 0xffab, /* Grey + */ | |
| 157 0xff57, /* End */ | |
| 158 | |
| 159 /* --------------- 50 to 5f --------------- */ | |
| 160 0xff54, /* Down */ | |
| 161 0xff56, /* Page Down */ | |
| 162 0xff63, /* Insert */ | |
| 163 0xffff, /* Delete */ | |
| 164 0xffbe, /* (Shift) F1 */ | |
| 165 0xffbf, /* (Shift) F2 */ | |
| 166 0xffc0, /* (Shift) F3 */ | |
| 167 0xffc1, /* (Shift) F4 */ | |
| 168 0xffc2, /* (Shift) F5 */ | |
| 169 0xffc3, /* (Shift) F6 */ | |
| 170 0xffc4, /* (Shift) F7 */ | |
| 171 0xffc5, /* (Shift) F8 */ | |
| 172 0xffc6, /* (Shift) F9 */ | |
| 173 0xffc7, /* (Shift) F10 */ | |
| 174 0xffbe, /* (Ctrl) F1 */ | |
| 175 0xffbf, /* (Ctrl) F2 */ | |
| 176 | |
| 177 /* --------------- 60 to 6f --------------- */ | |
| 178 0xffc0, /* (Ctrl) F3 */ | |
| 179 0xffc1, /* (Ctrl) F4 */ | |
| 180 0xffc2, /* (Ctrl) F5 */ | |
| 181 0xffc3, /* (Ctrl) F6 */ | |
| 182 0xffc4, /* (Ctrl) F7 */ | |
| 183 0xffc5, /* (Ctrl) F8 */ | |
| 184 0xffc6, /* (Ctrl) F9 */ | |
| 185 0xffc7, /* (Ctrl) F10 */ | |
| 186 0xffbe, /* (Alt) F1 */ | |
| 187 0xffbf, /* (Alt) F2 */ | |
| 188 0xffc0, /* (Alt) F3 */ | |
| 189 0xffc1, /* (Alt) F4 */ | |
| 190 0xffc2, /* (Alt) F5 */ | |
| 191 0xffc3, /* (Alt) F6 */ | |
| 192 0xffc4, /* (Alt) F7 */ | |
| 193 0xffc5, /* (Alt) F8 */ | |
| 194 | |
| 195 /* --------------- 70 to 7f --------------- */ | |
| 196 0xffc6, /* (Alt) F9 */ | |
| 197 0xffc7, /* (Alt) F10 */ | |
| 198 0xff6d, /* (Ctrl) Sys Rq */ | |
| 199 0xff51, /* (Ctrl) Left */ | |
| 200 0xff53, /* (Ctrl) Right */ | |
| 201 0xff57, /* (Ctrl) End */ | |
| 202 0xff56, /* (Ctrl) Page Down */ | |
| 203 0xff50, /* (Ctrl) Home */ | |
| 204 '1', '2', '3', '4', '5', '6', '7', '8', /* (Alt) */ | |
| 205 | |
| 206 /* --------------- 80 to 8f --------------- */ | |
| 207 '9', '0', '-', '=', /* (Alt) */ | |
| 208 0xff55, /* (Ctrl) Page Up */ | |
| 209 0xffc8, /* F11 */ | |
| 210 0xffc9, /* F12 */ | |
| 211 0xffc8, /* (Shift) F11 */ | |
| 212 0xffc9, /* (Shift) F12 */ | |
| 213 0xffc8, /* (Ctrl) F11 */ | |
| 214 0xffc9, /* (Ctrl) F12 */ | |
| 215 0xffc8, /* (Alt) F11 */ | |
| 216 0xffc9, /* (Alt) F12 */ | |
| 217 0xff52, /* (Ctrl) Up */ | |
| 218 0xffae, /* (Ctrl) Grey - */ | |
| 219 0xffb5, /* (Ctrl) Keypad 5 */ | |
| 220 | |
| 221 /* --------------- 90 to 9f --------------- */ | |
| 222 0xffab, /* (Ctrl) Grey + */ | |
| 223 0xff54, /* (Ctrl) Down */ | |
| 224 0xff63, /* (Ctrl) Insert */ | |
| 225 0xffff, /* (Ctrl) Delete */ | |
| 226 0xff09, /* (Ctrl) Tab */ | |
| 227 0xffaf, /* (Ctrl) Grey / */ | |
| 228 0xffaa, /* (Ctrl) Grey * */ | |
| 229 0xff50, /* (Alt) Home */ | |
| 230 0xff52, /* (Alt) Up */ | |
| 231 0xff55, /* (Alt) Page Up */ | |
| 232 0, /* NO KEY */ | |
| 233 0xff51, /* (Alt) Left */ | |
| 234 0, /* NO KEY */ | |
| 235 0xff53, /* (Alt) Right */ | |
| 236 0, /* NO KEY */ | |
| 237 0xff57, /* (Alt) End */ | |
| 238 | |
| 239 /* --------------- a0 to af --------------- */ | |
| 240 0xff54, /* (Alt) Down */ | |
| 241 0xff56, /* (Alt) Page Down */ | |
| 242 0xff63, /* (Alt) Insert */ | |
| 243 0xffff, /* (Alt) Delete */ | |
| 244 0xffaf, /* (Alt) Grey / */ | |
| 245 0xff09, /* (Alt) Tab */ | |
| 246 0xff0d /* (Alt) Enter */ | |
| 247 }; | |
| 248 | |
| 249 /* Get a char from keyboard. Function keys are put into the event queue. */ | |
| 250 static int | |
| 251 dos_rawgetc () | |
| 252 { | |
| 253 struct input_event event; | |
| 254 struct timeval tv; | |
| 255 union REGS regs; | |
| 256 int ctrl_p, alt_p, shift_p; | |
| 257 | |
| 258 /* Calculate modifier bits */ | |
| 259 regs.h.ah = extended_kbd ? 0x12 : 0x02; | |
| 260 int86 (0x16, ®s, ®s); | |
| 261 ctrl_p = ((regs.h.al & 4) != 0); | |
| 262 shift_p = ((regs.h.al & 3) != 0); | |
|
7666
13a977e6777a
(dos_rawgetc): Doc fix. Make C-, S-, and M- modifiers
Richard M. Stallman <rms@gnu.org>
parents:
7523
diff
changeset
|
263 /* Please be very careful here not to break international keyboard support. |
|
13a977e6777a
(dos_rawgetc): Doc fix. Make C-, S-, and M- modifiers
Richard M. Stallman <rms@gnu.org>
parents:
7523
diff
changeset
|
264 When Keyb.Com is loaded, the key marked `Alt Gr' is used for accessing |
|
13a977e6777a
(dos_rawgetc): Doc fix. Make C-, S-, and M- modifiers
Richard M. Stallman <rms@gnu.org>
parents:
7523
diff
changeset
|
265 characters like { and } if their positions are overlaid. */ |
| 5503 | 266 alt_p = ((extended_kbd ? (regs.h.ah & 2) : (regs.h.al & 8)) != 0); |
| 267 | |
| 268 while (kbhit ()) | |
| 269 { | |
| 270 union REGS regs; | |
| 271 register unsigned char c; | |
| 272 int sc, code; | |
| 273 | |
| 274 regs.h.ah = extended_kbd ? 0x10 : 0x00; | |
| 275 int86 (0x16, ®s, ®s); | |
| 276 c = regs.h.al; | |
| 277 sc = regs.h.ah; | |
| 278 | |
| 279 /* Determine from the scan code if a keypad key was pressed. */ | |
| 280 if (c >= '0' && c <= '9' && sc > 0xb) | |
| 281 sc = (c == '0') ? 0xb : (c - '0' + 1), c = 0; | |
|
7666
13a977e6777a
(dos_rawgetc): Doc fix. Make C-, S-, and M- modifiers
Richard M. Stallman <rms@gnu.org>
parents:
7523
diff
changeset
|
282 else if (sc == 0x53 && c != 0xe0) |
|
13a977e6777a
(dos_rawgetc): Doc fix. Make C-, S-, and M- modifiers
Richard M. Stallman <rms@gnu.org>
parents:
7523
diff
changeset
|
283 { |
|
13a977e6777a
(dos_rawgetc): Doc fix. Make C-, S-, and M- modifiers
Richard M. Stallman <rms@gnu.org>
parents:
7523
diff
changeset
|
284 code = 0xffae; /* Keypad decimal point/comma. */ |
|
13a977e6777a
(dos_rawgetc): Doc fix. Make C-, S-, and M- modifiers
Richard M. Stallman <rms@gnu.org>
parents:
7523
diff
changeset
|
285 goto nonascii; |
|
13a977e6777a
(dos_rawgetc): Doc fix. Make C-, S-, and M- modifiers
Richard M. Stallman <rms@gnu.org>
parents:
7523
diff
changeset
|
286 } |
| 5503 | 287 else if (sc == 0xe0) |
| 288 { | |
| 289 switch (c) | |
| 290 { | |
| 291 case 10: /* Ctrl Enter */ | |
| 292 case 13: | |
| 293 sc = 0x1c; | |
| 294 break; | |
| 295 case '/': | |
| 296 sc = 0x35; | |
| 297 break; | |
| 298 default: | |
| 299 sc = 0; | |
| 300 }; | |
| 301 c = 0; | |
| 302 } | |
| 303 | |
| 304 if (c == 0 | |
| 305 || c == ' ' | |
| 306 || alt_p | |
| 307 || (ctrl_p && shift_p) | |
| 308 || (c == 0xe0 && sc != 0) /* Pseudo-key */ | |
| 309 || sc == 0x37 /* Grey * */ | |
| 310 || sc == 0x4a /* Grey - */ | |
| 311 || sc == 0x4e /* Grey + */ | |
| 312 || sc == 0x0e) /* Back space *key*, not Ctrl-h */ | |
| 313 { | |
| 314 if (sc >= (sizeof (ibmpc_translate_map) / sizeof (short))) | |
| 315 code = 0; | |
| 316 else | |
| 317 code = ibmpc_translate_map[sc]; | |
| 318 if (code != 0) | |
| 319 { | |
| 320 if (code >= 0x100) | |
| 321 { | |
|
7666
13a977e6777a
(dos_rawgetc): Doc fix. Make C-, S-, and M- modifiers
Richard M. Stallman <rms@gnu.org>
parents:
7523
diff
changeset
|
322 nonascii: |
| 5503 | 323 event.kind = non_ascii_keystroke; |
|
7273
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
324 event.code = (code & 0xff) + 0xff00; |
| 5503 | 325 } |
| 326 else | |
| 327 { | |
|
7666
13a977e6777a
(dos_rawgetc): Doc fix. Make C-, S-, and M- modifiers
Richard M. Stallman <rms@gnu.org>
parents:
7523
diff
changeset
|
328 /* Don't return S- if we don't have to. `shifted' is |
|
13a977e6777a
(dos_rawgetc): Doc fix. Make C-, S-, and M- modifiers
Richard M. Stallman <rms@gnu.org>
parents:
7523
diff
changeset
|
329 supposed to be the shifted versions of the characters |
|
13a977e6777a
(dos_rawgetc): Doc fix. Make C-, S-, and M- modifiers
Richard M. Stallman <rms@gnu.org>
parents:
7523
diff
changeset
|
330 in `unshifted'. Unfortunately, this is only true for |
|
13a977e6777a
(dos_rawgetc): Doc fix. Make C-, S-, and M- modifiers
Richard M. Stallman <rms@gnu.org>
parents:
7523
diff
changeset
|
331 US keyboard layout. If anyone knows how to do this |
|
13a977e6777a
(dos_rawgetc): Doc fix. Make C-, S-, and M- modifiers
Richard M. Stallman <rms@gnu.org>
parents:
7523
diff
changeset
|
332 right, please tell us. */ |
|
13a977e6777a
(dos_rawgetc): Doc fix. Make C-, S-, and M- modifiers
Richard M. Stallman <rms@gnu.org>
parents:
7523
diff
changeset
|
333 static char *unshifted |
|
13a977e6777a
(dos_rawgetc): Doc fix. Make C-, S-, and M- modifiers
Richard M. Stallman <rms@gnu.org>
parents:
7523
diff
changeset
|
334 = "abcdefghijklmnopqrstuvwxyz,./=;[\\]'-`0123456789"; |
|
13a977e6777a
(dos_rawgetc): Doc fix. Make C-, S-, and M- modifiers
Richard M. Stallman <rms@gnu.org>
parents:
7523
diff
changeset
|
335 static char *shifted |
|
13a977e6777a
(dos_rawgetc): Doc fix. Make C-, S-, and M- modifiers
Richard M. Stallman <rms@gnu.org>
parents:
7523
diff
changeset
|
336 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ<>?+:{|}\"_~)!@#$%^&*("; |
|
13a977e6777a
(dos_rawgetc): Doc fix. Make C-, S-, and M- modifiers
Richard M. Stallman <rms@gnu.org>
parents:
7523
diff
changeset
|
337 char *pos; |
|
13a977e6777a
(dos_rawgetc): Doc fix. Make C-, S-, and M- modifiers
Richard M. Stallman <rms@gnu.org>
parents:
7523
diff
changeset
|
338 |
|
13a977e6777a
(dos_rawgetc): Doc fix. Make C-, S-, and M- modifiers
Richard M. Stallman <rms@gnu.org>
parents:
7523
diff
changeset
|
339 if (shift_p && (pos = strchr (unshifted, code))) |
| 5503 | 340 { |
|
7666
13a977e6777a
(dos_rawgetc): Doc fix. Make C-, S-, and M- modifiers
Richard M. Stallman <rms@gnu.org>
parents:
7523
diff
changeset
|
341 c = shifted[pos - unshifted]; |
| 5503 | 342 shift_p = 0; |
| 343 } | |
| 344 else | |
| 345 if (c == 0) c = code; | |
| 346 event.kind = ascii_keystroke; | |
| 347 event.code = c; | |
| 348 } | |
| 349 event.modifiers | |
|
7666
13a977e6777a
(dos_rawgetc): Doc fix. Make C-, S-, and M- modifiers
Richard M. Stallman <rms@gnu.org>
parents:
7523
diff
changeset
|
350 = (shift_p ? shift_modifier : 0) |
|
13a977e6777a
(dos_rawgetc): Doc fix. Make C-, S-, and M- modifiers
Richard M. Stallman <rms@gnu.org>
parents:
7523
diff
changeset
|
351 + (ctrl_p ? ctrl_modifier : 0) |
|
13a977e6777a
(dos_rawgetc): Doc fix. Make C-, S-, and M- modifiers
Richard M. Stallman <rms@gnu.org>
parents:
7523
diff
changeset
|
352 + (alt_p ? meta_modifier : 0); |
| 5503 | 353 /* EMACS == Enter Meta Alt Control Shift */ |
| 354 event.frame_or_window = selected_frame; | |
| 355 gettimeofday (&tv, NULL); | |
| 356 event.timestamp = tv.tv_usec; | |
| 357 kbd_buffer_store_event (&event); | |
| 358 } | |
| 359 } else | |
| 360 return c; | |
| 361 } | |
| 362 | |
| 363 if (have_mouse) | |
| 364 { | |
| 365 int but, press, x, y, ok; | |
| 366 | |
| 367 /* Check for mouse movement *before* buttons. */ | |
|
7273
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
368 mouse_check_moved (); |
| 5503 | 369 |
| 370 for (but = 0; but < NUM_MOUSE_BUTTONS; but++) | |
| 371 for (press = 0; press < 2; press++) | |
| 372 { | |
| 373 if (press) | |
|
7273
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
374 ok = mouse_pressed (but, &x, &y); |
| 5503 | 375 else |
|
7273
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
376 ok = mouse_released (but, &x, &y); |
| 5503 | 377 if (ok) |
| 378 { | |
| 379 event.kind = mouse_click; | |
| 380 event.code = but; | |
| 381 event.modifiers | |
|
7666
13a977e6777a
(dos_rawgetc): Doc fix. Make C-, S-, and M- modifiers
Richard M. Stallman <rms@gnu.org>
parents:
7523
diff
changeset
|
382 = (shift_p ? shift_modifier : 0) |
|
13a977e6777a
(dos_rawgetc): Doc fix. Make C-, S-, and M- modifiers
Richard M. Stallman <rms@gnu.org>
parents:
7523
diff
changeset
|
383 + (ctrl_p ? ctrl_modifier : 0) |
|
13a977e6777a
(dos_rawgetc): Doc fix. Make C-, S-, and M- modifiers
Richard M. Stallman <rms@gnu.org>
parents:
7523
diff
changeset
|
384 + (alt_p ? meta_modifier : 0) |
|
13a977e6777a
(dos_rawgetc): Doc fix. Make C-, S-, and M- modifiers
Richard M. Stallman <rms@gnu.org>
parents:
7523
diff
changeset
|
385 + (press ? down_modifier : up_modifier); |
| 5503 | 386 event.x = x; |
| 387 event.y = y; | |
| 388 event.frame_or_window = selected_frame; | |
| 389 gettimeofday (&tv, NULL); | |
| 390 event.timestamp = tv.tv_usec; | |
| 391 kbd_buffer_store_event (&event); | |
| 392 } | |
| 393 } | |
| 394 } | |
| 395 | |
| 396 return -1; | |
| 397 } | |
| 398 | |
| 399 static int prev_get_char = -1; | |
| 400 | |
| 401 /* Return 1 if a key is ready to be read without suspending execution. */ | |
| 402 dos_keysns () | |
| 403 { | |
| 404 if (prev_get_char != -1) | |
| 405 return 1; | |
| 406 else | |
| 407 return ((prev_get_char = dos_rawgetc ()) != -1); | |
| 408 } | |
| 409 | |
| 410 /* Read a key. Return -1 if no key is ready. */ | |
| 411 dos_keyread () | |
| 412 { | |
| 413 if (prev_get_char != -1) | |
| 414 { | |
| 415 int c = prev_get_char; | |
| 416 prev_get_char = -1; | |
| 417 return c; | |
| 418 } | |
| 419 else | |
| 420 return dos_rawgetc (); | |
| 421 } | |
| 422 | |
| 423 /* Hostnames for a pc are not really funny, but they are used in change log | |
| 424 so we emulate the best we can. */ | |
| 425 gethostname (p, size) | |
| 426 char *p; | |
| 427 int size; | |
| 428 { | |
| 429 char *q = egetenv ("HOSTNAME"); | |
| 430 | |
| 431 if (!q) q = "pc"; | |
| 432 strcpy (p, q); | |
| 433 return 0; | |
| 434 } | |
| 435 | |
| 436 /* Destructively turn backslashes into slashes. */ | |
| 437 void | |
| 438 dostounix_filename (p) | |
| 439 register char *p; | |
| 440 { | |
| 441 while (*p) | |
| 442 { | |
| 443 if (*p == '\\') | |
| 444 *p = '/'; | |
| 445 p++; | |
| 446 } | |
| 447 } | |
| 448 | |
| 449 /* Destructively turn slashes into backslashes. */ | |
| 450 void | |
| 451 unixtodos_filename (p) | |
| 452 register char *p; | |
| 453 { | |
| 454 while (*p) | |
| 455 { | |
| 456 if (*p == '/') | |
| 457 *p = '\\'; | |
| 458 p++; | |
| 459 } | |
| 460 } | |
| 461 | |
| 462 /* Get the default directory for a given drive. 0=def, 1=A, 2=B, ... */ | |
| 463 int | |
| 464 getdefdir (drive, dst) | |
| 465 int drive; | |
| 466 char *dst; | |
| 467 { | |
| 468 union REGS regs; | |
| 469 | |
| 470 *dst++ = '/'; | |
| 471 regs.h.dl = drive; | |
| 472 regs.x.si = (int) dst; | |
| 473 regs.h.ah = 0x47; | |
| 474 intdos (®s, ®s); | |
| 475 return !regs.x.cflag; | |
| 476 } | |
| 477 | |
| 478 /* Remove all CR's that are followed by a LF. */ | |
| 479 int | |
| 480 crlf_to_lf (n, buf) | |
| 481 register int n; | |
| 482 register unsigned char *buf; | |
| 483 { | |
| 484 unsigned char *np = buf; | |
| 485 unsigned char *startp = buf; | |
| 486 unsigned char *endp = buf + n; | |
| 487 unsigned char c; | |
| 488 | |
| 489 if (n == 0) | |
| 490 return n; | |
|
7507
b393834bab2a
(crlf_to_lf): Fix off-by-one condition.
Richard M. Stallman <rms@gnu.org>
parents:
7273
diff
changeset
|
491 while (buf < endp - 1) |
| 5503 | 492 { |
| 493 if (*buf == 0x0d) | |
| 494 { | |
| 495 if (*(++buf) != 0x0a) | |
| 496 *np++ = 0x0d; | |
| 497 } | |
| 498 else | |
| 499 *np++ = *buf++; | |
| 500 } | |
|
7507
b393834bab2a
(crlf_to_lf): Fix off-by-one condition.
Richard M. Stallman <rms@gnu.org>
parents:
7273
diff
changeset
|
501 if (buf < endp) |
|
b393834bab2a
(crlf_to_lf): Fix off-by-one condition.
Richard M. Stallman <rms@gnu.org>
parents:
7273
diff
changeset
|
502 *np++ = *buf++; |
| 5503 | 503 return np - startp; |
| 504 } | |
| 505 | |
| 506 | |
| 507 /* Run command as specified by ARGV in directory DIR. | |
| 508 The command is run with input from TEMPIN and output to file TEMPOUT. */ | |
| 509 int | |
| 510 run_msdos_command (argv, dir, tempin, tempout) | |
| 511 unsigned char **argv; | |
| 512 Lisp_Object dir; | |
| 513 int tempin, tempout; | |
| 514 { | |
| 515 char *saveargv1, *saveargv2, **envv; | |
| 516 char oldwd[MAXPATHLEN + 1]; /* Fixed size is safe on MSDOS. */ | |
| 517 int msshell, result = -1; | |
| 518 int in, out, inbak, outbak, errbak; | |
| 519 Lisp_Object cmd; | |
| 520 | |
| 521 /* Get current directory as MSDOS cwd is not per-process. */ | |
| 522 getwd (oldwd); | |
| 523 | |
| 524 cmd = Ffile_name_nondirectory (build_string (argv[0])); | |
| 525 msshell = !NILP (Fmember (cmd, Fsymbol_value (intern ("msdos-shells")))) | |
| 526 && !strcmp ("-c", argv[1]); | |
| 527 if (msshell) | |
| 528 { | |
| 529 saveargv1 = argv[1]; | |
| 530 argv[1] = "/c"; | |
| 531 if (argv[2]) | |
| 532 { | |
| 533 saveargv2 = argv[2]; | |
| 534 unixtodos_filename (argv[2] = strdup (argv[2])); | |
| 535 } | |
| 536 } | |
| 537 | |
| 538 /* Build the environment array. */ | |
| 539 { | |
| 540 extern Lisp_Object Vprocess_environment; | |
|
6505
ce4fbb055f87
(run_msdos_command): Use assignment instead of initialization.
Karl Heuer <kwzh@gnu.org>
parents:
6056
diff
changeset
|
541 Lisp_Object tmp, lst; |
|
ce4fbb055f87
(run_msdos_command): Use assignment instead of initialization.
Karl Heuer <kwzh@gnu.org>
parents:
6056
diff
changeset
|
542 int i, len; |
|
ce4fbb055f87
(run_msdos_command): Use assignment instead of initialization.
Karl Heuer <kwzh@gnu.org>
parents:
6056
diff
changeset
|
543 |
|
ce4fbb055f87
(run_msdos_command): Use assignment instead of initialization.
Karl Heuer <kwzh@gnu.org>
parents:
6056
diff
changeset
|
544 lst = Vprocess_environment; |
|
ce4fbb055f87
(run_msdos_command): Use assignment instead of initialization.
Karl Heuer <kwzh@gnu.org>
parents:
6056
diff
changeset
|
545 len = XFASTINT (Flength (lst)); |
| 5503 | 546 |
| 547 envv = alloca ((len + 1) * sizeof (char *)); | |
| 548 for (i = 0; i < len; i++) | |
| 549 { | |
| 550 tmp = Fcar (lst); | |
| 551 lst = Fcdr (lst); | |
| 552 CHECK_STRING (tmp, 0); | |
| 553 envv[i] = alloca (XSTRING (tmp)->size + 1); | |
| 554 strcpy (envv[i], XSTRING (tmp)->data); | |
| 555 } | |
| 556 envv[len] = (char *) 0; | |
| 557 } | |
| 558 | |
| 559 if (XTYPE (dir) == Lisp_String) | |
| 560 chdir (XSTRING (dir)->data); | |
| 561 inbak = dup (0); | |
| 562 outbak = dup (1); | |
| 563 errbak = dup (2); | |
| 564 if (inbak < 0 || outbak < 0 || errbak < 0) | |
| 565 goto done; /* Allocation might fail due to lack of descriptors. */ | |
| 566 dup2 (tempin, 0); | |
| 567 dup2 (tempout, 1); | |
| 568 dup2 (tempout, 2); | |
| 569 dos_ttcooked (); | |
| 570 result = spawnve (P_WAIT, argv[0], argv, envv); | |
| 571 dos_ttraw (); | |
| 572 dup2 (inbak, 0); | |
| 573 dup2 (outbak, 1); | |
| 574 dup2 (errbak, 2); | |
| 575 | |
| 576 done: | |
| 577 chdir (oldwd); | |
| 578 if (msshell) | |
| 579 { | |
| 580 argv[1] = saveargv1; | |
| 581 if (argv[2]) | |
| 582 { | |
| 583 free (argv[2]); | |
| 584 argv[2] = saveargv2; | |
| 585 } | |
| 586 } | |
| 587 return result; | |
| 588 } | |
| 589 | |
| 590 | |
| 591 croak (badfunc) | |
| 592 char *badfunc; | |
| 593 { | |
| 594 fprintf (stderr, "%s not yet implemented\r\n", badfunc); | |
| 595 reset_sys_modes (); | |
| 596 exit (1); | |
| 597 } | |
| 598 | |
| 599 /* A list of unimplemented functions that we silently ignore. */ | |
| 600 unsigned alarm (s) unsigned s; {} | |
| 601 fork () { return 0; } | |
| 602 int kill (x, y) int x, y; { return -1; } | |
| 603 nice (p) int p; {} | |
| 604 void volatile pause () {} | |
| 605 request_sigio () {} | |
| 606 setpgrp () {return 0; } | |
| 607 setpriority (x,y,z) int x,y,z; { return 0; } | |
| 608 sigsetmask (x) int x; { return 0; } | |
| 609 unrequest_sigio () {} | |
| 610 | |
| 611 #ifdef chdir | |
| 612 #undef chdir | |
| 613 #endif | |
| 614 | |
| 615 int | |
| 616 sys_chdir (path) | |
| 617 const char* path; | |
| 618 { | |
| 619 int len = strlen (path); | |
| 620 char *tmp = (char *) alloca (len + 1); | |
| 621 /* Gotta do this extern here due to the corresponding #define: */ | |
| 622 extern int chdir (); | |
| 623 | |
| 624 if (*path && path[1] == ':' && (getdisk () != tolower (path[0]) - 'a')) | |
| 625 setdisk (tolower (path[0]) - 'a'); | |
| 626 | |
| 627 strcpy (tmp, path); | |
| 628 if (strcmp (path, "/") && strcmp (path + 1, ":/") && (path[len - 1] == '/')) | |
| 629 tmp[len - 1] = 0; | |
| 630 return chdir (tmp); | |
| 631 } | |
| 632 | |
| 633 /* Sleep SECS. If KBDOK also return immediately if a key is pressed. */ | |
| 634 void | |
| 635 sleep_or_kbd_hit (secs, kbdok) | |
| 636 int secs, kbdok; | |
| 637 { | |
| 638 long clnow, clthen; | |
| 639 struct timeval t; | |
| 640 | |
| 641 gettimeofday (&t, NULL); | |
| 642 clnow = t.tv_sec * 100 + t.tv_usec / 10000; | |
| 643 clthen = clnow + (100 * secs); | |
| 644 | |
| 645 do | |
| 646 { | |
| 647 gettimeofday (&t, NULL); | |
| 648 clnow = t.tv_sec * 100 + t.tv_usec / 10000; | |
| 649 if (kbdok && detect_input_pending ()) | |
| 650 return; | |
| 651 } | |
| 652 while (clnow < clthen); | |
| 653 } | |
| 654 | |
| 655 /* Define a lot of environment variables if not already defined. Don't | |
| 656 remove anything unless you know what you're doing -- lots of code will | |
| 657 break if one or more of these are missing. */ | |
| 658 void | |
| 659 init_environment (argc, argv, skip_args) | |
| 660 int argc; | |
| 661 char **argv; | |
| 662 int skip_args; | |
| 663 { | |
| 664 char *s, *t; | |
| 665 | |
| 666 /* We default HOME to the directory from which Emacs was started, but with | |
| 667 a "/bin" suffix removed. */ | |
| 668 s = argv[0]; | |
| 669 t = alloca (strlen (s) + 1); | |
| 670 strcpy (t, s); | |
| 671 s = t + strlen (t); | |
| 672 while (s != t && *s != '/' && *s != ':') s--; | |
| 673 if (s == t) | |
| 674 t = "c:/emacs"; /* When run under debug32. */ | |
| 675 else | |
| 676 { | |
| 677 if (*s == ':') s++; | |
| 678 *s = 0; | |
| 679 if (s - 4 >= t && strcmp (s - 4, "/bin") == 0) | |
| 680 s[strlen (s) - 4] = 0; | |
| 681 } | |
| 682 setenv ("HOME", t, 0); | |
| 683 | |
| 684 /* We set EMACSPATH to ~/bin (expanded) */ | |
| 685 s = getenv ("HOME"); | |
| 686 t = strcpy (alloca (strlen (s) + 6), s); | |
| 687 if (s[strlen (s) - 1] != '/') strcat (t, "/"); | |
| 688 strcat (t, "bin"); | |
| 689 setenv ("EMACSPATH", t, 0); | |
| 690 | |
| 691 /* I don't expect anybody to ever use other terminals so the internal | |
| 692 terminal is the default. */ | |
| 693 setenv ("TERM", "internal", 0); | |
| 694 | |
| 695 /* SHELL is a bit tricky -- COMSPEC is the closest we come, but we must | |
| 696 downcase it and mirror the backslashes. */ | |
| 697 s = getenv ("COMSPEC"); | |
| 698 if (!s) s = "c:/command.com"; | |
| 699 t = alloca (strlen (s) + 1); | |
| 700 strcpy (t, s); | |
| 701 strlwr (t); | |
| 702 dostounix_filename (t); | |
| 703 setenv ("SHELL", t, 0); | |
| 704 | |
| 705 /* PATH is also downcased and backslashes mirrored. */ | |
| 706 s = getenv ("PATH"); | |
| 707 if (!s) s = ""; | |
| 708 t = alloca (strlen (s) + 3); | |
| 709 /* Current directory is always considered part of MsDos's path but it is | |
| 710 not normally mentioned. Now it is. */ | |
| 711 strcat (strcpy (t, ".;"), s); | |
| 712 strlwr (t); | |
| 713 dostounix_filename (t); /* Not a single file name, but this should work. */ | |
| 714 setenv ("PATH", t, 1); | |
| 715 | |
| 716 /* In some sense all dos users have root privileges, so... */ | |
| 717 setenv ("USER", "root", 0); | |
| 718 setenv ("NAME", getenv ("USER"), 0); | |
| 719 | |
| 720 /* Time zone determined from country code. To make this possible, the | |
| 721 country code may not span more than one time zone. In other words, | |
| 722 in the USA, you lose. */ | |
| 723 switch (dos_country_code) | |
| 724 { | |
| 725 case 31: /* Belgium */ | |
| 726 case 32: /* The Netherlands */ | |
| 727 case 33: /* France */ | |
| 728 case 34: /* Spain */ | |
| 729 case 36: /* Hungary */ | |
| 730 case 38: /* Yugoslavia (or what's left of it?) */ | |
| 731 case 39: /* Italy */ | |
| 732 case 41: /* Switzerland */ | |
| 733 case 42: /* Tjekia */ | |
| 734 case 45: /* Denmark */ | |
| 735 case 46: /* Sweden */ | |
| 736 case 47: /* Norway */ | |
| 737 case 48: /* Poland */ | |
| 738 case 49: /* Germany */ | |
| 739 /* Daylight saving from last Sunday in March to last Sunday in | |
| 740 September, both at 2AM. */ | |
| 741 setenv ("TZ", "MET-01METDST-02,M3.5.0/02:00,M9.5.0/02:00", 0); | |
| 742 break; | |
| 743 case 44: /* United Kingdom */ | |
| 744 case 351: /* Portugal */ | |
| 745 case 354: /* Iceland */ | |
| 746 setenv ("TZ", "GMT+00", 0); | |
| 747 break; | |
| 748 case 81: /* Japan */ | |
| 749 case 82: /* Korea */ | |
| 750 setenv ("TZ", "???-09", 0); | |
| 751 break; | |
| 752 case 90: /* Turkey */ | |
| 753 case 358: /* Finland */ | |
| 754 case 972: /* Israel */ | |
| 755 setenv ("TZ", "EET-02", 0); | |
| 756 break; | |
| 757 } | |
| 758 tzset (); | |
|
7523
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
759 init_gettimeofday (); |
| 5503 | 760 } |
| 761 | |
| 762 /* Flash the screen as a substitute for BEEPs. */ | |
| 763 | |
| 764 static unsigned char _xorattr; | |
| 765 | |
|
7273
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
766 static void |
|
7667
bae9c0fa1c2f
(do_visible_bell): Renamed from visible_bell to avoid
Richard M. Stallman <rms@gnu.org>
parents:
7666
diff
changeset
|
767 do_visible_bell (xorattr) |
| 5503 | 768 unsigned char xorattr; |
| 769 { | |
| 770 _xorattr = xorattr; | |
|
7273
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
771 asm volatile |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
772 (" pushl %eax |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
773 pushl %ebx |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
774 pushl %ecx |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
775 pushl %edx |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
776 movl $1,%edx |
| 5503 | 777 visible_bell_0: |
|
7273
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
778 call _ScreenRows |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
779 pushl %eax |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
780 call _ScreenCols |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
781 pushl %eax |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
782 movl _ScreenPrimary,%eax |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
783 call dosmemsetup |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
784 movl %eax,%ebx |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
785 popl %ecx |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
786 popl %eax |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
787 imull %eax,%ecx |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
788 movb (__xorattr),%al |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
789 incl %ebx |
| 5503 | 790 visible_bell_1: |
|
7273
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
791 xorb %al,%gs:(%ebx) |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
792 addl $2,%ebx |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
793 decl %ecx |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
794 jne visible_bell_1 |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
795 decl %edx |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
796 jne visible_bell_3 |
| 5503 | 797 visible_bell_2: |
|
7273
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
798 movzwl %ax,%eax |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
799 movzwl %ax,%eax |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
800 movzwl %ax,%eax |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
801 movzwl %ax,%eax |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
802 decw %cx |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
803 jne visible_bell_2 |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
804 jmp visible_bell_0 |
| 5503 | 805 visible_bell_3: |
|
7273
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
806 popl %edx |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
807 popl %ecx |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
808 popl %ebx |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
809 popl %eax"); |
| 5503 | 810 } |
| 811 | |
| 812 static int internal_terminal = 0; | |
| 813 #undef fflush | |
| 814 | |
| 815 int | |
| 816 internal_flush (f) | |
| 817 FILE *f; | |
| 818 { | |
| 819 static int x; | |
| 820 static int y; | |
| 821 char c, *cp; | |
| 822 int count, i; | |
| 823 | |
| 824 if (internal_terminal && f == stdout) | |
| 825 { | |
|
7273
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
826 if (have_mouse) mouse_off (); |
| 5503 | 827 cp = stdout->_base; |
| 828 count = stdout->_ptr - stdout->_base; | |
| 829 while (count > 0) | |
| 830 { | |
| 831 switch (c = *cp++) | |
| 832 { | |
| 833 case 27: | |
| 834 switch (*cp++) | |
| 835 { | |
| 836 case '@': | |
| 837 y = *cp++; | |
| 838 x = *cp++; | |
| 839 count -= 4; | |
| 840 break; | |
| 841 case 'A': | |
| 842 ScreenAttrib = *cp++; | |
| 843 count -= 3; | |
| 844 break; | |
| 845 case 'B': | |
|
7667
bae9c0fa1c2f
(do_visible_bell): Renamed from visible_bell to avoid
Richard M. Stallman <rms@gnu.org>
parents:
7666
diff
changeset
|
846 do_visible_bell (*cp++); |
| 5503 | 847 count -= 3; |
| 848 break; | |
| 849 case 'C': | |
| 850 ScreenClear (); | |
| 851 x = y = 0; | |
| 852 count -= 2; | |
| 853 break; | |
| 854 case 'E': | |
| 855 for (i = ScreenCols () - 1; i >= x; i--) | |
| 856 ScreenPutChar (' ', ScreenAttrib, i, y); | |
| 857 count -= 2; | |
| 858 break; | |
| 859 case 'R': | |
| 860 x++; | |
| 861 count -= 2; | |
| 862 break; | |
| 863 case 'U': | |
| 864 y--; | |
| 865 count -= 2; | |
| 866 break; | |
| 867 case 'X': | |
| 868 ScreenAttrib ^= *cp++; | |
| 869 count -= 3; | |
| 870 break; | |
| 871 default: | |
| 872 count -= 2; | |
| 873 } | |
| 874 break; | |
|
7667
bae9c0fa1c2f
(do_visible_bell): Renamed from visible_bell to avoid
Richard M. Stallman <rms@gnu.org>
parents:
7666
diff
changeset
|
875 case 7: |
|
bae9c0fa1c2f
(do_visible_bell): Renamed from visible_bell to avoid
Richard M. Stallman <rms@gnu.org>
parents:
7666
diff
changeset
|
876 write (1, "\007", 1); |
|
bae9c0fa1c2f
(do_visible_bell): Renamed from visible_bell to avoid
Richard M. Stallman <rms@gnu.org>
parents:
7666
diff
changeset
|
877 count--; |
|
bae9c0fa1c2f
(do_visible_bell): Renamed from visible_bell to avoid
Richard M. Stallman <rms@gnu.org>
parents:
7666
diff
changeset
|
878 break; |
| 5503 | 879 case 8: |
| 880 x--; | |
| 881 count--; | |
| 882 break; | |
| 883 case 13: | |
| 884 x = 0; | |
| 885 count--; | |
| 886 break; | |
| 887 case 10: | |
| 888 y++; | |
| 889 count--; | |
| 890 break; | |
| 891 default: | |
| 892 ScreenPutChar (c, ScreenAttrib, x++, y); | |
| 893 count--; | |
| 894 } | |
| 895 } | |
| 896 fpurge (stdout); | |
| 897 ScreenSetCursor (y, x); | |
|
7273
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
898 if (have_mouse) mouse_on (); |
| 5503 | 899 } |
| 900 else | |
| 901 /* This is a call to the original fflush. */ | |
| 902 fflush (f); | |
| 903 } | |
| 904 | |
| 905 /* Do we need the internal terminal? */ | |
| 906 void | |
| 907 internal_terminal_init () | |
| 908 { | |
| 909 char *term = getenv ("TERM"); | |
| 910 | |
| 911 internal_terminal | |
| 912 = (!noninteractive) && term && !strcmp (term, "internal"); | |
| 913 } | |
|
7523
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
914 |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
915 /* When time zones are set from Ms-Dos too may C-libraries are playing |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
916 tricks with time values. We solve this by defining our own version |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
917 of `gettimeofday' bypassing GO32. Our version needs to be initialized |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
918 once and after each call to `tzset' with TZ changed. */ |
| 5503 | 919 |
|
7523
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
920 static int daylight, gmtoffset; |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
921 |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
922 int |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
923 gettimeofday (struct timeval *tp, struct timezone *tzp) |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
924 { |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
925 if (tp) |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
926 { |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
927 struct time t; |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
928 struct date d; |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
929 struct tm tmrec; |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
930 |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
931 gettime (&t); |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
932 getdate (&d); |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
933 tmrec.tm_year = d.da_year - 1900; |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
934 tmrec.tm_mon = d.da_mon - 1; |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
935 tmrec.tm_mday = d.da_day; |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
936 tmrec.tm_hour = t.ti_hour; |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
937 tmrec.tm_min = t.ti_min; |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
938 tmrec.tm_sec = t.ti_sec; |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
939 tmrec.tm_gmtoff = gmtoffset; |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
940 tmrec.tm_isdst = daylight; |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
941 tp->tv_sec = mktime (&tmrec); |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
942 tp->tv_usec = t.ti_hund * (1000000 / 100); |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
943 } |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
944 if (tzp) |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
945 { |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
946 tzp->tz_minuteswest = gmtoffset; |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
947 tzp->tz_dsttime = daylight; |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
948 } |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
949 return 0; |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
950 } |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
951 |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
952 void |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
953 init_gettimeofday () |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
954 { |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
955 time_t ltm, gtm; |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
956 struct tm *lstm; |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
957 |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
958 daylight = 0; |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
959 gmtoffset = 0; |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
960 ltm = gtm = time (NULL); |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
961 ltm = mktime (lstm = localtime (<m)); |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
962 gtm = mktime (gmtime (>m)); |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
963 daylight = lstm->tm_isdst; |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
964 gmtoffset = (int)(gtm - ltm) / 60; |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
965 } |
|
8994727ff976
(gettimeofday): New function substituting the library
Richard M. Stallman <rms@gnu.org>
parents:
7507
diff
changeset
|
966 |
| 5503 | 967 /* These must be global. */ |
| 968 static _go32_dpmi_seginfo ctrl_break_vector; | |
| 969 static _go32_dpmi_registers ctrl_break_regs; | |
| 970 static int ctrlbreakinstalled = 0; | |
| 971 | |
| 972 /* Interrupt level detection of Ctrl-Break. Don't do anything fancy here! */ | |
| 973 void | |
| 974 ctrl_break_func (regs) | |
| 975 _go32_dpmi_registers *regs; | |
| 976 { | |
| 977 Vquit_flag = Qt; | |
| 978 } | |
| 979 | |
| 980 void | |
| 981 install_ctrl_break_check () | |
| 982 { | |
| 983 if (!ctrlbreakinstalled) | |
| 984 { | |
| 985 /* Don't press Ctrl-Break if you don't have either DPMI or Emacs | |
| 986 was compiler with Djgpp 1.11 maintenance level 2 or later! */ | |
| 987 ctrlbreakinstalled = 1; | |
| 988 ctrl_break_vector.pm_offset = (int) ctrl_break_func; | |
| 989 _go32_dpmi_allocate_real_mode_callback_iret (&ctrl_break_vector, | |
| 990 &ctrl_break_regs); | |
| 991 _go32_dpmi_set_real_mode_interrupt_vector (0x1b, &ctrl_break_vector); | |
| 992 } | |
| 993 } | |
| 994 | |
| 995 | |
| 996 /* Mouse routines under devellopment follow. Coordinates are in screen | |
| 997 positions and zero based. Mouse buttons are numbered from left to | |
| 998 right and also zero based. */ | |
| 999 | |
| 1000 static int mouse_button_translate[NUM_MOUSE_BUTTONS]; | |
| 1001 static int mouse_button_count; | |
| 1002 | |
| 1003 void | |
| 1004 mouse_init () | |
| 1005 { | |
| 1006 union REGS regs; | |
| 1007 | |
| 1008 regs.x.ax = 0x0007; | |
| 1009 regs.x.cx = 0; | |
| 1010 regs.x.dx = 8 * (ScreenCols () - 1); | |
| 1011 int86 (0x33, ®s, ®s); | |
| 1012 | |
| 1013 regs.x.ax = 0x0008; | |
| 1014 regs.x.cx = 0; | |
| 1015 regs.x.dx = 8 * (ScreenRows () - 1); | |
| 1016 int86 (0x33, ®s, ®s); | |
| 1017 | |
| 1018 mouse_moveto (ScreenCols () - 1, ScreenRows () - 1); | |
| 1019 mouse_on (); | |
| 1020 } | |
| 1021 | |
| 1022 void | |
| 1023 mouse_on () | |
| 1024 { | |
| 1025 union REGS regs; | |
| 1026 | |
| 1027 regs.x.ax = 0x0001; | |
| 1028 int86 (0x33, ®s, ®s); | |
| 1029 } | |
| 1030 | |
| 1031 void | |
| 1032 mouse_off () | |
| 1033 { | |
| 1034 union REGS regs; | |
| 1035 | |
| 1036 regs.x.ax = 0x0002; | |
| 1037 int86 (0x33, ®s, ®s); | |
| 1038 } | |
| 1039 | |
| 1040 void | |
| 1041 mouse_moveto (x, y) | |
| 1042 int x, y; | |
| 1043 { | |
| 1044 union REGS regs; | |
| 1045 | |
| 1046 regs.x.ax = 0x0004; | |
| 1047 mouse_last_x = regs.x.cx = x * 8; | |
| 1048 mouse_last_y = regs.x.dx = y * 8; | |
| 1049 int86 (0x33, ®s, ®s); | |
| 1050 } | |
| 1051 | |
| 1052 int | |
| 1053 mouse_pressed (b, xp, yp) | |
| 1054 int b, *xp, *yp; | |
| 1055 { | |
| 1056 union REGS regs; | |
| 1057 | |
| 1058 if (b >= mouse_button_count) | |
| 1059 return 0; | |
| 1060 regs.x.ax = 0x0005; | |
| 1061 regs.x.bx = mouse_button_translate[b]; | |
| 1062 int86 (0x33, ®s, ®s); | |
| 1063 if (regs.x.bx) | |
| 1064 *xp = regs.x.cx / 8, *yp = regs.x.dx /8; | |
| 1065 return (regs.x.bx != 0); | |
| 1066 } | |
| 1067 | |
| 1068 int | |
| 1069 mouse_released (b, xp, yp) | |
| 1070 int b, *xp, *yp; | |
| 1071 { | |
| 1072 union REGS regs; | |
| 1073 | |
| 1074 if (b >= mouse_button_count) | |
| 1075 return 0; | |
| 1076 regs.x.ax = 0x0006; | |
| 1077 regs.x.bx = mouse_button_translate[b]; | |
| 1078 int86 (0x33, ®s, ®s); | |
| 1079 if (regs.x.bx) | |
| 1080 *xp = regs.x.cx / 8, *yp = regs.x.dx / 8; | |
| 1081 return (regs.x.bx != 0); | |
| 1082 } | |
| 1083 | |
| 1084 void | |
| 1085 mouse_get_pos (f, bar_window, part, x, y, time) | |
| 1086 FRAME_PTR *f; | |
| 1087 Lisp_Object *bar_window, *x, *y; | |
| 1088 enum scroll_bar_part *part; | |
| 1089 unsigned long *time; | |
| 1090 { | |
| 1091 union REGS regs; | |
| 1092 struct timeval tv; | |
| 1093 | |
| 1094 regs.x.ax = 0x0003; | |
| 1095 int86 (0x33, ®s, ®s); | |
| 1096 *f = selected_frame; | |
| 1097 *bar_window = Qnil; | |
| 1098 gettimeofday (&tv, NULL); | |
|
6056
afa75a0c15f8
(mouse_get_pos): Don't convert to glyph units.
Richard M. Stallman <rms@gnu.org>
parents:
5980
diff
changeset
|
1099 *x = make_number (regs.x.cx); |
|
afa75a0c15f8
(mouse_get_pos): Don't convert to glyph units.
Richard M. Stallman <rms@gnu.org>
parents:
5980
diff
changeset
|
1100 *y = make_number (regs.x.dx); |
| 5503 | 1101 *time = tv.tv_usec; |
| 1102 mouse_moved = 0; | |
| 1103 } | |
| 1104 | |
| 1105 void | |
| 1106 mouse_check_moved () | |
| 1107 { | |
| 1108 union REGS regs; | |
| 1109 | |
| 1110 regs.x.ax = 0x0003; | |
| 1111 int86 (0x33, ®s, ®s); | |
| 1112 if (regs.x.cx != mouse_last_x || regs.x.dx != mouse_last_y) | |
| 1113 { | |
| 1114 mouse_moved = 1; | |
| 1115 mouse_last_x = regs.x.cx; | |
| 1116 mouse_last_y = regs.x.dx; | |
| 1117 } | |
| 1118 } | |
| 1119 | |
| 1120 int | |
| 1121 mouse_init1 () | |
| 1122 { | |
| 1123 union REGS regs; | |
| 1124 int present; | |
| 1125 | |
| 1126 regs.x.ax = 0x0021; | |
| 1127 int86 (0x33, ®s, ®s); | |
| 1128 present = internal_terminal && (regs.x.ax & 0xffff) == 0xffff; | |
| 1129 if (present) | |
| 1130 { | |
| 1131 if (regs.x.bx == 3) | |
| 1132 { | |
| 1133 mouse_button_count = 3; | |
| 1134 mouse_button_translate[0] = 0; /* Left */ | |
| 1135 mouse_button_translate[1] = 2; /* Middle */ | |
| 1136 mouse_button_translate[2] = 1; /* Right */ | |
| 1137 } | |
| 1138 else | |
| 1139 { | |
| 1140 mouse_button_count = 2; | |
| 1141 mouse_button_translate[0] = 0; | |
| 1142 mouse_button_translate[1] = 1; | |
| 1143 } | |
| 1144 mouse_position_hook = &mouse_get_pos; | |
| 1145 mouse_init (); | |
| 1146 } | |
| 1147 return present; | |
| 1148 } | |
| 1149 | |
|
7273
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1150 /* See xterm.c for more info. */ |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1151 void |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1152 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
|
1153 FRAME_PTR f; |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1154 register int pix_x, pix_y; |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1155 register int *x, *y; |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1156 void /* XRectangle */ *bounds; |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1157 int noclip; |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1158 { |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1159 if (bounds) abort (); |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1160 |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1161 /* Ignore clipping. */ |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1162 |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1163 *x = pix_x; |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1164 *y = pix_y; |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1165 } |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1166 |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1167 void |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1168 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
|
1169 FRAME_PTR f; |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1170 register int x, y; |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1171 register int *pix_x, *pix_y; |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1172 { |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1173 *pix_x = x; |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1174 *pix_y = y; |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1175 } |
|
24426d7e14eb
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
6505
diff
changeset
|
1176 |
| 5503 | 1177 #endif /* MSDOS */ |
