Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
[bpt/emacs.git] / src / s / ms-w32.h
CommitLineData
95ed0025 1/* System description file for Windows NT.
7490175b
GM
2
3Copyright (C) 1993, 1994, 1995, 2001, 2002, 2003, 2004, 2005, 2006,
4 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
95ed0025
RS
5
6This file is part of GNU Emacs.
7
4b158629 8GNU Emacs is free software: you can redistribute it and/or modify
95ed0025 9it under the terms of the GNU General Public License as published by
4b158629
GM
10the Free Software Foundation, either version 3 of the License, or
11(at your option) any later version.
95ed0025
RS
12
13GNU Emacs is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
4b158629 19along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
95ed0025 20
e05aebe9
GM
21/* Define symbols to identify the version of Unix this is.
22 Define all the symbols that apply correctly. */
95ed0025 23
95ed0025
RS
24#ifndef WINDOWSNT
25#define WINDOWSNT
26#endif
27#ifndef DOS_NT
28#define DOS_NT /* MSDOS or WINDOWSNT */
29#endif
30
3360970a 31/* If you are compiling with a non-C calling convention but need to
e05aebe9 32 declare vararg routines differently, put it here. */
3360970a
KH
33#define _VARARGS_ __cdecl
34
35/* If you are providing a function to something that will call the
36 function back (like a signal handler and signal, or main) its calling
e05aebe9 37 convention must be whatever standard the libraries expect. */
3360970a
KH
38#define _CALLBACK_ __cdecl
39
95ed0025 40/* SYSTEM_TYPE should indicate the kind of system you are using.
e05aebe9 41 It sets the Lisp variable system-type. */
95ed0025
RS
42#define SYSTEM_TYPE "windows-nt"
43#define SYMS_SYSTEM syms_of_ntterm ()
44
124abc74 45#define NO_MATHERR 1
95ed0025 46
95ed0025 47/* Letter to use in finding device name of first pty,
e05aebe9 48 if system supports pty's. 'a' means it is /dev/ptya0 */
95ed0025
RS
49#define FIRST_PTY_LETTER 'a'
50
e05aebe9
GM
51/* Define HAVE_TIMEVAL if the system supports the BSD style clock values.
52 Look in <sys/time.h> for a timeval structure. */
124abc74 53#define HAVE_TIMEVAL 1
95ed0025 54
e05aebe9 55/* NT supports Winsock which is close enough (with some hacks). */
124abc74 56#define HAVE_SOCKETS 1
4e36126c 57
69fd7dbf
KS
58/* But our select implementation doesn't allow us to make non-blocking
59 connects. So until that is fixed, this is necessary: */
69fd7dbf
KS
60#define BROKEN_NON_BLOCKING_CONNECT 1
61
401ea527
KS
62/* And the select implementation does 1-byte read-ahead waiting
63 for received packets, so datagrams are broken too. */
401ea527
KS
64#define BROKEN_DATAGRAM_SOCKETS 1
65
95ed0025 66/* If your system uses COFF (Common Object File Format) then define the
e05aebe9 67 preprocessor symbol "COFF". */
124abc74 68#define COFF 1
95ed0025 69
124abc74
AI
70#define MAIL_USE_POP 1
71#define MAIL_USE_SYSTEM_LOCK 1
95ed0025 72
95ed0025
RS
73/* If the character used to separate elements of the executable path
74 is not ':', #define this to be the appropriate character constant. */
75#define SEPCHAR ';'
76
cc48c6e7
AI
77#define ORDINARY_LINK 1
78
95ed0025
RS
79/* ============================================================ */
80
e05aebe9
GM
81/* Here, add any special hacks needed to make Emacs work on this
82 system. For example, you might define certain system call names
83 that don't exist on your system, or that do different things on
84 your system and must be used only through an encapsulation (which
85 you should place, by convention, in sysdep.c). */
95ed0025 86
e05aebe9 87/* Define this to be the separator between devices and paths. */
95ed0025
RS
88#define DEVICE_SEP ':'
89
90/* We'll support either convention on NT. */
91#define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\')
92#define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
93
d6dae14b
EZ
94#include <sys/types.h>
95struct sigaction {
96 int sa_flags;
97 void (*sa_handler)(int);
98 sigset_t sa_mask;
99};
100#define SIG_BLOCK 1
101#define SIG_SETMASK 2
102#define SIG_UNBLOCK 3
103
e05aebe9 104/* The null device on Windows NT. */
95ed0025 105#define NULL_DEVICE "NUL:"
95ed0025
RS
106
107#ifndef MAXPATHLEN
108#define MAXPATHLEN _MAX_PATH
109#endif
110
f60ae425 111#define HAVE_SOUND 1
124abc74 112#define LISP_FLOAT_TYPE 1
3360970a 113
2a741506 114#undef HAVE_SYS_SELECT_H
124abc74
AI
115#define HAVE_SYS_TIMEB_H 1
116#define HAVE_SYS_TIME_H 1
117#define HAVE_UNISTD_H 1
2a741506
GV
118#undef HAVE_UTIME_H
119#undef HAVE_LINUX_VERSION_H
120#undef HAVE_SYS_SYSTEMINFO_H
121#undef HAVE_TERMIOS_H
122#define HAVE_LIMITS_H 1
124abc74 123#define HAVE_STRING_H 1
c8f7c76b 124#define HAVE_STDLIB_H 1
47539b85 125#define HAVE_PWD_H 1
2a741506 126#define STDC_HEADERS 1
124abc74 127#define TIME_WITH_SYS_TIME 1
4e36126c 128
124abc74
AI
129#define HAVE_GETTIMEOFDAY 1
130#define HAVE_GETHOSTNAME 1
2a741506 131#undef HAVE_GETDOMAINNAME
124abc74
AI
132#define HAVE_DUP2 1
133#define HAVE_RENAME 1
134#define HAVE_CLOSEDIR 1
a5a7d30f 135#define HAVE_FSYNC 1 /* fsync is called _commit in MSVC. */
4e36126c 136
2a741506
GV
137#undef TM_IN_SYS_TIME
138#undef HAVE_TM_ZONE
4e36126c 139
124abc74 140#define HAVE_LONG_FILE_NAMES 1
4e36126c 141
124abc74
AI
142#define HAVE_MKDIR 1
143#define HAVE_RMDIR 1
144#define HAVE_RANDOM 1
2a741506
GV
145#undef HAVE_SYSINFO
146#undef HAVE_LRAND48
72af86bd
AS
147#define HAVE_MEMCMP 1
148#define HAVE_MEMCPY 1
149#define HAVE_MEMMOVE 1
150#define HAVE_MEMSET 1
124abc74
AI
151#define HAVE_LOGB 1
152#define HAVE_FREXP 1
153#define HAVE_FMOD 1
2a741506
GV
154#undef HAVE_RINT
155#undef HAVE_CBRT
124abc74 156#define HAVE_FTIME 1
2a741506
GV
157#undef HAVE_RES_INIT /* For -lresolv on Suns. */
158#undef HAVE_SETSID
159#undef HAVE_FPATHCONF
7b7262a7 160#define HAVE_SELECT 1
2a741506
GV
161#define HAVE_MKTIME 1
162#undef HAVE_EUIDACCESS
124abc74 163#define HAVE_GETPAGESIZE 1
2a741506 164#define HAVE_TZSET 1
124abc74 165#define HAVE_SETLOCALE 1
2a741506
GV
166#undef HAVE_UTIMES
167#undef HAVE_SETRLIMIT
168#undef HAVE_SETPGID
169#undef HAVE_GETCWD
124abc74 170#define HAVE_SHUTDOWN 1
b2140d4b 171#define HAVE_STRFTIME 1
2a741506 172
dabe36a8 173#define LOCALTIME_CACHE
99674eec 174#define HAVE_INET_SOCKETS 1
2a741506
GV
175
176#undef HAVE_AIX_SMT_EXP
addedb8e 177#define USE_TOOLKIT_SCROLL_BARS 1
2a741506
GV
178
179/* Define if you have the ANSI `strerror' function.
180 Otherwise you must have the variable `char *sys_errlist[]'. */
124abc74 181#define HAVE_STRERROR 1
2a741506
GV
182
183/* Define if `struct utimbuf' is declared by <utime.h>. */
184#undef HAVE_STRUCT_UTIMBUF
4e36126c 185
124abc74
AI
186#define HAVE_MOUSE 1
187#define HAVE_H_ERRNO 1
1cd47f14 188
4a1ba222 189#ifdef HAVE_NTGUI
124abc74 190#define HAVE_WINDOW_SYSTEM 1
124abc74 191#define HAVE_MENUS 1
4a1ba222
GV
192#endif
193
1cd47f14 194#define MODE_LINE_BINARY_TEXT(_b_) (NILP ((_b_)->buffer_file_type) ? "T" : "B")
95ed0025 195
e05aebe9 196/* Get some redefinitions in place. */
4e36126c 197
124abc74
AI
198#ifdef emacs
199
e05aebe9 200/* Calls that are emulated or shadowed. */
7f470eff 201#undef access
4e36126c 202#define access sys_access
7f470eff 203#undef chdir
4e36126c 204#define chdir sys_chdir
7f470eff 205#undef chmod
4e36126c 206#define chmod sys_chmod
0e20b3a3 207#define chown sys_chown
7f470eff 208#undef close
4e36126c 209#define close sys_close
7f470eff 210#undef creat
4e36126c
GV
211#define creat sys_creat
212#define ctime sys_ctime
7f470eff 213#undef dup
4e36126c 214#define dup sys_dup
7f470eff 215#undef dup2
4e36126c
GV
216#define dup2 sys_dup2
217#define fopen sys_fopen
218#define link sys_link
219#define mkdir sys_mkdir
7f470eff 220#undef mktemp
4e36126c 221#define mktemp sys_mktemp
7f470eff 222#undef open
4e36126c
GV
223#define open sys_open
224#define pipe sys_pipe
7f470eff 225#undef read
4e36126c
GV
226#define read sys_read
227#define rename sys_rename
228#define rmdir sys_rmdir
229#define select sys_select
230#define sleep sys_sleep
a14724c8 231#define strerror sys_strerror
7f470eff 232#undef unlink
4e36126c 233#define unlink sys_unlink
7f470eff 234#undef write
4e36126c
GV
235#define write sys_write
236
e05aebe9 237/* Subprocess calls that are emulated. */
4e36126c
GV
238#define spawnve sys_spawnve
239#define wait sys_wait
240#define kill sys_kill
241#define signal sys_signal
242
e05aebe9 243/* termcap.c calls that are emulated. */
91eac4bb
JB
244#define tputs sys_tputs
245#define tgetstr sys_tgetstr
246
e05aebe9 247/* cm.c calls that are emulated. */
91eac4bb
JB
248#define chcheckmagic sys_chcheckmagic
249#define cmcostinit sys_cmcostinit
250#define cmgoto sys_cmgoto
251#define cmputc sys_cmputc
252#define Wcm_clear sys_Wcm_clear
253
124abc74
AI
254#endif /* emacs */
255
e05aebe9 256/* Map to MSVC names. */
4e36126c
GV
257#define execlp _execlp
258#define execvp _execvp
4e36126c 259#define fdopen _fdopen
23bf9efb 260#ifndef fileno
4e36126c 261#define fileno _fileno
23bf9efb 262#endif
a5a7d30f
AI
263#define fsync _commit
264#define ftruncate _chsize
4e36126c 265#define getpid _getpid
9b67f3aa
EZ
266#ifdef _MSC_VER
267typedef int pid_t;
268#endif
4e36126c
GV
269#define isatty _isatty
270#define logb _logb
271#define _longjmp longjmp
272#define lseek _lseek
273#define popen _popen
274#define pclose _pclose
4e36126c 275#define umask _umask
719072f5 276#define utimbuf _utimbuf
4e36126c
GV
277#define index strchr
278#define rindex strrchr
bfba227f
AI
279#define strdup _strdup
280#define strupr _strupr
281#define strnicmp _strnicmp
282#define stricmp _stricmp
283#define tzset _tzset
e37b3faf
JR
284
285#if !defined (_MSC_VER) || (_MSC_VER < 1400)
bfba227f 286#define tzname _tzname
bc5f466c 287#define utime _utime
e37b3faf 288#endif
95ed0025 289
e05aebe9
GM
290/* This is hacky, but is necessary to avoid warnings about macro
291 redefinitions using the SDK compilers. */
7f470eff
GV
292#ifndef __STDC__
293#define __STDC__ 1
294#define MUST_UNDEF__STDC__
295#endif
296#include <direct.h>
297#include <io.h>
298#include <stdio.h>
299#ifdef MUST_UNDEF__STDC__
300#undef __STDC__
301#undef MUST_UNDEF__STDC__
302#endif
303
e05aebe9 304/* Defines that we need that aren't in the standard signal.h. */
95ed0025
RS
305#define SIGHUP 1 /* Hang up */
306#define SIGQUIT 3 /* Quit process */
307#define SIGTRAP 5 /* Trace trap */
308#define SIGKILL 9 /* Die, die die */
309#define SIGPIPE 13 /* Write on pipe with no readers */
310#define SIGALRM 14 /* Alarm */
311#define SIGCHLD 18 /* Death of child */
312
bfba227f
AI
313#ifndef NSIG
314#define NSIG 23
315#endif
316
95ed0025
RS
317/* For integration with MSDOS support. */
318#define getdisk() (_getdrive () - 1)
445f44d2
RS
319#ifdef emacs
320#define getdefdir(_drv, _buf) ((_buf[0] = (_drv + 'A' - 1), _buf[1] = ':', _buf[2] = '/', _buf[3] = 0), 1)
321#else
95ed0025 322#define getdefdir(_drv, _buf) _getdcwd (_drv, _buf, MAXPATHLEN)
445f44d2 323#endif
95ed0025 324
bfba227f
AI
325extern char *get_emacs_configuration (void);
326extern char *get_emacs_configuration_options (void);
3360970a 327#define EMACS_CONFIGURATION get_emacs_configuration ()
bfba227f 328#define EMACS_CONFIG_OPTIONS get_emacs_configuration_options ()
3360970a 329
4e36126c
GV
330/* Define this so that winsock.h definitions don't get included with
331 windows.h. For this to have proper effect, config.h must always be
332 included before windows.h. */
95ed0025 333#define _WINSOCKAPI_ 1
bfba227f 334#define _WINSOCK_H
95ed0025 335
1cd47f14 336/* Defines size_t and alloca (). */
bfba227f
AI
337#ifdef USE_CRT_DLL
338#define malloc e_malloc
339#define free e_free
340#define realloc e_realloc
341#define calloc e_calloc
342#endif
1cd47f14
KH
343#include <malloc.h>
344
3360970a 345#include <sys/stat.h>
3360970a 346
e05aebe9 347/* Define for those source files that do not include enough NT system files. */
3360970a
KH
348#ifndef NULL
349#ifdef __cplusplus
350#define NULL 0
351#else
352#define NULL ((void *)0)
353#endif
354#endif
896c0d8b 355
4a1ba222
GV
356/* For proper declaration of environ. */
357#include <stdlib.h>
bfba227f
AI
358#ifndef sys_nerr
359#define sys_nerr _sys_nerr
360#endif
4e36126c 361#include <string.h>
4a1ba222 362
517d7b9f 363/* We need a little extra space, see ../../lisp/loadup.el. */
ff709c3a 364#define SYSTEM_PURESIZE_EXTRA 50000
e3be3bfd 365
7f470eff
GV
366/* For unexec to work on Alpha systems, we need to put Emacs'
367 initialized data into a separate section from the CRT initialized
368 data (because the Alpha linker freely reorders data variables, even
369 across libraries, so our data and the CRT data get intermingled).
370
371 Starting with MSVC 5.0, we must also place the uninitialized data
372 into its own section. VC5 intermingles uninitialized data from the CRT
373 between Emacs' static uninitialized data and its public uninitialized
374 data. A separate .bss section for Emacs groups both static and
517d7b9f 375 public uninitialized together.
7f470eff 376
517d7b9f 377 Note that unexw32.c relies on this fact, and must be modified
7f470eff
GV
378 accordingly if this section name is changed, or if this pragma is
379 removed. Also, obviously, all files that define initialized data
380 must include config.h to pick up this pragma. */
381
e05aebe9 382/* Names must be < 8 bytes. */
52c7f9ee 383#ifdef _MSC_VER
7f470eff
GV
384#pragma data_seg("EMDATA")
385#pragma bss_seg("EMBSS")
52c7f9ee 386#endif
7f470eff
GV
387
388/* #define FULL_DEBUG */
389/* #define EMACSDEBUG */
390
391#ifdef EMACSDEBUG
392extern void _DebPrint (const char *fmt, ...);
393#define DebPrint(stuff) _DebPrint stuff
394#else
395#define DebPrint(stuff)
396#endif
397
398
3360970a 399/* ============================================================ */
ab5796a9
MB
400
401/* arch-tag: 5d4a3a1c-40dc-4dea-9c7c-38fed9ae0eae
402 (do not change this comment) */