1/* System description file for Windows NT.
2   Copyright (C) 1993, 1994, 1995, 2001, 2002, 2003, 2004,
3                 2005, 2006, 2007  Free Software Foundation, Inc.
4
5This file is part of GNU Emacs.
6
7GNU Emacs is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12GNU Emacs is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU Emacs; see the file COPYING.  If not, write to
19the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20Boston, MA 02110-1301, USA.  */
21
22/*
23 *      Define symbols to identify the version of Unix this is.
24 *      Define all the symbols that apply correctly.
25 */
26
27/* #define UNIPLUS */
28/* #define USG5 */
29/* #define USG */
30/* #define HPUX */
31/* #define UMAX */
32/* #define BSD4_1 */
33/* #define BSD4_2 */
34/* #define BSD4_3 */
35/* #define BSD_SYSTEM */
36/* #define VMS */
37#ifndef WINDOWSNT
38#define WINDOWSNT
39#endif
40#ifndef DOS_NT
41#define DOS_NT 	/* MSDOS or WINDOWSNT */
42#endif
43
44/* If you are compiling with a non-C calling convention but need to
45   declare vararg routines differently, put it here */
46#define _VARARGS_ __cdecl
47
48/* If you are providing a function to something that will call the
49   function back (like a signal handler and signal, or main) its calling
50   convention must be whatever standard the libraries expect */
51#define _CALLBACK_ __cdecl
52
53/* SYSTEM_TYPE should indicate the kind of system you are using.
54 It sets the Lisp variable system-type.  */
55
56#define SYSTEM_TYPE "windows-nt"
57#define SYMS_SYSTEM syms_of_ntterm ()
58
59#define NO_MATHERR 1
60
61/* NOMULTIPLEJOBS should be defined if your system's shell
62 does not have "job control" (the ability to stop a program,
63 run some other program, then continue the first one).  */
64
65/* #define NOMULTIPLEJOBS 1 */
66
67/* Emacs can read input using SIGIO and buffering characters itself,
68   or using CBREAK mode and making C-g cause SIGINT.
69   The choice is controlled by the variable interrupt_input.
70
71   Define INTERRUPT_INPUT to make interrupt_input = 1 the default (use SIGIO)
72
73   Emacs uses the presence or absence of the SIGIO macro to indicate
74   whether or not signal-driven I/O is possible.  It uses
75   INTERRUPT_INPUT to decide whether to use it by default.
76
77   SIGIO can be used only on systems that implement it (4.2 and 4.3).
78   CBREAK mode has two disadvantages
79     1) At least in 4.2, it is impossible to handle the Meta key properly.
80	I hear that in system V this problem does not exist.
81     2) Control-G causes output to be discarded.
82	I do not know whether this can be fixed in system V.
83
84   Another method of doing input is planned but not implemented.
85   It would have Emacs fork off a separate process
86   to read the input and send it to the true Emacs process
87   through a pipe. */
88
89/* #define INTERRUPT_INPUT 1 */
90
91/* Letter to use in finding device name of first pty,
92  if system supports pty's.  'a' means it is /dev/ptya0  */
93
94#define FIRST_PTY_LETTER 'a'
95
96/*
97 *      Define HAVE_TERMIOS if the system provides POSIX-style
98 *      functions and macros for terminal control.
99 *
100 *      Define HAVE_TERMIO if the system provides sysV-style ioctls
101 *      for terminal control.
102 *
103 *      Do not define both.  HAVE_TERMIOS is preferred, if it is
104 *      supported on your system.
105 */
106
107/* #define HAVE_TERMIOS 1 */
108/* #define HAVE_TERMIO 1 */
109
110/*
111 *      Define HAVE_TIMEVAL if the system supports the BSD style clock values.
112 *      Look in <sys/time.h> for a timeval structure.
113 */
114
115#define HAVE_TIMEVAL 1
116
117/*
118 *      Define HAVE_SELECT if the system supports the `select' system call.
119 */
120
121/* #define HAVE_SELECT 1 */
122
123/*
124 *      Define HAVE_PTYS if the system supports pty devices.
125 */
126
127/* #define HAVE_PTYS 1 */
128
129/*
130 *      Define NONSYSTEM_DIR_LIBRARY to make Emacs emulate
131 *      The 4.2 opendir, etc., library functions.
132 */
133
134/* #define NONSYSTEM_DIR_LIBRARY */
135
136/* NT supports Winsock which is close enough (with some hacks) */
137
138#define HAVE_SOCKETS 1
139
140/* But our select implementation doesn't allow us to make non-blocking
141   connects.  So until that is fixed, this is necessary:  */
142
143#define BROKEN_NON_BLOCKING_CONNECT 1
144
145/* And the select implementation does 1-byte read-ahead waiting
146   for received packets, so datagrams are broken too.  */
147
148#define BROKEN_DATAGRAM_SOCKETS 1
149
150/* Define this symbol if your system has the functions bcopy, etc. */
151
152#define BSTRING
153#define bzero(b, l) memset(b, 0, l)
154#define bcopy(s, d, l) memmove(d, s, l)
155#define bcmp(a, b, l) memcmp(a, b, l)
156
157/* bcopy (aka memmove aka memcpy at least on x86) under MSVC is quite safe */
158#define GAP_USE_BCOPY 1
159#define BCOPY_UPWARD_SAFE 1
160#define BCOPY_DOWNWARD_SAFE 1
161
162/* subprocesses should be defined if you want to
163   have code for asynchronous subprocesses
164   (as used in M-x compile and M-x shell).
165   This is generally OS dependent, and not supported
166   under most USG systems. */
167
168#define subprocesses 1
169
170/* If your system uses COFF (Common Object File Format) then define the
171   preprocessor symbol "COFF". */
172
173#define COFF 1
174
175/* define MAIL_USE_FLOCK if the mailer uses flock
176   to interlock access to /usr/spool/mail/$USER.
177   The alternative is that a lock file named
178   /usr/spool/mail/$USER.lock.  */
179
180/* #define MAIL_USE_FLOCK */
181#define MAIL_USE_POP 1
182#define MAIL_USE_SYSTEM_LOCK 1
183
184/* Define CLASH_DETECTION if you want lock files to be written
185   so that Emacs can tell instantly when you try to modify
186   a file that someone else has modified in his Emacs.  */
187
188/* #define CLASH_DETECTION 1 */
189
190/* Define this if your operating system declares signal handlers to
191   have a type other than the usual.  `The usual' is `void' for ANSI C
192   systems (i.e. when the __STDC__ macro is defined), and `int' for
193   pre-ANSI systems.  If you're using GCC on an older system, __STDC__
194   will be defined, but the system's include files will still say that
195   signal returns int or whatever; in situations like that, define
196   this to be what the system's include files want.  */
197/* #define SIGTYPE int */
198
199/* If the character used to separate elements of the executable path
200   is not ':', #define this to be the appropriate character constant.  */
201#define SEPCHAR ';'
202
203#define ORDINARY_LINK 1
204
205/* ============================================================ */
206
207/* Here, add any special hacks needed
208   to make Emacs work on this system.  For example,
209   you might define certain system call names that don't
210   exist on your system, or that do different things on
211   your system and must be used only through an encapsulation
212   (Which you should place, by convention, in sysdep.c).  */
213
214/* Define this to be the separator between path elements */
215#define DIRECTORY_SEP XINT (Vdirectory_sep_char)
216
217/* Define this to be the separator between devices and paths */
218#define DEVICE_SEP ':'
219
220/* We'll support either convention on NT.  */
221#define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\')
222#define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
223
224/* The null device on Windows NT. */
225#define NULL_DEVICE     "NUL:"
226
227#ifndef MAXPATHLEN
228#define MAXPATHLEN      _MAX_PATH
229#endif
230
231#define HAVE_SOUND  1
232#define LISP_FLOAT_TYPE 1
233
234#undef  HAVE_SYS_SELECT_H
235#define HAVE_SYS_TIMEB_H 1
236#define HAVE_SYS_TIME_H 1
237#define HAVE_UNISTD_H 1
238#undef  HAVE_UTIME_H
239#undef  HAVE_LINUX_VERSION_H
240#undef  HAVE_SYS_SYSTEMINFO_H
241#undef  HAVE_TERMIOS_H
242#define HAVE_LIMITS_H 1
243#define HAVE_STRING_H 1
244#define HAVE_PWD_H 1
245#define STDC_HEADERS 1
246#define TIME_WITH_SYS_TIME 1
247
248#define HAVE_GETTIMEOFDAY 1
249#define HAVE_GETHOSTNAME 1
250#undef  HAVE_GETDOMAINNAME
251#define HAVE_DUP2 1
252#define HAVE_RENAME 1
253#define HAVE_CLOSEDIR 1
254#define HAVE_FSYNC 1		/* fsync is called _commit in MSVC.  */
255
256#undef  TM_IN_SYS_TIME
257#undef  HAVE_TM_ZONE
258#define HAVE_TZNAME 1
259
260#define HAVE_LONG_FILE_NAMES 1
261
262#define HAVE_MKDIR 1
263#define HAVE_RMDIR 1
264#define HAVE_RANDOM 1
265#undef  HAVE_SYSINFO
266#undef  HAVE_LRAND48
267#define HAVE_BCOPY 1
268#define HAVE_BCMP 1
269#define HAVE_LOGB 1
270#define HAVE_FREXP 1
271#define HAVE_FMOD 1
272#undef  HAVE_RINT
273#undef  HAVE_CBRT
274#define HAVE_FTIME 1
275#undef  HAVE_RES_INIT /* For -lresolv on Suns.  */
276#undef  HAVE_SETSID
277#undef  HAVE_FPATHCONF
278#define HAVE_SELECT 1
279#define HAVE_MKTIME 1
280#undef  HAVE_EUIDACCESS
281#define HAVE_GETPAGESIZE 1
282#define HAVE_TZSET 1
283#define HAVE_SETLOCALE 1
284#undef  HAVE_UTIMES
285#undef  HAVE_SETRLIMIT
286#undef  HAVE_SETPGID
287#undef  HAVE_GETCWD
288#define HAVE_SHUTDOWN 1
289#define HAVE_STRFTIME 1
290
291#define LOCALTIME_CACHE
292#define HAVE_INET_SOCKETS 1
293
294#undef  HAVE_AIX_SMT_EXP
295
296/* Define if you have the ANSI `strerror' function.
297   Otherwise you must have the variable `char *sys_errlist[]'.  */
298#define HAVE_STRERROR 1
299
300/* Define if `struct utimbuf' is declared by <utime.h>.  */
301#undef  HAVE_STRUCT_UTIMBUF
302
303#define HAVE_MOUSE 1
304#define HAVE_H_ERRNO 1
305
306#ifdef HAVE_NTGUI
307#define HAVE_WINDOW_SYSTEM 1
308#define HAVE_FACES 1
309#define HAVE_MENUS 1
310#endif
311
312#define MODE_LINE_BINARY_TEXT(_b_) (NILP ((_b_)->buffer_file_type) ? "T" : "B")
313
314/* get some redefinitions in place */
315
316#ifdef emacs
317
318/* calls that are emulated or shadowed */
319#undef access
320#define access  sys_access
321#undef chdir
322#define chdir   sys_chdir
323#undef chmod
324#define chmod   sys_chmod
325#define chown   sys_chown
326#undef close
327#define close   sys_close
328#undef creat
329#define creat   sys_creat
330#define ctime	sys_ctime
331#undef dup
332#define dup     sys_dup
333#undef dup2
334#define dup2    sys_dup2
335#define fopen   sys_fopen
336#define link    sys_link
337#define mkdir   sys_mkdir
338#undef mktemp
339#define mktemp  sys_mktemp
340#undef open
341#define open    sys_open
342#define pipe    sys_pipe
343#undef read
344#define read    sys_read
345#define rename  sys_rename
346#define rmdir   sys_rmdir
347#define select  sys_select
348#define sleep   sys_sleep
349#define strerror sys_strerror
350#undef unlink
351#define unlink  sys_unlink
352#undef write
353#define write   sys_write
354
355/* subprocess calls that are emulated */
356#define spawnve sys_spawnve
357#define wait    sys_wait
358#define kill    sys_kill
359#define signal  sys_signal
360
361#endif /* emacs */
362
363/* map to MSVC names */
364#define execlp    _execlp
365#define execvp    _execvp
366#define fcloseall _fcloseall
367#define fdopen	  _fdopen
368#define fgetchar  _fgetchar
369#ifndef fileno
370#define fileno	  _fileno
371#endif
372#define flushall  _flushall
373#define fputchar  _fputchar
374#define fsync	  _commit
375#define ftruncate _chsize
376#define getw	  _getw
377#define getpid    _getpid
378#ifdef _MSC_VER
379typedef int pid_t;
380#endif
381#define isatty    _isatty
382#define logb      _logb
383#define _longjmp  longjmp
384#define lseek     _lseek
385#define popen     _popen
386#define pclose    _pclose
387#define putw	  _putw
388#define umask	  _umask
389#define utimbuf	  _utimbuf
390#define index     strchr
391#define rindex    strrchr
392#define strdup    _strdup
393#define strupr    _strupr
394#define strnicmp  _strnicmp
395#define stricmp   _stricmp
396#define tzset     _tzset
397
398#if !defined (_MSC_VER) || (_MSC_VER < 1400)
399#define tzname    _tzname
400#define utime	  _utime
401#endif
402
403#ifdef HAVE_NTGUI
404#define abort	w32_abort
405#endif
406
407/* this is hacky, but is necessary to avoid warnings about macro
408   redefinitions using the SDK compilers */
409#ifndef __STDC__
410#define __STDC__ 1
411#define MUST_UNDEF__STDC__
412#endif
413#include <direct.h>
414#include <io.h>
415#include <stdio.h>
416#ifdef MUST_UNDEF__STDC__
417#undef __STDC__
418#undef MUST_UNDEF__STDC__
419#endif
420
421/* Defines that we need that aren't in the standard signal.h  */
422#define SIGHUP  1               /* Hang up */
423#define SIGQUIT 3               /* Quit process */
424#define SIGTRAP 5               /* Trace trap */
425#define SIGKILL 9               /* Die, die die */
426#define SIGPIPE 13              /* Write on pipe with no readers */
427#define SIGALRM 14              /* Alarm */
428#define SIGCHLD 18              /* Death of child */
429
430#ifndef NSIG
431#define NSIG 23
432#endif
433
434/* For integration with MSDOS support.  */
435#define getdisk()               (_getdrive () - 1)
436#ifdef emacs
437#define getdefdir(_drv, _buf)   ((_buf[0] = (_drv + 'A' - 1), _buf[1] = ':', _buf[2] = '/', _buf[3] = 0), 1)
438#else
439#define getdefdir(_drv, _buf)   _getdcwd (_drv, _buf, MAXPATHLEN)
440#endif
441
442extern char *get_emacs_configuration (void);
443extern char *get_emacs_configuration_options (void);
444#define EMACS_CONFIGURATION 	get_emacs_configuration ()
445#define EMACS_CONFIG_OPTIONS	get_emacs_configuration_options ()
446
447/* Define this so that winsock.h definitions don't get included with
448   windows.h.  For this to have proper effect, config.h must always be
449   included before windows.h.  */
450#define _WINSOCKAPI_    1
451#define _WINSOCK_H
452
453/* Defines size_t and alloca ().  */
454#ifdef USE_CRT_DLL
455#define malloc e_malloc
456#define free   e_free
457#define realloc e_realloc
458#define calloc e_calloc
459#endif
460#include <malloc.h>
461
462#include <sys/stat.h>
463
464/* Define for those source files that do not include enough NT
465   system files.  */
466#ifndef NULL
467#ifdef __cplusplus
468#define NULL	0
469#else
470#define NULL	((void *)0)
471#endif
472#endif
473
474/* For proper declaration of environ.  */
475#include <stdlib.h>
476#ifndef sys_nerr
477#define sys_nerr _sys_nerr
478#endif
479#include <string.h>
480
481/* We need a little extra space, see ../../lisp/loadup.el.
482   The number below comes from 23923 bytes worth (as of 2006-04)
483   of w32-specific files loaded by loadup.el, plus 1K spare.  */
484#define SYSTEM_PURESIZE_EXTRA 25000
485
486/* For unexec to work on Alpha systems, we need to put Emacs'
487   initialized data into a separate section from the CRT initialized
488   data (because the Alpha linker freely reorders data variables, even
489   across libraries, so our data and the CRT data get intermingled).
490
491   Starting with MSVC 5.0, we must also place the uninitialized data
492   into its own section.  VC5 intermingles uninitialized data from the CRT
493   between Emacs' static uninitialized data and its public uninitialized
494   data.  A separate .bss section for Emacs groups both static and
495   public uninitalized together.
496
497   Note that unexnt.c relies on this fact, and must be modified
498   accordingly if this section name is changed, or if this pragma is
499   removed.  Also, obviously, all files that define initialized data
500   must include config.h to pick up this pragma.  */
501
502/* Names must be < 8 bytes */
503#ifdef _MSC_VER
504#pragma data_seg("EMDATA")
505#pragma bss_seg("EMBSS")
506#endif
507
508/* #define FULL_DEBUG */
509/* #define EMACSDEBUG */
510
511#ifdef EMACSDEBUG
512extern void _DebPrint (const char *fmt, ...);
513#define DebPrint(stuff) _DebPrint stuff
514#else
515#define DebPrint(stuff)
516#endif
517
518
519/* ============================================================ */
520
521/* arch-tag: 5d4a3a1c-40dc-4dea-9c7c-38fed9ae0eae
522   (do not change this comment) */
523