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