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