annotate src/dosfns.c @ 12328:dbc55496f684

(main): On MSDOS, don't change stdout to binary, and insist on an -o option.
author Richard M. Stallman <rms@gnu.org>
date Tue, 20 Jun 1995 02:52:38 +0000
parents 8a1bd0598b49
children 93cc41315528
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1 /* MS-DOS specific Lisp utilities. Coded by Manabu Higashida, 1991.
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2 Major changes May-July 1993 Morten Welinder (only 10% original code left)
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3 Copyright (C) 1991, 1993 Free Software Foundation, Inc.
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5 This file is part of GNU Emacs.
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7 GNU Emacs is free software; you can redistribute it and/or modify
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8 it under the terms of the GNU General Public License as published by
10504
8a1bd0598b49 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 9572
diff changeset
9 the Free Software Foundation; either version 2, or (at your option)
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10 any later version.
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 GNU Emacs is distributed in the hope that it will be useful,
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 GNU General Public License for more details.
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 along with GNU Emacs; see the file COPYING. If not, write to
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21
5980
a203b7c30300 Use <...> for config.h.
Richard M. Stallman <rms@gnu.org>
parents: 5503
diff changeset
22 #include <config.h>
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24 #ifdef MSDOS
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25 /* The entire file is within this conditional */
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27 #include <stdio.h>
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 #include <dos.h>
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 #include "lisp.h"
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30 #include "buffer.h"
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31 #include "termchar.h"
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32 #include "termhooks.h"
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33 #include "frame.h"
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34 #include "dosfns.h"
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 #include "msdos.h"
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36
7272
b5f74966c9da Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents: 5980
diff changeset
37 DEFUN ("mode25", Fmode25, Smode25, 0, 0, "", "\
b5f74966c9da Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents: 5980
diff changeset
38 Changes the number of rows to 25.")
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39 ()
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40 {
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41 union REGS regs;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42
7272
b5f74966c9da Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents: 5980
diff changeset
43 #ifdef HAVE_X_WINDOWS
b5f74966c9da Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents: 5980
diff changeset
44 if (!inhibit_window_system)
b5f74966c9da Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents: 5980
diff changeset
45 return Qnil;
b5f74966c9da Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents: 5980
diff changeset
46 #endif
b5f74966c9da Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents: 5980
diff changeset
47 if (have_mouse) mouse_off ();
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48 regs.x.ax = 3;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49 int86 (0x10, &regs, &regs);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50 regs.x.ax = 0x1101;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51 regs.h.bl = 0;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 int86 (0x10, &regs, &regs);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
53 regs.x.ax = 0x1200;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54 regs.h.bl = 32;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
55 int86 (0x10, &regs, &regs);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56 regs.x.ax = 3;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
57 int86 (0x10, &regs, &regs);
7272
b5f74966c9da Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents: 5980
diff changeset
58 Fset_frame_size (Fselected_frame (), ScreenCols (), ScreenRows ());
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59 Frecenter (Qnil);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60 Fredraw_display ();
7272
b5f74966c9da Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents: 5980
diff changeset
61 if (have_mouse) mouse_init ();
b5f74966c9da Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents: 5980
diff changeset
62 return Qnil;
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63 }
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64
7272
b5f74966c9da Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents: 5980
diff changeset
65 DEFUN ("mode4350", Fmode4350, Smode4350, 0, 0, "", "\
b5f74966c9da Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents: 5980
diff changeset
66 Changes the number of rows to 43 (EGA) or 50 (VGA).")
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67 ()
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68 {
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69 union REGS regs;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70
7272
b5f74966c9da Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents: 5980
diff changeset
71 #ifdef HAVE_X_WINDOWS
b5f74966c9da Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents: 5980
diff changeset
72 if (!inhibit_window_system)
b5f74966c9da Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents: 5980
diff changeset
73 return Qnil;
b5f74966c9da Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents: 5980
diff changeset
74 #endif
b5f74966c9da Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents: 5980
diff changeset
75 if (have_mouse) mouse_off ();
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76 regs.x.ax = 3;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77 int86 (0x10, &regs, &regs);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 regs.x.ax = 0x1112;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79 regs.h.bl = 0;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80 int86 (0x10, &regs, &regs);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 regs.x.ax = 0x1200;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82 regs.h.bl = 32;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83 int86 (0x10, &regs, &regs);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84 regs.x.ax = 0x0100;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85 regs.x.cx = 7;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86 int86 (0x10, &regs, &regs);
7272
b5f74966c9da Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents: 5980
diff changeset
87 Fset_frame_size (Fselected_frame (), ScreenCols (), ScreenRows ());
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88 Frecenter (Qnil);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89 Fredraw_display ();
7272
b5f74966c9da Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents: 5980
diff changeset
90 if (have_mouse) mouse_init ();
b5f74966c9da Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents: 5980
diff changeset
91 return Qnil;
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92 }
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 DEFUN ("int86", Fint86, Sint86, 2, 2, 0,
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95 "Call specific MSDOS interrupt number INTERRUPT with REGISTERS.\n\
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96 Return the updated REGISTER vector.\n\
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
97 \n\
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
98 INTERRUPT should be an integer in the range 0 to 255.\n\
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
99 REGISTERS should be a vector produced by `make-register' and\n\
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100 `set-register-value'.")
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101 (intno, regs)
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102 Lisp_Object intno, regs;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 {
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104 register int i;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105 int no;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 union REGS inregs, outregs;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107 Lisp_Object val;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109 CHECK_NUMBER (intno, 0);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110 no = (unsigned long) XINT (intno);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 CHECK_VECTOR (regs, 1);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112 if (no < 0 || no > 0xff || XVECTOR (regs)-> size != 8)
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113 return Qnil;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114 for (i = 0; i < 8; i++)
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115 CHECK_NUMBER (XVECTOR (regs)->contents[i], 1);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
117 inregs.x.ax = (unsigned long) XFASTINT (XVECTOR (regs)->contents[0]);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118 inregs.x.bx = (unsigned long) XFASTINT (XVECTOR (regs)->contents[1]);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
119 inregs.x.cx = (unsigned long) XFASTINT (XVECTOR (regs)->contents[2]);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120 inregs.x.dx = (unsigned long) XFASTINT (XVECTOR (regs)->contents[3]);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
121 inregs.x.si = (unsigned long) XFASTINT (XVECTOR (regs)->contents[4]);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
122 inregs.x.di = (unsigned long) XFASTINT (XVECTOR (regs)->contents[5]);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123 inregs.x.cflag = (unsigned long) XFASTINT (XVECTOR (regs)->contents[6]);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
124 inregs.x.flags = (unsigned long) XFASTINT (XVECTOR (regs)->contents[7]);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126 int86 (no, &inregs, &outregs);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
127
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
128 XVECTOR (regs)->contents[0] = make_number (outregs.x.ax);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
129 XVECTOR (regs)->contents[1] = make_number (outregs.x.bx);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130 XVECTOR (regs)->contents[2] = make_number (outregs.x.cx);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
131 XVECTOR (regs)->contents[3] = make_number (outregs.x.dx);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
132 XVECTOR (regs)->contents[4] = make_number (outregs.x.si);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133 XVECTOR (regs)->contents[5] = make_number (outregs.x.di);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134 XVECTOR (regs)->contents[6] = make_number (outregs.x.cflag);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
135 XVECTOR (regs)->contents[7] = make_number (outregs.x.flags);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
136
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
137 return regs;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138 }
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139
9572
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
140 #ifndef HAVE_X_WINDOWS
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
141 /* 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
142 e.g., with respect to non-80 column screen modes. */
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
143
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
144 DEFUN ("msdos-mouse-p", Fmsdos_mouse_p, Smsdos_mouse_p, 0, 0, 0, "\
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
145 Report whether a mouse is present.")
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
146 ()
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
147 {
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
148 if (have_mouse)
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
149 return Qt;
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
150 else
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
151 return Qnil;
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
152 }
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
153
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
154 DEFUN ("set-mouse-position", Fset_mouse_position, Sset_mouse_position, 3, 3, 0,
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
155 "Move the mouse pointer to the center of character cell (X,Y) in FRAME.\n\
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
156 WARNING: If you use this under X windows,\n\
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
157 you should call `unfocus-frame' afterwards.")
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
158 (frame, x, y)
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
159 Lisp_Object frame, x, y;
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
160 {
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
161 mouse_moveto (XINT (x), XINT (y));
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
162 }
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
163
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
164 /* Function to translate colour names to integers. See lisp/term/pc-win.el
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
165 for its definition. */
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
166
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
167 Lisp_Object Qmsdos_color_translate;
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
168 #endif
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
169
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
170
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
171 int dos_country_code;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
172 int dos_codepage;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
173 Lisp_Object Vdos_version;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
174
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
175 void
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
176 init_dosfns ()
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
177 {
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
178 union REGS regs;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
179 _go32_dpmi_seginfo info;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
180 _go32_dpmi_registers dpmiregs;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
181
9572
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
182 #ifndef SYSTEM_MALLOC
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
183 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
184 #endif
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
185
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
186 regs.x.ax = 0x3000;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
187 intdos (&regs, &regs);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
188 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
189
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
190 /* Obtain the country code by calling Dos via Dpmi. Don't rely on GO32. */
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
191 info.size = (34 + 15) / 16;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
192 if (_go32_dpmi_allocate_dos_memory (&info))
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
193 dos_country_code = 1;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
194 else
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
195 {
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
196 dpmiregs.x.ax = 0x3800;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
197 dpmiregs.x.ds = info.rm_segment;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
198 dpmiregs.x.dx = 0;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
199 dpmiregs.x.ss = dpmiregs.x.sp = 0;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
200 _go32_dpmi_simulate_int (0x21, &dpmiregs);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
201 dos_country_code = dpmiregs.x.bx;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
202 _go32_dpmi_free_dos_memory (&info);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
203 }
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
204
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
205 regs.x.ax = 0x6601;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
206 intdos (&regs, &regs);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
207 if (regs.x.cflag)
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
208 /* Estimate code page from country code */
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
209 switch (dos_country_code)
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
210 {
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
211 case 45: /* Denmark */
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
212 case 47: /* Norway */
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
213 dos_codepage = 865;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
214 break;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
215 default:
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
216 /* US */
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
217 dos_codepage = 437;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
218 }
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
219 else
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
220 dos_codepage = regs.x.bx & 0xffff;
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
221 }
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
222
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
223 /*
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
224 * Define everything
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
225 */
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
226 syms_of_dosfns ()
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
227 {
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
228 defsubr (&Smode25);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
229 defsubr (&Smode4350);
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
230 defsubr (&Sint86);
9572
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
231 #ifndef HAVE_X_WINDOWS
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
232 defsubr (&Smsdos_mouse_p);
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
233 defsubr (&Sset_mouse_position);
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
234
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
235 Qmsdos_color_translate = intern ("msdos-color-translate");
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
236 staticpro (&Qmsdos_color_translate);
b36d5e88cccc *** empty log message ***
Morten Welinder <terra@diku.dk>
parents: 7272
diff changeset
237 #endif
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
238
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
239 DEFVAR_INT ("dos-country-code", &dos_country_code,
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
240 "The country code returned by Dos when Emacs was started.\n\
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
241 Usually this is the international telephone prefix.");
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
242
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
243 DEFVAR_INT ("dos-codepage", &dos_codepage,
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
244 "The codepage active when Emacs was started.\n\
7272
b5f74966c9da Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents: 5980
diff changeset
245 The following are known:\n\
b5f74966c9da Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents: 5980
diff changeset
246 437 United States\n\
b5f74966c9da Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents: 5980
diff changeset
247 850 Multilingual (Latin I)\n\
b5f74966c9da Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents: 5980
diff changeset
248 852 Slavic (Latin II)\n\
b5f74966c9da Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents: 5980
diff changeset
249 857 Turkish\n\
b5f74966c9da Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents: 5980
diff changeset
250 860 Portugal\n\
b5f74966c9da Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents: 5980
diff changeset
251 861 Iceland\n\
b5f74966c9da Finish downcasing mouse_init1, mouse_off,
Richard M. Stallman <rms@gnu.org>
parents: 5980
diff changeset
252 863 Canada (French)\n\
5503
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
253 865 Norway/Denmark");
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
254
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
255 DEFVAR_LISP ("dos-version", &Vdos_version,
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
256 "The (MAJOR . MINOR) Dos version (subject to modification with setver).");
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
257 }
003e84b91d21 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
258 #endif /* MSDOS */