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