annotate src/dosfns.c @ 16144:2ca3765fdc00

(syms_of_buffer): Doc fixes.
author Richard M. Stallman <rms@gnu.org>
date Mon, 09 Sep 1996 22:36:48 +0000
parents 55f9d648be36
children 6cf0a8b5c895
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1 /* MS-DOS specific Lisp utilities. Coded by Manabu Higashida, 1991.
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2 Major changes May-July 1993 Morten Welinder (only 10% original code left)
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3 Copyright (C) 1991, 1993 Free Software Foundation, Inc.
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5 This file is part of GNU Emacs.
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7 GNU Emacs is free software; you can redistribute it and/or modify
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8 it under the terms of the GNU General Public License as published by
10504
8a1bd0598b49 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 9572
diff changeset
9 the Free Software Foundation; either version 2, or (at your option)
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10 any later version.
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 GNU Emacs is distributed in the hope that it will be useful,
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 GNU General Public License for more details.
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 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: 14070
diff changeset
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 14070
diff changeset
20 Boston, MA 02111-1307, USA. */
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22
5980
a203b7c30300 Use <...> for config.h.
Richard M. Stallman <rms@gnu.org>
parents: 5503
diff changeset
23 #include <config.h>
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25 #ifdef MSDOS
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26 /* The entire file is within this conditional */
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 #include <stdio.h>
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 #include <dos.h>
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30 #include "lisp.h"
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31 #include "buffer.h"
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32 #include "termchar.h"
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33 #include "termhooks.h"
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34 #include "frame.h"
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 #include "dosfns.h"
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36 #include "msdos.h"
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
37 #include <go32.h>
15226
31a30cc1d61a (init_dosfns) [DJGPP >= 2]: Make `opendir' preserve
Richard M. Stallman <rms@gnu.org>
parents: 15173
diff changeset
38 #include <dirent.h>
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40 DEFUN ("int86", Fint86, Sint86, 2, 2, 0,
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41 "Call specific MSDOS interrupt number INTERRUPT with REGISTERS.\n\
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42 Return the updated REGISTER vector.\n\
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43 \n\
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44 INTERRUPT should be an integer in the range 0 to 255.\n\
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45 REGISTERS should be a vector produced by `make-register' and\n\
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46 `set-register-value'.")
14070
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
47 (interrupt, registers)
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
48 Lisp_Object interrupt, registers;
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49 {
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50 register int i;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51 int no;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 union REGS inregs, outregs;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
53 Lisp_Object val;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54
14070
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
55 CHECK_NUMBER (interrupt, 0);
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
56 no = (unsigned long) XINT (interrupt);
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
57 CHECK_VECTOR (registers, 1);
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
58 if (no < 0 || no > 0xff || XVECTOR (registers)-> size != 8)
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59 return Qnil;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60 for (i = 0; i < 8; i++)
14070
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
61 CHECK_NUMBER (XVECTOR (registers)->contents[i], 1);
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62
14070
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
63 inregs.x.ax = (unsigned long) XFASTINT (XVECTOR (registers)->contents[0]);
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
64 inregs.x.bx = (unsigned long) XFASTINT (XVECTOR (registers)->contents[1]);
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
65 inregs.x.cx = (unsigned long) XFASTINT (XVECTOR (registers)->contents[2]);
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
66 inregs.x.dx = (unsigned long) XFASTINT (XVECTOR (registers)->contents[3]);
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
67 inregs.x.si = (unsigned long) XFASTINT (XVECTOR (registers)->contents[4]);
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
68 inregs.x.di = (unsigned long) XFASTINT (XVECTOR (registers)->contents[5]);
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
69 inregs.x.cflag = (unsigned long) XFASTINT (XVECTOR (registers)->contents[6]);
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
70 inregs.x.flags = (unsigned long) XFASTINT (XVECTOR (registers)->contents[7]);
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 int86 (no, &inregs, &outregs);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73
14070
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
74 XVECTOR (registers)->contents[0] = make_number (outregs.x.ax);
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
75 XVECTOR (registers)->contents[1] = make_number (outregs.x.bx);
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
76 XVECTOR (registers)->contents[2] = make_number (outregs.x.cx);
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
77 XVECTOR (registers)->contents[3] = make_number (outregs.x.dx);
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
78 XVECTOR (registers)->contents[4] = make_number (outregs.x.si);
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
79 XVECTOR (registers)->contents[5] = make_number (outregs.x.di);
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
80 XVECTOR (registers)->contents[6] = make_number (outregs.x.cflag);
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
81 XVECTOR (registers)->contents[7] = make_number (outregs.x.flags);
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82
14070
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
83 return registers;
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84 }
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
86 DEFUN ("msdos-memget", Fdos_memget, Sdos_memget, 2, 2, 0,
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
87 "Read DOS memory at offset ADDRESS into VECTOR.\n\
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
88 Return the updated VECTOR.")
14070
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
89 (address, vector)
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
90 Lisp_Object address, vector;
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
91 {
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
92 register int i;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
93 int offs, len;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
94 char *buf;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
95 Lisp_Object val;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
96
14070
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
97 CHECK_NUMBER (address, 0);
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
98 offs = (unsigned long) XINT (address);
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
99 CHECK_VECTOR (vector, 1);
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
100 len = XVECTOR (vector)-> size;
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
101 if (len < 1 || len > 2048 || address < 0 || address > 0xfffff - len)
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
102 return Qnil;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
103 buf = alloca (len);
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
104 dosmemget (offs, len, buf);
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
105
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
106 for (i = 0; i < len; i++)
14070
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
107 XVECTOR (vector)->contents[i] = make_number (buf[i]);
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
108
14070
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
109 return vector;
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
110 }
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
111
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
112 DEFUN ("msdos-memput", Fdos_memput, Sdos_memput, 2, 2, 0,
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
113 "Write DOS memory at offset ADDRESS from VECTOR.")
14070
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
114 (address, vector)
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
115 Lisp_Object address, vector;
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
116 {
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
117 register int i;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
118 int offs, len;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
119 char *buf;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
120 Lisp_Object val;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
121
14070
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
122 CHECK_NUMBER (address, 0);
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
123 offs = (unsigned long) XINT (address);
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
124 CHECK_VECTOR (vector, 1);
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
125 len = XVECTOR (vector)-> size;
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
126 if (len < 1 || len > 2048 || address < 0 || address > 0xfffff - len)
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
127 return Qnil;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
128 buf = alloca (len);
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
129
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
130 for (i = 0; i < len; i++)
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
131 {
14070
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
132 CHECK_NUMBER (XVECTOR (vector)->contents[i], 1);
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
133 buf[i] = (unsigned char) XFASTINT (XVECTOR (vector)->contents[i]) & 0xFF;
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
134 }
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
135
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
136 dosmemput (buf, len, offs);
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
137 return Qt;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
138 }
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
139
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
140 DEFUN ("msdos-set-keyboard", Fmsdos_set_keyboard, Smsdos_set_keyboard, 1, 2, 0,
14070
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
141 "Set keyboard layout according to COUNTRY-CODE.\n\
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
142 If the optional argument ALLKEYS is non-nil, the keyboard is mapped for\n\
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
143 all keys; otherwise it is only used when the ALT key is pressed.\n\
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
144 The current keyboard layout is available in dos-keyboard-code.")
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
145 (country_code, allkeys)
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
146 Lisp_Object country_code;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
147 {
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
148 CHECK_NUMBER (country_code, 0);
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
149 if (!dos_set_keyboard (XINT (country_code), !NILP (allkeys)))
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
150 return Qnil;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
151 return Qt;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
152 }
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
153
9572
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
154 #ifndef HAVE_X_WINDOWS
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
155 /* Later we might want to control the mouse interface with this function,
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
156 e.g., with respect to non-80 column screen modes. */
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
157
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
158 DEFUN ("msdos-mouse-p", Fmsdos_mouse_p, Smsdos_mouse_p, 0, 0, 0, "\
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
159 Report whether a mouse is present.")
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
160 ()
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
161 {
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
162 if (have_mouse)
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
163 return Qt;
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
164 else
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
165 return Qnil;
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
166 }
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
167
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
168 /* Function to translate colour names to integers. See lisp/term/pc-win.el
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
169 for its definition. */
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
170
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
171 Lisp_Object Qmsdos_color_translate;
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
172 #endif
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
173
12990
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
174
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
175 DEFUN ("msdos-mouse-init", Fmsdos_mouse_init, Smsdos_mouse_init, 0, 0, "",
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
176 "Initialize and enable mouse if available.")
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
177 ()
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
178 {
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
179 if (have_mouse)
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
180 {
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
181 have_mouse = 1;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
182 mouse_init ();
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
183 return Qt;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
184 }
12990
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
185 return Qnil;
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
186 }
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
187
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
188 DEFUN ("msdos-mouse-enable", Fmsdos_mouse_enable, Smsdos_mouse_enable, 0, 0, "",
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
189 "Enable mouse if available.")
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
190 ()
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
191 {
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
192 if (have_mouse)
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
193 {
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
194 have_mouse = 1;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
195 mouse_on ();
12990
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
196 }
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
197 return have_mouse ? Qt : Qnil;
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
198 }
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
199
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
200 DEFUN ("msdos-mouse-disable", Fmsdos_mouse_disable, Smsdos_mouse_disable, 0, 0, "",
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
201 "Disable mouse if available.")
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
202 ()
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
203 {
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
204 mouse_off ();
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
205 if (have_mouse) have_mouse = -1;
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
206 return Qnil;
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
207 }
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
208
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
209 DEFUN ("insert-startup-screen", Finsert_startup_screen, Sinsert_startup_screen, 0, 0, "", "\
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
210 Insert copy of screen contents prior to starting emacs.\n\
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
211 Return nil if startup screen is not available.")
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
212 ()
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
213 {
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
214 char *s;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
215 int rows, cols;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
216 int i, j;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
217
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
218 if (!dos_get_saved_screen (&s, &rows, &cols))
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
219 return Qnil;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
220
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
221 for (i = 0; i < rows; i++)
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
222 {
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
223 for (j = 0; j < cols; j++)
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
224 {
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
225 insert_char (*s, 1);
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
226 s += 2;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
227 }
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
228 insert_char ('\n', 1);
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
229 }
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
230
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
231 return Qt;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
232 }
9572
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
233
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
234 /* country info */
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
235 int dos_country_code;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
236 int dos_codepage;
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
237 int dos_timezone_offset;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
238 int dos_decimal_point;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
239 int dos_keyboard_layout;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
240 unsigned char dos_country_info[DOS_COUNTRY_INFO];
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
241
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
242 int dos_hyper_key;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
243 int dos_super_key;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
244 int dos_keypad_mode;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
245
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
246 Lisp_Object Vdos_version;
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
247 Lisp_Object Vdos_display_scancodes;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
248
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
249 void
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
250 init_dosfns ()
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
251 {
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
252 union REGS regs;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
253 _go32_dpmi_seginfo info;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
254 _go32_dpmi_registers dpmiregs;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
255
9572
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
256 #ifndef SYSTEM_MALLOC
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
257 get_lim_data (); /* why the hell isn't this called elsewhere? */
9572
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
258 #endif
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
259
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
260 regs.x.ax = 0x3000;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
261 intdos (&regs, &regs);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
262 Vdos_version = Fcons (make_number (regs.h.al), make_number (regs.h.ah));
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
263
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
264 /* Obtain the country code by calling Dos via Dpmi. Don't rely on GO32. */
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
265 info.size = (sizeof(dos_country_info) + 15) / 16;
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
266 if (_go32_dpmi_allocate_dos_memory (&info))
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
267 dos_country_code = 1;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
268 else
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
269 {
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
270 dpmiregs.x.ax = 0x3800;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
271 dpmiregs.x.ds = info.rm_segment;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
272 dpmiregs.x.dx = 0;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
273 dpmiregs.x.ss = dpmiregs.x.sp = 0;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
274 _go32_dpmi_simulate_int (0x21, &dpmiregs);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
275 dos_country_code = dpmiregs.x.bx;
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
276 dosmemget (info.rm_segment * 16, DOS_COUNTRY_INFO, dos_country_info);
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
277 _go32_dpmi_free_dos_memory (&info);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
278 }
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
279 dos_set_keyboard (dos_country_code, 0);
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
280
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
281 regs.x.ax = 0x6601;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
282 intdos (&regs, &regs);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
283 if (regs.x.cflag)
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
284 /* Estimate code page from country code */
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
285 switch (dos_country_code)
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
286 {
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
287 case 45: /* Denmark */
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
288 case 47: /* Norway */
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
289 dos_codepage = 865;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
290 break;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
291 default:
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
292 /* US */
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
293 dos_codepage = 437;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
294 }
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
295 else
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
296 dos_codepage = regs.x.bx & 0xffff;
15226
31a30cc1d61a (init_dosfns) [DJGPP >= 2]: Make `opendir' preserve
Richard M. Stallman <rms@gnu.org>
parents: 15173
diff changeset
297
31a30cc1d61a (init_dosfns) [DJGPP >= 2]: Make `opendir' preserve
Richard M. Stallman <rms@gnu.org>
parents: 15173
diff changeset
298 #if __DJGPP__ >= 2
31a30cc1d61a (init_dosfns) [DJGPP >= 2]: Make `opendir' preserve
Richard M. Stallman <rms@gnu.org>
parents: 15173
diff changeset
299
31a30cc1d61a (init_dosfns) [DJGPP >= 2]: Make `opendir' preserve
Richard M. Stallman <rms@gnu.org>
parents: 15173
diff changeset
300 /* Without this, we never see hidden files. */
31a30cc1d61a (init_dosfns) [DJGPP >= 2]: Make `opendir' preserve
Richard M. Stallman <rms@gnu.org>
parents: 15173
diff changeset
301 __opendir_flags |= __OPENDIR_FIND_HIDDEN;
31a30cc1d61a (init_dosfns) [DJGPP >= 2]: Make `opendir' preserve
Richard M. Stallman <rms@gnu.org>
parents: 15173
diff changeset
302
31a30cc1d61a (init_dosfns) [DJGPP >= 2]: Make `opendir' preserve
Richard M. Stallman <rms@gnu.org>
parents: 15173
diff changeset
303 /* Under LFN, preserve the case of files as recorded in the directory. */
31a30cc1d61a (init_dosfns) [DJGPP >= 2]: Make `opendir' preserve
Richard M. Stallman <rms@gnu.org>
parents: 15173
diff changeset
304 if (!NILP (Fmsdos_long_file_names ()))
31a30cc1d61a (init_dosfns) [DJGPP >= 2]: Make `opendir' preserve
Richard M. Stallman <rms@gnu.org>
parents: 15173
diff changeset
305 __opendir_flags |= __OPENDIR_PRESERVE_CASE;
31a30cc1d61a (init_dosfns) [DJGPP >= 2]: Make `opendir' preserve
Richard M. Stallman <rms@gnu.org>
parents: 15173
diff changeset
306
31a30cc1d61a (init_dosfns) [DJGPP >= 2]: Make `opendir' preserve
Richard M. Stallman <rms@gnu.org>
parents: 15173
diff changeset
307 #endif
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
308 }
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
309
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
310 /*
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
311 * Define everything
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
312 */
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
313 syms_of_dosfns ()
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
314 {
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
315 defsubr (&Sint86);
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
316 defsubr (&Sdos_memget);
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
317 defsubr (&Sdos_memput);
12990
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
318 defsubr (&Smsdos_mouse_init);
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
319 defsubr (&Smsdos_mouse_enable);
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
320 defsubr (&Smsdos_set_keyboard);
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
321 defsubr (&Sinsert_startup_screen);
12990
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
322 defsubr (&Smsdos_mouse_disable);
9572
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
323 #ifndef HAVE_X_WINDOWS
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
324 defsubr (&Smsdos_mouse_p);
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
325 Qmsdos_color_translate = intern ("msdos-color-translate");
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
326 staticpro (&Qmsdos_color_translate);
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
327 #endif
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
328
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
329 DEFVAR_INT ("dos-country-code", &dos_country_code,
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
330 "The country code returned by Dos when Emacs was started.\n\
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
331 Usually this is the international telephone prefix.");
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
332
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
333 DEFVAR_INT ("dos-codepage", &dos_codepage,
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
334 "The codepage active when Emacs was started.\n\
7272
b5f74966c9da Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents: 5980
diff changeset
335 The following are known:\n\
b5f74966c9da Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents: 5980
diff changeset
336 437 United States\n\
b5f74966c9da Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents: 5980
diff changeset
337 850 Multilingual (Latin I)\n\
b5f74966c9da Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents: 5980
diff changeset
338 852 Slavic (Latin II)\n\
b5f74966c9da Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents: 5980
diff changeset
339 857 Turkish\n\
b5f74966c9da Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents: 5980
diff changeset
340 860 Portugal\n\
b5f74966c9da Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents: 5980
diff changeset
341 861 Iceland\n\
b5f74966c9da Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents: 5980
diff changeset
342 863 Canada (French)\n\
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
343 865 Norway/Denmark");
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
344
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
345 DEFVAR_INT ("dos-timezone-offset", &dos_timezone_offset,
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
346 "The current timezone offset to UTC in minutes.
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
347 Implicitly modified when the TZ variable is changed.");
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
348
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
349 DEFVAR_LISP ("dos-version", &Vdos_version,
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
350 "The (MAJOR . MINOR) Dos version (subject to modification with setver).");
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
351
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
352 DEFVAR_LISP ("dos-display-scancodes", &Vdos_display_scancodes,
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
353 "*When non-nil, the keyboard scan-codes are displayed at the bottom right\n\
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
354 corner of the display (typically at the end of the mode line).\n\
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
355 The output format is: scan code:char code*modifiers.");
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
356 Vdos_display_scancodes = Qnil;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
357
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
358 DEFVAR_INT ("dos-hyper-key", &dos_hyper_key,
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
359 "*If set to 1, use right ALT key as hyper key.\n\
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
360 If set to 2, use right CTRL key as hyper key.");
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
361 dos_hyper_key = 0;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
362
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
363 DEFVAR_INT ("dos-super-key", &dos_super_key,
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
364 "*If set to 1, use right ALT key as super key.\n\
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
365 If set to 2, use right CTRL key as super key.");
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
366 dos_super_key = 0;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
367
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
368 DEFVAR_INT ("dos-keypad-mode", &dos_keypad_mode,
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
369 "*Controls what key code is returned by a key in the numeric keypad.\n\
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
370 The `numlock ON' action is only taken if no modifier keys are pressed.\n\
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
371 The value is an integer constructed by adding the following bits together:\n\
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
372 \n\
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
373 0x00 Digit key returns digit (if numlock ON)\n\
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
374 0x01 Digit key returns kp-digit (if numlock ON)\n\
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
375 0x02 Digit key returns M-digit (if numlock ON)\n\
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
376 0x03 Digit key returns edit key (if numlock ON)\n\
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
377 \n\
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
378 0x00 Grey key returns char (if numlock ON)\n\
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
379 0x04 Grey key returns kp-key (if numlock ON)\n\
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
380 \n\
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
381 0x00 Digit key returns digit (if numlock OFF)\n\
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
382 0x10 Digit key returns kp-digit (if numlock OFF)\n\
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
383 0x20 Digit key returns M-digit (if numlock OFF)\n\
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
384 0x30 Digit key returns edit key (if numlock OFF)\n\
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
385 \n\
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
386 0x00 Grey key returns char (if numlock OFF)\n\
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
387 0x40 Grey key returns kp-key (if numlock OFF)\n\
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
388 \n\
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
389 0x200 ALT-0..ALT-9 in top-row produces shifted codes.");
13612
342d919f52b2 (syms_of_dosfns): Use 0x75 for dos_keypad_mode.
Richard M. Stallman <rms@gnu.org>
parents: 13180
diff changeset
390 dos_keypad_mode = 0x75;
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
391
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
392 DEFVAR_INT ("dos-keyboard-layout", &dos_keyboard_layout,
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
393 "Contains the country code for the current keyboard layout.\n\
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
394 Use msdos-set-keyboard to select another keyboard layout.");
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
395 dos_keyboard_layout = 1; /* US */
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
396
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
397 DEFVAR_INT ("dos-decimal-point", &dos_decimal_point,
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
398 "If non-zero, it contains the character to be returned when the\n\
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
399 decimal point key in the numeric keypad is pressed when Num Lock is on.\n\
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
400 If zero, the decimal point key returns the country code specific value.");
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
401 dos_decimal_point = 0;
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
402 }
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
403 #endif /* MSDOS */