f65ba7450cf23e46769b4d9924d0a111ae39e546
[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 /* System calls that are encapsulated */
89 #define ENCAPSULATE_RENAME
90 #define ENCAPSULATE_OPEN
91 #define ENCAPSULATE_FOPEN
92 #define ENCAPSULATE_MKDIR
93
94 /* Data type of load average, as read out of kmem.  */
95
96 #define LOAD_AVE_TYPE long
97
98 /* Convert that into an integer that is 100 for a load average of 1.0  */
99
100 #define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
101
102 /* Define VIRT_ADDR_VARIES if the virtual addresses of
103    pure and impure space as loaded can vary, and even their
104    relative order cannot be relied on.
105
106    Otherwise Emacs assumes that text space precedes data space,
107    numerically.  */
108
109 /* Text does precede data space, but this is never a safe assumption.  */
110 #define VIRT_ADDR_VARIES
111
112 /* If you are compiling with a non-C calling convention but need to
113    declare vararg routines differently, put it here */
114 #define _VARARGS_ __cdecl
115
116 /* If you are providing a function to something that will call the
117    function back (like a signal handler and signal, or main) its calling
118    convention must be whatever standard the libraries expect */
119 #define _CALLBACK_ __cdecl
120
121 /* SYSTEM_TYPE should indicate the kind of system you are using.
122  It sets the Lisp variable system-type.  */
123
124 #define SYSTEM_TYPE "windows-nt"
125
126 #define NO_MATHERR
127
128 /* define MAIL_USE_FLOCK if the mailer uses flock
129    to interlock access to /usr/spool/mail/$USER.
130    The alternative is that a lock file named
131    /usr/spool/mail/$USER.lock.  */
132
133 /* If the character used to separate elements of the executable path
134    is not ':', #define this to be the appropriate character constant.  */
135 #define SEPCHAR ';'
136
137 /* ============================================================ */
138
139 /* Here, add any special hacks needed
140    to make Emacs work on this system.  For example,
141    you might define certain system call names that don't
142    exist on your system, or that do different things on
143    your system and must be used only through an encapsulation
144    (Which you should place, by convention, in sysdep.c).  */
145
146 /* Define this to be the separator between devices and paths */
147 #define DEVICE_SEP ':'
148
149 #define DIRECTORY_SEP '\\'
150
151 /* The null device on Windows NT. */
152 #define NULL_DEVICE     "NUL:"
153 #define EXEC_SUFFIXES   ".exe:.com:.bat:.cmd:"
154 /* We'll support either convention on NT.  */
155 #define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\')
156 #define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
157 #define EXEC_SUFFIXES   ".exe:.com:.bat:.cmd:"
158
159 /* We need a little extra space, see ../../lisp/loadup.el */
160 #define SYSTEM_PURESIZE_EXTRA 15000
161
162 #ifndef NOT_C_CODE
163 #include <stdlib.h>
164 #include <mingw32/process.h>
165 #define mkdir __mkdir
166 #include <dir.h>
167 #undef mkdir
168 #ifdef HAVE_CYGWIN_VERSION_H
169 #include <cygwin/version.h>
170 #endif
171
172 typedef unsigned int MMRESULT;
173 typedef struct timecaps_tag {           
174   unsigned int    wPeriodMin;
175   unsigned int    wPeriodMax;
176 } TIMECAPS;
177
178 /* IO calls that are emulated or shadowed */
179 #define pipe    sys_pipe
180 int sys_pipe (int * phandles);
181
182 #ifndef HAVE_X_WINDOWS
183 #define sleep   sys_sleep
184 void sleep (int seconds);
185 #endif
186
187 /* subprocess calls that are emulated */
188 #define spawnve sys_spawnve
189 int spawnve (int mode, const char *cmdname, 
190              const char * const *argv, const char *const *envp);
191
192 #define wait    sys_wait
193 int wait (int *status);
194
195 #define kill    sys_kill
196 int kill (int pid, int sig);
197
198 /* map to MSVC names */
199 #define popen     _popen
200 #define pclose    _pclose
201
202 typedef int uid_t;
203 typedef int gid_t;
204 typedef int pid_t;
205 typedef int ssize_t;
206
207 /* Encapsulation of system calls */
208 #ifndef DONT_ENCAPSULATE
209 #define getpid sys_getpid
210 pid_t getpid (void);
211 #endif
212
213 #define DONT_USE_LITOUT
214
215 /* Random global functions called everywhere. Implemented in nt.c */
216 /* #### Most of these are FSFisms and must be avoided */
217 /* #### All of these are FSFisms and must be avoided */
218 void dostounix_filename (char *p);
219 void unixtodos_filename (char *p);
220 int crlf_to_lf (int n, unsigned char *buf, unsigned int *lf_count);
221
222 char *getwd (char *dir);
223
224 void *sbrk (unsigned long increment);
225
226 struct passwd;
227 struct passwd *getpwuid (uid_t uid);
228 struct passwd *getpwnam (const char *name);
229 uid_t getuid (void);
230 uid_t geteuid (void);
231 gid_t getgid (void);
232 gid_t getegid (void);
233 #define _timeb timeb
234
235 /* Stuff that gets set wrongly or otherwise */
236 #define HAVE_SETITIMER
237 #define HAVE_GETTIMEOFDAY
238 #define HAVE_SELECT
239 /*#define HAVE_STRUCT_UTIMBUF*/
240
241 #undef GETTIMEOFDAY_ONE_ARGUMENT
242 #undef HAVE_SYS_WAIT_H
243 #undef HAVE_TERMIOS
244 #undef SYSV_SYSTEM_DIR
245
246 /* We now have emulation for some signals */
247 #define HAVE_SIGHOLD
248 #define sigset(s,h) msw_sigset(s,h)
249 #define sighold(s) msw_sighold(s)
250 #define sigrelse(s) msw_sigrelse(s)
251 #define sigpause(s) msw_sigpause(s)
252 #define signal sigset
253
254 /* Defines that we need that aren't in the standard signal.h  */
255 #define SIGHUP  1               /* Hang up */
256 #define SIGQUIT 3               /* Quit process */
257 #define SIGKILL 9               /* Die, die die */
258 #define SIGALRM 14              /* Alarm */
259 #define SIGPROF 29              /* Profiling timer exp */
260
261 #ifndef MAXPATHLEN
262 #define MAXPATHLEN      _MAX_PATH
263 #endif
264
265 /* For integration with MSDOS support.  */
266 #define getdisk()               (_getdrive () - 1)
267 #define getdefdir(_drv, _buf)   _getdcwd (_drv, _buf, MAXPATHLEN)
268 #endif
269
270 /* Define for those source files that do not include enough NT 
271    system files.  */
272 #ifndef NULL
273 #ifdef __cplusplus
274 #define NULL    0
275 #else
276 #define NULL    ((void *)0)
277 #endif
278 #endif
279
280 /* Define process implementation */
281 #define HAVE_WIN32_PROCESSES
282
283 /* ============================================================ */
284