annotate src/dosfns.c @ 110535:eb986ca47c5a

Minor url.texi update. * doc/misc/url.texi (Disk Caching): Mention url-cache-expire-time, url-cache-expired, and url-fetch-from-cache.
author Glenn Morris <rgm@gnu.org>
date Thu, 23 Sep 2010 19:34:56 -0700
parents 31def5db596a
children 55c8c3ca3d48
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)
64770
a0d1312ede66 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64084
diff changeset
3 Copyright (C) 1991, 1993, 1996, 1997, 1998, 2001, 2002, 2003, 2004,
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 105669
diff changeset
4 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6 This file is part of GNU Emacs.
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7
94963
8971ddf55736 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 91327
diff changeset
8 GNU Emacs is free software: you can redistribute it and/or modify
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9 it under the terms of the GNU General Public License as published by
94963
8971ddf55736 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 91327
diff changeset
10 the Free Software Foundation, either version 3 of the License, or
8971ddf55736 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 91327
diff changeset
11 (at your option) any later version.
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 GNU Emacs is distributed in the hope that it will be useful,
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 GNU General Public License for more details.
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
94963
8971ddf55736 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 91327
diff changeset
19 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20
5980
a203b7c30300 Use <...> for config.h.
Richard M. Stallman <rms@gnu.org>
parents: 5503
diff changeset
21 #include <config.h>
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23 #ifdef MSDOS
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24 /* The entire file is within this conditional */
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26 #include <stdio.h>
25113
73c54061f4bb (msdos_stdcolor_name, msdos_stdcolor_idx): New
Eli Zaretskii <eliz@gnu.org>
parents: 23814
diff changeset
27 #include <string.h>
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 #include <dos.h>
105669
68dd71358159 * alloc.c: Do not define struct catchtag.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 102838
diff changeset
29 #include <setjmp.h>
5503
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"
97653
8e2483da8823 Include frame.h before termhooks.h.
Eli Zaretskii <eliz@gnu.org>
parents: 95209
diff changeset
33 #include "frame.h"
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34 #include "termhooks.h"
20034
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
35 #include "blockinput.h"
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
36 #include "window.h"
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 #include "dosfns.h"
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 #include "msdos.h"
25113
73c54061f4bb (msdos_stdcolor_name, msdos_stdcolor_idx): New
Eli Zaretskii <eliz@gnu.org>
parents: 23814
diff changeset
39 #include "dispextern.h"
88351
aac41b50c875 Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents: 41914
diff changeset
40 #include "character.h"
34348
5cd770204501 (Ffile_system_info): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 32544
diff changeset
41 #include "coding.h"
100859
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
42 #include "process.h"
20034
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
43 #include <dpmi.h>
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
44 #include <go32.h>
15226
31a30cc1d61a (init_dosfns) [DJGPP >= 2]: Make `opendir' preserve
Richard M. Stallman <rms@gnu.org>
parents: 15173
diff changeset
45 #include <dirent.h>
34348
5cd770204501 (Ffile_system_info): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 32544
diff changeset
46 #include <sys/vfs.h>
100859
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
47 #include <unistd.h>
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
48 #include <grp.h>
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
49 #include <crt0.h>
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51 DEFUN ("int86", Fint86, Sint86, 2, 2, 0,
99540
c5c8f07bc47c * w32-fns.el (w32-shell-dos-semantics):
Juanma Barranquero <lekktu@gmail.com>
parents: 97653
diff changeset
52 doc: /* Call specific MS-DOS interrupt number INTERRUPT with REGISTERS.
41914
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
53 Return the updated REGISTER vector.
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
54
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
55 INTERRUPT should be an integer in the range 0 to 255.
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
56 REGISTERS should be a vector produced by `make-register' and
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
57 `set-register-value'. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109162
diff changeset
58 (Lisp_Object interrupt, Lisp_Object registers)
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59 {
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60 register int i;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61 int no;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62 union REGS inregs, outregs;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 38319
diff changeset
64 CHECK_NUMBER (interrupt);
14070
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
65 no = (unsigned long) XINT (interrupt);
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 38319
diff changeset
66 CHECK_VECTOR (registers);
45331
425d5cebd73c Fix whitespace.
Eli Zaretskii <eliz@gnu.org>
parents: 43713
diff changeset
67 if (no < 0 || no > 0xff || XVECTOR (registers)-> size != 8)
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68 return Qnil;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69 for (i = 0; i < 8; i++)
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 38319
diff changeset
70 CHECK_NUMBER (XVECTOR (registers)->contents[i]);
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71
14070
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
72 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
73 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
74 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
75 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
76 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
77 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
78 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
79 inregs.x.flags = (unsigned long) XFASTINT (XVECTOR (registers)->contents[7]);
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 int86 (no, &inregs, &outregs);
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 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
84 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
85 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
86 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
87 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
88 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
89 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
90 XVECTOR (registers)->contents[7] = make_number (outregs.x.flags);
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91
14070
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
92 return registers;
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93 }
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
95 DEFUN ("msdos-memget", Fdos_memget, Sdos_memget, 2, 2, 0,
41914
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
96 doc: /* Read DOS memory at offset ADDRESS into VECTOR.
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
97 Return the updated VECTOR. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109162
diff changeset
98 (Lisp_Object address, Lisp_Object vector)
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
99 {
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
100 register int i;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
101 int offs, len;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
102 char *buf;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
103
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 38319
diff changeset
104 CHECK_NUMBER (address);
14070
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);
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 38319
diff changeset
106 CHECK_VECTOR (vector);
14070
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
107 len = XVECTOR (vector)-> size;
58012
934f6fb6fd8a * dosfns.c (Fdos_memget, Fdos_memput): Use integer variable offs in
Jan Djärv <jan.h.d@swipnet.se>
parents: 52401
diff changeset
108 if (len < 1 || len > 2048 || offs < 0 || offs > 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);
45331
425d5cebd73c Fix whitespace.
Eli Zaretskii <eliz@gnu.org>
parents: 43713
diff changeset
112
13180
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,
41914
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
120 doc: /* Write DOS memory at offset ADDRESS from VECTOR. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109162
diff changeset
121 (Lisp_Object address, Lisp_Object vector)
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
122 {
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
123 register int i;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
124 int offs, len;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
125 char *buf;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
126
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 38319
diff changeset
127 CHECK_NUMBER (address);
14070
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
128 offs = (unsigned long) XINT (address);
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 38319
diff changeset
129 CHECK_VECTOR (vector);
14070
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
130 len = XVECTOR (vector)-> size;
58012
934f6fb6fd8a * dosfns.c (Fdos_memget, Fdos_memput): Use integer variable offs in
Jan Djärv <jan.h.d@swipnet.se>
parents: 52401
diff changeset
131 if (len < 1 || len > 2048 || offs < 0 || offs > 0xfffff - len)
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
132 return Qnil;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
133 buf = alloca (len);
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 for (i = 0; i < len; i++)
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
136 {
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 38319
diff changeset
137 CHECK_NUMBER (XVECTOR (vector)->contents[i]);
14070
c74bb6ea72ab (Fint86, Fdos_memget, Fdos_memput, Fmsdos_set_keyboard): Harmonize
Erik Naggum <erik@naggum.no>
parents: 13745
diff changeset
138 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
139 }
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
140
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
141 dosmemput (buf, len, offs);
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
142 return Qt;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
143 }
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
144
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
145 DEFUN ("msdos-set-keyboard", Fmsdos_set_keyboard, Smsdos_set_keyboard, 1, 2, 0,
41914
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
146 doc: /* Set keyboard layout according to COUNTRY-CODE.
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
147 If the optional argument ALLKEYS is non-nil, the keyboard is mapped for
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
148 all keys; otherwise it is only used when the ALT key is pressed.
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
149 The current keyboard layout is available in dos-keyboard-code. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109162
diff changeset
150 (Lisp_Object country_code, Lisp_Object allkeys)
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
151 {
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 38319
diff changeset
152 CHECK_NUMBER (country_code);
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
153 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
154 return Qnil;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
155 return Qt;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
156 }
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
157
9572
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
158 #ifndef HAVE_X_WINDOWS
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
159 /* 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
160 e.g., with respect to non-80 column screen modes. */
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
161
41914
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
162 DEFUN ("msdos-mouse-p", Fmsdos_mouse_p, Smsdos_mouse_p, 0, 0, 0,
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
163 doc: /* Report whether a mouse is present. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109162
diff changeset
164 (void)
9572
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
165 {
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
166 if (have_mouse)
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
167 return Qt;
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
168 else
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
169 return Qnil;
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 #endif
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
172
12990
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
173 DEFUN ("msdos-mouse-init", Fmsdos_mouse_init, Smsdos_mouse_init, 0, 0, "",
41914
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
174 doc: /* Initialize and enable mouse if available. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109162
diff changeset
175 (void)
12990
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
176 {
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
177 if (have_mouse)
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
178 {
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
179 have_mouse = 1;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
180 mouse_init ();
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
181 return Qt;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
182 }
12990
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
183 return Qnil;
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
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
186 DEFUN ("msdos-mouse-enable", Fmsdos_mouse_enable, Smsdos_mouse_enable, 0, 0, "",
41914
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
187 doc: /* Enable mouse if available. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109162
diff changeset
188 (void)
12990
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
189 {
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
190 if (have_mouse)
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
191 {
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
192 have_mouse = 1;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
193 mouse_on ();
12990
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 return have_mouse ? Qt : Qnil;
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
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
198 DEFUN ("msdos-mouse-disable", Fmsdos_mouse_disable, Smsdos_mouse_disable, 0, 0, "",
41914
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
199 doc: /* Disable mouse if available. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109162
diff changeset
200 (void)
12990
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
201 {
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
202 mouse_off ();
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
203 if (have_mouse) have_mouse = -1;
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
204 return 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
41914
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
207 DEFUN ("insert-startup-screen", Finsert_startup_screen, Sinsert_startup_screen, 0, 0, "",
73685
f25200449e7b (Finsert_startup_screen): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 68651
diff changeset
208 doc: /* Insert copy of screen contents prior to starting Emacs.
41914
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
209 Return nil if startup screen is not available. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109162
diff changeset
210 (void)
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
211 {
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
212 char *s;
45331
425d5cebd73c Fix whitespace.
Eli Zaretskii <eliz@gnu.org>
parents: 43713
diff changeset
213 int rows, cols, i, j;
425d5cebd73c Fix whitespace.
Eli Zaretskii <eliz@gnu.org>
parents: 43713
diff changeset
214
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
215 if (!dos_get_saved_screen (&s, &rows, &cols))
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
216 return Qnil;
45331
425d5cebd73c Fix whitespace.
Eli Zaretskii <eliz@gnu.org>
parents: 43713
diff changeset
217
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
218 for (i = 0; i < rows; i++)
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 for (j = 0; j < cols; j++)
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
221 {
19288
bdc4b7818976 (Finsert_startup_screen): Call `insert_char' with a single argument.
Richard M. Stallman <rms@gnu.org>
parents: 16335
diff changeset
222 insert_char (*s);
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
223 s += 2;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
224 }
19288
bdc4b7818976 (Finsert_startup_screen): Call `insert_char' with a single argument.
Richard M. Stallman <rms@gnu.org>
parents: 16335
diff changeset
225 insert_char ('\n');
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
226 }
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 return Qt;
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
229 }
9572
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
230
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
231 /* country info */
43713
f92c4d87863a Change defvar_int def and vars to use EMACS_INT instead of just int.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41914
diff changeset
232 EMACS_INT dos_country_code;
f92c4d87863a Change defvar_int def and vars to use EMACS_INT instead of just int.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41914
diff changeset
233 EMACS_INT dos_codepage;
f92c4d87863a Change defvar_int def and vars to use EMACS_INT instead of just int.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41914
diff changeset
234 EMACS_INT dos_timezone_offset;
f92c4d87863a Change defvar_int def and vars to use EMACS_INT instead of just int.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41914
diff changeset
235 EMACS_INT dos_decimal_point;
f92c4d87863a Change defvar_int def and vars to use EMACS_INT instead of just int.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41914
diff changeset
236 EMACS_INT dos_keyboard_layout;
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
237 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
238 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
239 0, 0, /* date format */
1f8ca0c4836f (init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents: 19288
diff changeset
240 '$', 0, 0, 0, 0, /* currency string */
1f8ca0c4836f (init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents: 19288
diff changeset
241 ',', 0, /* thousands separator */
1f8ca0c4836f (init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents: 19288
diff changeset
242 '.', 0, /* decimal separator */
1f8ca0c4836f (init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents: 19288
diff changeset
243 '/', 0, /* date separator */
1f8ca0c4836f (init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents: 19288
diff changeset
244 ':', 0, /* time separator */
1f8ca0c4836f (init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents: 19288
diff changeset
245 0, /* currency format */
1f8ca0c4836f (init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents: 19288
diff changeset
246 2, /* digits after decimal in currency */
1f8ca0c4836f (init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents: 19288
diff changeset
247 0, /* time format */
1f8ca0c4836f (init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents: 19288
diff changeset
248 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
249 ' ', 0, /* data-list separator (?) */
1f8ca0c4836f (init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents: 19288
diff changeset
250 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
251 };
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
252
43713
f92c4d87863a Change defvar_int def and vars to use EMACS_INT instead of just int.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41914
diff changeset
253 EMACS_INT dos_hyper_key;
f92c4d87863a Change defvar_int def and vars to use EMACS_INT instead of just int.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41914
diff changeset
254 EMACS_INT dos_super_key;
f92c4d87863a Change defvar_int def and vars to use EMACS_INT instead of just int.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41914
diff changeset
255 EMACS_INT dos_keypad_mode;
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
256
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
257 Lisp_Object Vdos_version;
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
258 Lisp_Object Vdos_display_scancodes;
20034
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
259
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
260 #ifndef HAVE_X_WINDOWS
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
261 static unsigned dos_windows_version;
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
262 Lisp_Object Vdos_windows_version;
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
263
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
264 char parent_vm_title[50]; /* Ralf Brown says 30 is enough */
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
265 int w95_set_virtual_machine_title (const char *);
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
266
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
267 void
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
268 restore_parent_vm_title (void)
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
269 {
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
270 if (NILP (Vdos_windows_version))
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
271 return;
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
272 if ((dos_windows_version & 0xff) >= 4 && parent_vm_title[0])
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
273 w95_set_virtual_machine_title (parent_vm_title);
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
274 delay (50);
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
275 }
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
276 #endif /* !HAVE_X_WINDOWS */
45331
425d5cebd73c Fix whitespace.
Eli Zaretskii <eliz@gnu.org>
parents: 43713
diff changeset
277
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
278 void
109162
8efd6d04c47a Convert function definitions in MS-DOS sources to ANSI C.
Eli Zaretskii <eliz@gnu.org>
parents: 107733
diff changeset
279 init_dosfns (void)
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 union REGS regs;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
282 _go32_dpmi_registers dpmiregs;
19294
1f8ca0c4836f (init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents: 19288
diff changeset
283 unsigned long xbuf = _go32_info_block.linear_address_of_transfer_buffer;
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
284
9572
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
285 #ifndef SYSTEM_MALLOC
109761
31def5db596a Fix -Wall compiler warnings in MSDOS sources.
Eli Zaretskii <eliz@gnu.org>
parents: 109179
diff changeset
286 extern void get_lim_data (void);
31def5db596a Fix -Wall compiler warnings in MSDOS sources.
Eli Zaretskii <eliz@gnu.org>
parents: 109179
diff changeset
287
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
288 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
289 #endif
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
290
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
291 regs.x.ax = 0x3000;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
292 intdos (&regs, &regs);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
293 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
294
19294
1f8ca0c4836f (init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents: 19288
diff changeset
295 /* 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
296 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
297 dpmiregs.x.ds = xbuf >> 4;
19294
1f8ca0c4836f (init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents: 19288
diff changeset
298 dpmiregs.x.dx = 0;
1f8ca0c4836f (init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents: 19288
diff changeset
299 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
300 _go32_dpmi_simulate_int (0x21, &dpmiregs);
1f8ca0c4836f (init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents: 19288
diff changeset
301 if (dpmiregs.x.flags & 1)
1f8ca0c4836f (init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents: 19288
diff changeset
302 {
1f8ca0c4836f (init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents: 19288
diff changeset
303 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
304 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
305 }
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
306 else
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
307 {
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
308 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
309 dosmemget (xbuf, DOS_COUNTRY_INFO, dos_country_info);
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
310 }
19294
1f8ca0c4836f (init_dosfns): Avoid calling DOS memory-allocation
Richard M. Stallman <rms@gnu.org>
parents: 19288
diff changeset
311
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
312 dos_set_keyboard (dos_country_code, 0);
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
313
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
314 regs.x.ax = 0x6601;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
315 intdos (&regs, &regs);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
316 if (regs.x.cflag)
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
317 /* Estimate code page from country code */
45331
425d5cebd73c Fix whitespace.
Eli Zaretskii <eliz@gnu.org>
parents: 43713
diff changeset
318 switch (dos_country_code)
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
319 {
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
320 case 45: /* Denmark */
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
321 case 47: /* Norway */
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
322 dos_codepage = 865;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
323 break;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
324 default:
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
325 /* US */
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
326 dos_codepage = 437;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
327 }
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
328 else
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
329 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
330
20034
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
331 #ifndef HAVE_X_WINDOWS
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
332 parent_vm_title[0] = '\0';
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
333
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
334 /* If we are running from DOS box on MS-Windows, get Windows version. */
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
335 dpmiregs.x.ax = 0x1600; /* enhanced mode installation check */
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
336 dpmiregs.x.ss = dpmiregs.x.sp = dpmiregs.x.flags = 0;
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
337 _go32_dpmi_simulate_int (0x2f, &dpmiregs);
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
338 /* We only support Windows-specific features when we run on Windows 9X
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
339 or on Windows 3.X/enhanced mode.
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
340
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
341 Int 2Fh/AX=1600h returns:
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
342
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
343 AL = 00: no Windows at all;
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
344 AL = 01: Windows/386 2.x;
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
345 AL = 80h: Windows 3.x in mode other than enhanced;
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
346 AL = FFh: Windows/386 2.x
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
347
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
348 We also check AH > 0 (Windows 3.1 or later), in case AL tricks us. */
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
349 if (dpmiregs.h.al > 2 && dpmiregs.h.al != 0x80 && dpmiregs.h.al != 0xff
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
350 && (dpmiregs.h.al > 3 || dpmiregs.h.ah > 0))
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
351 {
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
352 dos_windows_version = dpmiregs.x.ax;
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
353 Vdos_windows_version =
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
354 Fcons (make_number (dpmiregs.h.al), make_number (dpmiregs.h.ah));
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
355
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
356 /* Save the current title of this virtual machine, so we can restore
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
357 it before exiting. Otherwise, Windows 95 will continue to use
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
358 the title we set even after we are history, stupido... */
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
359 if (dpmiregs.h.al >= 4)
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
360 {
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
361 dpmiregs.x.ax = 0x168e;
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
362 dpmiregs.x.dx = 3; /* get VM title */
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
363 dpmiregs.x.cx = sizeof(parent_vm_title) - 1;
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
364 dpmiregs.x.es = __tb >> 4;
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
365 dpmiregs.x.di = __tb & 15;
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
366 dpmiregs.x.sp = dpmiregs.x.ss = dpmiregs.x.flags = 0;
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
367 _go32_dpmi_simulate_int (0x2f, &dpmiregs);
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
368 if (dpmiregs.x.ax == 1)
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
369 dosmemget (__tb, sizeof(parent_vm_title), parent_vm_title);
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
370 }
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
371 }
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
372 else
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
373 {
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
374 dos_windows_version = 0;
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
375 Vdos_windows_version = Qnil;
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
376 }
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
377 #endif /* !HAVE_X_WINDOWS */
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
378
16335
6cf0a8b5c895 (init_dosfns): When setting `__opendir_flags' value,
Richard M. Stallman <rms@gnu.org>
parents: 15393
diff changeset
379 /* 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
380 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
381 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
382 __opendir_flags = __OPENDIR_FIND_HIDDEN;
15226
31a30cc1d61a (init_dosfns) [DJGPP >= 2]: Make `opendir' preserve
Richard M. Stallman <rms@gnu.org>
parents: 15173
diff changeset
383
16335
6cf0a8b5c895 (init_dosfns): When setting `__opendir_flags' value,
Richard M. Stallman <rms@gnu.org>
parents: 15393
diff changeset
384 #if __DJGPP_MINOR__ == 0
6cf0a8b5c895 (init_dosfns): When setting `__opendir_flags' value,
Richard M. Stallman <rms@gnu.org>
parents: 15393
diff changeset
385 /* 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
386 (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
387 if (!NILP (Fmsdos_long_file_names ()))
31a30cc1d61a (init_dosfns) [DJGPP >= 2]: Make `opendir' preserve
Richard M. Stallman <rms@gnu.org>
parents: 15173
diff changeset
388 __opendir_flags |= __OPENDIR_PRESERVE_CASE;
16335
6cf0a8b5c895 (init_dosfns): When setting `__opendir_flags' value,
Richard M. Stallman <rms@gnu.org>
parents: 15393
diff changeset
389 #endif /* __DJGPP_MINOR__ == 0 */
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
390 }
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
391
20034
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
392 #ifndef HAVE_X_WINDOWS
25113
73c54061f4bb (msdos_stdcolor_name, msdos_stdcolor_idx): New
Eli Zaretskii <eliz@gnu.org>
parents: 23814
diff changeset
393
73c54061f4bb (msdos_stdcolor_name, msdos_stdcolor_idx): New
Eli Zaretskii <eliz@gnu.org>
parents: 23814
diff changeset
394 /* Emulation of some X window features from xfns.c and xfaces.c. */
73c54061f4bb (msdos_stdcolor_name, msdos_stdcolor_idx): New
Eli Zaretskii <eliz@gnu.org>
parents: 23814
diff changeset
395
73c54061f4bb (msdos_stdcolor_name, msdos_stdcolor_idx): New
Eli Zaretskii <eliz@gnu.org>
parents: 23814
diff changeset
396 /* Standard VGA colors, in the order of their standard numbering
73c54061f4bb (msdos_stdcolor_name, msdos_stdcolor_idx): New
Eli Zaretskii <eliz@gnu.org>
parents: 23814
diff changeset
397 in the default VGA palette. */
73c54061f4bb (msdos_stdcolor_name, msdos_stdcolor_idx): New
Eli Zaretskii <eliz@gnu.org>
parents: 23814
diff changeset
398 static char *vga_colors[16] = {
73c54061f4bb (msdos_stdcolor_name, msdos_stdcolor_idx): New
Eli Zaretskii <eliz@gnu.org>
parents: 23814
diff changeset
399 "black", "blue", "green", "cyan", "red", "magenta", "brown",
73c54061f4bb (msdos_stdcolor_name, msdos_stdcolor_idx): New
Eli Zaretskii <eliz@gnu.org>
parents: 23814
diff changeset
400 "lightgray", "darkgray", "lightblue", "lightgreen", "lightcyan",
73c54061f4bb (msdos_stdcolor_name, msdos_stdcolor_idx): New
Eli Zaretskii <eliz@gnu.org>
parents: 23814
diff changeset
401 "lightred", "lightmagenta", "yellow", "white"
73c54061f4bb (msdos_stdcolor_name, msdos_stdcolor_idx): New
Eli Zaretskii <eliz@gnu.org>
parents: 23814
diff changeset
402 };
73c54061f4bb (msdos_stdcolor_name, msdos_stdcolor_idx): New
Eli Zaretskii <eliz@gnu.org>
parents: 23814
diff changeset
403
73c54061f4bb (msdos_stdcolor_name, msdos_stdcolor_idx): New
Eli Zaretskii <eliz@gnu.org>
parents: 23814
diff changeset
404 /* Given a color name, return its index, or -1 if not found. Note
73c54061f4bb (msdos_stdcolor_name, msdos_stdcolor_idx): New
Eli Zaretskii <eliz@gnu.org>
parents: 23814
diff changeset
405 that this only performs case-insensitive comparison against the
73c54061f4bb (msdos_stdcolor_name, msdos_stdcolor_idx): New
Eli Zaretskii <eliz@gnu.org>
parents: 23814
diff changeset
406 standard names. For anything more sophisticated, like matching
73c54061f4bb (msdos_stdcolor_name, msdos_stdcolor_idx): New
Eli Zaretskii <eliz@gnu.org>
parents: 23814
diff changeset
407 "gray" with "grey" or translating X color names into their MSDOS
26729
f5dded41adcc Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents: 25212
diff changeset
408 equivalents, call the Lisp function Qtty_color_desc (defined
f5dded41adcc Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents: 25212
diff changeset
409 on lisp/term/tty-colors.el). */
25113
73c54061f4bb (msdos_stdcolor_name, msdos_stdcolor_idx): New
Eli Zaretskii <eliz@gnu.org>
parents: 23814
diff changeset
410 int
73c54061f4bb (msdos_stdcolor_name, msdos_stdcolor_idx): New
Eli Zaretskii <eliz@gnu.org>
parents: 23814
diff changeset
411 msdos_stdcolor_idx (const char *name)
73c54061f4bb (msdos_stdcolor_name, msdos_stdcolor_idx): New
Eli Zaretskii <eliz@gnu.org>
parents: 23814
diff changeset
412 {
73c54061f4bb (msdos_stdcolor_name, msdos_stdcolor_idx): New
Eli Zaretskii <eliz@gnu.org>
parents: 23814
diff changeset
413 int i;
73c54061f4bb (msdos_stdcolor_name, msdos_stdcolor_idx): New
Eli Zaretskii <eliz@gnu.org>
parents: 23814
diff changeset
414
73c54061f4bb (msdos_stdcolor_name, msdos_stdcolor_idx): New
Eli Zaretskii <eliz@gnu.org>
parents: 23814
diff changeset
415 for (i = 0; i < sizeof (vga_colors) / sizeof (vga_colors[0]); i++)
95209
6758d4235380 * dispextern.h, xfaces.c (xstrcasecmp): Renamed from xstricmp.
Jason Rumney <jasonr@gnu.org>
parents: 95205
diff changeset
416 if (xstrcasecmp (name, vga_colors[i]) == 0)
25113
73c54061f4bb (msdos_stdcolor_name, msdos_stdcolor_idx): New
Eli Zaretskii <eliz@gnu.org>
parents: 23814
diff changeset
417 return i;
73c54061f4bb (msdos_stdcolor_name, msdos_stdcolor_idx): New
Eli Zaretskii <eliz@gnu.org>
parents: 23814
diff changeset
418
26902
264b83a3a688 Changes for separate unspecified foreground and background colors
Eli Zaretskii <eliz@gnu.org>
parents: 26729
diff changeset
419 return
27115
13a2c64e6ade (unspecified_colors): Remove.
Eli Zaretskii <eliz@gnu.org>
parents: 26902
diff changeset
420 strcmp (name, unspecified_fg) == 0 ? FACE_TTY_DEFAULT_FG_COLOR
13a2c64e6ade (unspecified_colors): Remove.
Eli Zaretskii <eliz@gnu.org>
parents: 26902
diff changeset
421 : strcmp (name, unspecified_bg) == 0 ? FACE_TTY_DEFAULT_BG_COLOR
26902
264b83a3a688 Changes for separate unspecified foreground and background colors
Eli Zaretskii <eliz@gnu.org>
parents: 26729
diff changeset
422 : FACE_TTY_DEFAULT_COLOR;
25113
73c54061f4bb (msdos_stdcolor_name, msdos_stdcolor_idx): New
Eli Zaretskii <eliz@gnu.org>
parents: 23814
diff changeset
423 }
73c54061f4bb (msdos_stdcolor_name, msdos_stdcolor_idx): New
Eli Zaretskii <eliz@gnu.org>
parents: 23814
diff changeset
424
73c54061f4bb (msdos_stdcolor_name, msdos_stdcolor_idx): New
Eli Zaretskii <eliz@gnu.org>
parents: 23814
diff changeset
425 /* Given a color index, return its standard name. */
26729
f5dded41adcc Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents: 25212
diff changeset
426 Lisp_Object
25113
73c54061f4bb (msdos_stdcolor_name, msdos_stdcolor_idx): New
Eli Zaretskii <eliz@gnu.org>
parents: 23814
diff changeset
427 msdos_stdcolor_name (int idx)
73c54061f4bb (msdos_stdcolor_name, msdos_stdcolor_idx): New
Eli Zaretskii <eliz@gnu.org>
parents: 23814
diff changeset
428 {
27115
13a2c64e6ade (unspecified_colors): Remove.
Eli Zaretskii <eliz@gnu.org>
parents: 26902
diff changeset
429 extern Lisp_Object Qunspecified;
26729
f5dded41adcc Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents: 25212
diff changeset
430
27115
13a2c64e6ade (unspecified_colors): Remove.
Eli Zaretskii <eliz@gnu.org>
parents: 26902
diff changeset
431 if (idx == FACE_TTY_DEFAULT_FG_COLOR)
13a2c64e6ade (unspecified_colors): Remove.
Eli Zaretskii <eliz@gnu.org>
parents: 26902
diff changeset
432 return build_string (unspecified_fg);
13a2c64e6ade (unspecified_colors): Remove.
Eli Zaretskii <eliz@gnu.org>
parents: 26902
diff changeset
433 else if (idx == FACE_TTY_DEFAULT_BG_COLOR)
13a2c64e6ade (unspecified_colors): Remove.
Eli Zaretskii <eliz@gnu.org>
parents: 26902
diff changeset
434 return build_string (unspecified_bg);
13a2c64e6ade (unspecified_colors): Remove.
Eli Zaretskii <eliz@gnu.org>
parents: 26902
diff changeset
435 else if (idx >= 0 && idx < sizeof (vga_colors) / sizeof (vga_colors[0]))
13a2c64e6ade (unspecified_colors): Remove.
Eli Zaretskii <eliz@gnu.org>
parents: 26902
diff changeset
436 return build_string (vga_colors[idx]);
13a2c64e6ade (unspecified_colors): Remove.
Eli Zaretskii <eliz@gnu.org>
parents: 26902
diff changeset
437 else
13a2c64e6ade (unspecified_colors): Remove.
Eli Zaretskii <eliz@gnu.org>
parents: 26902
diff changeset
438 return Qunspecified; /* meaning the default */
25113
73c54061f4bb (msdos_stdcolor_name, msdos_stdcolor_idx): New
Eli Zaretskii <eliz@gnu.org>
parents: 23814
diff changeset
439 }
73c54061f4bb (msdos_stdcolor_name, msdos_stdcolor_idx): New
Eli Zaretskii <eliz@gnu.org>
parents: 23814
diff changeset
440
20034
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
441 /* Support for features that are available when we run in a DOS box
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
442 on MS-Windows. */
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
443 int
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
444 ms_windows_version (void)
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
445 {
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
446 return dos_windows_version;
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
447 }
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
448
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
449 /* Set the title of the current virtual machine, to appear on
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
450 the caption bar of that machine's window. */
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
451
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
452 int
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
453 w95_set_virtual_machine_title (const char *title_string)
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
454 {
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
455 /* Only Windows 9X (version 4 and higher) support this function. */
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
456 if (!NILP (Vdos_windows_version)
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
457 && (dos_windows_version & 0xff) >= 4)
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
458 {
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
459 _go32_dpmi_registers regs;
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
460 dosmemput (title_string, strlen (title_string) + 1, __tb);
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
461 regs.x.ax = 0x168e;
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
462 regs.x.dx = 1;
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
463 regs.x.es = __tb >> 4;
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
464 regs.x.di = __tb & 15;
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
465 regs.x.sp = regs.x.ss = regs.x.flags = 0;
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
466 _go32_dpmi_simulate_int (0x2f, &regs);
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
467 return regs.x.ax == 1;
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
468 }
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
469 return 0;
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
470 }
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
471
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
472 /* Change the title of frame F to NAME.
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
473 If NAME is nil, use the frame name as the title.
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
474
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
475 If Emacs is not run from a DOS box on Windows 9X, this only
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
476 sets the name in the frame struct, but has no other effects. */
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
477
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
478 void
109162
8efd6d04c47a Convert function definitions in MS-DOS sources to ANSI C.
Eli Zaretskii <eliz@gnu.org>
parents: 107733
diff changeset
479 x_set_title (struct frame *f, Lisp_Object name)
20034
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
480 {
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
481 /* Don't change the title if it's already NAME. */
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
482 if (EQ (name, f->title))
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
483 return;
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
484
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
485 update_mode_lines = 1;
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
486
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
487 f->title = name;
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
488
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
489 if (NILP (name))
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
490 name = f->name;
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
491
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
492 if (FRAME_MSDOS_P (f))
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
493 {
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
494 BLOCK_INPUT;
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45331
diff changeset
495 w95_set_virtual_machine_title (SDATA (name));
20034
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
496 UNBLOCK_INPUT;
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
497 }
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
498 }
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
499 #endif /* !HAVE_X_WINDOWS */
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
500
34348
5cd770204501 (Ffile_system_info): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 32544
diff changeset
501 DEFUN ("file-system-info", Ffile_system_info, Sfile_system_info, 1, 1, 0,
41914
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
502 doc: /* Return storage information about the file system FILENAME is on.
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
503 Value is a list of floats (TOTAL FREE AVAIL), where TOTAL is the total
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
504 storage of the file system, FREE is the free storage, and AVAIL is the
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
505 storage available to a non-superuser. All 3 numbers are in bytes.
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
506 If the underlying system call fails, value is nil. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109162
diff changeset
507 (Lisp_Object filename)
34348
5cd770204501 (Ffile_system_info): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 32544
diff changeset
508 {
5cd770204501 (Ffile_system_info): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 32544
diff changeset
509 struct statfs stfs;
5cd770204501 (Ffile_system_info): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 32544
diff changeset
510 Lisp_Object encoded, value;
5cd770204501 (Ffile_system_info): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 32544
diff changeset
511
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 38319
diff changeset
512 CHECK_STRING (filename);
34348
5cd770204501 (Ffile_system_info): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 32544
diff changeset
513 filename = Fexpand_file_name (filename, Qnil);
5cd770204501 (Ffile_system_info): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 32544
diff changeset
514 encoded = ENCODE_FILE (filename);
5cd770204501 (Ffile_system_info): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 32544
diff changeset
515
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45331
diff changeset
516 if (statfs (SDATA (encoded), &stfs))
34348
5cd770204501 (Ffile_system_info): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 32544
diff changeset
517 value = Qnil;
5cd770204501 (Ffile_system_info): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 32544
diff changeset
518 else
5cd770204501 (Ffile_system_info): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 32544
diff changeset
519 value = list3 (make_float ((double) stfs.f_bsize * stfs.f_blocks),
5cd770204501 (Ffile_system_info): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 32544
diff changeset
520 make_float ((double) stfs.f_bsize * stfs.f_bfree),
5cd770204501 (Ffile_system_info): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 32544
diff changeset
521 make_float ((double) stfs.f_bsize * stfs.f_bavail));
5cd770204501 (Ffile_system_info): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 32544
diff changeset
522
5cd770204501 (Ffile_system_info): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 32544
diff changeset
523 return value;
5cd770204501 (Ffile_system_info): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 32544
diff changeset
524 }
5cd770204501 (Ffile_system_info): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 32544
diff changeset
525
100859
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
526 /* System depended enumeration of and access to system processes a-la
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
527 ps(1). Here, we only return info about the running Emacs process.
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
528 (There are no other processes on DOS, right?) */
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
529
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
530 Lisp_Object
109162
8efd6d04c47a Convert function definitions in MS-DOS sources to ANSI C.
Eli Zaretskii <eliz@gnu.org>
parents: 107733
diff changeset
531 list_system_processes (void)
100859
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
532 {
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
533 Lisp_Object proclist = Qnil;
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
534
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
535 proclist = Fcons (make_fixnum_or_float (getpid ()), proclist);
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
536
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
537 return proclist;
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
538 }
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
539
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
540 Lisp_Object
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
541 system_process_attributes (Lisp_Object pid)
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
542 {
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
543 int proc_id;
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
544 Lisp_Object attrs = Qnil;
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
545
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
546 CHECK_NUMBER_OR_FLOAT (pid);
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
547 proc_id = FLOATP (pid) ? XFLOAT_DATA (pid) : XINT (pid);
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
548
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
549 if (proc_id == getpid ())
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
550 {
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
551 EMACS_INT uid, gid;
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
552 char *usr;
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
553 struct group *gr;
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
554 char cmd[FILENAME_MAX];
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
555 char *cmdline = NULL, *p, *q;
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
556 size_t cmdline_size = 0;
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
557 int i;
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
558 Lisp_Object cmd_str, decoded_cmd, tem;
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
559 double pmem;
109761
31def5db596a Fix -Wall compiler warnings in MSDOS sources.
Eli Zaretskii <eliz@gnu.org>
parents: 109179
diff changeset
560 EXFUN (Fget_internal_run_time, 0);
102838
a722c792ebd7 (system_process_attributes) [SYSTEM_MALLOC]: Don't call ret_lim_data.
Eli Zaretskii <eliz@gnu.org>
parents: 100859
diff changeset
561 #ifndef SYSTEM_MALLOC
100859
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
562 extern unsigned long ret_lim_data ();
102838
a722c792ebd7 (system_process_attributes) [SYSTEM_MALLOC]: Don't call ret_lim_data.
Eli Zaretskii <eliz@gnu.org>
parents: 100859
diff changeset
563 #endif
100859
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
564
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
565 uid = getuid ();
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
566 attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (uid)), attrs);
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
567 usr = getlogin ();
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
568 if (usr)
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
569 attrs = Fcons (Fcons (Quser, build_string (usr)), attrs);
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
570 gid = getgid ();
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
571 attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (gid)), attrs);
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
572 gr = getgrgid (gid);
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
573 if (gr)
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
574 attrs = Fcons (Fcons (Qgroup, build_string (gr->gr_name)), attrs);
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
575 strcpy (cmd, basename (__crt0_argv[0]));
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
576 /* Command name is encoded in locale-coding-system; decode it. */
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
577 cmd_str = make_unibyte_string (cmd, strlen (cmd));
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
578 decoded_cmd = code_convert_string_norecord (cmd_str,
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
579 Vlocale_coding_system, 0);
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
580 attrs = Fcons (Fcons (Qcomm, decoded_cmd), attrs);
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
581 /* Pretend we have 0 as PPID. */
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
582 attrs = Fcons (Fcons (Qppid, make_number (0)), attrs);
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
583 attrs = Fcons (Fcons (Qpgrp, pid), attrs);
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
584 attrs = Fcons (Fcons (Qttname, build_string ("/dev/tty")), attrs);
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
585 /* We are never idle! */
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
586 tem = Fget_internal_run_time ();
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
587 attrs = Fcons (Fcons (Qtime, tem), attrs);
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
588 attrs = Fcons (Fcons (Qthcount, make_number (1)), attrs);
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
589 attrs = Fcons (Fcons (Qstart,
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
590 Fsymbol_value (intern ("before-init-time"))),
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
591 attrs);
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
592 attrs = Fcons (Fcons (Qvsize,
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
593 make_fixnum_or_float ((unsigned long)sbrk(0)/1024)),
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
594 attrs);
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
595 attrs = Fcons (Fcons (Qetime, tem), attrs);
102838
a722c792ebd7 (system_process_attributes) [SYSTEM_MALLOC]: Don't call ret_lim_data.
Eli Zaretskii <eliz@gnu.org>
parents: 100859
diff changeset
596 #ifndef SYSTEM_MALLOC
a722c792ebd7 (system_process_attributes) [SYSTEM_MALLOC]: Don't call ret_lim_data.
Eli Zaretskii <eliz@gnu.org>
parents: 100859
diff changeset
597 /* ret_lim_data is on vm-limit.c, which is not compiled in under
a722c792ebd7 (system_process_attributes) [SYSTEM_MALLOC]: Don't call ret_lim_data.
Eli Zaretskii <eliz@gnu.org>
parents: 100859
diff changeset
598 SYSTEM_MALLOC. */
100859
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
599 pmem = (double)((unsigned long) sbrk (0)) / ret_lim_data () * 100.0;
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
600 if (pmem > 100)
102838
a722c792ebd7 (system_process_attributes) [SYSTEM_MALLOC]: Don't call ret_lim_data.
Eli Zaretskii <eliz@gnu.org>
parents: 100859
diff changeset
601 #endif
100859
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
602 pmem = 100;
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
603 attrs = Fcons (Fcons (Qpmem, make_float (pmem)), attrs);
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
604 /* Pass 1: Count how much storage we need. */
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
605 for (i = 0; i < __crt0_argc; i++)
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
606 {
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
607 cmdline_size += strlen (__crt0_argv[i]) + 1; /* +1 for blank delim */
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
608 if (strpbrk (__crt0_argv[i], " \t\n\r\v\f"))
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
609 {
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
610 cmdline_size += 2;
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
611 for (p = __crt0_argv[i]; *p; p++)
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
612 {
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
613 if (*p == '"')
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
614 cmdline_size++;
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
615 }
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
616 }
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
617 }
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
618 /* Pass 2: Allocate storage and concatenate argv[]. */
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
619 cmdline = xmalloc (cmdline_size + 1);
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
620 for (i = 0, q = cmdline; i < __crt0_argc; i++)
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
621 {
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
622 if (strpbrk (__crt0_argv[i], " \t\n\r\v\f"))
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
623 {
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
624 *q++ = '"';
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
625 for (p = __crt0_argv[i]; *p; p++)
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
626 {
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
627 if (*p == '\"')
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
628 *q++ = '\\';
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
629 *q++ = *p;
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
630 }
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
631 *q++ = '"';
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
632 }
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
633 else
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
634 {
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
635 strcpy (q, __crt0_argv[i]);
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
636 q += strlen (__crt0_argv[i]);
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
637 }
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
638 *q++ = ' ';
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
639 }
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
640 /* Remove the trailing blank. */
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
641 if (q > cmdline)
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
642 q[-1] = '\0';
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
643
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
644 /* Command line is encoded in locale-coding-system; decode it. */
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
645 cmd_str = make_unibyte_string (cmdline, strlen (cmdline));
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
646 decoded_cmd = code_convert_string_norecord (cmd_str,
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
647 Vlocale_coding_system, 0);
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
648 xfree (cmdline);
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
649 attrs = Fcons (Fcons (Qargs, decoded_cmd), attrs);
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
650 }
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
651
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
652 return attrs;
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
653 }
bb7058ae1991 (system_process_attributes, list_system_processes): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 99540
diff changeset
654
20034
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
655 void
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
656 dos_cleanup (void)
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
657 {
97653
8e2483da8823 Include frame.h before termhooks.h.
Eli Zaretskii <eliz@gnu.org>
parents: 95209
diff changeset
658 struct tty_display_info *tty;
8e2483da8823 Include frame.h before termhooks.h.
Eli Zaretskii <eliz@gnu.org>
parents: 95209
diff changeset
659
20034
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
660 #ifndef HAVE_X_WINDOWS
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
661 restore_parent_vm_title ();
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
662 #endif
23814
3229c65a13c5 (dos_cleanup): Flush and fsync the termscript stream.
Eli Zaretskii <eliz@gnu.org>
parents: 21430
diff changeset
663 /* Make sure the termscript file is committed, in case we are
3229c65a13c5 (dos_cleanup): Flush and fsync the termscript stream.
Eli Zaretskii <eliz@gnu.org>
parents: 21430
diff changeset
664 crashing and some vital info was written there. */
97653
8e2483da8823 Include frame.h before termhooks.h.
Eli Zaretskii <eliz@gnu.org>
parents: 95209
diff changeset
665 if (FRAMEP (selected_frame))
23814
3229c65a13c5 (dos_cleanup): Flush and fsync the termscript stream.
Eli Zaretskii <eliz@gnu.org>
parents: 21430
diff changeset
666 {
97653
8e2483da8823 Include frame.h before termhooks.h.
Eli Zaretskii <eliz@gnu.org>
parents: 95209
diff changeset
667 struct frame *sf = XFRAME (selected_frame);
8e2483da8823 Include frame.h before termhooks.h.
Eli Zaretskii <eliz@gnu.org>
parents: 95209
diff changeset
668
8e2483da8823 Include frame.h before termhooks.h.
Eli Zaretskii <eliz@gnu.org>
parents: 95209
diff changeset
669 if (FRAME_LIVE_P (sf)
8e2483da8823 Include frame.h before termhooks.h.
Eli Zaretskii <eliz@gnu.org>
parents: 95209
diff changeset
670 && (FRAME_MSDOS_P (sf) || FRAME_TERMCAP_P (sf)))
8e2483da8823 Include frame.h before termhooks.h.
Eli Zaretskii <eliz@gnu.org>
parents: 95209
diff changeset
671 {
8e2483da8823 Include frame.h before termhooks.h.
Eli Zaretskii <eliz@gnu.org>
parents: 95209
diff changeset
672 tty = CURTTY ();
8e2483da8823 Include frame.h before termhooks.h.
Eli Zaretskii <eliz@gnu.org>
parents: 95209
diff changeset
673 if (tty->termscript)
8e2483da8823 Include frame.h before termhooks.h.
Eli Zaretskii <eliz@gnu.org>
parents: 95209
diff changeset
674 {
8e2483da8823 Include frame.h before termhooks.h.
Eli Zaretskii <eliz@gnu.org>
parents: 95209
diff changeset
675 fflush (tty->termscript);
8e2483da8823 Include frame.h before termhooks.h.
Eli Zaretskii <eliz@gnu.org>
parents: 95209
diff changeset
676 fsync (fileno (tty->termscript));
8e2483da8823 Include frame.h before termhooks.h.
Eli Zaretskii <eliz@gnu.org>
parents: 95209
diff changeset
677 }
8e2483da8823 Include frame.h before termhooks.h.
Eli Zaretskii <eliz@gnu.org>
parents: 95209
diff changeset
678 }
23814
3229c65a13c5 (dos_cleanup): Flush and fsync the termscript stream.
Eli Zaretskii <eliz@gnu.org>
parents: 21430
diff changeset
679 }
20034
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
680 }
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
681
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
682 /*
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
683 * Define everything
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
684 */
109162
8efd6d04c47a Convert function definitions in MS-DOS sources to ANSI C.
Eli Zaretskii <eliz@gnu.org>
parents: 107733
diff changeset
685 void
8efd6d04c47a Convert function definitions in MS-DOS sources to ANSI C.
Eli Zaretskii <eliz@gnu.org>
parents: 107733
diff changeset
686 syms_of_dosfns (void)
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
687 {
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
688 defsubr (&Sint86);
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
689 defsubr (&Sdos_memget);
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
690 defsubr (&Sdos_memput);
12990
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
691 defsubr (&Smsdos_mouse_init);
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
692 defsubr (&Smsdos_mouse_enable);
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
693 defsubr (&Smsdos_set_keyboard);
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
694 defsubr (&Sinsert_startup_screen);
12990
93cc41315528 (Fmsdos_mouse_enable, Fmsdos_mouse_disable)
Richard M. Stallman <rms@gnu.org>
parents: 10504
diff changeset
695 defsubr (&Smsdos_mouse_disable);
34348
5cd770204501 (Ffile_system_info): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 32544
diff changeset
696 defsubr (&Sfile_system_info);
9572
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
697 #ifndef HAVE_X_WINDOWS
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
698 defsubr (&Smsdos_mouse_p);
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
699 #endif
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
700
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
701 DEFVAR_INT ("dos-country-code", &dos_country_code,
41914
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
702 doc: /* The country code returned by Dos when Emacs was started.
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
703 Usually this is the international telephone prefix. */);
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
704
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
705 DEFVAR_INT ("dos-codepage", &dos_codepage,
41914
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
706 doc: /* The codepage active when Emacs was started.
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
707 The following are known:
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
708 437 United States
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
709 850 Multilingual (Latin I)
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
710 852 Slavic (Latin II)
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
711 857 Turkish
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
712 860 Portugal
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
713 861 Iceland
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
714 863 Canada (French)
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
715 865 Norway/Denmark */);
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
716
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
717 DEFVAR_INT ("dos-timezone-offset", &dos_timezone_offset,
41914
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
718 doc: /* The current timezone offset to UTC in minutes.
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
719 Implicitly modified when the TZ variable is changed. */);
45331
425d5cebd73c Fix whitespace.
Eli Zaretskii <eliz@gnu.org>
parents: 43713
diff changeset
720
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
721 DEFVAR_LISP ("dos-version", &Vdos_version,
41914
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
722 doc: /* 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
723
20034
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
724 #ifndef HAVE_X_WINDOWS
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
725 DEFVAR_LISP ("dos-windows-version", &Vdos_windows_version,
41914
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
726 doc: /* The (MAJOR . MINOR) Windows version for DOS session on MS-Windows. */);
20034
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
727 #endif
674d7beabce0 (__tb): Define.
Eli Zaretskii <eliz@gnu.org>
parents: 19294
diff changeset
728
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
729 DEFVAR_LISP ("dos-display-scancodes", &Vdos_display_scancodes,
41914
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
730 doc: /* *Controls whether DOS raw keyboard events are displayed as you type.
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
731 When non-nil, the keyboard scan-codes are displayed at the bottom right
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
732 corner of the display (typically at the end of the mode line).
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
733 The output format is: scan code:char code*modifiers. */);
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
734
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
735 Vdos_display_scancodes = Qnil;
45331
425d5cebd73c Fix whitespace.
Eli Zaretskii <eliz@gnu.org>
parents: 43713
diff changeset
736
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
737 DEFVAR_INT ("dos-hyper-key", &dos_hyper_key,
41914
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
738 doc: /* *If set to 1, use right ALT key as hyper key.
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
739 If set to 2, use right CTRL key as hyper key. */);
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
740 dos_hyper_key = 0;
45331
425d5cebd73c Fix whitespace.
Eli Zaretskii <eliz@gnu.org>
parents: 43713
diff changeset
741
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
742 DEFVAR_INT ("dos-super-key", &dos_super_key,
41914
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
743 doc: /* *If set to 1, use right ALT key as super key.
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
744 If set to 2, use right CTRL key as super key. */);
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
745 dos_super_key = 0;
45331
425d5cebd73c Fix whitespace.
Eli Zaretskii <eliz@gnu.org>
parents: 43713
diff changeset
746
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
747 DEFVAR_INT ("dos-keypad-mode", &dos_keypad_mode,
41914
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
748 doc: /* *Controls what key code is returned by a key in the numeric keypad.
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
749 The `numlock ON' action is only taken if no modifier keys are pressed.
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
750 The value is an integer constructed by adding the following bits together:
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
751
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
752 0x00 Digit key returns digit (if numlock ON)
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
753 0x01 Digit key returns kp-digit (if numlock ON)
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
754 0x02 Digit key returns M-digit (if numlock ON)
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
755 0x03 Digit key returns edit key (if numlock ON)
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
756
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
757 0x00 Grey key returns char (if numlock ON)
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
758 0x04 Grey key returns kp-key (if numlock ON)
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
759
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
760 0x00 Digit key returns digit (if numlock OFF)
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
761 0x10 Digit key returns kp-digit (if numlock OFF)
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
762 0x20 Digit key returns M-digit (if numlock OFF)
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
763 0x30 Digit key returns edit key (if numlock OFF)
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
764
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
765 0x00 Grey key returns char (if numlock OFF)
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
766 0x40 Grey key returns kp-key (if numlock OFF)
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
767
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
768 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
769 dos_keypad_mode = 0x75;
45331
425d5cebd73c Fix whitespace.
Eli Zaretskii <eliz@gnu.org>
parents: 43713
diff changeset
770
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
771 DEFVAR_INT ("dos-keyboard-layout", &dos_keyboard_layout,
41914
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
772 doc: /* Contains the country code for the current keyboard layout.
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
773 Use msdos-set-keyboard to select another keyboard layout. */);
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
774 dos_keyboard_layout = 1; /* US */
45331
425d5cebd73c Fix whitespace.
Eli Zaretskii <eliz@gnu.org>
parents: 43713
diff changeset
775
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
776 DEFVAR_INT ("dos-decimal-point", &dos_decimal_point,
41914
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
777 doc: /* The character to produce when kp-decimal key is pressed.
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
778 If non-zero, this variable contains the character to be returned when the
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
779 decimal point key in the numeric keypad is pressed when Num Lock is on.
ee8ae85f22ae Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 41912
diff changeset
780 If zero, the decimal point key returns the country code specific value. */);
13180
59663cba4b02 (insert-startup-screen): New function.
Kim F. Storm <storm@cua.dk>
parents: 12990
diff changeset
781 dos_decimal_point = 0;
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
782 }
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
783 #endif /* MSDOS */
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 46370
diff changeset
784
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 46370
diff changeset
785 /* arch-tag: f5ea8847-a014-42c9-83f5-7738ad640b17
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 46370
diff changeset
786 (do not change this comment) */