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