XEmacs 21.2.22 "Mercedes".
[chise/xemacs-chise.git.1] / src / s / mingw32.h
1 /* system description file for mingw32.
2    Copyright (C) 1993, 1994, 1995, 1999 Free Software Foundation, Inc.
3
4 This file is part of GNU Emacs.
5
6 GNU Emacs is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GNU Emacs is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with XEmacs; see the file COPYING.  If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.  */
20
21 /* based on cygwin32.h by Andy Piper <andy@xemacs.org> */
22
23 #ifndef WINDOWSNT
24 #define WINDOWSNT
25 #endif
26
27 #ifndef DOS_NT
28 #define DOS_NT  /* MSDOS or WINDOWSNT */
29 #endif
30
31 #define PBS_SMOOTH              0x01
32
33 #ifdef HAVE_MS_WINDOWS
34 #define HAVE_NTGUI
35 #define HAVE_FACES
36 #endif
37
38 #ifndef ORDINARY_LINK
39 #define ORDINARY_LINK
40 #endif
41
42 #define C_SWITCH_SYSTEM "-mno-cygwin -Wno-sign-compare -fno-caller-saves -Int/inc -I../nt/inc -DWINDOWSNT"
43 #define LIBS_SYSTEM "-mno-cygwin -lwinmm -lwsock32"
44
45 #define TEXT_START -1
46 #define TEXT_END -1
47 #define DATA_END -1
48 #define HEAP_IN_DATA
49 #define UNEXEC "unexcw.o"
50
51 #define TIME_ONESHOT 0
52 #define TIME_PERIODIC 1
53 #define LOCALE_USE_CP_ACP 0x40000000
54 #define SHGFI_EXETYPE 0x2000
55 #define NSIG 23
56
57 #ifndef SPI_GETWHEELSCROLLLINES
58 #define SPI_GETWHEELSCROLLLINES 104
59 #endif
60 #ifndef WHEEL_PAGESCROLL
61 #define WHEEL_PAGESCROLL (UINT_MAX)
62 #endif
63 #ifndef WHEEL_DELTA
64 #define WHEEL_DELTA 120
65 #endif
66 #ifndef WM_MOUSEWHEEL
67 #define WM_MOUSEWHEEL 0x20A
68 #endif
69
70 /* translate NT world unexec stuff to our a.out definitions */
71
72 #define strnicmp strncasecmp
73 /* #ifndef HAVE_SOCKETS */
74 #define HAVE_SOCKETS
75 /* #endif */
76 #define OBJECTS_SYSTEM  ntplay.o nt.o ntheap.o ntproc.o dired-msw.o
77 #define HAVE_NATIVE_SOUND
78
79 #undef MAIL_USE_SYSTEM_LOCK
80 #define MAIL_USE_POP
81 #define HAVE_MSW_C_DIRED
82
83 /* Define NO_ARG_ARRAY if you cannot take the address of the first of a
84  * group of arguments and treat it as an array of the arguments.  */
85
86 #define NO_ARG_ARRAY
87
88 /* Define WORD_MACHINE if addresses and such have
89  * to be corrected before they can be used as byte counts.  */
90
91 #define WORD_MACHINE
92
93 /* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend
94    the 24-bit bit field into an int.  In other words, if bit fields
95    are always unsigned.
96
97    If you use NO_UNION_TYPE, this flag does not matter.  */
98
99 #define EXPLICIT_SIGN_EXTEND
100 /* System calls that are encapsulated */
101 #define ENCAPSULATE_RENAME
102 #define ENCAPSULATE_OPEN
103 #define ENCAPSULATE_FOPEN
104 #define ENCAPSULATE_MKDIR
105
106 /* Data type of load average, as read out of kmem.  */
107
108 #define LOAD_AVE_TYPE long
109
110 /* Convert that into an integer that is 100 for a load average of 1.0  */
111
112 #define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
113
114 /* Define VIRT_ADDR_VARIES if the virtual addresses of
115    pure and impure space as loaded can vary, and even their
116    relative order cannot be relied on.
117
118    Otherwise Emacs assumes that text space precedes data space,
119    numerically.  */
120
121 /* Text does precede data space, but this is never a safe assumption.  */
122 #define VIRT_ADDR_VARIES
123
124 /* set this if you have a new version of cygwin
125 #define DATA_SEG_BITS 0x10000000
126 */
127
128 /* If you are compiling with a non-C calling convention but need to
129    declare vararg routines differently, put it here */
130 #define _VARARGS_ __cdecl
131
132 /* If you are providing a function to something that will call the
133    function back (like a signal handler and signal, or main) its calling
134    convention must be whatever standard the libraries expect */
135 #define _CALLBACK_ __cdecl
136
137 /* SYSTEM_TYPE should indicate the kind of system you are using.
138  It sets the Lisp variable system-type.  */
139
140 #define SYSTEM_TYPE "windows-nt"
141
142 #define NO_MATHERR
143
144 /* define MAIL_USE_FLOCK if the mailer uses flock
145    to interlock access to /usr/spool/mail/$USER.
146    The alternative is that a lock file named
147    /usr/spool/mail/$USER.lock.  */
148
149 /* If the character used to separate elements of the executable path
150    is not ':', #define this to be the appropriate character constant.  */
151 #define SEPCHAR ';'
152
153 /* ============================================================ */
154
155 /* Here, add any special hacks needed
156    to make Emacs work on this system.  For example,
157    you might define certain system call names that don't
158    exist on your system, or that do different things on
159    your system and must be used only through an encapsulation
160    (Which you should place, by convention, in sysdep.c).  */
161
162 /* Define this to be the separator between devices and paths */
163 #define DEVICE_SEP ':'
164
165 #define DIRECTORY_SEP '\\'
166
167 /* The null device on Windows NT. */
168 #define NULL_DEVICE     "NUL:"
169 #define EXEC_SUFFIXES   ".exe:.com:.bat:.cmd:"
170 /* We'll support either convention on NT.  */
171 #define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\')
172 #define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
173 #define EXEC_SUFFIXES   ".exe:.com:.bat:.cmd:"
174
175 /* We need a little extra space, see ../../lisp/loadup.el */
176 #define SYSTEM_PURESIZE_EXTRA 15000
177
178 #ifndef NOT_C_CODE
179 #include <stdlib.h>
180 #include <mingw32/process.h>
181 #define mkdir __mkdir
182 #include <dir.h>
183 #undef mkdir
184 #ifdef HAVE_CYGWIN_VERSION_H
185 #include <cygwin/version.h>
186 #endif
187
188 typedef unsigned int MMRESULT;
189 typedef struct timecaps_tag {           
190   unsigned int    wPeriodMin;
191   unsigned int    wPeriodMax;
192 } TIMECAPS;
193
194 /* IO calls that are emulated or shadowed */
195 #define pipe    sys_pipe
196 int sys_pipe (int * phandles);
197
198 #ifndef HAVE_X_WINDOWS
199 #define sleep   sys_sleep
200 void sleep (int seconds);
201 #endif
202
203 /* subprocess calls that are emulated */
204 #define spawnve sys_spawnve
205 int spawnve (int mode, CONST char *cmdname, 
206              CONST char * CONST *argv, CONST char *CONST *envp);
207
208 #define wait    sys_wait
209 int wait (int *status);
210
211 #define kill    sys_kill
212 int kill (int pid, int sig);
213
214 /* map to MSVC names */
215 #define popen     _popen
216 #define pclose    _pclose
217
218 typedef int uid_t;
219 typedef int gid_t;
220 typedef int pid_t;
221 typedef int ssize_t;
222
223 /* Encapsulation of system calls */
224 #ifndef DONT_ENCAPSULATE
225 #define getpid sys_getpid
226 pid_t getpid (void);
227 #endif
228
229 #define DONT_USE_LITOUT
230
231 /* Random global functions called everywhere. Implemented in nt.c */
232 /* #### Most of these are FSFisms and must be avoided */
233 /* #### All of these are FSFisms and must be avoided */
234 void dostounix_filename (char *p);
235 void unixtodos_filename (char *p);
236 int crlf_to_lf (int n, unsigned char *buf, unsigned int *lf_count);
237
238 char *getwd (char *dir);
239
240 void *sbrk (unsigned long increment);
241
242 struct passwd;
243 struct passwd *getpwuid (uid_t uid);
244 struct passwd *getpwnam (const char *name);
245 uid_t getuid (void);
246 uid_t geteuid (void);
247 gid_t getgid (void);
248 gid_t getegid (void);
249 #define _timeb timeb
250
251 /* Stuff that gets set wrongly or otherwise */
252 #define HAVE_SETITIMER
253 #define HAVE_GETTIMEOFDAY
254 #define HAVE_SELECT
255 /*#define HAVE_STRUCT_UTIMBUF*/
256
257 #undef GETTIMEOFDAY_ONE_ARGUMENT
258 #undef HAVE_SYS_WAIT_H
259 #undef HAVE_TERMIOS
260 #undef SYSV_SYSTEM_DIR
261
262 /* We now have emulation for some signals */
263 #define HAVE_SIGHOLD
264 #define sigset(s,h) msw_sigset(s,h)
265 #define sighold(s) msw_sighold(s)
266 #define sigrelse(s) msw_sigrelse(s)
267 #define sigpause(s) msw_sigpause(s)
268 #define signal sigset
269
270 /* Defines that we need that aren't in the standard signal.h  */
271 #define SIGHUP  1               /* Hang up */
272 #define SIGQUIT 3               /* Quit process */
273 #define SIGKILL 9               /* Die, die die */
274 #define SIGALRM 14              /* Alarm */
275 #define SIGPROF 29              /* Profiling timer exp */
276
277 #ifndef MAXPATHLEN
278 #define MAXPATHLEN      _MAX_PATH
279 #endif
280
281 /* For integration with MSDOS support.  */
282 #define getdisk()               (_getdrive () - 1)
283 #define getdefdir(_drv, _buf)   _getdcwd (_drv, _buf, MAXPATHLEN)
284 #endif
285
286 /* Define for those source files that do not include enough NT 
287    system files.  */
288 #ifndef NULL
289 #ifdef __cplusplus
290 #define NULL    0
291 #else
292 #define NULL    ((void *)0)
293 #endif
294 #endif
295
296 /* Define process implementation */
297 #define HAVE_WIN32_PROCESSES
298
299 /* ============================================================ */
300