comparison src/s/windowsnt.h @ 442:abe6d1db359e r21-2-36

Import from CVS: tag r21-2-36
author cvs
date Mon, 13 Aug 2007 11:35:02 +0200
parents 8de8e3f6228a
children 223736d75acb
comparison
equal deleted inserted replaced
441:72a7cfa4a488 442:abe6d1db359e
1 /* System description file for Windows 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 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 #ifndef WINDOWSNT 23 /* Capsule summary of different preprocessor flags:
24 #define WINDOWSNT 24
25 #endif 25 1. Keep in mind that there are two possible OS environments we are dealing
26 26 with -- Cygwin and Native Windows. Cygwin provides a POSIX emulation
27 #ifndef DOS_NT 27 layer on top of MS Windows -- in particular, providing the file-system,
28 #define DOS_NT /* MSDOS or WINDOWSNT */ 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).
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
29 #endif 90 #endif
30 91
31 /* In case non-Microsoft compiler is used, we fake _MSC_VER */ 92 /* In case non-Microsoft compiler is used, we fake _MSC_VER */
32 #ifndef _MSC_VER 93 #ifndef _MSC_VER
33 #define _MSC_VER 1 94 #define _MSC_VER 1
56 #define NO_MATHERR 117 #define NO_MATHERR
57 118
58 #define SIZEOF_SHORT 2 119 #define SIZEOF_SHORT 2
59 #define SIZEOF_INT 4 120 #define SIZEOF_INT 4
60 #define SIZEOF_LONG 4 121 #define SIZEOF_LONG 4
61 #define SIZEOF_LONG_LONG 8 122 #define SIZEOF_LONG_LONG 0
62 #define SIZEOF_VOID_P 4 123 #define SIZEOF_VOID_P 4
63 124
64 /* NOMULTIPLEJOBS should be defined if your system's shell 125 /* NOMULTIPLEJOBS should be defined if your system's shell
65 does not have "job control" (the ability to stop a program, 126 does not have "job control" (the ability to stop a program,
66 run some other program, then continue the first one). */ 127 run some other program, then continue the first one). */
165 226
166 #define HAVE_MOUSE 227 #define HAVE_MOUSE
167 #define HAVE_H_ERRNO 228 #define HAVE_H_ERRNO
168 #define HAVE_STRUCT_UTIMBUF 229 #define HAVE_STRUCT_UTIMBUF
169 230
170 #ifdef HAVE_NTGUI
171 #define HAVE_WINDOW_SYSTEM
172 #define HAVE_FACES
173 #endif
174
175 #define HAVE_STRCASECMP
176
177 /* Compatibility macros. Some used to be routines in nt.c */ 231 /* Compatibility macros. Some used to be routines in nt.c */
178 #define strcasecmp(x,y) _stricmp(x,y) 232 #define strcasecmp(x,y) _stricmp(x,y)
179 #define random() (rand() << 15 | rand()) 233 #define random() (rand() << 15 | rand())
180 #define srandom(seed) (srand(seed)) 234 #define srandom(seed) (srand(seed))
181 #define setpgrp(pid,gid) 235 #define setpgrp(pid,gid)
186 #include <stdio.h> 240 #include <stdio.h>
187 241
188 /* subprocess calls that are emulated */ 242 /* subprocess calls that are emulated */
189 #ifndef DONT_ENCAPSULATE 243 #ifndef DONT_ENCAPSULATE
190 #define spawnve sys_spawnve 244 #define spawnve sys_spawnve
191 int spawnve (int mode, CONST char *cmdname, 245 int spawnve (int mode, const char *cmdname,
192 CONST char * CONST *argv, CONST char *CONST *envp); 246 const char * const *argv, const char *const *envp);
193 #endif 247 #endif
194 248
195 /* IO calls that are emulated or shadowed */ 249 /* IO calls that are emulated or shadowed */
196 #define pipe sys_pipe 250 #define pipe sys_pipe
197 int sys_pipe (int * phandles); 251 int sys_pipe (int * phandles);
244 /* Setitimer is emulated */ 298 /* Setitimer is emulated */
245 #define HAVE_SETITIMER 299 #define HAVE_SETITIMER
246 300
247 /* We now have emulation for some signals */ 301 /* We now have emulation for some signals */
248 #define HAVE_SIGHOLD 302 #define HAVE_SIGHOLD
249 #define sigset(s,h) msw_sigset(s,h) 303 #define sigset(s,h) mswindows_sigset(s,h)
250 #define sighold(s) msw_sighold(s) 304 #define sighold(s) mswindows_sighold(s)
251 #define sigrelse(s) msw_sigrelse(s) 305 #define sigrelse(s) mswindows_sigrelse(s)
252 #define sigpause(s) msw_sigpause(s) 306 #define sigpause(s) mswindows_sigpause(s)
253 307
254 /* Defines that we need that aren't in the standard signal.h */ 308 /* Defines that we need that aren't in the standard signal.h */
255 #define SIGHUP 1 /* Hang up */ 309 #define SIGHUP 1 /* Hang up */
256 #define SIGQUIT 3 /* Quit process */ 310 #define SIGQUIT 3 /* Quit process */
257 #define SIGKILL 9 /* Die, die die */ 311 #define SIGKILL 9 /* Die, die die */
258 #define SIGALRM 14 /* Alarm */ 312 #define SIGALRM 14 /* Alarm */
259 #define SIGPROF 29 /* Profiling timer exp */ 313 #define SIGPROF 29 /* Profiling timer exp */
260
261 /* For integration with MSDOS support. */
262 #define getdisk() (_getdrive () - 1)
263 #define getdefdir(_drv, _buf) _getdcwd (_drv, _buf, MAXPATHLEN)
264 314
265 /* Defines size_t and alloca (). */ 315 /* Defines size_t and alloca (). */
266 #include <malloc.h> 316 #include <malloc.h>
267 317
268 #include <sys/stat.h> 318 #include <sys/stat.h>
302 /* Ensure the NT 4 mouse definitions in winuser.h are available */ 352 /* Ensure the NT 4 mouse definitions in winuser.h are available */
303 #ifndef _WIN32_WINNT 353 #ifndef _WIN32_WINNT
304 #define _WIN32_WINNT 0x0400 354 #define _WIN32_WINNT 0x0400
305 #endif 355 #endif
306 #endif 356 #endif
357
358 /* Force the various NT 4 structures and constants to be included; we're
359 careful not to call (or even link with) functions not in NT 3.51 when
360 running on 3.51, but when running on NT 4 or Win9x, we use the later
361 functions, and need their headers. */
362 /* The VC++ (5.0, at least) headers treat WINVER non-existent as 0x0400 */
363 #if defined (WINVER) && WINVER < 0x0400
364 # undef WINVER
365 # define WINVER 0x0400
366 #endif
367
368 /* MSVC 6.0 has a mechanism to declare functions which never return */
369 #if (_MSC_VER >= 1200)
370 #define DOESNT_RETURN __declspec(noreturn) void
371 #define DECLARE_DOESNT_RETURN(decl) __declspec(noreturn) extern void decl
372 #define DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS(decl,str,idx) \
373 __declspec(noreturn) extern void decl PRINTF_ARGS(str,idx)
374 #endif /* MSVC 6.0 */
375
376 #define CORRECT_DIR_SEPS(s) \
377 do { if ('/' == DIRECTORY_SEP) dostounix_filename (s); \
378 else unixtodos_filename (s); \
379 } while (0)