*** empty log message ***
[bpt/emacs.git] / src / s / ms-w32.h
CommitLineData
95ed0025 1/* System description file for Windows NT.
92b47a4a 2 Copyright (C) 1993, 1994, 1995, 2002, 2003, 2004,
aaef169d 3 2005, 2006 Free Software Foundation, Inc.
95ed0025
RS
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
364c38d3
LK
19the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20Boston, MA 02110-1301, USA. */
95ed0025
RS
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 */
8e4c450d 35/* #define BSD_SYSTEM */
95ed0025
RS
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
3360970a
KH
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
95ed0025
RS
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
124abc74 59#define NO_MATHERR 1
95ed0025
RS
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
124abc74 65/* #define NOMULTIPLEJOBS 1 */
95ed0025
RS
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
124abc74 89/* #define INTERRUPT_INPUT 1 */
95ed0025
RS
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
124abc74
AI
107/* #define HAVE_TERMIOS 1 */
108/* #define HAVE_TERMIO 1 */
95ed0025
RS
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
124abc74 115#define HAVE_TIMEVAL 1
95ed0025
RS
116
117/*
118 * Define HAVE_SELECT if the system supports the `select' system call.
119 */
120
124abc74 121/* #define HAVE_SELECT 1 */
95ed0025
RS
122
123/*
124 * Define HAVE_PTYS if the system supports pty devices.
125 */
126
124abc74 127/* #define HAVE_PTYS 1 */
95ed0025
RS
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
4e36126c
GV
136/* NT supports Winsock which is close enough (with some hacks) */
137
124abc74 138#define HAVE_SOCKETS 1
4e36126c 139
69fd7dbf
KS
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
95ed0025
RS
145/* Define this symbol if your system has the functions bcopy, etc. */
146
147#define BSTRING
148#define bzero(b, l) memset(b, 0, l)
7f470eff 149#define bcopy(s, d, l) memmove(d, s, l)
95ed0025
RS
150#define bcmp(a, b, l) memcmp(a, b, l)
151
7f470eff 152/* bcopy (aka memmove aka memcpy at least on x86) under MSVC is quite safe */
124abc74 153#define GAP_USE_BCOPY 1
7f470eff
GV
154#define BCOPY_UPWARD_SAFE 1
155#define BCOPY_DOWNWARD_SAFE 1
156
95ed0025
RS
157/* subprocesses should be defined if you want to
158 have code for asynchronous subprocesses
159 (as used in M-x compile and M-x shell).
160 This is generally OS dependent, and not supported
161 under most USG systems. */
162
124abc74 163#define subprocesses 1
95ed0025
RS
164
165/* If your system uses COFF (Common Object File Format) then define the
166 preprocessor symbol "COFF". */
167
124abc74 168#define COFF 1
95ed0025
RS
169
170/* define MAIL_USE_FLOCK if the mailer uses flock
171 to interlock access to /usr/spool/mail/$USER.
172 The alternative is that a lock file named
173 /usr/spool/mail/$USER.lock. */
174
175/* #define MAIL_USE_FLOCK */
124abc74
AI
176#define MAIL_USE_POP 1
177#define MAIL_USE_SYSTEM_LOCK 1
95ed0025
RS
178
179/* Define CLASH_DETECTION if you want lock files to be written
180 so that Emacs can tell instantly when you try to modify
181 a file that someone else has modified in his Emacs. */
182
124abc74 183/* #define CLASH_DETECTION 1 */
95ed0025
RS
184
185/* Define this if your operating system declares signal handlers to
186 have a type other than the usual. `The usual' is `void' for ANSI C
187 systems (i.e. when the __STDC__ macro is defined), and `int' for
188 pre-ANSI systems. If you're using GCC on an older system, __STDC__
189 will be defined, but the system's include files will still say that
190 signal returns int or whatever; in situations like that, define
191 this to be what the system's include files want. */
192/* #define SIGTYPE int */
193
194/* If the character used to separate elements of the executable path
195 is not ':', #define this to be the appropriate character constant. */
196#define SEPCHAR ';'
197
cc48c6e7
AI
198#define ORDINARY_LINK 1
199
95ed0025
RS
200/* ============================================================ */
201
202/* Here, add any special hacks needed
203 to make Emacs work on this system. For example,
204 you might define certain system call names that don't
205 exist on your system, or that do different things on
206 your system and must be used only through an encapsulation
207 (Which you should place, by convention, in sysdep.c). */
208
95ed0025 209/* Define this to be the separator between path elements */
4e36126c 210#define DIRECTORY_SEP XINT (Vdirectory_sep_char)
95ed0025
RS
211
212/* Define this to be the separator between devices and paths */
213#define DEVICE_SEP ':'
214
215/* We'll support either convention on NT. */
216#define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\')
217#define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
218
219/* The null device on Windows NT. */
220#define NULL_DEVICE "NUL:"
95ed0025
RS
221
222#ifndef MAXPATHLEN
223#define MAXPATHLEN _MAX_PATH
224#endif
225
f60ae425 226#define HAVE_SOUND 1
124abc74 227#define LISP_FLOAT_TYPE 1
3360970a 228
2a741506 229#undef HAVE_SYS_SELECT_H
124abc74
AI
230#define HAVE_SYS_TIMEB_H 1
231#define HAVE_SYS_TIME_H 1
232#define HAVE_UNISTD_H 1
2a741506
GV
233#undef HAVE_UTIME_H
234#undef HAVE_LINUX_VERSION_H
235#undef HAVE_SYS_SYSTEMINFO_H
236#undef HAVE_TERMIOS_H
237#define HAVE_LIMITS_H 1
124abc74 238#define HAVE_STRING_H 1
47539b85 239#define HAVE_PWD_H 1
2a741506 240#define STDC_HEADERS 1
124abc74 241#define TIME_WITH_SYS_TIME 1
4e36126c 242
124abc74
AI
243#define HAVE_GETTIMEOFDAY 1
244#define HAVE_GETHOSTNAME 1
2a741506 245#undef HAVE_GETDOMAINNAME
124abc74
AI
246#define HAVE_DUP2 1
247#define HAVE_RENAME 1
248#define HAVE_CLOSEDIR 1
a5a7d30f 249#define HAVE_FSYNC 1 /* fsync is called _commit in MSVC. */
4e36126c 250
2a741506
GV
251#undef TM_IN_SYS_TIME
252#undef HAVE_TM_ZONE
253#define HAVE_TZNAME 1
4e36126c 254
124abc74 255#define HAVE_LONG_FILE_NAMES 1
4e36126c 256
124abc74
AI
257#define HAVE_MKDIR 1
258#define HAVE_RMDIR 1
259#define HAVE_RANDOM 1
2a741506
GV
260#undef HAVE_SYSINFO
261#undef HAVE_LRAND48
124abc74
AI
262#define HAVE_BCOPY 1
263#define HAVE_BCMP 1
264#define HAVE_LOGB 1
265#define HAVE_FREXP 1
266#define HAVE_FMOD 1
2a741506
GV
267#undef HAVE_RINT
268#undef HAVE_CBRT
124abc74 269#define HAVE_FTIME 1
2a741506
GV
270#undef HAVE_RES_INIT /* For -lresolv on Suns. */
271#undef HAVE_SETSID
272#undef HAVE_FPATHCONF
7b7262a7 273#define HAVE_SELECT 1
2a741506
GV
274#define HAVE_MKTIME 1
275#undef HAVE_EUIDACCESS
124abc74 276#define HAVE_GETPAGESIZE 1
2a741506 277#define HAVE_TZSET 1
124abc74 278#define HAVE_SETLOCALE 1
2a741506
GV
279#undef HAVE_UTIMES
280#undef HAVE_SETRLIMIT
281#undef HAVE_SETPGID
282#undef HAVE_GETCWD
124abc74 283#define HAVE_SHUTDOWN 1
b2140d4b 284#define HAVE_STRFTIME 1
2a741506 285
dabe36a8 286#define LOCALTIME_CACHE
99674eec 287#define HAVE_INET_SOCKETS 1
2a741506
GV
288
289#undef HAVE_AIX_SMT_EXP
290
291/* Define if you have the ANSI `strerror' function.
292 Otherwise you must have the variable `char *sys_errlist[]'. */
124abc74 293#define HAVE_STRERROR 1
2a741506
GV
294
295/* Define if `struct utimbuf' is declared by <utime.h>. */
296#undef HAVE_STRUCT_UTIMBUF
4e36126c 297
124abc74
AI
298#define HAVE_MOUSE 1
299#define HAVE_H_ERRNO 1
1cd47f14 300
4a1ba222 301#ifdef HAVE_NTGUI
124abc74
AI
302#define HAVE_WINDOW_SYSTEM 1
303#define HAVE_FACES 1
304#define HAVE_MENUS 1
4a1ba222
GV
305#endif
306
1cd47f14 307#define MODE_LINE_BINARY_TEXT(_b_) (NILP ((_b_)->buffer_file_type) ? "T" : "B")
95ed0025 308
4e36126c
GV
309/* get some redefinitions in place */
310
124abc74
AI
311#ifdef emacs
312
a14724c8 313/* calls that are emulated or shadowed */
7f470eff 314#undef access
4e36126c 315#define access sys_access
7f470eff 316#undef chdir
4e36126c 317#define chdir sys_chdir
7f470eff 318#undef chmod
4e36126c 319#define chmod sys_chmod
0e20b3a3 320#define chown sys_chown
7f470eff 321#undef close
4e36126c 322#define close sys_close
7f470eff 323#undef creat
4e36126c
GV
324#define creat sys_creat
325#define ctime sys_ctime
7f470eff 326#undef dup
4e36126c 327#define dup sys_dup
7f470eff 328#undef dup2
4e36126c
GV
329#define dup2 sys_dup2
330#define fopen sys_fopen
331#define link sys_link
332#define mkdir sys_mkdir
7f470eff 333#undef mktemp
4e36126c 334#define mktemp sys_mktemp
7f470eff 335#undef open
4e36126c
GV
336#define open sys_open
337#define pipe sys_pipe
7f470eff 338#undef read
4e36126c
GV
339#define read sys_read
340#define rename sys_rename
341#define rmdir sys_rmdir
342#define select sys_select
343#define sleep sys_sleep
a14724c8 344#define strerror sys_strerror
7f470eff 345#undef unlink
4e36126c 346#define unlink sys_unlink
7f470eff 347#undef write
4e36126c
GV
348#define write sys_write
349
4e36126c
GV
350/* subprocess calls that are emulated */
351#define spawnve sys_spawnve
352#define wait sys_wait
353#define kill sys_kill
354#define signal sys_signal
355
124abc74
AI
356#endif /* emacs */
357
4e36126c
GV
358/* map to MSVC names */
359#define execlp _execlp
360#define execvp _execvp
361#define fcloseall _fcloseall
362#define fdopen _fdopen
363#define fgetchar _fgetchar
23bf9efb 364#ifndef fileno
4e36126c 365#define fileno _fileno
23bf9efb 366#endif
4e36126c
GV
367#define flushall _flushall
368#define fputchar _fputchar
a5a7d30f
AI
369#define fsync _commit
370#define ftruncate _chsize
4e36126c
GV
371#define getw _getw
372#define getpid _getpid
9b67f3aa
EZ
373#ifdef _MSC_VER
374typedef int pid_t;
375#endif
4e36126c
GV
376#define isatty _isatty
377#define logb _logb
378#define _longjmp longjmp
379#define lseek _lseek
380#define popen _popen
381#define pclose _pclose
382#define putw _putw
383#define umask _umask
384#define utime _utime
719072f5 385#define utimbuf _utimbuf
4e36126c
GV
386#define index strchr
387#define rindex strrchr
bfba227f
AI
388#define strdup _strdup
389#define strupr _strupr
390#define strnicmp _strnicmp
391#define stricmp _stricmp
392#define tzset _tzset
393#define tzname _tzname
95ed0025 394
4a1ba222 395#ifdef HAVE_NTGUI
fbd6baed 396#define abort w32_abort
4a1ba222
GV
397#endif
398
7f470eff
GV
399/* this is hacky, but is necessary to avoid warnings about macro
400 redefinitions using the SDK compilers */
401#ifndef __STDC__
402#define __STDC__ 1
403#define MUST_UNDEF__STDC__
404#endif
405#include <direct.h>
406#include <io.h>
407#include <stdio.h>
408#ifdef MUST_UNDEF__STDC__
409#undef __STDC__
410#undef MUST_UNDEF__STDC__
411#endif
412
95ed0025
RS
413/* Defines that we need that aren't in the standard signal.h */
414#define SIGHUP 1 /* Hang up */
415#define SIGQUIT 3 /* Quit process */
416#define SIGTRAP 5 /* Trace trap */
417#define SIGKILL 9 /* Die, die die */
418#define SIGPIPE 13 /* Write on pipe with no readers */
419#define SIGALRM 14 /* Alarm */
420#define SIGCHLD 18 /* Death of child */
421
bfba227f
AI
422#ifndef NSIG
423#define NSIG 23
424#endif
425
95ed0025
RS
426/* For integration with MSDOS support. */
427#define getdisk() (_getdrive () - 1)
445f44d2
RS
428#ifdef emacs
429#define getdefdir(_drv, _buf) ((_buf[0] = (_drv + 'A' - 1), _buf[1] = ':', _buf[2] = '/', _buf[3] = 0), 1)
430#else
95ed0025 431#define getdefdir(_drv, _buf) _getdcwd (_drv, _buf, MAXPATHLEN)
445f44d2 432#endif
95ed0025 433
bfba227f
AI
434extern char *get_emacs_configuration (void);
435extern char *get_emacs_configuration_options (void);
3360970a 436#define EMACS_CONFIGURATION get_emacs_configuration ()
bfba227f 437#define EMACS_CONFIG_OPTIONS get_emacs_configuration_options ()
3360970a 438
4e36126c
GV
439/* Define this so that winsock.h definitions don't get included with
440 windows.h. For this to have proper effect, config.h must always be
441 included before windows.h. */
95ed0025 442#define _WINSOCKAPI_ 1
bfba227f 443#define _WINSOCK_H
95ed0025 444
1cd47f14 445/* Defines size_t and alloca (). */
bfba227f
AI
446#ifdef USE_CRT_DLL
447#define malloc e_malloc
448#define free e_free
449#define realloc e_realloc
450#define calloc e_calloc
451#endif
1cd47f14
KH
452#include <malloc.h>
453
3360970a 454#include <sys/stat.h>
3360970a 455
177c0ea7 456/* Define for those source files that do not include enough NT
3360970a
KH
457 system files. */
458#ifndef NULL
459#ifdef __cplusplus
460#define NULL 0
461#else
462#define NULL ((void *)0)
463#endif
464#endif
896c0d8b 465
4a1ba222
GV
466/* For proper declaration of environ. */
467#include <stdlib.h>
bfba227f
AI
468#ifndef sys_nerr
469#define sys_nerr _sys_nerr
470#endif
4e36126c 471#include <string.h>
4a1ba222 472
4bba3064 473/* We need a little extra space, see ../../lisp/loadup.el.
0d95f6b2
EZ
474 The number below comes from 23923 bytes worth (as of 2006-04)
475 of w32-specific files loaded by loadup.el, plus 1K spare. */
476#define SYSTEM_PURESIZE_EXTRA 25000
e3be3bfd 477
7f470eff
GV
478/* For unexec to work on Alpha systems, we need to put Emacs'
479 initialized data into a separate section from the CRT initialized
480 data (because the Alpha linker freely reorders data variables, even
481 across libraries, so our data and the CRT data get intermingled).
482
483 Starting with MSVC 5.0, we must also place the uninitialized data
484 into its own section. VC5 intermingles uninitialized data from the CRT
485 between Emacs' static uninitialized data and its public uninitialized
486 data. A separate .bss section for Emacs groups both static and
487 public uninitalized together.
488
489 Note that unexnt.c relies on this fact, and must be modified
490 accordingly if this section name is changed, or if this pragma is
491 removed. Also, obviously, all files that define initialized data
492 must include config.h to pick up this pragma. */
493
494/* Names must be < 8 bytes */
52c7f9ee 495#ifdef _MSC_VER
7f470eff
GV
496#pragma data_seg("EMDATA")
497#pragma bss_seg("EMBSS")
52c7f9ee 498#endif
7f470eff
GV
499
500/* #define FULL_DEBUG */
501/* #define EMACSDEBUG */
502
503#ifdef EMACSDEBUG
504extern void _DebPrint (const char *fmt, ...);
505#define DebPrint(stuff) _DebPrint stuff
506#else
507#define DebPrint(stuff)
508#endif
509
510
3360970a 511/* ============================================================ */
ab5796a9
MB
512
513/* arch-tag: 5d4a3a1c-40dc-4dea-9c7c-38fed9ae0eae
514 (do not change this comment) */