* etc/NEWS: Move and improve the defun/defalias changes.
[bpt/emacs.git] / src / s / ms-w32.h
CommitLineData
95ed0025 1/* System description file for Windows NT.
7490175b 2
acaf905b 3Copyright (C) 1993-1995, 2001-2012 Free Software Foundation, Inc.
95ed0025
RS
4
5This file is part of GNU Emacs.
6
4b158629 7GNU Emacs is free software: you can redistribute it and/or modify
95ed0025 8it under the terms of the GNU General Public License as published by
4b158629
GM
9the Free Software Foundation, either version 3 of the License, or
10(at your option) any later version.
95ed0025
RS
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
4b158629 18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
95ed0025 19
e05aebe9
GM
20/* Define symbols to identify the version of Unix this is.
21 Define all the symbols that apply correctly. */
95ed0025 22
95ed0025
RS
23#ifndef WINDOWSNT
24#define WINDOWSNT
25#endif
26#ifndef DOS_NT
27#define DOS_NT /* MSDOS or WINDOWSNT */
28#endif
29
3360970a 30/* If you are compiling with a non-C calling convention but need to
e05aebe9 31 declare vararg routines differently, put it here. */
3360970a
KH
32#define _VARARGS_ __cdecl
33
34/* If you are providing a function to something that will call the
35 function back (like a signal handler and signal, or main) its calling
e05aebe9 36 convention must be whatever standard the libraries expect. */
3360970a
KH
37#define _CALLBACK_ __cdecl
38
124abc74 39#define NO_MATHERR 1
95ed0025 40
95ed0025 41/* Letter to use in finding device name of first pty,
e05aebe9 42 if system supports pty's. 'a' means it is /dev/ptya0 */
95ed0025
RS
43#define FIRST_PTY_LETTER 'a'
44
e05aebe9
GM
45/* Define HAVE_TIMEVAL if the system supports the BSD style clock values.
46 Look in <sys/time.h> for a timeval structure. */
124abc74 47#define HAVE_TIMEVAL 1
95ed0025 48
e05aebe9 49/* NT supports Winsock which is close enough (with some hacks). */
124abc74 50#define HAVE_SOCKETS 1
4e36126c 51
69fd7dbf
KS
52/* But our select implementation doesn't allow us to make non-blocking
53 connects. So until that is fixed, this is necessary: */
69fd7dbf
KS
54#define BROKEN_NON_BLOCKING_CONNECT 1
55
401ea527
KS
56/* And the select implementation does 1-byte read-ahead waiting
57 for received packets, so datagrams are broken too. */
401ea527
KS
58#define BROKEN_DATAGRAM_SOCKETS 1
59
124abc74
AI
60#define MAIL_USE_POP 1
61#define MAIL_USE_SYSTEM_LOCK 1
95ed0025 62
95ed0025
RS
63/* If the character used to separate elements of the executable path
64 is not ':', #define this to be the appropriate character constant. */
65#define SEPCHAR ';'
66
cc48c6e7
AI
67#define ORDINARY_LINK 1
68
95ed0025
RS
69/* ============================================================ */
70
e05aebe9
GM
71/* Here, add any special hacks needed to make Emacs work on this
72 system. For example, you might define certain system call names
73 that don't exist on your system, or that do different things on
74 your system and must be used only through an encapsulation (which
75 you should place, by convention, in sysdep.c). */
95ed0025 76
e05aebe9 77/* Define this to be the separator between devices and paths. */
95ed0025
RS
78#define DEVICE_SEP ':'
79
80/* We'll support either convention on NT. */
81#define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\')
82#define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
83
d6dae14b 84#include <sys/types.h>
a6fc3b5c
EZ
85
86#ifdef _MSC_VER
87typedef unsigned long sigset_t;
88typedef int ssize_t;
89#endif
90
d6dae14b
EZ
91struct sigaction {
92 int sa_flags;
93 void (*sa_handler)(int);
94 sigset_t sa_mask;
95};
96#define SIG_BLOCK 1
97#define SIG_SETMASK 2
98#define SIG_UNBLOCK 3
99
e05aebe9 100/* The null device on Windows NT. */
95ed0025 101#define NULL_DEVICE "NUL:"
95ed0025
RS
102
103#ifndef MAXPATHLEN
104#define MAXPATHLEN _MAX_PATH
105#endif
106
f60ae425 107#define HAVE_SOUND 1
124abc74 108#define LISP_FLOAT_TYPE 1
3360970a 109
124abc74
AI
110#define HAVE_SYS_TIMEB_H 1
111#define HAVE_SYS_TIME_H 1
112#define HAVE_UNISTD_H 1
2a741506
GV
113#undef HAVE_UTIME_H
114#undef HAVE_LINUX_VERSION_H
115#undef HAVE_SYS_SYSTEMINFO_H
47539b85 116#define HAVE_PWD_H 1
124abc74 117#define TIME_WITH_SYS_TIME 1
4e36126c 118
124abc74
AI
119#define HAVE_GETTIMEOFDAY 1
120#define HAVE_GETHOSTNAME 1
124abc74
AI
121#define HAVE_DUP2 1
122#define HAVE_RENAME 1
123#define HAVE_CLOSEDIR 1
a5a7d30f 124#define HAVE_FSYNC 1 /* fsync is called _commit in MSVC. */
4e36126c 125
2a741506
GV
126#undef TM_IN_SYS_TIME
127#undef HAVE_TM_ZONE
4e36126c 128
124abc74 129#define HAVE_LONG_FILE_NAMES 1
4e36126c 130
124abc74
AI
131#define HAVE_MKDIR 1
132#define HAVE_RMDIR 1
133#define HAVE_RANDOM 1
2a741506
GV
134#undef HAVE_SYSINFO
135#undef HAVE_LRAND48
72af86bd
AS
136#define HAVE_MEMCMP 1
137#define HAVE_MEMCPY 1
138#define HAVE_MEMMOVE 1
139#define HAVE_MEMSET 1
124abc74
AI
140#define HAVE_LOGB 1
141#define HAVE_FREXP 1
142#define HAVE_FMOD 1
2a741506
GV
143#undef HAVE_RINT
144#undef HAVE_CBRT
2a741506
GV
145#undef HAVE_RES_INIT /* For -lresolv on Suns. */
146#undef HAVE_SETSID
147#undef HAVE_FPATHCONF
7b7262a7 148#define HAVE_SELECT 1
2a741506 149#undef HAVE_EUIDACCESS
124abc74 150#define HAVE_GETPAGESIZE 1
2a741506 151#define HAVE_TZSET 1
124abc74 152#define HAVE_SETLOCALE 1
2a741506
GV
153#undef HAVE_UTIMES
154#undef HAVE_SETRLIMIT
155#undef HAVE_SETPGID
581355cc
EZ
156/* If you think about defining HAVE_GETCWD, don't: the alternative
157 getwd is redefined on w32.c, and does not really return the current
158 directory, to get the desired results elsewhere in Emacs */
2a741506 159#undef HAVE_GETCWD
124abc74 160#define HAVE_SHUTDOWN 1
2a741506 161
dabe36a8 162#define LOCALTIME_CACHE
99674eec 163#define HAVE_INET_SOCKETS 1
2a741506
GV
164
165#undef HAVE_AIX_SMT_EXP
addedb8e 166#define USE_TOOLKIT_SCROLL_BARS 1
2a741506
GV
167
168/* Define if you have the ANSI `strerror' function.
169 Otherwise you must have the variable `char *sys_errlist[]'. */
124abc74 170#define HAVE_STRERROR 1
2a741506
GV
171
172/* Define if `struct utimbuf' is declared by <utime.h>. */
173#undef HAVE_STRUCT_UTIMBUF
4e36126c 174
124abc74
AI
175#define HAVE_MOUSE 1
176#define HAVE_H_ERRNO 1
1cd47f14 177
4a1ba222 178#ifdef HAVE_NTGUI
124abc74 179#define HAVE_WINDOW_SYSTEM 1
124abc74 180#define HAVE_MENUS 1
4a1ba222
GV
181#endif
182
e05aebe9 183/* Get some redefinitions in place. */
4e36126c 184
124abc74
AI
185#ifdef emacs
186
a6fc3b5c
EZ
187#ifdef _MSC_VER
188#include <sys/timeb.h>
189#include <sys/stat.h>
190#include <signal.h>
3ad924ba
EZ
191
192/* MSVC gets link-time errors without these redirections. */
193#define fstat(a, b) sys_fstat(a, b)
194#define stat(a, b) sys_stat(a, b)
195#define utime sys_utime
a6fc3b5c
EZ
196#endif
197
e05aebe9 198/* Calls that are emulated or shadowed. */
7f470eff 199#undef access
4e36126c 200#define access sys_access
7f470eff 201#undef chdir
4e36126c 202#define chdir sys_chdir
7f470eff 203#undef chmod
4e36126c 204#define chmod sys_chmod
0e20b3a3 205#define chown sys_chown
7f470eff 206#undef close
4e36126c 207#define close sys_close
7f470eff 208#undef creat
4e36126c
GV
209#define creat sys_creat
210#define ctime sys_ctime
7f470eff 211#undef dup
4e36126c 212#define dup sys_dup
7f470eff 213#undef dup2
4e36126c
GV
214#define dup2 sys_dup2
215#define fopen sys_fopen
216#define link sys_link
97a93095 217#define localtime sys_localtime
4e36126c 218#define mkdir sys_mkdir
7f470eff 219#undef mktemp
4e36126c 220#define mktemp sys_mktemp
7f470eff 221#undef open
4e36126c
GV
222#define open sys_open
223#define pipe sys_pipe
7f470eff 224#undef read
4e36126c
GV
225#define read sys_read
226#define rename sys_rename
227#define rmdir sys_rmdir
228#define select sys_select
388cdec0 229#define pselect sys_select
4e36126c 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;
8c9afb46
EZ
268#define snprintf _snprintf
269#define strtoll _strtoi64
9b67f3aa 270#endif
4e36126c
GV
271#define isatty _isatty
272#define logb _logb
273#define _longjmp longjmp
274#define lseek _lseek
275#define popen _popen
276#define pclose _pclose
4e36126c 277#define umask _umask
8c9afb46 278#ifndef _MSC_VER
719072f5 279#define utimbuf _utimbuf
8c9afb46 280#endif
bfba227f
AI
281#define strdup _strdup
282#define strupr _strupr
283#define strnicmp _strnicmp
284#define stricmp _stricmp
285#define tzset _tzset
e37b3faf 286
8a0c01dd
EZ
287/* Include time.h before redirecting tzname, since MSVC's time.h
288 defines _tzname to call a function, but also declares tzname a
289 2-element array. Having the redirection before including the
290 header thus has the effect of declaring a function that returns an
291 array, and triggers an error message. */
292#include <time.h>
bfba227f 293#define tzname _tzname
8c9afb46 294#if !defined (_MSC_VER) || (_MSC_VER < 1400)
3ad924ba 295#undef utime
bc5f466c 296#define utime _utime
e37b3faf 297#endif
95ed0025 298
e05aebe9
GM
299/* This is hacky, but is necessary to avoid warnings about macro
300 redefinitions using the SDK compilers. */
7f470eff
GV
301#ifndef __STDC__
302#define __STDC__ 1
303#define MUST_UNDEF__STDC__
304#endif
305#include <direct.h>
306#include <io.h>
307#include <stdio.h>
308#ifdef MUST_UNDEF__STDC__
309#undef __STDC__
310#undef MUST_UNDEF__STDC__
311#endif
312
e05aebe9 313/* Defines that we need that aren't in the standard signal.h. */
95ed0025
RS
314#define SIGHUP 1 /* Hang up */
315#define SIGQUIT 3 /* Quit process */
316#define SIGTRAP 5 /* Trace trap */
317#define SIGKILL 9 /* Die, die die */
318#define SIGPIPE 13 /* Write on pipe with no readers */
319#define SIGALRM 14 /* Alarm */
320#define SIGCHLD 18 /* Death of child */
321
bfba227f
AI
322#ifndef NSIG
323#define NSIG 23
324#endif
325
95ed0025
RS
326/* For integration with MSDOS support. */
327#define getdisk() (_getdrive () - 1)
445f44d2
RS
328#ifdef emacs
329#define getdefdir(_drv, _buf) ((_buf[0] = (_drv + 'A' - 1), _buf[1] = ':', _buf[2] = '/', _buf[3] = 0), 1)
330#else
95ed0025 331#define getdefdir(_drv, _buf) _getdcwd (_drv, _buf, MAXPATHLEN)
445f44d2 332#endif
95ed0025 333
bfba227f
AI
334extern char *get_emacs_configuration (void);
335extern char *get_emacs_configuration_options (void);
3360970a 336#define EMACS_CONFIGURATION get_emacs_configuration ()
bfba227f 337#define EMACS_CONFIG_OPTIONS get_emacs_configuration_options ()
3360970a 338
4e36126c
GV
339/* Define this so that winsock.h definitions don't get included with
340 windows.h. For this to have proper effect, config.h must always be
341 included before windows.h. */
95ed0025 342#define _WINSOCKAPI_ 1
bfba227f 343#define _WINSOCK_H
95ed0025 344
1cd47f14 345/* Defines size_t and alloca (). */
8c9afb46 346#ifdef emacs
bfba227f
AI
347#define malloc e_malloc
348#define free e_free
349#define realloc e_realloc
350#define calloc e_calloc
351#endif
a6fc3b5c
EZ
352#ifdef _MSC_VER
353#define alloca _alloca
354#else
1cd47f14 355#include <malloc.h>
a6fc3b5c 356#endif
1cd47f14 357
3360970a 358#include <sys/stat.h>
3360970a 359
e05aebe9 360/* Define for those source files that do not include enough NT system files. */
3360970a
KH
361#ifndef NULL
362#ifdef __cplusplus
363#define NULL 0
364#else
365#define NULL ((void *)0)
366#endif
367#endif
896c0d8b 368
4a1ba222
GV
369/* For proper declaration of environ. */
370#include <stdlib.h>
bfba227f
AI
371#ifndef sys_nerr
372#define sys_nerr _sys_nerr
373#endif
4e36126c 374#include <string.h>
4a1ba222 375
eef5ce6e
EZ
376extern int getloadavg (double *, int);
377
517d7b9f 378/* We need a little extra space, see ../../lisp/loadup.el. */
ff709c3a 379#define SYSTEM_PURESIZE_EXTRA 50000
e3be3bfd 380
34374650
PE
381#define DATA_START get_data_start ()
382
7f470eff
GV
383/* For unexec to work on Alpha systems, we need to put Emacs'
384 initialized data into a separate section from the CRT initialized
385 data (because the Alpha linker freely reorders data variables, even
386 across libraries, so our data and the CRT data get intermingled).
387
388 Starting with MSVC 5.0, we must also place the uninitialized data
389 into its own section. VC5 intermingles uninitialized data from the CRT
390 between Emacs' static uninitialized data and its public uninitialized
391 data. A separate .bss section for Emacs groups both static and
517d7b9f 392 public uninitialized together.
7f470eff 393
517d7b9f 394 Note that unexw32.c relies on this fact, and must be modified
7f470eff
GV
395 accordingly if this section name is changed, or if this pragma is
396 removed. Also, obviously, all files that define initialized data
397 must include config.h to pick up this pragma. */
398
e05aebe9 399/* Names must be < 8 bytes. */
52c7f9ee 400#ifdef _MSC_VER
7f470eff
GV
401#pragma data_seg("EMDATA")
402#pragma bss_seg("EMBSS")
52c7f9ee 403#endif
7f470eff
GV
404
405/* #define FULL_DEBUG */
406/* #define EMACSDEBUG */
407
408#ifdef EMACSDEBUG
409extern void _DebPrint (const char *fmt, ...);
410#define DebPrint(stuff) _DebPrint stuff
411#else
412#define DebPrint(stuff)
413#endif
414
415
3360970a 416/* ============================================================ */