XEmacs 21.2.32 "Kastor & Polydeukes".
[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 #ifdef HAVE_MS_WINDOWS
32 #define HAVE_NTGUI
33 #define HAVE_FACES
34 #endif
35
36 #ifndef ORDINARY_LINK
37 #define ORDINARY_LINK
38 #endif
39
40 #define C_SWITCH_SYSTEM "-mno-cygwin -Wno-sign-compare -fno-caller-saves -Int/inc -I../nt/inc -DWINDOWSNT"
41 #define LIBS_SYSTEM "-mno-cygwin -lwinmm -lwsock32"
42
43 #define TEXT_START -1
44 #define TEXT_END -1
45 #define DATA_END -1
46 #define HEAP_IN_DATA
47 #define UNEXEC "unexcw.o"
48
49 #define TIME_ONESHOT 0
50 #define TIME_PERIODIC 1
51 #define LOCALE_USE_CP_ACP 0x40000000
52 #define NSIG 23
53
54 #ifndef SPI_GETWHEELSCROLLLINES
55 #define SPI_GETWHEELSCROLLLINES 104
56 #endif
57 #ifndef WHEEL_PAGESCROLL
58 #define WHEEL_PAGESCROLL (UINT_MAX)
59 #endif
60 #ifndef WHEEL_DELTA
61 #define WHEEL_DELTA 120
62 #endif
63
64 /* this is necessary to get the TCS_* definitions in <commctrl.h> */
65 #define _WIN32_IE 0x0400
66
67 #ifndef WM_MOUSEWHEEL
68 #define WM_MOUSEWHEEL 0x20A
69 #endif
70 #ifndef TCS_BOTTOM
71 #define TCS_BOTTOM 0x0002
72 #endif
73 #ifndef TCS_VERTICAL
74 #define TCS_VERTICAL 0x0080
75 #endif
76 #ifndef PHYSICALWIDTH
77 #define PHYSICALWIDTH 110
78 #endif
79 #ifndef PHYSICALHEIGHT
80 #define PHYSICALHEIGHT 111
81 #endif
82 #ifndef PHYSICALOFFSETX
83 #define PHYSICALOFFSETX 112
84 #endif
85 #ifndef PHYSICALOFFSETY
86 #define PHYSICALOFFSETY 113
87 #endif
88 #ifndef PBS_SMOOTH
89 #define PBS_SMOOTH              0x01
90 #endif
91
92 /* translate NT world unexec stuff to our a.out definitions */
93
94 #define strnicmp strncasecmp
95 /* #ifndef HAVE_SOCKETS */
96 #define HAVE_SOCKETS
97 /* #endif */
98 #define OBJECTS_SYSTEM  ntplay.o nt.o ntheap.o ntproc.o dired-msw.o
99 #define HAVE_NATIVE_SOUND
100
101 #undef MAIL_USE_SYSTEM_LOCK
102 #define MAIL_USE_POP
103 #define HAVE_MSW_C_DIRED
104
105 /* Define NO_ARG_ARRAY if you cannot take the address of the first of a
106  * group of arguments and treat it as an array of the arguments.  */
107
108 #define NO_ARG_ARRAY
109
110 /* System calls that are encapsulated */
111 #define ENCAPSULATE_RENAME
112 #define ENCAPSULATE_OPEN
113 #define ENCAPSULATE_FOPEN
114 #define ENCAPSULATE_MKDIR
115
116 /* Data type of load average, as read out of kmem.  */
117
118 #define LOAD_AVE_TYPE long
119
120 /* Convert that into an integer that is 100 for a load average of 1.0  */
121
122 #define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
123
124 /* Define VIRT_ADDR_VARIES if the virtual addresses of
125    pure and impure space as loaded can vary, and even their
126    relative order cannot be relied on.
127
128    Otherwise Emacs assumes that text space precedes data space,
129    numerically.  */
130
131 /* Text does precede data space, but this is never a safe assumption.  */
132 #define VIRT_ADDR_VARIES
133
134 /* If you are compiling with a non-C calling convention but need to
135    declare vararg routines differently, put it here */
136 #define _VARARGS_ __cdecl
137
138 /* If you are providing a function to something that will call the
139    function back (like a signal handler and signal, or main) its calling
140    convention must be whatever standard the libraries expect */
141 #define _CALLBACK_ __cdecl
142
143 /* SYSTEM_TYPE should indicate the kind of system you are using.
144  It sets the Lisp variable system-type.  */
145
146 #define SYSTEM_TYPE "windows-nt"
147
148 #define NO_MATHERR
149
150 /* define MAIL_USE_FLOCK if the mailer uses flock
151    to interlock access to /usr/spool/mail/$USER.
152    The alternative is that a lock file named
153    /usr/spool/mail/$USER.lock.  */
154
155 /* If the character used to separate elements of the executable path
156    is not ':', #define this to be the appropriate character constant.  */
157 #define SEPCHAR ';'
158
159 /* ============================================================ */
160
161 /* Here, add any special hacks needed
162    to make Emacs work on this system.  For example,
163    you might define certain system call names that don't
164    exist on your system, or that do different things on
165    your system and must be used only through an encapsulation
166    (Which you should place, by convention, in sysdep.c).  */
167
168 /* Define this to be the separator between devices and paths */
169 #define DEVICE_SEP ':'
170
171 #define DIRECTORY_SEP '\\'
172
173 /* The null device on Windows NT. */
174 #define NULL_DEVICE     "NUL:"
175 #define EXEC_SUFFIXES   ".exe:.com:.bat:.cmd:"
176 /* We'll support either convention on NT.  */
177 #define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\')
178 #define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
179 #define EXEC_SUFFIXES   ".exe:.com:.bat:.cmd:"
180
181 /* We need a little extra space, see ../../lisp/loadup.el */
182 #define SYSTEM_PURESIZE_EXTRA 15000
183
184 #ifndef NOT_C_CODE
185 #include <stdlib.h>
186 #include <mingw32/process.h>
187 #define mkdir __mkdir
188 #include <dir.h>
189 #undef mkdir
190 #ifdef HAVE_CYGWIN_VERSION_H
191 #include <cygwin/version.h>
192 #endif
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 /* Encapsulation of system calls */
219 #ifndef DONT_ENCAPSULATE
220 #define getpid sys_getpid
221 pid_t getpid (void);
222 #endif
223
224 #define DONT_USE_LITOUT
225
226 /* Random global functions called everywhere. Implemented in nt.c */
227 /* #### Most of these are FSFisms and must be avoided */
228 /* #### All of these are FSFisms and must be avoided */
229 void dostounix_filename (char *p);
230 void unixtodos_filename (char *p);
231 int crlf_to_lf (int n, unsigned char *buf, unsigned int *lf_count);
232
233 char *getwd (char *dir);
234
235 void *sbrk (unsigned long increment);
236
237 struct passwd;
238 struct passwd *getpwuid (uid_t uid);
239 struct passwd *getpwnam (const char *name);
240 uid_t getuid (void);
241 uid_t geteuid (void);
242 gid_t getgid (void);
243 gid_t getegid (void);
244
245 #if CYGWIN_VERSION_DLL_MAJOR <= 21
246 #define _ftime ftime
247 #define _timeb timeb
248 #endif
249
250 /* Stuff that gets set wrongly or otherwise */
251 #define HAVE_SETITIMER
252 #define HAVE_GETTIMEOFDAY
253 #define HAVE_SELECT
254 /*#define HAVE_STRUCT_UTIMBUF*/
255 #ifndef HAVE_H_ERRNO
256 #define HAVE_H_ERRNO
257 #endif
258 #ifndef HAVE_TZNAME
259 #define HAVE_TZNAME
260 #endif
261
262 #undef GETTIMEOFDAY_ONE_ARGUMENT
263 #undef HAVE_SYS_WAIT_H
264 #undef HAVE_TERMIOS
265 #undef SYSV_SYSTEM_DIR
266
267 /* We now have emulation for some signals */
268 #define HAVE_SIGHOLD
269 #define sigset(s,h) msw_sigset(s,h)
270 #define sighold(s) msw_sighold(s)
271 #define sigrelse(s) msw_sigrelse(s)
272 #define sigpause(s) msw_sigpause(s)
273 #define signal sigset
274
275 /* Defines that we need that aren't in the standard signal.h  */
276 #define SIGHUP  1               /* Hang up */
277 #define SIGQUIT 3               /* Quit process */
278 #define SIGKILL 9               /* Die, die die */
279 #define SIGALRM 14              /* Alarm */
280 #define SIGPROF 29              /* Profiling timer exp */
281
282 #ifndef MAXPATHLEN
283 #define MAXPATHLEN      _MAX_PATH
284 #endif
285
286 /* For integration with MSDOS support.  */
287 #define getdisk()               (_getdrive () - 1)
288 #define getdefdir(_drv, _buf)   _getdcwd (_drv, _buf, MAXPATHLEN)
289 #endif
290
291 /* Define for those source files that do not include enough NT 
292    system files.  */
293 #ifndef NULL
294 #ifdef __cplusplus
295 #define NULL    0
296 #else
297 #define NULL    ((void *)0)
298 #endif
299 #endif
300
301 /* Define process implementation */
302 #define HAVE_WIN32_PROCESSES
303
304 /* ============================================================ */
305