Mercurial > hg > xemacs-beta
comparison src/s/windowsnt.h @ 771:943eaba38521
[xemacs-hg @ 2002-03-13 08:51:24 by ben]
The big ben-mule-21-5 check-in!
Various files were added and deleted. See CHANGES-ben-mule.
There are still some test suite failures. No crashes, though.
Many of the failures have to do with problems in the test suite itself
rather than in the actual code. I'll be addressing these in the next
day or so -- none of the test suite failures are at all critical.
Meanwhile I'll be trying to address the biggest issues -- i.e. build
or run failures, which will almost certainly happen on various platforms.
All comments should be sent to ben@xemacs.org -- use a Cc: if necessary
when sending to mailing lists. There will be pre- and post- tags,
something like
pre-ben-mule-21-5-merge-in, and
post-ben-mule-21-5-merge-in.
author | ben |
---|---|
date | Wed, 13 Mar 2002 08:54:06 +0000 |
parents | 023b83f4e54b |
children | a5954632b187 |
comparison
equal
deleted
inserted
replaced
770:336a418893b5 | 771:943eaba38521 |
---|---|
1 /* System description file for Windows 9x and NT. | 1 /* System description file for Windows 9x and NT. |
2 Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc. | 2 Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc. |
3 Copyright (C) 2001 Ben Wing. | |
3 | 4 |
4 This file is part of XEmacs. | 5 This file is part of XEmacs. |
5 | 6 |
6 XEmacs is free software; you can redistribute it and/or modify | 7 XEmacs 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 it under the terms of the GNU General Public License as published by |
21 /* Synched up with: FSF 19.31. */ | 22 /* Synched up with: FSF 19.31. */ |
22 | 23 |
23 /* Capsule summary of different preprocessor flags: | 24 /* Capsule summary of different preprocessor flags: |
24 | 25 |
25 1. Keep in mind that there are two possible OS environments we are dealing | 26 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 with -- Cygwin and Native Windows. MS Windows natively provides |
27 layer on top of MS Windows -- in particular, providing the file-system, | 28 file-system, process, and window-system services through the Win32 API, |
28 process, tty, and signal semantics that are part of a modern, standard | 29 implemented by various DLL's. (The most important and KERNEL32, USER32, |
29 Unix operating system. MS Windows also provides these services, but | 30 and GDI32. KERNEL32 implements the basic file-system and process |
30 through their own API, called Win32. When compiling in a Cygwin | 31 services. USER32 implements the fundamental window-system services |
31 environment, the Win32 API's are also available, and in fact are used | 32 such as creating windows and handling messages. GDI32 implements |
32 to do native GUI programming. | 33 higher-level drawing capabilities -- fonts, colors, lines, etc.) The C |
34 library is implemented on top of Win32 using either MSVCRT (dynamically | |
35 linked) or LIBC.LIB (statically linked). Cygwin provides a POSIX | |
36 emulation layer on top of MS Windows -- in particular, providing the | |
37 file-system, process, tty, and signal semantics that are part of a | |
38 modern, standard Unix operating system. Cygwin does this using its own | |
39 DLL, cygwin1.dll, which makes calls to the Win32 API services in | |
40 kernel32.dll. Cygwin also provides its own implementation of the C | |
41 library, called `newlib' (libcygwin.a; libc.a and libm.a are symlinked | |
42 to it), which is implemented on top of the Unix system calls provided | |
43 in cygwin1.dll. In addition, Cygwin provides static import libraries | |
44 that give you direct access to the Win32 API -- XEmacs uses this to | |
45 provide GUI support under Cygwin. The two environments also use | |
46 different compilers -- Native Windows uses Visual C++, and Cygwin uses | |
47 GCC. (MINGW, however, is a way of using GCC to target the Native | |
48 Windows environment. This works similarly to building with Cygwin, but | |
49 the resulting executable does not use the Cygwin DLL. Instead, MINGW | |
50 provides import libraries for the standard C library DLL's | |
51 (specifically CRTDLL -- #### how does this differ from MSVCRT and | |
52 LIBC.LIB?).) | |
33 | 53 |
34 2. There are two windowing environments we can target XEmacs for when | 54 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 | 55 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 | 56 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 | 57 servers out there running on Windows, and as far as I know there is no |
47 Windows + X Windows for windowing. | 67 Windows + X Windows for windowing. |
48 | 68 |
49 The build flags used for these divisions are: | 69 The build flags used for these divisions are: |
50 | 70 |
51 CYGWIN -- for Cygwin-only stuff. | 71 CYGWIN -- for Cygwin-only stuff. |
52 WIN32_NATIVE -- Win32 native OS-level stuff (files, process, etc.). | 72 WIN32_NATIVE -- Win32 native OS-level stuff (files, process, etc.). Applies |
73 whenever linking against the native C libraries -- i.e. | |
74 all compilations with VC++ and with MINGW, but never Cygwin. | |
53 HAVE_X_WINDOWS -- for X Windows (regardless of whether under MS Win) | 75 HAVE_X_WINDOWS -- for X Windows (regardless of whether under MS Win) |
54 HAVE_MS_WINDOWS -- MS Windows native windowing system (anything related to | 76 HAVE_MS_WINDOWS -- MS Windows native windowing system (anything related to |
55 the appearance of the graphical screen). | 77 the appearance of the graphical screen). May or may not |
78 apply to any of VC++, MINGW, Cygwin. | |
56 | 79 |
57 Finally, there's also the MINGW build environment, which uses GCC | 80 Finally, there's also the MINGW build environment, which uses GCC |
58 \(similar to Cygwin), but native MS Windows libraries rather than a | 81 \(similar to Cygwin), but native MS Windows libraries rather than a |
59 POSIX emulation layer (the Cygwin approach). This environment defines | 82 POSIX emulation layer (the Cygwin approach). This environment defines |
60 WIN32_NATIVE, but also defines MINGW, which is used mostly because | 83 WIN32_NATIVE, but also defines MINGW, which is used mostly because |
82 __CYGWIN32__ -> CYGWIN | 105 __CYGWIN32__ -> CYGWIN |
83 __MINGW32__ -> MINGW | 106 __MINGW32__ -> MINGW |
84 | 107 |
85 */ | 108 */ |
86 | 109 |
87 /* Identify ourselves */ | 110 #include "win32-native.h" |
88 #ifndef WIN32_NATIVE | |
89 #define WIN32_NATIVE | |
90 #endif | |
91 | 111 |
92 /* In case non-Microsoft compiler is used, we fake _MSC_VER */ | 112 /* In case non-Microsoft compiler is used, we fake _MSC_VER */ |
93 #ifndef _MSC_VER | 113 #ifndef _MSC_VER |
94 #define _MSC_VER 1 | 114 #define _MSC_VER 1 |
95 #endif | 115 #endif |
96 | 116 |
97 typedef unsigned short mode_t; | 117 /* Stuff from old nt/config.h: */ |
98 /* typedef long ptrdiff_t; -kkm */ | 118 |
99 typedef int pid_t; | 119 #define NTHEAP_PROBE_BASE 1 |
100 | 120 |
101 #include <stddef.h> | 121 #define LISP_FLOAT_TYPE |
102 | 122 |
103 /* If you are compiling with a non-C calling convention but need to | 123 #ifdef HAVE_X_WINDOWS |
104 declare vararg routines differently, put it here */ | 124 |
105 #define _VARARGS_ __cdecl | 125 #define HAVE_XREGISTERIMINSTANTIATECALLBACK |
106 | 126 |
107 /* If you are providing a function to something that will call the | 127 #define THIS_IS_X11R6 |
108 function back (like a signal handler and signal, or main) its calling | 128 #define HAVE_XMU |
109 convention must be whatever standard the libraries expect */ | 129 #define HAVE_XLOCALE_H |
110 #define _CALLBACK_ __cdecl | 130 #define HAVE_X11_LOCALE_H |
111 | 131 #define GETTIMEOFDAY_ONE_ARGUMENT |
112 /* SYSTEM_TYPE should indicate the kind of system you are using. | 132 |
113 It sets the Lisp variable system-type. */ | 133 #define LWLIB_USES_ATHENA |
114 | 134 #define LWLIB_MENUBARS_LUCID |
115 #define SYSTEM_TYPE "windows-nt" | 135 #define LWLIB_SCROLLBARS_LUCID |
116 | 136 #define LWLIB_DIALOGS_ATHENA |
117 #define NO_MATHERR | 137 #define LWLIB_TABS_LUCID |
138 #define LWLIB_WIDGETS_ATHENA | |
139 | |
140 /* These are what gets defined under Cygwin */ | |
141 #define _BSD_SOURCE 1 | |
142 #define _SVID_SOURCE 1 | |
143 #define X_LOCALE 1 | |
144 #define NARROWPROTO 1 | |
145 | |
146 #endif /* HAVE_X_WINDOWS */ | |
147 | |
148 #define HAVE_LOCALE_H | |
149 #define STDC_HEADERS | |
150 | |
151 #define HAVE_LONG_FILE_NAMES | |
152 | |
153 #define HAVE_TIMEVAL | |
154 #define HAVE_TZNAME | |
155 #define HAVE_H_ERRNO | |
156 | |
157 #define HAVE_CLOSEDIR | |
158 #define HAVE_DUP2 | |
159 #define HAVE_EXECVPE | |
160 #define HAVE_FMOD | |
161 #define HAVE_FREXP | |
162 #define HAVE_FTIME | |
163 #define HAVE_GETCWD | |
164 #define HAVE_GETHOSTNAME | |
165 #define HAVE_GETPAGESIZE | |
166 #define getpagesize() 4096 | |
167 #define HAVE_GETTIMEOFDAY | |
168 #define HAVE_LINK | |
169 #define HAVE_LOGB | |
170 #define HAVE_MKDIR | |
171 #define HAVE_MKTIME | |
172 #define HAVE_RENAME | |
173 #define HAVE_RMDIR | |
174 #define HAVE_SELECT | |
175 #define HAVE_STRERROR | |
176 | |
177 #define HAVE_SOCKETS | |
178 | |
179 #ifdef DEBUG_XEMACS | |
180 #define USE_ASSERTIONS | |
181 #define MEMORY_USAGE_STATS | |
182 #define ERROR_CHECK_EXTENTS | |
183 #define ERROR_CHECK_TYPECHECK | |
184 #define ERROR_CHECK_CHARBPOS | |
185 #define ERROR_CHECK_GC | |
186 #define ERROR_CHECK_MALLOC | |
187 #define ERROR_CHECK_BYTE_CODE | |
188 #define ERROR_CHECK_GLYPHS | |
189 #endif /* DEBUG_XEMACS */ | |
190 | |
191 #define HAVE_DRAGNDROP | |
118 | 192 |
119 #define SIZEOF_SHORT 2 | 193 #define SIZEOF_SHORT 2 |
120 #define SIZEOF_INT 4 | 194 #define SIZEOF_INT 4 |
121 #define SIZEOF_LONG 4 | 195 #define SIZEOF_LONG 4 |
122 #define SIZEOF_LONG_LONG 0 | 196 #define SIZEOF_LONG_LONG 0 |
123 #define SIZEOF_VOID_P 4 | 197 #define SIZEOF_VOID_P 4 |
124 | 198 |
125 /* NOMULTIPLEJOBS should be defined if your system's shell | 199 typedef int mode_t; |
126 does not have "job control" (the ability to stop a program, | 200 typedef int pid_t; |
127 run some other program, then continue the first one). */ | 201 typedef int uid_t; |
128 | 202 typedef int gid_t; |
129 /* #define NOMULTIPLEJOBS */ | 203 typedef int pid_t; |
130 | 204 typedef int ssize_t; |
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 | 205 |
149 /* If your system uses COFF (Common Object File Format) then define the | 206 /* If your system uses COFF (Common Object File Format) then define the |
150 preprocessor symbol "COFF". */ | 207 preprocessor symbol "COFF". */ |
151 | 208 |
152 #define COFF | 209 #define COFF |
153 | |
154 /* NT supports Winsock which is close enough (with some hacks) */ | |
155 | |
156 #define HAVE_SOCKETS | |
157 | 210 |
158 /* define MAIL_USE_FLOCK if the mailer uses flock | 211 /* define MAIL_USE_FLOCK if the mailer uses flock |
159 to interlock access to /usr/spool/mail/$USER. | 212 to interlock access to /usr/spool/mail/$USER. |
160 The alternative is that a lock file named | 213 The alternative is that a lock file named |
161 /usr/spool/mail/$USER.lock. */ | 214 /usr/spool/mail/$USER.lock. */ |
162 | 215 |
163 #define MAIL_USE_POP | 216 #define MAIL_USE_POP |
164 #define HAVE_LOCKING | 217 #define HAVE_LOCKING |
165 #define MAIL_USE_LOCKING | 218 #define MAIL_USE_LOCKING |
166 | 219 |
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 | |
183 #define DIRECTORY_SEP ((char)XCHAR(Vdirectory_sep_char)) | |
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 | |
235 /* subprocess calls that are emulated */ | |
236 #ifndef DONT_ENCAPSULATE | |
237 #define spawnve sys_spawnve | |
238 int spawnve (int mode, const char *cmdname, | |
239 const char * const *argv, const char *const *envp); | |
240 #endif | |
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 */ | 220 /* See unexnt.c */ |
322 #if (_MSC_VER >= 1100) | 221 #if (_MSC_VER >= 1100) |
323 #define DUMP_SEPARATE_SECTION | 222 #define DUMP_SEPARATE_SECTION |
324 #endif | 223 #endif |
325 #ifdef DUMP_SEPARATE_SECTION | 224 #ifdef DUMP_SEPARATE_SECTION |
327 #pragma bss_seg("xdata") | 226 #pragma bss_seg("xdata") |
328 #endif | 227 #endif |
329 | 228 |
330 #ifdef HAVE_SCROLLBARS | 229 #ifdef HAVE_SCROLLBARS |
331 /* Ensure the NT 4 mouse definitions in winuser.h are available */ | 230 /* Ensure the NT 4 mouse definitions in winuser.h are available */ |
332 #ifndef _WIN32_WINNT | 231 # ifndef _WIN32_WINNT |
333 #define _WIN32_WINNT 0x0400 | 232 # define _WIN32_WINNT 0x0400 |
334 #endif | 233 # endif |
335 #endif | 234 #endif |
336 | 235 |
337 /* Force the various NT 4 structures and constants to be included; we're | 236 /* 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 | 237 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 | 238 running on 3.51, but when running on NT 4 or Win9x, we use the later |
350 #define DECLARE_DOESNT_RETURN(decl) __declspec(noreturn) extern void decl | 249 #define DECLARE_DOESNT_RETURN(decl) __declspec(noreturn) extern void decl |
351 #define DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS(decl,str,idx) \ | 250 #define DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS(decl,str,idx) \ |
352 __declspec(noreturn) extern void decl PRINTF_ARGS(str,idx) | 251 __declspec(noreturn) extern void decl PRINTF_ARGS(str,idx) |
353 #endif /* MSVC 6.0 */ | 252 #endif /* MSVC 6.0 */ |
354 | 253 |
355 #define CORRECT_DIR_SEPS(s) \ | 254 /* MSVC warnings no-no crap. When adding one to this section, |
356 do { if ('/' == DIRECTORY_SEP) dostounix_filename (s); \ | 255 1. Think twice |
357 else unixtodos_filename (s); \ | 256 2. Insert textual description of the warning. |
358 } while (0) | 257 3. Think twice. Undo still works */ |
258 #if (_MSC_VER >= 800) | |
259 | |
260 /* 'expression' : signed/unsigned mismatch */ | |
261 /* #pragma warning ( disable : 4018 ) */ | |
262 /* unnamed type definition in parentheses | |
263 (Martin added a pedantically correct definition of ALIGNOF, which | |
264 generates temporary anonymous structures, and MSVC complains) */ | |
265 #pragma warning ( disable : 4116 ) | |
266 | |
267 #endif /* compiler understands #pragma warning*/ | |
268 | |
269 /* MSVC version >= 2.x without /Za supports __inline */ | |
270 #if (_MSC_VER < 900) || defined (__STDC__) | |
271 # define inline | |
272 #else | |
273 # define inline __inline | |
274 #endif | |
275 | |
276 /* lisp.h defines abort() as a macro. therefore, we must include all | |
277 files that contain prototypes for abort() before then. */ | |
278 #include <../include/process.h> |