1 /* MS-DOS specific Lisp utilities. Coded by Manabu Higashida, 1991.
2 Major changes May-July 1993 Morten Welinder (only 10% original code left)
3 Copyright (C) 1991, 1993, 1996-1998, 2001-2012 Free Software Foundation, Inc.
5 This file is part of GNU Emacs.
7 GNU Emacs is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 GNU Emacs is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
23 /* The entire file is within this conditional */
26 /* gettime and settime in dos.h clash with their namesakes from
27 gnulib, so we move out of our way the prototypes in dos.h. */
28 #define gettime dos_h_gettime_
29 #define settime dos_h_settime_
35 #include "character.h"
39 #include "termhooks.h"
40 #include "blockinput.h"
44 #include "dispextern.h"
55 DEFUN ("int86", Fint86
, Sint86
, 2, 2, 0,
56 doc
: /* Call specific MS-DOS interrupt number INTERRUPT with REGISTERS.
57 Return the updated REGISTER vector.
59 INTERRUPT should be an integer in the range 0 to 255.
60 REGISTERS should be a vector produced by `make-register' and
61 `set-register-value'. */)
62 (Lisp_Object interrupt
, Lisp_Object registers
)
66 union REGS inregs
, outregs
;
68 CHECK_NUMBER (interrupt
);
69 no
= (unsigned long) XINT (interrupt
);
70 CHECK_VECTOR (registers
);
71 if (no
< 0 || no
> 0xff || ASIZE (registers
) != 8)
73 for (i
= 0; i
< 8; i
++)
74 CHECK_NUMBER (AREF (registers
, i
));
76 inregs
.x
.ax
= (unsigned long) XFASTINT (AREF (registers
, 0));
77 inregs
.x
.bx
= (unsigned long) XFASTINT (AREF (registers
, 1));
78 inregs
.x
.cx
= (unsigned long) XFASTINT (AREF (registers
, 2));
79 inregs
.x
.dx
= (unsigned long) XFASTINT (AREF (registers
, 3));
80 inregs
.x
.si
= (unsigned long) XFASTINT (AREF (registers
, 4));
81 inregs
.x
.di
= (unsigned long) XFASTINT (AREF (registers
, 5));
82 inregs
.x
.cflag
= (unsigned long) XFASTINT (AREF (registers
, 6));
83 inregs
.x
.flags
= (unsigned long) XFASTINT (AREF (registers
, 7));
85 int86 (no
, &inregs
, &outregs
);
87 ASET (registers
, 0, make_number (outregs
.x
.ax
));
88 ASET (registers
, 1, make_number (outregs
.x
.bx
));
89 ASET (registers
, 2, make_number (outregs
.x
.cx
));
90 ASET (registers
, 3, make_number (outregs
.x
.dx
));
91 ASET (registers
, 4, make_number (outregs
.x
.si
));
92 ASET (registers
, 5, make_number (outregs
.x
.di
));
93 ASET (registers
, 6, make_number (outregs
.x
.cflag
));
94 ASET (registers
, 7, make_number (outregs
.x
.flags
));
99 DEFUN ("msdos-memget", Fdos_memget
, Sdos_memget
, 2, 2, 0,
100 doc
: /* Read DOS memory at offset ADDRESS into VECTOR.
101 Return the updated VECTOR. */)
102 (Lisp_Object address
, Lisp_Object vector
)
108 CHECK_NUMBER (address
);
109 offs
= (unsigned long) XINT (address
);
110 CHECK_VECTOR (vector
);
111 len
= ASIZE (vector
);
112 if (len
< 1 || len
> 2048 || offs
< 0 || offs
> 0xfffff - len
)
115 dosmemget (offs
, len
, buf
);
117 for (i
= 0; i
< len
; i
++)
118 ASET (vector
, i
, make_number (buf
[i
]));
123 DEFUN ("msdos-memput", Fdos_memput
, Sdos_memput
, 2, 2, 0,
124 doc
: /* Write DOS memory at offset ADDRESS from VECTOR. */)
125 (Lisp_Object address
, Lisp_Object vector
)
131 CHECK_NUMBER (address
);
132 offs
= (unsigned long) XINT (address
);
133 CHECK_VECTOR (vector
);
134 len
= ASIZE (vector
);
135 if (len
< 1 || len
> 2048 || offs
< 0 || offs
> 0xfffff - len
)
139 for (i
= 0; i
< len
; i
++)
141 CHECK_NUMBER (AREF (vector
, i
));
142 buf
[i
] = (unsigned char) XFASTINT (AREF (vector
, i
)) & 0xFF;
145 dosmemput (buf
, len
, offs
);
149 DEFUN ("msdos-set-keyboard", Fmsdos_set_keyboard
, Smsdos_set_keyboard
, 1, 2, 0,
150 doc
: /* Set keyboard layout according to COUNTRY-CODE.
151 If the optional argument ALLKEYS is non-nil, the keyboard is mapped for
152 all keys; otherwise it is only used when the ALT key is pressed.
153 The current keyboard layout is available in dos-keyboard-code. */)
154 (Lisp_Object country_code
, Lisp_Object allkeys
)
156 CHECK_NUMBER (country_code
);
157 if (!dos_set_keyboard (XINT (country_code
), !NILP (allkeys
)))
162 #ifndef HAVE_X_WINDOWS
163 /* Later we might want to control the mouse interface with this function,
164 e.g., with respect to non-80 column screen modes. */
166 DEFUN ("msdos-mouse-p", Fmsdos_mouse_p
, Smsdos_mouse_p
, 0, 0, 0,
167 doc
: /* Report whether a mouse is present. */)
177 DEFUN ("msdos-mouse-init", Fmsdos_mouse_init
, Smsdos_mouse_init
, 0, 0, "",
178 doc
: /* Initialize and enable mouse if available. */)
190 DEFUN ("msdos-mouse-enable", Fmsdos_mouse_enable
, Smsdos_mouse_enable
, 0, 0, "",
191 doc
: /* Enable mouse if available. */)
199 return have_mouse
? Qt
: Qnil
;
202 DEFUN ("msdos-mouse-disable", Fmsdos_mouse_disable
, Smsdos_mouse_disable
, 0, 0, "",
203 doc
: /* Disable mouse if available. */)
207 if (have_mouse
) have_mouse
= -1;
211 DEFUN ("insert-startup-screen", Finsert_startup_screen
, Sinsert_startup_screen
, 0, 0, "",
212 doc
: /* Insert copy of screen contents prior to starting Emacs.
213 Return nil if startup screen is not available. */)
217 int rows
, cols
, i
, j
;
219 if (!dos_get_saved_screen (&s
, &rows
, &cols
))
222 for (i
= 0; i
< rows
; i
++)
224 for (j
= 0; j
< cols
; j
++)
235 unsigned char dos_country_info
[DOS_COUNTRY_INFO
];
236 static unsigned char usa_country_info
[DOS_COUNTRY_INFO
] = {
237 0, 0, /* date format */
238 '$', 0, 0, 0, 0, /* currency string */
239 ',', 0, /* thousands separator */
240 '.', 0, /* decimal separator */
241 '/', 0, /* date separator */
242 ':', 0, /* time separator */
243 0, /* currency format */
244 2, /* digits after decimal in currency */
246 0, 0, 0, 0, /* address of case map routine, GPF if used */
247 ' ', 0, /* data-list separator (?) */
248 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* reserved */
251 #ifndef HAVE_X_WINDOWS
252 static unsigned dos_windows_version
;
253 char parent_vm_title
[50]; /* Ralf Brown says 30 is enough */
254 int w95_set_virtual_machine_title (const char *);
257 restore_parent_vm_title (void)
259 if (NILP (Vdos_windows_version
))
261 if ((dos_windows_version
& 0xff) >= 4 && parent_vm_title
[0])
262 w95_set_virtual_machine_title (parent_vm_title
);
265 #endif /* !HAVE_X_WINDOWS */
271 _go32_dpmi_registers dpmiregs
;
272 unsigned long xbuf
= _go32_info_block
.linear_address_of_transfer_buffer
;
274 #ifndef SYSTEM_MALLOC
275 extern void get_lim_data (void);
277 get_lim_data (); /* why the hell isn't this called elsewhere? */
281 intdos (®s
, ®s
);
282 Vdos_version
= Fcons (make_number (regs
.h
.al
), make_number (regs
.h
.ah
));
284 /* Obtain the country code via DPMI, use DJGPP transfer buffer. */
285 dpmiregs
.x
.ax
= 0x3800;
286 dpmiregs
.x
.ds
= xbuf
>> 4;
288 dpmiregs
.x
.ss
= dpmiregs
.x
.sp
= dpmiregs
.x
.flags
= 0;
289 _go32_dpmi_simulate_int (0x21, &dpmiregs
);
290 if (dpmiregs
.x
.flags
& 1)
292 dos_country_code
= 1; /* assume USA if 213800 failed */
293 memcpy (dos_country_info
, usa_country_info
, DOS_COUNTRY_INFO
);
297 dos_country_code
= dpmiregs
.x
.bx
;
298 dosmemget (xbuf
, DOS_COUNTRY_INFO
, dos_country_info
);
301 dos_set_keyboard (dos_country_code
, 0);
304 intdos (®s
, ®s
);
306 /* Estimate code page from country code */
307 switch (dos_country_code
)
309 case 45: /* Denmark */
310 case 47: /* Norway */
318 dos_codepage
= regs
.x
.bx
& 0xffff;
320 #ifndef HAVE_X_WINDOWS
321 parent_vm_title
[0] = '\0';
323 /* If we are running from DOS box on MS-Windows, get Windows version. */
324 dpmiregs
.x
.ax
= 0x1600; /* enhanced mode installation check */
325 dpmiregs
.x
.ss
= dpmiregs
.x
.sp
= dpmiregs
.x
.flags
= 0;
326 _go32_dpmi_simulate_int (0x2f, &dpmiregs
);
327 /* We only support Windows-specific features when we run on Windows 9X
328 or on Windows 3.X/enhanced mode.
330 Int 2Fh/AX=1600h returns:
332 AL = 00: no Windows at all;
333 AL = 01: Windows/386 2.x;
334 AL = 80h: Windows 3.x in mode other than enhanced;
335 AL = FFh: Windows/386 2.x
337 We also check AH > 0 (Windows 3.1 or later), in case AL tricks us. */
338 if (dpmiregs
.h
.al
> 2 && dpmiregs
.h
.al
!= 0x80 && dpmiregs
.h
.al
!= 0xff
339 && (dpmiregs
.h
.al
> 3 || dpmiregs
.h
.ah
> 0))
341 dos_windows_version
= dpmiregs
.x
.ax
;
342 Vdos_windows_version
=
343 Fcons (make_number (dpmiregs
.h
.al
), make_number (dpmiregs
.h
.ah
));
345 /* Save the current title of this virtual machine, so we can restore
346 it before exiting. Otherwise, Windows 95 will continue to use
347 the title we set even after we are history, stupido... */
348 if (dpmiregs
.h
.al
>= 4)
350 dpmiregs
.x
.ax
= 0x168e;
351 dpmiregs
.x
.dx
= 3; /* get VM title */
352 dpmiregs
.x
.cx
= sizeof (parent_vm_title
) - 1;
353 dpmiregs
.x
.es
= __tb
>> 4;
354 dpmiregs
.x
.di
= __tb
& 15;
355 dpmiregs
.x
.sp
= dpmiregs
.x
.ss
= dpmiregs
.x
.flags
= 0;
356 _go32_dpmi_simulate_int (0x2f, &dpmiregs
);
357 if (dpmiregs
.x
.ax
== 1)
358 dosmemget (__tb
, sizeof (parent_vm_title
), parent_vm_title
);
363 dos_windows_version
= 0;
364 Vdos_windows_version
= Qnil
;
366 #endif /* !HAVE_X_WINDOWS */
368 /* Without this, we never see hidden files.
369 Don't OR it with the previous value, so the value recorded at dump
370 time, possibly with `preserve-case' flags set, won't get through. */
371 __opendir_flags
= __OPENDIR_FIND_HIDDEN
;
373 #if __DJGPP_MINOR__ == 0
374 /* Under LFN, preserve the case of files as recorded in the directory
375 (in DJGPP 2.01 and later this is automagically done by the library). */
376 if (!NILP (Fmsdos_long_file_names ()))
377 __opendir_flags
|= __OPENDIR_PRESERVE_CASE
;
378 #endif /* __DJGPP_MINOR__ == 0 */
381 #ifndef HAVE_X_WINDOWS
383 /* Emulation of some X window features from xfns.c and xfaces.c. */
385 /* Standard VGA colors, in the order of their standard numbering
386 in the default VGA palette. */
387 static char *vga_colors
[16] = {
388 "black", "blue", "green", "cyan", "red", "magenta", "brown",
389 "lightgray", "darkgray", "lightblue", "lightgreen", "lightcyan",
390 "lightred", "lightmagenta", "yellow", "white"
393 /* Given a color name, return its index, or -1 if not found. Note
394 that this only performs case-insensitive comparison against the
395 standard names. For anything more sophisticated, like matching
396 "gray" with "grey" or translating X color names into their MSDOS
397 equivalents, call the Lisp function Qtty_color_desc (defined
398 on lisp/term/tty-colors.el). */
400 msdos_stdcolor_idx (const char *name
)
404 for (i
= 0; i
< sizeof (vga_colors
) / sizeof (vga_colors
[0]); i
++)
405 if (xstrcasecmp (name
, vga_colors
[i
]) == 0)
409 strcmp (name
, unspecified_fg
) == 0 ? FACE_TTY_DEFAULT_FG_COLOR
410 : strcmp (name
, unspecified_bg
) == 0 ? FACE_TTY_DEFAULT_BG_COLOR
411 : FACE_TTY_DEFAULT_COLOR
;
414 /* Given a color index, return its standard name. */
416 msdos_stdcolor_name (int idx
)
418 extern Lisp_Object Qunspecified
;
420 if (idx
== FACE_TTY_DEFAULT_FG_COLOR
)
421 return build_string (unspecified_fg
);
422 else if (idx
== FACE_TTY_DEFAULT_BG_COLOR
)
423 return build_string (unspecified_bg
);
424 else if (idx
>= 0 && idx
< sizeof (vga_colors
) / sizeof (vga_colors
[0]))
425 return build_string (vga_colors
[idx
]);
427 return Qunspecified
; /* meaning the default */
430 /* Support for features that are available when we run in a DOS box
433 ms_windows_version (void)
435 return dos_windows_version
;
438 /* Set the title of the current virtual machine, to appear on
439 the caption bar of that machine's window. */
442 w95_set_virtual_machine_title (const char *title_string
)
444 /* Only Windows 9X (version 4 and higher) support this function. */
445 if (!NILP (Vdos_windows_version
)
446 && (dos_windows_version
& 0xff) >= 4)
448 _go32_dpmi_registers regs
;
449 dosmemput (title_string
, strlen (title_string
) + 1, __tb
);
452 regs
.x
.es
= __tb
>> 4;
453 regs
.x
.di
= __tb
& 15;
454 regs
.x
.sp
= regs
.x
.ss
= regs
.x
.flags
= 0;
455 _go32_dpmi_simulate_int (0x2f, ®s
);
456 return regs
.x
.ax
== 1;
461 /* Change the title of frame F to NAME.
462 If NAME is nil, use the frame name as the title.
464 If Emacs is not run from a DOS box on Windows 9X, this only
465 sets the name in the frame struct, but has no other effects. */
468 x_set_title (struct frame
*f
, Lisp_Object name
)
470 /* Don't change the title if it's already NAME. */
471 if (EQ (name
, f
->title
))
474 update_mode_lines
= 1;
481 if (FRAME_MSDOS_P (f
))
484 w95_set_virtual_machine_title (SDATA (name
));
488 #endif /* !HAVE_X_WINDOWS */
490 DEFUN ("file-system-info", Ffile_system_info
, Sfile_system_info
, 1, 1, 0,
491 doc
: /* Return storage information about the file system FILENAME is on.
492 Value is a list of floats (TOTAL FREE AVAIL), where TOTAL is the total
493 storage of the file system, FREE is the free storage, and AVAIL is the
494 storage available to a non-superuser. All 3 numbers are in bytes.
495 If the underlying system call fails, value is nil. */)
496 (Lisp_Object filename
)
499 Lisp_Object encoded
, value
;
501 CHECK_STRING (filename
);
502 filename
= Fexpand_file_name (filename
, Qnil
);
503 encoded
= ENCODE_FILE (filename
);
505 if (statfs (SDATA (encoded
), &stfs
))
508 value
= list3 (make_float ((double) stfs
.f_bsize
* stfs
.f_blocks
),
509 make_float ((double) stfs
.f_bsize
* stfs
.f_bfree
),
510 make_float ((double) stfs
.f_bsize
* stfs
.f_bavail
));
515 /* System depended enumeration of and access to system processes a-la
516 ps(1). Here, we only return info about the running Emacs process.
517 (There are no other processes on DOS, right?) */
520 list_system_processes (void)
522 Lisp_Object proclist
= Qnil
;
524 proclist
= Fcons (make_fixnum_or_float (getpid ()), proclist
);
530 system_process_attributes (Lisp_Object pid
)
533 Lisp_Object attrs
= Qnil
;
535 CHECK_NUMBER_OR_FLOAT (pid
);
536 proc_id
= FLOATP (pid
) ? XFLOAT_DATA (pid
) : XINT (pid
);
538 if (proc_id
== getpid ())
543 char cmd
[FILENAME_MAX
];
544 char *cmdline
= NULL
, *p
, *q
;
545 size_t cmdline_size
= 0;
547 Lisp_Object cmd_str
, decoded_cmd
, tem
;
549 EXFUN (Fget_internal_run_time
, 0);
550 #ifndef SYSTEM_MALLOC
551 extern unsigned long ret_lim_data ();
555 attrs
= Fcons (Fcons (Qeuid
, make_fixnum_or_float (uid
)), attrs
);
558 attrs
= Fcons (Fcons (Quser
, build_string (usr
)), attrs
);
560 attrs
= Fcons (Fcons (Qegid
, make_fixnum_or_float (gid
)), attrs
);
563 attrs
= Fcons (Fcons (Qgroup
, build_string (gr
->gr_name
)), attrs
);
564 strcpy (cmd
, basename (__crt0_argv
[0]));
565 /* Command name is encoded in locale-coding-system; decode it. */
566 cmd_str
= make_unibyte_string (cmd
, strlen (cmd
));
567 decoded_cmd
= code_convert_string_norecord (cmd_str
,
568 Vlocale_coding_system
, 0);
569 attrs
= Fcons (Fcons (Qcomm
, decoded_cmd
), attrs
);
570 /* Pretend we have 0 as PPID. */
571 attrs
= Fcons (Fcons (Qppid
, make_number (0)), attrs
);
572 attrs
= Fcons (Fcons (Qpgrp
, pid
), attrs
);
573 attrs
= Fcons (Fcons (Qttname
, build_string ("/dev/tty")), attrs
);
574 /* We are never idle! */
575 tem
= Fget_internal_run_time ();
576 attrs
= Fcons (Fcons (Qtime
, tem
), attrs
);
577 attrs
= Fcons (Fcons (Qthcount
, make_number (1)), attrs
);
578 attrs
= Fcons (Fcons (Qstart
,
579 Fsymbol_value (intern ("before-init-time"))),
581 attrs
= Fcons (Fcons (Qvsize
,
582 make_fixnum_or_float ((unsigned long)sbrk (0)/1024)),
584 attrs
= Fcons (Fcons (Qetime
, tem
), attrs
);
585 #ifndef SYSTEM_MALLOC
586 /* ret_lim_data is on vm-limit.c, which is not compiled in under
588 pmem
= (double)((unsigned long) sbrk (0)) / ret_lim_data () * 100.0;
592 attrs
= Fcons (Fcons (Qpmem
, make_float (pmem
)), attrs
);
593 /* Pass 1: Count how much storage we need. */
594 for (i
= 0; i
< __crt0_argc
; i
++)
596 cmdline_size
+= strlen (__crt0_argv
[i
]) + 1; /* +1 for blank delim */
597 if (strpbrk (__crt0_argv
[i
], " \t\n\r\v\f"))
600 for (p
= __crt0_argv
[i
]; *p
; p
++)
607 /* Pass 2: Allocate storage and concatenate argv[]. */
608 cmdline
= xmalloc (cmdline_size
+ 1);
609 for (i
= 0, q
= cmdline
; i
< __crt0_argc
; i
++)
611 if (strpbrk (__crt0_argv
[i
], " \t\n\r\v\f"))
614 for (p
= __crt0_argv
[i
]; *p
; p
++)
624 strcpy (q
, __crt0_argv
[i
]);
625 q
+= strlen (__crt0_argv
[i
]);
629 /* Remove the trailing blank. */
633 /* Command line is encoded in locale-coding-system; decode it. */
634 cmd_str
= make_unibyte_string (cmdline
, strlen (cmdline
));
635 decoded_cmd
= code_convert_string_norecord (cmd_str
,
636 Vlocale_coding_system
, 0);
638 attrs
= Fcons (Fcons (Qargs
, decoded_cmd
), attrs
);
647 struct tty_display_info
*tty
;
649 #ifndef HAVE_X_WINDOWS
650 restore_parent_vm_title ();
652 /* Make sure the termscript file is committed, in case we are
653 crashing and some vital info was written there. */
654 if (FRAMEP (selected_frame
))
656 struct frame
*sf
= XFRAME (selected_frame
);
658 if (FRAME_LIVE_P (sf
)
659 && (FRAME_MSDOS_P (sf
) || FRAME_TERMCAP_P (sf
)))
664 fflush (tty
->termscript
);
665 fsync (fileno (tty
->termscript
));
675 syms_of_dosfns (void)
678 defsubr (&Sdos_memget
);
679 defsubr (&Sdos_memput
);
680 defsubr (&Smsdos_mouse_init
);
681 defsubr (&Smsdos_mouse_enable
);
682 defsubr (&Smsdos_set_keyboard
);
683 defsubr (&Sinsert_startup_screen
);
684 defsubr (&Smsdos_mouse_disable
);
685 defsubr (&Sfile_system_info
);
686 #ifndef HAVE_X_WINDOWS
687 defsubr (&Smsdos_mouse_p
);
690 DEFVAR_INT ("dos-country-code", dos_country_code
,
691 doc
: /* The country code returned by Dos when Emacs was started.
692 Usually this is the international telephone prefix. */);
694 DEFVAR_INT ("dos-codepage", dos_codepage
,
695 doc
: /* The codepage active when Emacs was started.
696 The following are known:
698 850 Multilingual (Latin I)
699 852 Slavic (Latin II)
704 865 Norway/Denmark */);
706 DEFVAR_INT ("dos-timezone-offset", dos_timezone_offset
,
707 doc
: /* The current timezone offset to UTC in minutes.
708 Implicitly modified when the TZ variable is changed. */);
710 DEFVAR_LISP ("dos-version", Vdos_version
,
711 doc
: /* The (MAJOR . MINOR) Dos version (subject to modification with setver). */);
713 #ifndef HAVE_X_WINDOWS
714 DEFVAR_LISP ("dos-windows-version", Vdos_windows_version
,
715 doc
: /* The (MAJOR . MINOR) Windows version for DOS session on MS-Windows. */);
718 DEFVAR_LISP ("dos-display-scancodes", Vdos_display_scancodes
,
719 doc
: /* Whether DOS raw keyboard events are displayed as you type.
720 When non-nil, the keyboard scan-codes are displayed at the bottom right
721 corner of the display (typically at the end of the mode line).
722 The output format is: scan code:char code*modifiers. */);
724 Vdos_display_scancodes
= Qnil
;
726 DEFVAR_INT ("dos-hyper-key", dos_hyper_key
,
727 doc
: /* If set to 1, use right ALT key as hyper key.
728 If set to 2, use right CTRL key as hyper key. */);
731 DEFVAR_INT ("dos-super-key", dos_super_key
,
732 doc
: /* If set to 1, use right ALT key as super key.
733 If set to 2, use right CTRL key as super key. */);
736 DEFVAR_INT ("dos-keypad-mode", dos_keypad_mode
,
737 doc
: /* Controls what key code is returned by a key in the numeric keypad.
738 The `numlock ON' action is only taken if no modifier keys are pressed.
739 The value is an integer constructed by adding the following bits together:
741 0x00 Digit key returns digit (if numlock ON)
742 0x01 Digit key returns kp-digit (if numlock ON)
743 0x02 Digit key returns M-digit (if numlock ON)
744 0x03 Digit key returns edit key (if numlock ON)
746 0x00 Grey key returns char (if numlock ON)
747 0x04 Grey key returns kp-key (if numlock ON)
749 0x00 Digit key returns digit (if numlock OFF)
750 0x10 Digit key returns kp-digit (if numlock OFF)
751 0x20 Digit key returns M-digit (if numlock OFF)
752 0x30 Digit key returns edit key (if numlock OFF)
754 0x00 Grey key returns char (if numlock OFF)
755 0x40 Grey key returns kp-key (if numlock OFF)
757 0x200 ALT-0..ALT-9 in top-row produces shifted codes. */);
758 dos_keypad_mode
= 0x75;
760 DEFVAR_INT ("dos-keyboard-layout", dos_keyboard_layout
,
761 doc
: /* Contains the country code for the current keyboard layout.
762 Use msdos-set-keyboard to select another keyboard layout. */);
763 dos_keyboard_layout
= 1; /* US */
765 DEFVAR_INT ("dos-decimal-point", dos_decimal_point
,
766 doc
: /* The character to produce when kp-decimal key is pressed.
767 If non-zero, this variable contains the character to be returned when the
768 decimal point key in the numeric keypad is pressed when Num Lock is on.
769 If zero, the decimal point key returns the country code specific value. */);
770 dos_decimal_point
= 0;