442
|
1 /* System description file for Windows 9x and NT.
|
428
|
2 Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
|
|
3
|
613
|
4 This file is part of XEmacs.
|
428
|
5
|
613
|
6 XEmacs is free software; you can redistribute it and/or modify
|
428
|
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
|
613
|
11 XEmacs is distributed in the hope that it will be useful,
|
428
|
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 /* Synched up with: FSF 19.31. */
|
|
22
|
442
|
23 /* Capsule summary of different preprocessor flags:
|
|
24
|
|
25 1. Keep in mind that there are two possible OS environments we are dealing
|
|
26 with -- Cygwin and Native Windows. Cygwin provides a POSIX emulation
|
|
27 layer on top of MS Windows -- in particular, providing the file-system,
|
|
28 process, tty, and signal semantics that are part of a modern, standard
|
|
29 Unix operating system. MS Windows also provides these services, but
|
|
30 through their own API, called Win32. When compiling in a Cygwin
|
|
31 environment, the Win32 API's are also available, and in fact are used
|
|
32 to do native GUI programming.
|
|
33
|
|
34 2. There are two windowing environments we can target XEmacs for when
|
|
35 running under MS Windows -- Windows native, and X. (It may seem strange
|
|
36 to write an X application under Windows, but there are in fact many X
|
|
37 servers out there running on Windows, and as far as I know there is no
|
|
38 real (or at least, that works well) networking Window-system extension
|
|
39 under MS Windows. Furthermore, if you're porting a Unix application to
|
|
40 Windows and use Cygwin to assist you, it might seem natural to use an
|
|
41 X server to avoid having to port all the code to Windows.) For XEmacs,
|
|
42 there are various reasons people could come up with for why we would
|
|
43 want to keep maintaining X Windows under MS Windows support.
|
|
44
|
|
45 That gives us four possible build environments. I (Ben) build
|
|
46 regularly on fully-native-everything, Andy builds on Cygwin + MS
|
|
47 Windows + X Windows for windowing.
|
|
48
|
|
49 The build flags used for these divisions are:
|
|
50
|
|
51 CYGWIN -- for Cygwin-only stuff.
|
|
52 WIN32_NATIVE -- Win32 native OS-level stuff (files, process, etc.).
|
|
53 HAVE_X_WINDOWS -- for X Windows (regardless of whether under MS Win)
|
|
54 HAVE_MS_WINDOWS -- MS Windows native windowing system (anything related to
|
|
55 the appearance of the graphical screen).
|
428
|
56
|
442
|
57 Finally, there's also the MINGW build environment, which uses GCC
|
|
58 \(similar to Cygwin), but native MS Windows libraries rather than a
|
|
59 POSIX emulation layer (the Cygwin approach). This environment defines
|
|
60 WIN32_NATIVE, but also defines MINGW, which is used mostly because
|
|
61 uses its own include files (related to Cygwin), which have a few
|
|
62 things messed up.
|
|
63
|
|
64
|
|
65 Formerly, we had a whole host of flags. Here's the conversion, for porting
|
|
66 code from GNU Emacs and such:
|
|
67
|
|
68
|
|
69 WINDOWSNT -> WIN32_NATIVE
|
|
70 WIN32 -> WIN32_NATIVE
|
|
71 _WIN32 -> WIN32_NATIVE
|
|
72 HAVE_WIN32 -> WIN32_NATIVE
|
|
73 DOS_NT -> WIN32_NATIVE
|
|
74 HAVE_NTGUI -> WIN32_NATIVE, unless it ends up already bracketed by this
|
|
75 HAVE_FACES -> always true
|
|
76 MSDOS -> determine whether this code is really specific to MS-DOS (and not
|
|
77 Windows -- e.g. DJGPP code); if so, delete the code; otherwise,
|
|
78 convert to WIN32_NATIVE (we do not support MS-DOS w/DOS Extender
|
|
79 under XEmacs)
|
|
80
|
|
81 __CYGWIN__ -> CYGWIN
|
|
82 __CYGWIN32__ -> CYGWIN
|
|
83 __MINGW32__ -> MINGW
|
|
84
|
|
85 */
|
|
86
|
|
87 /* Identify ourselves */
|
|
88 #ifndef WIN32_NATIVE
|
|
89 #define WIN32_NATIVE
|
428
|
90 #endif
|
|
91
|
|
92 /* In case non-Microsoft compiler is used, we fake _MSC_VER */
|
|
93 #ifndef _MSC_VER
|
|
94 #define _MSC_VER 1
|
|
95 #endif
|
|
96
|
|
97 typedef unsigned short mode_t;
|
|
98 /* typedef long ptrdiff_t; -kkm */
|
|
99 typedef int pid_t;
|
|
100
|
|
101 #include <stddef.h>
|
|
102
|
|
103 /* If you are compiling with a non-C calling convention but need to
|
|
104 declare vararg routines differently, put it here */
|
|
105 #define _VARARGS_ __cdecl
|
|
106
|
|
107 /* If you are providing a function to something that will call the
|
|
108 function back (like a signal handler and signal, or main) its calling
|
|
109 convention must be whatever standard the libraries expect */
|
|
110 #define _CALLBACK_ __cdecl
|
|
111
|
|
112 /* SYSTEM_TYPE should indicate the kind of system you are using.
|
|
113 It sets the Lisp variable system-type. */
|
|
114
|
|
115 #define SYSTEM_TYPE "windows-nt"
|
|
116
|
|
117 #define NO_MATHERR
|
|
118
|
|
119 #define SIZEOF_SHORT 2
|
|
120 #define SIZEOF_INT 4
|
|
121 #define SIZEOF_LONG 4
|
442
|
122 #define SIZEOF_LONG_LONG 0
|
428
|
123 #define SIZEOF_VOID_P 4
|
|
124
|
|
125 /* NOMULTIPLEJOBS should be defined if your system's shell
|
|
126 does not have "job control" (the ability to stop a program,
|
|
127 run some other program, then continue the first one). */
|
|
128
|
|
129 /* #define NOMULTIPLEJOBS */
|
|
130
|
|
131 /* Letter to use in finding device name of first pty,
|
|
132 if system supports pty's. 'a' means it is /dev/ptya0 */
|
|
133
|
|
134 #define FIRST_PTY_LETTER 'a'
|
|
135
|
|
136 /*
|
|
137 * Define HAVE_TIMEVAL if the system supports the BSD style clock values.
|
|
138 * Look in <sys/time.h> for a timeval structure.
|
|
139 */
|
|
140
|
|
141 #define HAVE_TIMEVAL
|
|
142
|
|
143 /*
|
|
144 * Define HAVE_SELECT if the system supports the `select' system call.
|
|
145 */
|
|
146
|
|
147 /* #define HAVE_SELECT */
|
|
148
|
|
149 /* If your system uses COFF (Common Object File Format) then define the
|
|
150 preprocessor symbol "COFF". */
|
|
151
|
|
152 #define COFF
|
|
153
|
|
154 /* NT supports Winsock which is close enough (with some hacks) */
|
|
155
|
|
156 #define HAVE_SOCKETS
|
|
157
|
|
158 /* define MAIL_USE_FLOCK if the mailer uses flock
|
|
159 to interlock access to /usr/spool/mail/$USER.
|
|
160 The alternative is that a lock file named
|
|
161 /usr/spool/mail/$USER.lock. */
|
|
162
|
|
163 #define MAIL_USE_POP
|
438
|
164 #define HAVE_LOCKING
|
|
165 #define MAIL_USE_LOCKING
|
428
|
166
|
|
167 /* If the character used to separate elements of the executable path
|
|
168 is not ':', #define this to be the appropriate character constant. */
|
|
169 #define SEPCHAR ';'
|
|
170
|
|
171 /* ============================================================ */
|
|
172
|
|
173 /* Here, add any special hacks needed
|
|
174 to make Emacs work on this system. For example,
|
|
175 you might define certain system call names that don't
|
|
176 exist on your system, or that do different things on
|
|
177 your system and must be used only through an encapsulation
|
|
178 (Which you should place, by convention, in sysdep.c). */
|
|
179
|
|
180 /* XEmacs file I/O for DOS text files requires FILE_CODING */
|
|
181 #define FILE_CODING
|
|
182
|
434
|
183 #define DIRECTORY_SEP ((char)XCHAR(Vdirectory_sep_char))
|
428
|
184
|
|
185 /* Define this to be the separator between devices and paths */
|
|
186 #define DEVICE_SEP ':'
|
|
187
|
|
188 /* We'll support either convention on NT. */
|
|
189 #define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\')
|
|
190 #define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
|
|
191
|
|
192 /* The null device on Windows NT. */
|
|
193 #define NULL_DEVICE "NUL:"
|
|
194 #define EXEC_SUFFIXES ".exe:.com:.bat:.cmd:"
|
|
195
|
|
196 #ifndef MAXPATHLEN
|
|
197 #define MAXPATHLEN _MAX_PATH
|
|
198 #endif
|
|
199
|
|
200 #define LISP_FLOAT_TYPE
|
|
201
|
|
202 #define HAVE_GETTIMEOFDAY
|
|
203 #define HAVE_GETHOSTNAME
|
|
204 #define HAVE_DUP2
|
|
205 #define HAVE_RENAME
|
|
206 #define HAVE_CLOSEDIR
|
|
207
|
|
208 #define HAVE_TZNAME
|
|
209
|
|
210 #define HAVE_LONG_FILE_NAMES
|
|
211
|
|
212 #define HAVE_MKDIR
|
|
213 #define HAVE_RMDIR
|
|
214 #define HAVE_RANDOM
|
|
215 #define HAVE_LOGB
|
|
216 #define HAVE_FREXP
|
|
217 #define HAVE_FMOD
|
|
218 #define HAVE_FTIME
|
|
219 #define HAVE_MKTIME
|
|
220
|
|
221 #define HAVE_MOUSE
|
|
222 #define HAVE_H_ERRNO
|
|
223
|
|
224 /* Compatibility macros. Some used to be routines in nt.c */
|
|
225 #define strcasecmp(x,y) _stricmp(x,y)
|
|
226 #define random() (rand() << 15 | rand())
|
|
227 #define srandom(seed) (srand(seed))
|
|
228 #define setpgrp(pid,gid)
|
|
229
|
|
230 #define MODE_LINE_BINARY_TEXT(_b_) (NILP ((_b_)->buffer_file_type) ? "T" : "B")
|
|
231
|
|
232
|
|
233 #include <stdio.h>
|
|
234
|
440
|
235 /* subprocess calls that are emulated */
|
|
236 #ifndef DONT_ENCAPSULATE
|
|
237 #define spawnve sys_spawnve
|
442
|
238 int spawnve (int mode, const char *cmdname,
|
|
239 const char * const *argv, const char *const *envp);
|
440
|
240 #endif
|
428
|
241
|
|
242 /* IO calls that are emulated or shadowed */
|
|
243 #define pipe sys_pipe
|
|
244 int sys_pipe (int * phandles);
|
|
245
|
|
246 #ifndef HAVE_X_WINDOWS
|
|
247 #define sleep sys_sleep
|
|
248 void sleep (int seconds);
|
|
249 #endif
|
|
250
|
|
251 #define wait sys_wait
|
|
252 int wait (int *status);
|
|
253
|
|
254 #define kill sys_kill
|
|
255 int kill (int pid, int sig);
|
|
256
|
|
257 /* map to MSVC names */
|
|
258 #define popen _popen
|
|
259 #define pclose _pclose
|
|
260
|
|
261 typedef int uid_t;
|
|
262 typedef int gid_t;
|
|
263 typedef int pid_t;
|
|
264 typedef int ssize_t;
|
|
265
|
|
266 /* Encapsulation of system calls */
|
|
267 #ifndef DONT_ENCAPSULATE
|
|
268 #define getpid sys_getpid
|
|
269 pid_t getpid (void);
|
|
270 #endif
|
|
271
|
|
272 /* Random global functions called everywhere. Implemented in nt.c */
|
|
273 /* #### Most of these are FSFisms and must be avoided */
|
|
274 /* #### All of these are FSFisms and must be avoided */
|
|
275 void dostounix_filename (char *p);
|
|
276 void unixtodos_filename (char *p);
|
|
277 int crlf_to_lf (int n, unsigned char *buf, unsigned int *lf_count);
|
|
278
|
|
279 char *getwd (char *dir);
|
|
280
|
|
281 void *sbrk (unsigned long increment);
|
|
282
|
|
283 struct passwd;
|
|
284 struct passwd *getpwuid (uid_t uid);
|
|
285 struct passwd *getpwnam (const char *name);
|
|
286 uid_t getuid (void);
|
|
287 uid_t geteuid (void);
|
|
288 gid_t getgid (void);
|
|
289 gid_t getegid (void);
|
|
290
|
|
291 /* Setitimer is emulated */
|
|
292 #define HAVE_SETITIMER
|
|
293
|
|
294 /* Defines size_t and alloca (). */
|
|
295 #include <malloc.h>
|
|
296
|
|
297 #include <sys/stat.h>
|
|
298
|
|
299 /* Define for those source files that do not include enough NT
|
|
300 system files. */
|
|
301 #ifndef NULL
|
|
302 #ifdef __cplusplus
|
|
303 #define NULL 0
|
|
304 #else
|
|
305 #define NULL ((void *)0)
|
|
306 #endif
|
|
307 #endif
|
|
308
|
|
309 /* For proper declaration of environ. */
|
|
310 #include <stdlib.h>
|
|
311 #include <string.h>
|
|
312
|
|
313 /* Define process implementation */
|
|
314 #define HAVE_WIN32_PROCESSES
|
|
315
|
|
316 /* We need a little extra space, see ../../lisp/loadup.el */
|
|
317 #define SYSTEM_PURESIZE_EXTRA 15000
|
|
318
|
|
319 /* ============================================================ */
|
|
320
|
|
321 /* See unexnt.c */
|
|
322 #if (_MSC_VER >= 1100)
|
|
323 #define DUMP_SEPARATE_SECTION
|
|
324 #endif
|
|
325 #ifdef DUMP_SEPARATE_SECTION
|
|
326 #pragma data_seg("xdata")
|
|
327 #pragma bss_seg("xdata")
|
|
328 #endif
|
|
329
|
|
330 #ifdef HAVE_SCROLLBARS
|
|
331 /* Ensure the NT 4 mouse definitions in winuser.h are available */
|
|
332 #ifndef _WIN32_WINNT
|
|
333 #define _WIN32_WINNT 0x0400
|
|
334 #endif
|
|
335 #endif
|
442
|
336
|
|
337 /* Force the various NT 4 structures and constants to be included; we're
|
|
338 careful not to call (or even link with) functions not in NT 3.51 when
|
|
339 running on 3.51, but when running on NT 4 or Win9x, we use the later
|
|
340 functions, and need their headers. */
|
|
341 /* The VC++ (5.0, at least) headers treat WINVER non-existent as 0x0400 */
|
|
342 #if defined (WINVER) && WINVER < 0x0400
|
|
343 # undef WINVER
|
|
344 # define WINVER 0x0400
|
|
345 #endif
|
|
346
|
|
347 /* MSVC 6.0 has a mechanism to declare functions which never return */
|
|
348 #if (_MSC_VER >= 1200)
|
|
349 #define DOESNT_RETURN __declspec(noreturn) void
|
|
350 #define DECLARE_DOESNT_RETURN(decl) __declspec(noreturn) extern void decl
|
|
351 #define DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS(decl,str,idx) \
|
|
352 __declspec(noreturn) extern void decl PRINTF_ARGS(str,idx)
|
|
353 #endif /* MSVC 6.0 */
|
|
354
|
|
355 #define CORRECT_DIR_SEPS(s) \
|
|
356 do { if ('/' == DIRECTORY_SEP) dostounix_filename (s); \
|
|
357 else unixtodos_filename (s); \
|
|
358 } while (0)
|