XEmacs 21.4.8 "Honest Recruiter".
[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 /* System calls that are encapsulated */
64 #define ENCAPSULATE_RENAME
65 #define ENCAPSULATE_OPEN
66 #define ENCAPSULATE_FOPEN
67 #define ENCAPSULATE_MKDIR
68 #define ENCAPSULATE_STAT
69 #define ENCAPSULATE_FSTAT
70
71 /* Do not define LOAD_AVE_TYPE or LOAD_AVE_CVT
72    since there is no load average available. */
73
74 /* Define VIRT_ADDR_VARIES if the virtual addresses of
75    pure and impure space as loaded can vary, and even their
76    relative order cannot be relied on.
77
78    Otherwise Emacs assumes that text space precedes data space,
79    numerically.  */
80
81 /* Text does precede data space, but this is never a safe assumption.  */
82 #define VIRT_ADDR_VARIES
83
84 /* If you are compiling with a non-C calling convention but need to
85    declare vararg routines differently, put it here */
86 #define _VARARGS_ __cdecl
87
88 /* If you are providing a function to something that will call the
89    function back (like a signal handler and signal, or main) its calling
90    convention must be whatever standard the libraries expect */
91 #define _CALLBACK_ __cdecl
92
93 /* SYSTEM_TYPE should indicate the kind of system you are using.
94  It sets the Lisp variable system-type.  */
95
96 #define SYSTEM_TYPE "windows-nt"
97
98 #define NO_MATHERR
99
100 /* define MAIL_USE_FLOCK if the mailer uses flock
101    to interlock access to /usr/spool/mail/$USER.
102    The alternative is that a lock file named
103    /usr/spool/mail/$USER.lock.  */
104
105 /* If the character used to separate elements of the executable path
106    is not ':', #define this to be the appropriate character constant.  */
107 #define SEPCHAR ';'
108
109 /* ============================================================ */
110
111 /* Here, add any special hacks needed
112    to make Emacs work on this system.  For example,
113    you might define certain system call names that don't
114    exist on your system, or that do different things on
115    your system and must be used only through an encapsulation
116    (Which you should place, by convention, in sysdep.c).  */
117
118 /* Define this to be the separator between devices and paths */
119 #define DEVICE_SEP ':'
120
121 #define DIRECTORY_SEP ((char)XCHAR(Vdirectory_sep_char))
122
123 /* The null device on Windows NT. */
124 #define NULL_DEVICE     "NUL:"
125 #define EXEC_SUFFIXES   ".exe:.com:.bat:.cmd:"
126 /* We'll support either convention on NT.  */
127 #define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\')
128 #define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
129 #define EXEC_SUFFIXES   ".exe:.com:.bat:.cmd:"
130
131 /* We need a little extra space, see ../../lisp/loadup.el */
132 #define SYSTEM_PURESIZE_EXTRA 15000
133
134 #ifndef NOT_C_CODE
135 #include <stdlib.h>
136 #include <../mingw/process.h>
137 #define mkdir __mkdir
138 #include <dir.h>
139 #undef mkdir
140
141 /* IO calls that are emulated or shadowed */
142 #define pipe    sys_pipe
143 int sys_pipe (int * phandles);
144
145 #ifndef HAVE_X_WINDOWS
146 #define sleep   sys_sleep
147 void sleep (int seconds);
148 #endif
149
150 /* subprocess calls that are emulated */
151 #define spawnve sys_spawnve
152 int spawnve (int mode, const char *cmdname, 
153              const char * const *argv, const char *const *envp);
154
155 #define wait    sys_wait
156 int wait (int *status);
157
158 #define kill    sys_kill
159 int kill (int pid, int sig);
160
161 /* map to MSVC names */
162 #define popen     _popen
163 #define pclose    _pclose
164
165 /* Encapsulation of system calls */
166 #ifndef DONT_ENCAPSULATE
167 #define getpid sys_getpid
168 pid_t getpid (void);
169 #endif
170
171 #define DONT_USE_LITOUT
172
173 /* Random global functions called everywhere. Implemented in nt.c */
174 /* #### Most of these are FSFisms and must be avoided */
175 /* #### All of these are FSFisms and must be avoided */
176 void dostounix_filename (char *p);
177 void unixtodos_filename (char *p);
178 int crlf_to_lf (int n, unsigned char *buf, unsigned int *lf_count);
179
180 char *getwd (char *dir);
181
182 void *sbrk (unsigned long increment);
183
184 struct passwd;
185 struct passwd *getpwuid (uid_t uid);
186 struct passwd *getpwnam (const char *name);
187 uid_t getuid (void);
188 uid_t geteuid (void);
189 gid_t getgid (void);
190 gid_t getegid (void);
191
192 /* Stuff that gets set wrongly or otherwise */
193 #define HAVE_SETITIMER
194 #define HAVE_GETTIMEOFDAY
195 #define HAVE_SELECT
196 /* systime.h includes winsock.h which defines timeval */
197 #define HAVE_TIMEVAL
198 #define HAVE_GETPAGESIZE
199 #define getpagesize() 4096
200 #ifndef HAVE_H_ERRNO
201 #define HAVE_H_ERRNO
202 #endif
203 #ifndef HAVE_TZNAME
204 #define HAVE_TZNAME
205 #endif
206
207 #undef GETTIMEOFDAY_ONE_ARGUMENT
208 #undef HAVE_SYS_WAIT_H
209 #undef HAVE_TERMIOS
210 #undef SYSV_SYSTEM_DIR
211 #undef CLASH_DETECTION
212
213 /* We now have emulation for some signals */
214 #define HAVE_SIGHOLD
215 #define sigset(s,h) mswindows_sigset(s,h)
216 #define sighold(s) mswindows_sighold(s)
217 #define sigrelse(s) mswindows_sigrelse(s)
218 #define sigpause(s) mswindows_sigpause(s)
219 #define signal sigset
220
221 /* Defines that we need that aren't in the standard signal.h  */
222 #define SIGHUP  1               /* Hang up */
223 #define SIGQUIT 3               /* Quit process */
224 #define SIGKILL 9               /* Die, die die */
225 #define SIGALRM 14              /* Alarm */
226 #define SIGPROF 29              /* Profiling timer exp */
227
228 #ifndef MAXPATHLEN
229 #define MAXPATHLEN      _MAX_PATH
230 #endif
231 #endif /* !NOT_C_CODE */
232
233 /* Define for those source files that do not include enough NT 
234    system files.  */
235 #ifndef NULL
236 #ifdef __cplusplus
237 #define NULL    0
238 #else
239 #define NULL    ((void *)0)
240 #endif
241 #endif
242
243 /* Define process implementation */
244 #define HAVE_WIN32_PROCESSES
245
246 #define CORRECT_DIR_SEPS(s) \
247   do { if ('/' == DIRECTORY_SEP) dostounix_filename (s); \
248        else unixtodos_filename (s); \
249   } while (0)