Mercurial > emacs
annotate src/dosfns.c @ 22243:ec7420aa37f3
(sms_of_print): Doc fix in prev change.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 25 May 1998 20:35:28 +0000 |
parents | b6b154ad6e22 |
children | 3229c65a13c5 |
rev | line source |
---|---|
5503 | 1 /* MS-DOS specific Lisp utilities. Coded by Manabu Higashida, 1991. |
2 Major changes May-July 1993 Morten Welinder (only 10% original code left) | |
19294
1f8ca0c4836f
(init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents:
19288
diff
changeset
|
3 Copyright (C) 1991, 1993, 1996, 1997 Free Software Foundation, Inc. |
5503 | 4 |
5 This file is part of GNU Emacs. | |
6 | |
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 | |
10504 | 9 the Free Software Foundation; either version 2, or (at your option) |
5503 | 10 any later version. |
11 | |
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. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
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 | 21 |
22 | |
5980 | 23 #include <config.h> |
5503 | 24 |
25 #ifdef MSDOS | |
26 /* The entire file is within this conditional */ | |
27 | |
28 #include <stdio.h> | |
29 #include <dos.h> | |
30 #include "lisp.h" | |
31 #include "buffer.h" | |
32 #include "termchar.h" | |
33 #include "termhooks.h" | |
34 #include "frame.h" | |
20034 | 35 #include "blockinput.h" |
36 #include "window.h" | |
5503 | 37 #include "dosfns.h" |
38 #include "msdos.h" | |
20034 | 39 #include <dpmi.h> |
13180
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
40 #include <go32.h> |
15226
31a30cc1d61a
(init_dosfns) [DJGPP >= 2]: Make `opendir' preserve
Richard M. Stallman <rms@gnu.org>
parents:
15173
diff
changeset
|
41 #include <dirent.h> |
5503 | 42 |
20034 | 43 #ifndef __DJGPP_MINOR__ |
44 # define __tb _go32_info_block.linear_address_of_transfer_buffer; | |
45 #endif | |
46 | |
5503 | 47 DEFUN ("int86", Fint86, Sint86, 2, 2, 0, |
48 "Call specific MSDOS interrupt number INTERRUPT with REGISTERS.\n\ | |
49 Return the updated REGISTER vector.\n\ | |
50 \n\ | |
51 INTERRUPT should be an integer in the range 0 to 255.\n\ | |
52 REGISTERS should be a vector produced by `make-register' and\n\ | |
53 `set-register-value'.") | |
14070
c74bb6ea72ab
(Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents:
13745
diff
changeset
|
54 (interrupt, registers) |
c74bb6ea72ab
(Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents:
13745
diff
changeset
|
55 Lisp_Object interrupt, registers; |
5503 | 56 { |
57 register int i; | |
58 int no; | |
59 union REGS inregs, outregs; | |
60 Lisp_Object val; | |
61 | |
14070
c74bb6ea72ab
(Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents:
13745
diff
changeset
|
62 CHECK_NUMBER (interrupt, 0); |
c74bb6ea72ab
(Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents:
13745
diff
changeset
|
63 no = (unsigned long) XINT (interrupt); |
c74bb6ea72ab
(Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents:
13745
diff
changeset
|
64 CHECK_VECTOR (registers, 1); |
c74bb6ea72ab
(Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents:
13745
diff
changeset
|
65 if (no < 0 || no > 0xff || XVECTOR (registers)-> size != 8) |
5503 | 66 return Qnil; |
67 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
|
68 CHECK_NUMBER (XVECTOR (registers)->contents[i], 1); |
5503 | 69 |
14070
c74bb6ea72ab
(Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents:
13745
diff
changeset
|
70 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
|
71 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
|
72 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
|
73 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
|
74 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
|
75 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
|
76 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
|
77 inregs.x.flags = (unsigned long) XFASTINT (XVECTOR (registers)->contents[7]); |
5503 | 78 |
79 int86 (no, &inregs, &outregs); | |
80 | |
14070
c74bb6ea72ab
(Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents:
13745
diff
changeset
|
81 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
|
82 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
|
83 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
|
84 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
|
85 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
|
86 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
|
87 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
|
88 XVECTOR (registers)->contents[7] = make_number (outregs.x.flags); |
5503 | 89 |
14070
c74bb6ea72ab
(Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents:
13745
diff
changeset
|
90 return registers; |
5503 | 91 } |
92 | |
13180
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
93 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
|
94 "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
|
95 Return the updated VECTOR.") |
14070
c74bb6ea72ab
(Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents:
13745
diff
changeset
|
96 (address, vector) |
c74bb6ea72ab
(Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents:
13745
diff
changeset
|
97 Lisp_Object address, vector; |
13180
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
98 { |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
99 register int i; |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
100 int offs, len; |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
101 char *buf; |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
102 Lisp_Object val; |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
103 |
14070
c74bb6ea72ab
(Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents:
13745
diff
changeset
|
104 CHECK_NUMBER (address, 0); |
c74bb6ea72ab
(Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents:
13745
diff
changeset
|
105 offs = (unsigned long) XINT (address); |
c74bb6ea72ab
(Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents:
13745
diff
changeset
|
106 CHECK_VECTOR (vector, 1); |
c74bb6ea72ab
(Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents:
13745
diff
changeset
|
107 len = XVECTOR (vector)-> size; |
c74bb6ea72ab
(Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents:
13745
diff
changeset
|
108 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
|
109 return Qnil; |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
110 buf = alloca (len); |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
111 dosmemget (offs, len, buf); |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
112 |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
113 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
|
114 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
|
115 |
14070
c74bb6ea72ab
(Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents:
13745
diff
changeset
|
116 return vector; |
13180
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
117 } |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
118 |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
119 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
|
120 "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
|
121 (address, vector) |
c74bb6ea72ab
(Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents:
13745
diff
changeset
|
122 Lisp_Object address, vector; |
13180
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
123 { |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
124 register int i; |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
125 int offs, len; |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
126 char *buf; |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
127 Lisp_Object val; |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
128 |
14070
c74bb6ea72ab
(Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents:
13745
diff
changeset
|
129 CHECK_NUMBER (address, 0); |
c74bb6ea72ab
(Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents:
13745
diff
changeset
|
130 offs = (unsigned long) XINT (address); |
c74bb6ea72ab
(Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents:
13745
diff
changeset
|
131 CHECK_VECTOR (vector, 1); |
c74bb6ea72ab
(Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents:
13745
diff
changeset
|
132 len = XVECTOR (vector)-> size; |
c74bb6ea72ab
(Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents:
13745
diff
changeset
|
133 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
|
134 return Qnil; |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
135 buf = alloca (len); |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
136 |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
137 for (i = 0; i < len; i++) |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
138 { |
14070
c74bb6ea72ab
(Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents:
13745
diff
changeset
|
139 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
|
140 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
|
141 } |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
142 |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
143 dosmemput (buf, len, offs); |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
144 return Qt; |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
145 } |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
146 |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
147 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
|
148 "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
|
149 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
|
150 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
|
151 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
|
152 (country_code, allkeys) |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
153 Lisp_Object country_code; |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
154 { |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
155 CHECK_NUMBER (country_code, 0); |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
156 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
|
157 return Qnil; |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
158 return Qt; |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
159 } |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
160 |
9572 | 161 #ifndef HAVE_X_WINDOWS |
162 /* Later we might want to control the mouse interface with this function, | |
163 e.g., with respect to non-80 column screen modes. */ | |
164 | |
165 DEFUN ("msdos-mouse-p", Fmsdos_mouse_p, Smsdos_mouse_p, 0, 0, 0, "\ | |
166 Report whether a mouse is present.") | |
167 () | |
168 { | |
169 if (have_mouse) | |
170 return Qt; | |
171 else | |
172 return Qnil; | |
173 } | |
174 | |
175 /* Function to translate colour names to integers. See lisp/term/pc-win.el | |
176 for its definition. */ | |
177 | |
178 Lisp_Object Qmsdos_color_translate; | |
179 #endif | |
180 | |
12990
93cc41315528
(Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents:
10504
diff
changeset
|
181 |
93cc41315528
(Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents:
10504
diff
changeset
|
182 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
|
183 "Initialize and enable mouse if available.") |
93cc41315528
(Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents:
10504
diff
changeset
|
184 () |
93cc41315528
(Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents:
10504
diff
changeset
|
185 { |
13180
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
186 if (have_mouse) |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
187 { |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
188 have_mouse = 1; |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
189 mouse_init (); |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
190 return Qt; |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
191 } |
12990
93cc41315528
(Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents:
10504
diff
changeset
|
192 return Qnil; |
93cc41315528
(Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents:
10504
diff
changeset
|
193 } |
93cc41315528
(Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents:
10504
diff
changeset
|
194 |
93cc41315528
(Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents:
10504
diff
changeset
|
195 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
|
196 "Enable mouse if available.") |
93cc41315528
(Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents:
10504
diff
changeset
|
197 () |
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 if (have_mouse) |
93cc41315528
(Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents:
10504
diff
changeset
|
200 { |
13180
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
201 have_mouse = 1; |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
202 mouse_on (); |
12990
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 return have_mouse ? Qt : Qnil; |
93cc41315528
(Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents:
10504
diff
changeset
|
205 } |
93cc41315528
(Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents:
10504
diff
changeset
|
206 |
93cc41315528
(Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents:
10504
diff
changeset
|
207 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
|
208 "Disable mouse if available.") |
93cc41315528
(Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents:
10504
diff
changeset
|
209 () |
93cc41315528
(Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents:
10504
diff
changeset
|
210 { |
93cc41315528
(Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents:
10504
diff
changeset
|
211 mouse_off (); |
93cc41315528
(Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents:
10504
diff
changeset
|
212 if (have_mouse) have_mouse = -1; |
93cc41315528
(Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents:
10504
diff
changeset
|
213 return Qnil; |
93cc41315528
(Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents:
10504
diff
changeset
|
214 } |
93cc41315528
(Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents:
10504
diff
changeset
|
215 |
13180
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
216 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
|
217 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
|
218 Return nil if startup screen is not available.") |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
219 () |
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 char *s; |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
222 int rows, cols; |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
223 int i, 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 if (!dos_get_saved_screen (&s, &rows, &cols)) |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
226 return Qnil; |
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 for (i = 0; i < rows; i++) |
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 for (j = 0; j < cols; j++) |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
231 { |
19288
bdc4b7818976
(Finsert_startup_screen): Call `insert_char' with a single argument.
Richard M. Stallman <rms@gnu.org>
parents:
16335
diff
changeset
|
232 insert_char (*s); |
13180
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
233 s += 2; |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
234 } |
19288
bdc4b7818976
(Finsert_startup_screen): Call `insert_char' with a single argument.
Richard M. Stallman <rms@gnu.org>
parents:
16335
diff
changeset
|
235 insert_char ('\n'); |
13180
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
236 } |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
237 |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
238 return Qt; |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
239 } |
9572 | 240 |
13180
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
241 /* country info */ |
5503 | 242 int dos_country_code; |
243 int dos_codepage; | |
13180
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
244 int dos_timezone_offset; |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
245 int dos_decimal_point; |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
246 int dos_keyboard_layout; |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
247 unsigned char dos_country_info[DOS_COUNTRY_INFO]; |
19294
1f8ca0c4836f
(init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents:
19288
diff
changeset
|
248 static unsigned char usa_country_info[DOS_COUNTRY_INFO] = { |
1f8ca0c4836f
(init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents:
19288
diff
changeset
|
249 0, 0, /* date format */ |
1f8ca0c4836f
(init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents:
19288
diff
changeset
|
250 '$', 0, 0, 0, 0, /* currency string */ |
1f8ca0c4836f
(init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents:
19288
diff
changeset
|
251 ',', 0, /* thousands separator */ |
1f8ca0c4836f
(init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents:
19288
diff
changeset
|
252 '.', 0, /* decimal separator */ |
1f8ca0c4836f
(init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents:
19288
diff
changeset
|
253 '/', 0, /* date separator */ |
1f8ca0c4836f
(init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents:
19288
diff
changeset
|
254 ':', 0, /* time separator */ |
1f8ca0c4836f
(init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents:
19288
diff
changeset
|
255 0, /* currency format */ |
1f8ca0c4836f
(init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents:
19288
diff
changeset
|
256 2, /* digits after decimal in currency */ |
1f8ca0c4836f
(init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents:
19288
diff
changeset
|
257 0, /* time format */ |
1f8ca0c4836f
(init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents:
19288
diff
changeset
|
258 0, 0, 0, 0, /* address of case map routine, GPF if used */ |
1f8ca0c4836f
(init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents:
19288
diff
changeset
|
259 ' ', 0, /* data-list separator (?) */ |
1f8ca0c4836f
(init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents:
19288
diff
changeset
|
260 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* reserved */ |
1f8ca0c4836f
(init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents:
19288
diff
changeset
|
261 }; |
13180
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
262 |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
263 int dos_hyper_key; |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
264 int dos_super_key; |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
265 int dos_keypad_mode; |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
266 |
5503 | 267 Lisp_Object Vdos_version; |
13180
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
268 Lisp_Object Vdos_display_scancodes; |
20034 | 269 |
270 #ifndef HAVE_X_WINDOWS | |
271 static unsigned dos_windows_version; | |
272 Lisp_Object Vdos_windows_version; | |
273 | |
274 char parent_vm_title[50]; /* Ralf Brown says 30 is enough */ | |
275 int w95_set_virtual_machine_title (const char *); | |
276 | |
277 void | |
278 restore_parent_vm_title (void) | |
279 { | |
280 if (NILP (Vdos_windows_version)) | |
281 return; | |
282 if ((dos_windows_version & 0xff) >= 4 && parent_vm_title[0]) | |
283 w95_set_virtual_machine_title (parent_vm_title); | |
284 delay (50); | |
285 } | |
286 #endif /* !HAVE_X_WINDOWS */ | |
13180
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
287 |
5503 | 288 void |
289 init_dosfns () | |
290 { | |
291 union REGS regs; | |
292 _go32_dpmi_registers dpmiregs; | |
19294
1f8ca0c4836f
(init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents:
19288
diff
changeset
|
293 unsigned long xbuf = _go32_info_block.linear_address_of_transfer_buffer; |
5503 | 294 |
9572 | 295 #ifndef SYSTEM_MALLOC |
5503 | 296 get_lim_data (); /* why the hell isn't this called elsewhere? */ |
9572 | 297 #endif |
5503 | 298 |
299 regs.x.ax = 0x3000; | |
300 intdos (®s, ®s); | |
301 Vdos_version = Fcons (make_number (regs.h.al), make_number (regs.h.ah)); | |
302 | |
19294
1f8ca0c4836f
(init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents:
19288
diff
changeset
|
303 /* Obtain the country code via DPMI, use DJGPP transfer buffer. */ |
1f8ca0c4836f
(init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents:
19288
diff
changeset
|
304 dpmiregs.x.ax = 0x3800; |
21430
b6b154ad6e22
(init_dosfns): Fix bug in passing segment address of the transfer buffer.
Eli Zaretskii <eliz@gnu.org>
parents:
20034
diff
changeset
|
305 dpmiregs.x.ds = xbuf >> 4; |
19294
1f8ca0c4836f
(init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents:
19288
diff
changeset
|
306 dpmiregs.x.dx = 0; |
1f8ca0c4836f
(init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents:
19288
diff
changeset
|
307 dpmiregs.x.ss = dpmiregs.x.sp = dpmiregs.x.flags = 0; |
1f8ca0c4836f
(init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents:
19288
diff
changeset
|
308 _go32_dpmi_simulate_int (0x21, &dpmiregs); |
1f8ca0c4836f
(init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents:
19288
diff
changeset
|
309 if (dpmiregs.x.flags & 1) |
1f8ca0c4836f
(init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents:
19288
diff
changeset
|
310 { |
1f8ca0c4836f
(init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents:
19288
diff
changeset
|
311 dos_country_code = 1; /* assume USA if 213800 failed */ |
1f8ca0c4836f
(init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents:
19288
diff
changeset
|
312 memcpy (dos_country_info, usa_country_info, DOS_COUNTRY_INFO); |
1f8ca0c4836f
(init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents:
19288
diff
changeset
|
313 } |
5503 | 314 else |
315 { | |
316 dos_country_code = dpmiregs.x.bx; | |
19294
1f8ca0c4836f
(init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents:
19288
diff
changeset
|
317 dosmemget (xbuf, DOS_COUNTRY_INFO, dos_country_info); |
5503 | 318 } |
19294
1f8ca0c4836f
(init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents:
19288
diff
changeset
|
319 |
13180
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
320 dos_set_keyboard (dos_country_code, 0); |
5503 | 321 |
322 regs.x.ax = 0x6601; | |
323 intdos (®s, ®s); | |
324 if (regs.x.cflag) | |
325 /* Estimate code page from country code */ | |
326 switch (dos_country_code) | |
327 { | |
328 case 45: /* Denmark */ | |
329 case 47: /* Norway */ | |
330 dos_codepage = 865; | |
331 break; | |
332 default: | |
333 /* US */ | |
334 dos_codepage = 437; | |
335 } | |
336 else | |
337 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
|
338 |
20034 | 339 #ifndef HAVE_X_WINDOWS |
340 parent_vm_title[0] = '\0'; | |
341 | |
342 /* If we are running from DOS box on MS-Windows, get Windows version. */ | |
343 dpmiregs.x.ax = 0x1600; /* enhanced mode installation check */ | |
344 dpmiregs.x.ss = dpmiregs.x.sp = dpmiregs.x.flags = 0; | |
345 _go32_dpmi_simulate_int (0x2f, &dpmiregs); | |
346 /* We only support Windows-specific features when we run on Windows 9X | |
347 or on Windows 3.X/enhanced mode. | |
348 | |
349 Int 2Fh/AX=1600h returns: | |
350 | |
351 AL = 00: no Windows at all; | |
352 AL = 01: Windows/386 2.x; | |
353 AL = 80h: Windows 3.x in mode other than enhanced; | |
354 AL = FFh: Windows/386 2.x | |
355 | |
356 We also check AH > 0 (Windows 3.1 or later), in case AL tricks us. */ | |
357 if (dpmiregs.h.al > 2 && dpmiregs.h.al != 0x80 && dpmiregs.h.al != 0xff | |
358 && (dpmiregs.h.al > 3 || dpmiregs.h.ah > 0)) | |
359 { | |
360 dos_windows_version = dpmiregs.x.ax; | |
361 Vdos_windows_version = | |
362 Fcons (make_number (dpmiregs.h.al), make_number (dpmiregs.h.ah)); | |
363 | |
364 /* Save the current title of this virtual machine, so we can restore | |
365 it before exiting. Otherwise, Windows 95 will continue to use | |
366 the title we set even after we are history, stupido... */ | |
367 if (dpmiregs.h.al >= 4) | |
368 { | |
369 dpmiregs.x.ax = 0x168e; | |
370 dpmiregs.x.dx = 3; /* get VM title */ | |
371 dpmiregs.x.cx = sizeof(parent_vm_title) - 1; | |
372 dpmiregs.x.es = __tb >> 4; | |
373 dpmiregs.x.di = __tb & 15; | |
374 dpmiregs.x.sp = dpmiregs.x.ss = dpmiregs.x.flags = 0; | |
375 _go32_dpmi_simulate_int (0x2f, &dpmiregs); | |
376 if (dpmiregs.x.ax == 1) | |
377 dosmemget (__tb, sizeof(parent_vm_title), parent_vm_title); | |
378 } | |
379 } | |
380 else | |
381 { | |
382 dos_windows_version = 0; | |
383 Vdos_windows_version = Qnil; | |
384 } | |
385 #endif /* !HAVE_X_WINDOWS */ | |
386 | |
15226
31a30cc1d61a
(init_dosfns) [DJGPP >= 2]: Make `opendir' preserve
Richard M. Stallman <rms@gnu.org>
parents:
15173
diff
changeset
|
387 #if __DJGPP__ >= 2 |
31a30cc1d61a
(init_dosfns) [DJGPP >= 2]: Make `opendir' preserve
Richard M. Stallman <rms@gnu.org>
parents:
15173
diff
changeset
|
388 |
16335
6cf0a8b5c895
(init_dosfns): When setting `__opendir_flags' value,
Richard M. Stallman <rms@gnu.org>
parents:
15393
diff
changeset
|
389 /* Without this, we never see hidden files. |
6cf0a8b5c895
(init_dosfns): When setting `__opendir_flags' value,
Richard M. Stallman <rms@gnu.org>
parents:
15393
diff
changeset
|
390 Don't OR it with the previous value, so the value recorded at dump |
6cf0a8b5c895
(init_dosfns): When setting `__opendir_flags' value,
Richard M. Stallman <rms@gnu.org>
parents:
15393
diff
changeset
|
391 time, possibly with `preserve-case' flags set, won't get through. */ |
6cf0a8b5c895
(init_dosfns): When setting `__opendir_flags' value,
Richard M. Stallman <rms@gnu.org>
parents:
15393
diff
changeset
|
392 __opendir_flags = __OPENDIR_FIND_HIDDEN; |
15226
31a30cc1d61a
(init_dosfns) [DJGPP >= 2]: Make `opendir' preserve
Richard M. Stallman <rms@gnu.org>
parents:
15173
diff
changeset
|
393 |
16335
6cf0a8b5c895
(init_dosfns): When setting `__opendir_flags' value,
Richard M. Stallman <rms@gnu.org>
parents:
15393
diff
changeset
|
394 #if __DJGPP_MINOR__ == 0 |
6cf0a8b5c895
(init_dosfns): When setting `__opendir_flags' value,
Richard M. Stallman <rms@gnu.org>
parents:
15393
diff
changeset
|
395 /* Under LFN, preserve the case of files as recorded in the directory |
6cf0a8b5c895
(init_dosfns): When setting `__opendir_flags' value,
Richard M. Stallman <rms@gnu.org>
parents:
15393
diff
changeset
|
396 (in DJGPP 2.01 and later this is automagically done by the library). */ |
15226
31a30cc1d61a
(init_dosfns) [DJGPP >= 2]: Make `opendir' preserve
Richard M. Stallman <rms@gnu.org>
parents:
15173
diff
changeset
|
397 if (!NILP (Fmsdos_long_file_names ())) |
31a30cc1d61a
(init_dosfns) [DJGPP >= 2]: Make `opendir' preserve
Richard M. Stallman <rms@gnu.org>
parents:
15173
diff
changeset
|
398 __opendir_flags |= __OPENDIR_PRESERVE_CASE; |
16335
6cf0a8b5c895
(init_dosfns): When setting `__opendir_flags' value,
Richard M. Stallman <rms@gnu.org>
parents:
15393
diff
changeset
|
399 #endif /* __DJGPP_MINOR__ == 0 */ |
6cf0a8b5c895
(init_dosfns): When setting `__opendir_flags' value,
Richard M. Stallman <rms@gnu.org>
parents:
15393
diff
changeset
|
400 #endif /* __DJGPP__ >= 2 */ |
5503 | 401 } |
402 | |
20034 | 403 #ifndef HAVE_X_WINDOWS |
404 /* Support for features that are available when we run in a DOS box | |
405 on MS-Windows. */ | |
406 int | |
407 ms_windows_version (void) | |
408 { | |
409 return dos_windows_version; | |
410 } | |
411 | |
412 /* Set the title of the current virtual machine, to appear on | |
413 the caption bar of that machine's window. */ | |
414 | |
415 int | |
416 w95_set_virtual_machine_title (const char *title_string) | |
417 { | |
418 /* Only Windows 9X (version 4 and higher) support this function. */ | |
419 if (!NILP (Vdos_windows_version) | |
420 && (dos_windows_version & 0xff) >= 4) | |
421 { | |
422 _go32_dpmi_registers regs; | |
423 dosmemput (title_string, strlen (title_string) + 1, __tb); | |
424 regs.x.ax = 0x168e; | |
425 regs.x.dx = 1; | |
426 regs.x.es = __tb >> 4; | |
427 regs.x.di = __tb & 15; | |
428 regs.x.sp = regs.x.ss = regs.x.flags = 0; | |
429 _go32_dpmi_simulate_int (0x2f, ®s); | |
430 return regs.x.ax == 1; | |
431 } | |
432 return 0; | |
433 } | |
434 | |
435 /* Change the title of frame F to NAME. | |
436 If NAME is nil, use the frame name as the title. | |
437 | |
438 If Emacs is not run from a DOS box on Windows 9X, this only | |
439 sets the name in the frame struct, but has no other effects. */ | |
440 | |
441 void | |
442 x_set_title (f, name) | |
443 struct frame *f; | |
444 Lisp_Object name; | |
445 { | |
446 /* Don't change the title if it's already NAME. */ | |
447 if (EQ (name, f->title)) | |
448 return; | |
449 | |
450 update_mode_lines = 1; | |
451 | |
452 f->title = name; | |
453 | |
454 if (NILP (name)) | |
455 name = f->name; | |
456 | |
457 if (FRAME_MSDOS_P (f)) | |
458 { | |
459 BLOCK_INPUT; | |
460 w95_set_virtual_machine_title (XSTRING (name)->data); | |
461 UNBLOCK_INPUT; | |
462 } | |
463 } | |
464 #endif /* !HAVE_X_WINDOWS */ | |
465 | |
466 void | |
467 dos_cleanup (void) | |
468 { | |
469 #ifndef HAVE_X_WINDOWS | |
470 restore_parent_vm_title (); | |
471 #endif | |
472 } | |
473 | |
5503 | 474 /* |
475 * Define everything | |
476 */ | |
477 syms_of_dosfns () | |
478 { | |
479 defsubr (&Sint86); | |
13180
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
480 defsubr (&Sdos_memget); |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
481 defsubr (&Sdos_memput); |
12990
93cc41315528
(Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents:
10504
diff
changeset
|
482 defsubr (&Smsdos_mouse_init); |
93cc41315528
(Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents:
10504
diff
changeset
|
483 defsubr (&Smsdos_mouse_enable); |
13180
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
484 defsubr (&Smsdos_set_keyboard); |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
485 defsubr (&Sinsert_startup_screen); |
12990
93cc41315528
(Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents:
10504
diff
changeset
|
486 defsubr (&Smsdos_mouse_disable); |
9572 | 487 #ifndef HAVE_X_WINDOWS |
488 defsubr (&Smsdos_mouse_p); | |
489 Qmsdos_color_translate = intern ("msdos-color-translate"); | |
490 staticpro (&Qmsdos_color_translate); | |
491 #endif | |
5503 | 492 |
493 DEFVAR_INT ("dos-country-code", &dos_country_code, | |
494 "The country code returned by Dos when Emacs was started.\n\ | |
495 Usually this is the international telephone prefix."); | |
496 | |
497 DEFVAR_INT ("dos-codepage", &dos_codepage, | |
13180
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
498 "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
|
499 The following are known:\n\ |
b5f74966c9da
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
5980
diff
changeset
|
500 437 United States\n\ |
b5f74966c9da
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
5980
diff
changeset
|
501 850 Multilingual (Latin I)\n\ |
b5f74966c9da
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
5980
diff
changeset
|
502 852 Slavic (Latin II)\n\ |
b5f74966c9da
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
5980
diff
changeset
|
503 857 Turkish\n\ |
b5f74966c9da
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
5980
diff
changeset
|
504 860 Portugal\n\ |
b5f74966c9da
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
5980
diff
changeset
|
505 861 Iceland\n\ |
b5f74966c9da
Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents:
5980
diff
changeset
|
506 863 Canada (French)\n\ |
5503 | 507 865 Norway/Denmark"); |
508 | |
13180
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
509 DEFVAR_INT ("dos-timezone-offset", &dos_timezone_offset, |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
510 "The current timezone offset to UTC in minutes. |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
511 Implicitly modified when the TZ variable is changed."); |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
512 |
5503 | 513 DEFVAR_LISP ("dos-version", &Vdos_version, |
514 "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
|
515 |
20034 | 516 #ifndef HAVE_X_WINDOWS |
517 DEFVAR_LISP ("dos-windows-version", &Vdos_windows_version, | |
518 "The (MAJOR . MINOR) Windows version for DOS session on MS-Windows."); | |
519 #endif | |
520 | |
13180
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
521 DEFVAR_LISP ("dos-display-scancodes", &Vdos_display_scancodes, |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
522 "*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
|
523 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
|
524 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
|
525 Vdos_display_scancodes = Qnil; |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
526 |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
527 DEFVAR_INT ("dos-hyper-key", &dos_hyper_key, |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
528 "*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
|
529 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
|
530 dos_hyper_key = 0; |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
531 |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
532 DEFVAR_INT ("dos-super-key", &dos_super_key, |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
533 "*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
|
534 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
|
535 dos_super_key = 0; |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
536 |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
537 DEFVAR_INT ("dos-keypad-mode", &dos_keypad_mode, |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
538 "*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
|
539 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
|
540 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
|
541 \n\ |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
542 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
|
543 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
|
544 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
|
545 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
|
546 \n\ |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
547 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
|
548 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
|
549 \n\ |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
550 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
|
551 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
|
552 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
|
553 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
|
554 \n\ |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
555 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
|
556 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
|
557 \n\ |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
558 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
|
559 dos_keypad_mode = 0x75; |
13180
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
560 |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
561 DEFVAR_INT ("dos-keyboard-layout", &dos_keyboard_layout, |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
562 "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
|
563 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
|
564 dos_keyboard_layout = 1; /* US */ |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
565 |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
566 DEFVAR_INT ("dos-decimal-point", &dos_decimal_point, |
59663cba4b02
(insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents:
12990
diff
changeset
|
567 "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
|
568 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
|
569 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
|
570 dos_decimal_point = 0; |
5503 | 571 } |
572 #endif /* MSDOS */ |