XEmacs 21.2.46 "Urania".
[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 #ifdef HAVE_CYGWIN_VERSION_H
141 #include <cygwin/version.h>
142 #endif
143
144 /* IO calls that are emulated or shadowed */
145 #define pipe    sys_pipe
146 int sys_pipe (int * phandles);
147
148 #ifndef HAVE_X_WINDOWS
149 #define sleep   sys_sleep
150 void sleep (int seconds);
151 #endif
152
153 /* subprocess calls that are emulated */
154 #define spawnve sys_spawnve
155 int spawnve (int mode, const char *cmdname, 
156              const char * const *argv, const char *const *envp);
157
158 #define wait    sys_wait
159 int wait (int *status);
160
161 #define kill    sys_kill
162 int kill (int pid, int sig);
163
164 /* map to MSVC names */
165 #define popen     _popen
166 #define pclose    _pclose
167
168 /* Encapsulation of system calls */
169 #ifndef DONT_ENCAPSULATE
170 #define getpid sys_getpid
171 pid_t getpid (void);
172 #endif
173
174 #define DONT_USE_LITOUT
175
176 /* Random global functions called everywhere. Implemented in nt.c */
177 /* #### Most of these are FSFisms and must be avoided */
178 /* #### All of these are FSFisms and must be avoided */
179 void dostounix_filename (char *p);
180 void unixtodos_filename (char *p);
181 int crlf_to_lf (int n, unsigned char *buf, unsigned int *lf_count);
182
183 char *getwd (char *dir);
184
185 void *sbrk (unsigned long increment);
186
187 struct passwd;
188 struct passwd *getpwuid (uid_t uid);
189 struct passwd *getpwnam (const char *name);
190 uid_t getuid (void);
191 uid_t geteuid (void);
192 gid_t getgid (void);
193 gid_t getegid (void);
194
195 #if CYGWIN_VERSION_DLL_MAJOR <= 21
196 #define _ftime ftime
197 #define _timeb timeb
198 #endif
199
200 /* Stuff that gets set wrongly or otherwise */
201 #define HAVE_SETITIMER
202 #define HAVE_GETTIMEOFDAY
203 #define HAVE_SELECT
204 /* systime.h includes winsock.h which defines timeval */
205 #define HAVE_TIMEVAL
206 #define HAVE_GETPAGESIZE
207 #define getpagesize() 4096
208 #ifndef HAVE_H_ERRNO
209 #define HAVE_H_ERRNO
210 #endif
211 #ifndef HAVE_TZNAME
212 #define HAVE_TZNAME
213 #endif
214
215 #undef GETTIMEOFDAY_ONE_ARGUMENT
216 #undef HAVE_SYS_WAIT_H
217 #undef HAVE_TERMIOS
218 #undef SYSV_SYSTEM_DIR
219 #undef CLASH_DETECTION
220
221 /* We now have emulation for some signals */
222 #define HAVE_SIGHOLD
223 #define sigset(s,h) mswindows_sigset(s,h)
224 #define sighold(s) mswindows_sighold(s)
225 #define sigrelse(s) mswindows_sigrelse(s)
226 #define sigpause(s) mswindows_sigpause(s)
227 #define signal sigset
228
229 /* Defines that we need that aren't in the standard signal.h  */
230 #define SIGHUP  1               /* Hang up */
231 #define SIGQUIT 3               /* Quit process */
232 #define SIGKILL 9               /* Die, die die */
233 #define SIGALRM 14              /* Alarm */
234 #define SIGPROF 29              /* Profiling timer exp */
235
236 #ifndef MAXPATHLEN
237 #define MAXPATHLEN      _MAX_PATH
238 #endif
239 #endif /* !NOT_C_CODE */
240
241 /* Define for those source files that do not include enough NT 
242    system files.  */
243 #ifndef NULL
244 #ifdef __cplusplus
245 #define NULL    0
246 #else
247 #define NULL    ((void *)0)
248 #endif
249 #endif
250
251 /* Define process implementation */
252 #define HAVE_WIN32_PROCESSES
253
254 #define CORRECT_DIR_SEPS(s) \
255   do { if ('/' == DIRECTORY_SEP) dostounix_filename (s); \
256        else unixtodos_filename (s); \
257   } while (0)