Mercurial > hg > xemacs-beta
comparison src/s/windowsnt.h @ 412:697ef44129c6 r21-2-14
Import from CVS: tag r21-2-14
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:20:41 +0200 |
parents | de805c49cfc1 |
children | 11054d720c21 |
comparison
equal
deleted
inserted
replaced
411:12e008d41344 | 412:697ef44129c6 |
---|---|
1 /* System description file for Windows 9x and NT. | 1 /* System description file for Windows NT. |
2 Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc. | 2 Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc. |
3 | 3 |
4 This file is part of GNU Emacs. | 4 This file is part of GNU Emacs. |
5 | 5 |
6 GNU Emacs is free software; you can redistribute it and/or modify | 6 GNU Emacs is free software; you can redistribute it and/or modify |
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 Boston, MA 02111-1307, USA. */ | 19 Boston, MA 02111-1307, USA. */ |
20 | 20 |
21 /* Synched up with: FSF 19.31. */ | 21 /* Synched up with: FSF 19.31. */ |
22 | 22 |
23 /* Capsule summary of different preprocessor flags: | 23 #ifndef WINDOWSNT |
24 | 24 #define WINDOWSNT |
25 1. Keep in mind that there are two possible OS environments we are dealing | 25 #endif |
26 with -- Cygwin and Native Windows. Cygwin provides a POSIX emulation | 26 |
27 layer on top of MS Windows -- in particular, providing the file-system, | 27 #ifndef DOS_NT |
28 process, tty, and signal semantics that are part of a modern, standard | 28 #define DOS_NT /* MSDOS or WINDOWSNT */ |
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). | |
56 | |
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 | |
90 #endif | 29 #endif |
91 | 30 |
92 /* In case non-Microsoft compiler is used, we fake _MSC_VER */ | 31 /* In case non-Microsoft compiler is used, we fake _MSC_VER */ |
93 #ifndef _MSC_VER | 32 #ifndef _MSC_VER |
94 #define _MSC_VER 1 | 33 #define _MSC_VER 1 |
117 #define NO_MATHERR | 56 #define NO_MATHERR |
118 | 57 |
119 #define SIZEOF_SHORT 2 | 58 #define SIZEOF_SHORT 2 |
120 #define SIZEOF_INT 4 | 59 #define SIZEOF_INT 4 |
121 #define SIZEOF_LONG 4 | 60 #define SIZEOF_LONG 4 |
122 #define SIZEOF_LONG_LONG 0 | 61 #define SIZEOF_LONG_LONG 8 |
123 #define SIZEOF_VOID_P 4 | 62 #define SIZEOF_VOID_P 4 |
124 | 63 |
125 /* NOMULTIPLEJOBS should be defined if your system's shell | 64 /* NOMULTIPLEJOBS should be defined if your system's shell |
126 does not have "job control" (the ability to stop a program, | 65 does not have "job control" (the ability to stop a program, |
127 run some other program, then continue the first one). */ | 66 run some other program, then continue the first one). */ |
164 /* define MAIL_USE_FLOCK if the mailer uses flock | 103 /* define MAIL_USE_FLOCK if the mailer uses flock |
165 to interlock access to /usr/spool/mail/$USER. | 104 to interlock access to /usr/spool/mail/$USER. |
166 The alternative is that a lock file named | 105 The alternative is that a lock file named |
167 /usr/spool/mail/$USER.lock. */ | 106 /usr/spool/mail/$USER.lock. */ |
168 | 107 |
108 /* #define MAIL_USE_FLOCK */ | |
169 #define MAIL_USE_POP | 109 #define MAIL_USE_POP |
170 #define HAVE_LOCKING | 110 #define MAIL_USE_SYSTEM_LOCK |
171 #define MAIL_USE_LOCKING | |
172 | 111 |
173 /* If the character used to separate elements of the executable path | 112 /* If the character used to separate elements of the executable path |
174 is not ':', #define this to be the appropriate character constant. */ | 113 is not ':', #define this to be the appropriate character constant. */ |
175 #define SEPCHAR ';' | 114 #define SEPCHAR ';' |
176 | 115 |
184 (Which you should place, by convention, in sysdep.c). */ | 123 (Which you should place, by convention, in sysdep.c). */ |
185 | 124 |
186 /* XEmacs file I/O for DOS text files requires FILE_CODING */ | 125 /* XEmacs file I/O for DOS text files requires FILE_CODING */ |
187 #define FILE_CODING | 126 #define FILE_CODING |
188 | 127 |
189 #define DIRECTORY_SEP ((char)XCHAR(Vdirectory_sep_char)) | 128 #define DIRECTORY_SEP '\\' |
190 | 129 |
191 /* Define this to be the separator between devices and paths */ | 130 /* Define this to be the separator between devices and paths */ |
192 #define DEVICE_SEP ':' | 131 #define DEVICE_SEP ':' |
193 | 132 |
194 /* We'll support either convention on NT. */ | 133 /* We'll support either convention on NT. */ |
226 | 165 |
227 #define HAVE_MOUSE | 166 #define HAVE_MOUSE |
228 #define HAVE_H_ERRNO | 167 #define HAVE_H_ERRNO |
229 #define HAVE_STRUCT_UTIMBUF | 168 #define HAVE_STRUCT_UTIMBUF |
230 | 169 |
170 #ifdef HAVE_NTGUI | |
171 #define HAVE_WINDOW_SYSTEM | |
172 #define HAVE_FACES | |
173 #endif | |
174 | |
231 #define HAVE_STRCASECMP | 175 #define HAVE_STRCASECMP |
232 | 176 |
233 /* Compatibility macros. Some used to be routines in nt.c */ | 177 /* Compatibility macros. Some used to be routines in nt.c */ |
234 #define strcasecmp(x,y) _stricmp(x,y) | 178 #define strcasecmp(x,y) _stricmp(x,y) |
235 #define random() (rand() << 15 | rand()) | 179 #define random() (rand() << 15 | rand()) |
236 #define srandom(seed) (srand(seed)) | 180 #define srandom(seed) (srand(seed)) |
237 #define setpgrp(pid,gid) | 181 #define setpgrp(pid,gid) |
238 | 182 |
239 #define MODE_LINE_BINARY_TEXT(_b_) (NILP ((_b_)->buffer_file_type) ? "T" : "B") | 183 #define MODE_LINE_BINARY_TEXT(_b_) (NILP ((_b_)->buffer_file_type) ? "T" : "B") |
240 | 184 |
241 | 185 /* get some redefinitions in place */ |
186 | |
187 #if 0 | |
188 /* IO calls that are emulated or shadowed */ | |
189 #define access sys_access | |
190 #define chdir sys_chdir | |
191 #define chmod sys_chmod | |
192 #define close sys_close | |
193 #define creat sys_creat | |
194 #define ctime sys_ctime | |
195 #define dup sys_dup | |
196 #define dup2 sys_dup2 | |
197 #define fopen sys_fopen | |
198 #define link sys_link | |
199 #define mktemp sys_mktemp | |
200 #define open sys_open | |
201 #define read sys_read | |
202 #define rename sys_rename | |
203 #define unlink sys_unlink | |
204 #define write sys_write | |
205 #define mkdir sys_mkdir | |
206 #define rmdir sys_rmdir | |
207 | |
208 #endif | |
209 | |
210 #if 0 | |
211 /* this is hacky, but is necessary to avoid warnings about macro | |
212 redefinitions using the SDK compilers */ | |
213 #ifndef __STDC__ | |
214 #define __STDC__ 1 | |
215 #define MUST_UNDEF__STDC__ | |
216 #endif | |
217 #include <direct.h> | |
218 #include <io.h> | |
242 #include <stdio.h> | 219 #include <stdio.h> |
243 | 220 #ifdef MUST_UNDEF__STDC__ |
244 /* subprocess calls that are emulated */ | 221 #undef __STDC__ |
245 #ifndef DONT_ENCAPSULATE | 222 #undef MUST_UNDEF__STDC__ |
246 #define spawnve sys_spawnve | 223 #endif |
247 int spawnve (int mode, const char *cmdname, | 224 #endif |
248 const char * const *argv, const char *const *envp); | 225 |
249 #endif | 226 #include <stdio.h> |
227 | |
250 | 228 |
251 /* IO calls that are emulated or shadowed */ | 229 /* IO calls that are emulated or shadowed */ |
252 #define pipe sys_pipe | 230 #define pipe sys_pipe |
253 int sys_pipe (int * phandles); | 231 int sys_pipe (int * phandles); |
254 | 232 |
255 #ifndef HAVE_X_WINDOWS | 233 #ifndef HAVE_X_WINDOWS |
256 #define sleep sys_sleep | 234 #define sleep sys_sleep |
257 void sleep (int seconds); | 235 void sleep (int seconds); |
258 #endif | 236 #endif |
259 | 237 |
238 /* subprocess calls that are emulated */ | |
239 #define spawnve sys_spawnve | |
240 int spawnve (int mode, CONST char *cmdname, | |
241 CONST char * CONST *argv, CONST char *CONST *envp); | |
242 | |
260 #define wait sys_wait | 243 #define wait sys_wait |
261 int wait (int *status); | 244 int wait (int *status); |
262 | 245 |
263 #define kill sys_kill | 246 #define kill sys_kill |
264 int kill (int pid, int sig); | 247 int kill (int pid, int sig); |
265 | 248 |
266 /* map to MSVC names */ | 249 /* map to MSVC names */ |
267 #define popen _popen | 250 #define popen _popen |
268 #define pclose _pclose | 251 #define pclose _pclose |
269 | 252 |
270 typedef int uid_t; | 253 #if 0 |
271 typedef int gid_t; | 254 #define chdir _chdir |
272 typedef int pid_t; | 255 #define execlp _execlp |
273 typedef int ssize_t; | 256 #define execvp _execvp |
257 #define fcloseall _fcloseall | |
258 #define fdopen _fdopen | |
259 #define fgetchar _fgetchar | |
260 #define fileno _fileno | |
261 #define flushall _flushall | |
262 #define fputchar _fputchar | |
263 #define getw _getw | |
264 #define getpid _getpid | |
265 #define isatty _isatty | |
266 #define logb _logb | |
267 #define _longjmp longjmp | |
268 #define lseek _lseek | |
269 #define putw _putw | |
270 #define umask _umask | |
271 /* #define utime _utime */ | |
272 /* #define index strchr */ | |
273 /* #define rindex strrchr */ | |
274 #define read _read | |
275 #define write _write | |
276 #define getcwd _getcwd | |
277 | |
278 #ifdef HAVE_NTGUI | |
279 #define abort win32_abort | |
280 #endif | |
281 | |
282 #endif /* 0 */ | |
274 | 283 |
275 /* Encapsulation of system calls */ | 284 /* Encapsulation of system calls */ |
276 #ifndef DONT_ENCAPSULATE | 285 #ifndef DONT_ENCAPSULATE |
277 #define getpid sys_getpid | 286 #define getpid sys_getpid |
278 pid_t getpid (void); | 287 int getpid (void); |
279 #endif | 288 #endif |
280 | 289 |
281 /* Random global functions called everywhere. Implemented in nt.c */ | 290 /* Random global functions called everywhere. Implemented in nt.c */ |
282 /* #### Most of these are FSFisms and must be avoided */ | 291 /* #### Most of these are FSFisms and must be avoided */ |
283 /* #### All of these are FSFisms and must be avoided */ | 292 /* #### All of these are FSFisms and must be avoided */ |
288 char *getwd (char *dir); | 297 char *getwd (char *dir); |
289 | 298 |
290 void *sbrk (unsigned long increment); | 299 void *sbrk (unsigned long increment); |
291 | 300 |
292 struct passwd; | 301 struct passwd; |
293 struct passwd *getpwuid (uid_t uid); | 302 struct passwd *getpwuid (int uid); |
294 struct passwd *getpwnam (const char *name); | 303 struct passwd *getpwnam (const char *name); |
295 uid_t getuid (void); | 304 int getuid (); |
296 uid_t geteuid (void); | 305 int geteuid (); |
297 gid_t getgid (void); | 306 int getgid (void); |
298 gid_t getegid (void); | 307 int getegid (); |
299 | 308 |
300 /* Setitimer is emulated */ | 309 /* Setitimer is emulated */ |
301 #define HAVE_SETITIMER | 310 #define HAVE_SETITIMER |
302 | 311 |
303 /* We now have emulation for some signals */ | 312 /* We now have emulation for some signals */ |
304 #define HAVE_SIGHOLD | 313 #define HAVE_SIGHOLD |
305 #define sigset(s,h) mswindows_sigset(s,h) | 314 #define sigset(s,h) msw_sigset(s,h) |
306 #define sighold(s) mswindows_sighold(s) | 315 #define sighold(s) msw_sighold(s) |
307 #define sigrelse(s) mswindows_sigrelse(s) | 316 #define sigrelse(s) msw_sigrelse(s) |
308 #define sigpause(s) mswindows_sigpause(s) | 317 #define sigpause(s) msw_sigpause(s) |
318 #define signal sigset | |
309 | 319 |
310 /* Defines that we need that aren't in the standard signal.h */ | 320 /* Defines that we need that aren't in the standard signal.h */ |
311 #define SIGHUP 1 /* Hang up */ | 321 #define SIGHUP 1 /* Hang up */ |
312 #define SIGQUIT 3 /* Quit process */ | 322 #define SIGQUIT 3 /* Quit process */ |
313 #define SIGKILL 9 /* Die, die die */ | 323 #define SIGKILL 9 /* Die, die die */ |
314 #define SIGALRM 14 /* Alarm */ | 324 #define SIGALRM 14 /* Alarm */ |
315 #define SIGPROF 29 /* Profiling timer exp */ | 325 #define SIGPROF 29 /* Profiling timer exp */ |
326 | |
327 /* For integration with MSDOS support. */ | |
328 #define getdisk() (_getdrive () - 1) | |
329 #define getdefdir(_drv, _buf) _getdcwd (_drv, _buf, MAXPATHLEN) | |
330 | |
331 #if 0 /* they do. -kkm */ | |
332 /* Define this so that winsock.h definitions don't get included when windows.h | |
333 is... I don't know if they do the right thing for emacs. For this to | |
334 have proper effect, config.h must always be included before windows.h. */ | |
335 #define _WINSOCKAPI_ 1 | |
336 #endif /* 0 */ | |
316 | 337 |
317 /* Defines size_t and alloca (). */ | 338 /* Defines size_t and alloca (). */ |
318 #include <malloc.h> | 339 #include <malloc.h> |
319 | 340 |
320 #include <sys/stat.h> | 341 #include <sys/stat.h> |
347 #endif | 368 #endif |
348 #ifdef DUMP_SEPARATE_SECTION | 369 #ifdef DUMP_SEPARATE_SECTION |
349 #pragma data_seg("xdata") | 370 #pragma data_seg("xdata") |
350 #pragma bss_seg("xdata") | 371 #pragma bss_seg("xdata") |
351 #endif | 372 #endif |
352 | |
353 #ifdef HAVE_SCROLLBARS | |
354 /* Ensure the NT 4 mouse definitions in winuser.h are available */ | |
355 #ifndef _WIN32_WINNT | |
356 #define _WIN32_WINNT 0x0400 | |
357 #endif | |
358 #endif | |
359 | |
360 /* MSVC 6.0 has a mechanism to declare functions which never return */ | |
361 #if (_MSC_VER >= 1200) | |
362 #define DOESNT_RETURN __declspec(noreturn) void | |
363 #define DECLARE_DOESNT_RETURN(decl) __declspec(noreturn) extern void decl | |
364 #define DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS(decl,str,idx) \ | |
365 __declspec(noreturn) extern void decl PRINTF_ARGS(str,idx) | |
366 #endif /* MSVC 6.0 */ | |
367 | |
368 #define CORRECT_DIR_SEPS(s) \ | |
369 do { if ('/' == DIRECTORY_SEP) dostounix_filename (s); \ | |
370 else unixtodos_filename (s); \ | |
371 } while (0) |