aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim F. Storm1995-10-11 15:12:35 +0000
committerKim F. Storm1995-10-11 15:12:35 +0000
commit5f08dc787a1bff660f24806daebc42b5aeb39d2d (patch)
tree0d995d549a9262ede28f16008088f0cf1eb2a878
parentf32d40914e7908e043320e7b61dc4f0c9694b113 (diff)
downloademacs-5f08dc787a1bff660f24806daebc42b5aeb39d2d.tar.gz
emacs-5f08dc787a1bff660f24806daebc42b5aeb39d2d.zip
(insert-startup-screen): New function.
(msdos-memget, msdos-memput): New functions. (msdos-set-keyboard, insert-startup-screen): New functions. (dos-timezone-offset, dos-display-scancodes, dos-menubar-clock, dos-hyper-key, dos-super-key, dos-keypad-mode, dos-keyboard-layout, dos-decimal-point): New variables.
-rw-r--r--src/dosfns.c197
1 files changed, 187 insertions, 10 deletions
diff --git a/src/dosfns.c b/src/dosfns.c
index 2b4ca88fce1..1a73bdb91d2 100644
--- a/src/dosfns.c
+++ b/src/dosfns.c
@@ -33,6 +33,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
33#include "frame.h" 33#include "frame.h"
34#include "dosfns.h" 34#include "dosfns.h"
35#include "msdos.h" 35#include "msdos.h"
36#include <go32.h>
36 37
37DEFUN ("mode25", Fmode25, Smode25, 0, 0, "", "\ 38DEFUN ("mode25", Fmode25, Smode25, 0, 0, "", "\
38Changes the number of rows to 25.") 39Changes the number of rows to 25.")
@@ -137,6 +138,74 @@ REGISTERS should be a vector produced by `make-register' and\n\
137 return regs; 138 return regs;
138} 139}
139 140
141DEFUN ("msdos-memget", Fdos_memget, Sdos_memget, 2, 2, 0,
142 "Read DOS memory at offset ADDRESS into VECTOR.\n\
143Return the updated VECTOR.")
144 (addr, v)
145 Lisp_Object addr, v;
146{
147 register int i;
148 int offs, len;
149 char *buf;
150 Lisp_Object val;
151
152 CHECK_NUMBER (addr, 0);
153 offs = (unsigned long) XINT (addr);
154 CHECK_VECTOR (v, 1);
155 len = XVECTOR (v)-> size;
156 if (len < 1 || len > 2048 || addr < 0 || addr > 0xfffff - len)
157 return Qnil;
158 buf = alloca (len);
159 dosmemget (offs, len, buf);
160
161 for (i = 0; i < len; i++)
162 XVECTOR (v)->contents[i] = make_number (buf[i]);
163
164 return v;
165}
166
167DEFUN ("msdos-memput", Fdos_memput, Sdos_memput, 2, 2, 0,
168 "Write DOS memory at offset ADDRESS from VECTOR.")
169 (addr, v)
170 Lisp_Object addr, v;
171{
172 register int i;
173 int offs, len;
174 char *buf;
175 Lisp_Object val;
176
177 CHECK_NUMBER (addr, 0);
178 offs = (unsigned long) XINT (addr);
179 CHECK_VECTOR (v, 1);
180 len = XVECTOR (v)-> size;
181 if (len < 1 || len > 2048 || addr < 0 || addr > 0xfffff - len)
182 return Qnil;
183 buf = alloca (len);
184
185 for (i = 0; i < len; i++)
186 {
187 CHECK_NUMBER (XVECTOR (v)->contents[i], 1);
188 buf[i] = (unsigned char) XFASTINT (XVECTOR (v)->contents[i]) & 0xFF;
189 }
190
191 dosmemput (buf, len, offs);
192 return Qt;
193}
194
195DEFUN ("msdos-set-keyboard", Fmsdos_set_keyboard, Smsdos_set_keyboard, 1, 2, 0,
196 "Set keyboard layout according to COUNTRY.\n\
197If the optional argument ALLKEYS is non-nil, the keyboard is mapped for\n\
198all keys; otherwise it is only used when the ALT key is pressed.\n\
199The current keyboard layout is available in dos-keyboard-code.")
200 (country_code, allkeys)
201 Lisp_Object country_code;
202{
203 CHECK_NUMBER (country_code, 0);
204 if (!dos_set_keyboard (XINT (country_code), !NILP (allkeys)))
205 return Qnil;
206 return Qt;
207}
208
140#ifndef HAVE_X_WINDOWS 209#ifndef HAVE_X_WINDOWS
141/* Later we might want to control the mouse interface with this function, 210/* Later we might want to control the mouse interface with this function,
142 e.g., with respect to non-80 column screen modes. */ 211 e.g., with respect to non-80 column screen modes. */
@@ -173,11 +242,12 @@ DEFUN ("msdos-mouse-init", Fmsdos_mouse_init, Smsdos_mouse_init, 0, 0, "",
173 "Initialize and enable mouse if available.") 242 "Initialize and enable mouse if available.")
174 () 243 ()
175{ 244{
176 if (have_mouse) { 245 if (have_mouse)
177 have_mouse = 1; 246 {
178 mouse_init (); 247 have_mouse = 1;
179 return Qt; 248 mouse_init ();
180 } 249 return Qt;
250 }
181 return Qnil; 251 return Qnil;
182} 252}
183 253
@@ -187,8 +257,8 @@ DEFUN ("msdos-mouse-enable", Fmsdos_mouse_enable, Smsdos_mouse_enable, 0, 0, "",
187{ 257{
188 if (have_mouse) 258 if (have_mouse)
189 { 259 {
190 have_mouse = 1; 260 have_mouse = 1;
191 mouse_on (); 261 mouse_on ();
192 } 262 }
193 return have_mouse ? Qt : Qnil; 263 return have_mouse ? Qt : Qnil;
194} 264}
@@ -202,12 +272,49 @@ DEFUN ("msdos-mouse-disable", Fmsdos_mouse_disable, Smsdos_mouse_disable, 0, 0,
202 return Qnil; 272 return Qnil;
203} 273}
204 274
275DEFUN ("insert-startup-screen", Finsert_startup_screen, Sinsert_startup_screen, 0, 0, "", "\
276Insert copy of screen contents prior to starting emacs.\n\
277Return nil if startup screen is not available.")
278 ()
279{
280 char *s;
281 int rows, cols;
282 int i, j;
283
284 if (!dos_get_saved_screen (&s, &rows, &cols))
285 return Qnil;
286
287 for (i = 0; i < rows; i++)
288 {
289 for (j = 0; j < cols; j++)
290 {
291 insert_char (*s, 1);
292 s += 2;
293 }
294 insert_char ('\n', 1);
295 }
296
297 return Qt;
298}
205 299
206 300
301/* country info */
207int dos_country_code; 302int dos_country_code;
208int dos_codepage; 303int dos_codepage;
209Lisp_Object Vdos_version; 304int dos_timezone_offset;
305int dos_decimal_point;
306int dos_keyboard_layout;
307unsigned char dos_country_info[DOS_COUNTRY_INFO];
308
309int dos_hyper_key;
310int dos_super_key;
311int dos_keypad_mode;
210 312
313Lisp_Object Vdos_version;
314Lisp_Object Vdos_display_scancodes;
315Lisp_Object Vdos_menubar_clock;
316Lisp_Object Vdos_timer_hooks;
317
211void 318void
212init_dosfns () 319init_dosfns ()
213{ 320{
@@ -224,7 +331,7 @@ init_dosfns ()
224 Vdos_version = Fcons (make_number (regs.h.al), make_number (regs.h.ah)); 331 Vdos_version = Fcons (make_number (regs.h.al), make_number (regs.h.ah));
225 332
226 /* Obtain the country code by calling Dos via Dpmi. Don't rely on GO32. */ 333 /* Obtain the country code by calling Dos via Dpmi. Don't rely on GO32. */
227 info.size = (34 + 15) / 16; 334 info.size = (sizeof(dos_country_info) + 15) / 16;
228 if (_go32_dpmi_allocate_dos_memory (&info)) 335 if (_go32_dpmi_allocate_dos_memory (&info))
229 dos_country_code = 1; 336 dos_country_code = 1;
230 else 337 else
@@ -235,8 +342,10 @@ init_dosfns ()
235 dpmiregs.x.ss = dpmiregs.x.sp = 0; 342 dpmiregs.x.ss = dpmiregs.x.sp = 0;
236 _go32_dpmi_simulate_int (0x21, &dpmiregs); 343 _go32_dpmi_simulate_int (0x21, &dpmiregs);
237 dos_country_code = dpmiregs.x.bx; 344 dos_country_code = dpmiregs.x.bx;
345 dosmemget (info.rm_segment * 16, DOS_COUNTRY_INFO, dos_country_info);
238 _go32_dpmi_free_dos_memory (&info); 346 _go32_dpmi_free_dos_memory (&info);
239 } 347 }
348 dos_set_keyboard (dos_country_code, 0);
240 349
241 regs.x.ax = 0x6601; 350 regs.x.ax = 0x6601;
242 intdos (&regs, &regs); 351 intdos (&regs, &regs);
@@ -264,8 +373,12 @@ syms_of_dosfns ()
264 defsubr (&Smode25); 373 defsubr (&Smode25);
265 defsubr (&Smode4350); 374 defsubr (&Smode4350);
266 defsubr (&Sint86); 375 defsubr (&Sint86);
376 defsubr (&Sdos_memget);
377 defsubr (&Sdos_memput);
267 defsubr (&Smsdos_mouse_init); 378 defsubr (&Smsdos_mouse_init);
268 defsubr (&Smsdos_mouse_enable); 379 defsubr (&Smsdos_mouse_enable);
380 defsubr (&Smsdos_set_keyboard);
381 defsubr (&Sinsert_startup_screen);
269 defsubr (&Smsdos_mouse_disable); 382 defsubr (&Smsdos_mouse_disable);
270#ifndef HAVE_X_WINDOWS 383#ifndef HAVE_X_WINDOWS
271 defsubr (&Smsdos_mouse_p); 384 defsubr (&Smsdos_mouse_p);
@@ -280,7 +393,7 @@ syms_of_dosfns ()
280Usually this is the international telephone prefix."); 393Usually this is the international telephone prefix.");
281 394
282 DEFVAR_INT ("dos-codepage", &dos_codepage, 395 DEFVAR_INT ("dos-codepage", &dos_codepage,
283 "The codepage active when Emacs was started.\n\ 396 "The codepage active when Emacs was started.\n\
284The following are known:\n\ 397The following are known:\n\
285 437 United States\n\ 398 437 United States\n\
286 850 Multilingual (Latin I)\n\ 399 850 Multilingual (Latin I)\n\
@@ -291,7 +404,71 @@ The following are known:\n\
291 863 Canada (French)\n\ 404 863 Canada (French)\n\
292 865 Norway/Denmark"); 405 865 Norway/Denmark");
293 406
407 DEFVAR_INT ("dos-timezone-offset", &dos_timezone_offset,
408 "The current timezone offset to UTC in minutes.
409Implicitly modified when the TZ variable is changed.");
410
294 DEFVAR_LISP ("dos-version", &Vdos_version, 411 DEFVAR_LISP ("dos-version", &Vdos_version,
295 "The (MAJOR . MINOR) Dos version (subject to modification with setver)."); 412 "The (MAJOR . MINOR) Dos version (subject to modification with setver).");
413
414 DEFVAR_LISP ("dos-display-scancodes", &Vdos_display_scancodes,
415 "*When non-nil, the keyboard scan-codes are displayed at the bottom right\n\
416corner of the display (typically at the end of the mode line).\n\
417The output format is: scan code:char code*modifiers.");
418 Vdos_display_scancodes = Qnil;
419
420 DEFVAR_LISP ("dos-menubar-clock", &Vdos_menubar_clock,
421 "*When non-nil, the current time is displayed in the upper right\n\
422corner of the screen (typically at the end of the menu bar).");
423 Vdos_menubar_clock = Qt;
424
425 DEFVAR_LISP ("dos-timer-hooks", &Vdos_timer_hooks,
426 "List of hooks which are run every second.");
427 Vdos_timer_hooks = Qnil;
428
429 DEFVAR_INT ("dos-hyper-key", &dos_hyper_key,
430 "*If set to 1, use right ALT key as hyper key.\n\
431If set to 2, use right CTRL key as hyper key.");
432 dos_hyper_key = 0;
433
434 DEFVAR_INT ("dos-super-key", &dos_super_key,
435 "*If set to 1, use right ALT key as super key.\n\
436If set to 2, use right CTRL key as super key.");
437 dos_super_key = 0;
438
439 DEFVAR_INT ("dos-keypad-mode", &dos_keypad_mode,
440 "*Controls what key code is returned by a key in the numeric keypad.\n\
441The `numlock ON' action is only taken if no modifier keys are pressed.\n\
442The value is an integer constructed by adding the following bits together:\n\
443 \n\
444 0x00 Digit key returns digit (if numlock ON)\n\
445 0x01 Digit key returns kp-digit (if numlock ON)\n\
446 0x02 Digit key returns M-digit (if numlock ON)\n\
447 0x03 Digit key returns edit key (if numlock ON)\n\
448 \n\
449 0x00 Grey key returns char (if numlock ON)\n\
450 0x04 Grey key returns kp-key (if numlock ON)\n\
451 \n\
452 0x00 Digit key returns digit (if numlock OFF)\n\
453 0x10 Digit key returns kp-digit (if numlock OFF)\n\
454 0x20 Digit key returns M-digit (if numlock OFF)\n\
455 0x30 Digit key returns edit key (if numlock OFF)\n\
456 \n\
457 0x00 Grey key returns char (if numlock OFF)\n\
458 0x40 Grey key returns kp-key (if numlock OFF)\n\
459 \n\
460 0x200 ALT-0..ALT-9 in top-row produces shifted codes.");
461 dos_keypad_mode = 0x70;
462
463 DEFVAR_INT ("dos-keyboard-layout", &dos_keyboard_layout,
464 "Contains the country code for the current keyboard layout.\n\
465Use msdos-set-keyboard to select another keyboard layout.");
466 dos_keyboard_layout = 1; /* US */
467
468 DEFVAR_INT ("dos-decimal-point", &dos_decimal_point,
469 "If non-zero, it contains the character to be returned when the\n\
470decimal point key in the numeric keypad is pressed when Num Lock is on.\n\
471If zero, the decimal point key returns the country code specific value.");
472 dos_decimal_point = 0;
296} 473}
297#endif /* MSDOS */ 474#endif /* MSDOS */