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