w32-fns.el (w32-convert-standard-filename): Doc fix.
[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 bzero(b, l) memset(b, 0, l)
67 #define bcopy(s, d, l) memmove(d, s, l)
68 #define bcmp(a, b, l) memcmp(a, b, l)
69
70 /* bcopy (aka memmove aka memcpy at least on x86) under MSVC is quite safe. */
71 #define GAP_USE_BCOPY 1
72 #define BCOPY_UPWARD_SAFE 1
73 #define BCOPY_DOWNWARD_SAFE 1
74
75 /* If your system uses COFF (Common Object File Format) then define the
76 preprocessor symbol "COFF". */
77 #define COFF 1
78
79 #define MAIL_USE_POP 1
80 #define MAIL_USE_SYSTEM_LOCK 1
81
82 /* If the character used to separate elements of the executable path
83 is not ':', #define this to be the appropriate character constant. */
84 #define SEPCHAR ';'
85
86 #define ORDINARY_LINK 1
87
88 /* ============================================================ */
89
90 /* Here, add any special hacks needed to make Emacs work on this
91 system. For example, you might define certain system call names
92 that don't exist on your system, or that do different things on
93 your system and must be used only through an encapsulation (which
94 you should place, by convention, in sysdep.c). */
95
96 /* Define this to be the separator between devices and paths. */
97 #define DEVICE_SEP ':'
98
99 /* We'll support either convention on NT. */
100 #define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\')
101 #define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
102
103 #include <sys/types.h>
104 struct sigaction {
105 int sa_flags;
106 void (*sa_handler)(int);
107 sigset_t sa_mask;
108 };
109 #define SIG_BLOCK 1
110 #define SIG_SETMASK 2
111 #define SIG_UNBLOCK 3
112
113 /* The null device on Windows NT. */
114 #define NULL_DEVICE "NUL:"
115
116 #ifndef MAXPATHLEN
117 #define MAXPATHLEN _MAX_PATH
118 #endif
119
120 #define HAVE_SOUND 1
121 #define LISP_FLOAT_TYPE 1
122
123 #undef HAVE_SYS_SELECT_H
124 #define HAVE_SYS_TIMEB_H 1
125 #define HAVE_SYS_TIME_H 1
126 #define HAVE_UNISTD_H 1
127 #undef HAVE_UTIME_H
128 #undef HAVE_LINUX_VERSION_H
129 #undef HAVE_SYS_SYSTEMINFO_H
130 #undef HAVE_TERMIOS_H
131 #define HAVE_LIMITS_H 1
132 #define HAVE_STRING_H 1
133 #define HAVE_STDLIB_H 1
134 #define HAVE_PWD_H 1
135 #define STDC_HEADERS 1
136 #define TIME_WITH_SYS_TIME 1
137
138 #define HAVE_GETTIMEOFDAY 1
139 #define HAVE_GETHOSTNAME 1
140 #undef HAVE_GETDOMAINNAME
141 #define HAVE_DUP2 1
142 #define HAVE_RENAME 1
143 #define HAVE_CLOSEDIR 1
144 #define HAVE_FSYNC 1 /* fsync is called _commit in MSVC. */
145
146 #undef TM_IN_SYS_TIME
147 #undef HAVE_TM_ZONE
148
149 #define HAVE_LONG_FILE_NAMES 1
150
151 #define HAVE_MKDIR 1
152 #define HAVE_RMDIR 1
153 #define HAVE_RANDOM 1
154 #undef HAVE_SYSINFO
155 #undef HAVE_LRAND48
156 #define HAVE_BCOPY 1
157 #define HAVE_BCMP 1
158 #define HAVE_LOGB 1
159 #define HAVE_FREXP 1
160 #define HAVE_FMOD 1
161 #undef HAVE_RINT
162 #undef HAVE_CBRT
163 #define HAVE_FTIME 1
164 #undef HAVE_RES_INIT /* For -lresolv on Suns. */
165 #undef HAVE_SETSID
166 #undef HAVE_FPATHCONF
167 #define HAVE_SELECT 1
168 #define HAVE_MKTIME 1
169 #undef HAVE_EUIDACCESS
170 #define HAVE_GETPAGESIZE 1
171 #define HAVE_TZSET 1
172 #define HAVE_SETLOCALE 1
173 #undef HAVE_UTIMES
174 #undef HAVE_SETRLIMIT
175 #undef HAVE_SETPGID
176 #undef HAVE_GETCWD
177 #define HAVE_SHUTDOWN 1
178 #define HAVE_STRFTIME 1
179
180 #define LOCALTIME_CACHE
181 #define HAVE_INET_SOCKETS 1
182
183 #undef HAVE_AIX_SMT_EXP
184 #define USE_TOOLKIT_SCROLL_BARS 1
185
186 /* Define if you have the ANSI `strerror' function.
187 Otherwise you must have the variable `char *sys_errlist[]'. */
188 #define HAVE_STRERROR 1
189
190 /* Define if `struct utimbuf' is declared by <utime.h>. */
191 #undef HAVE_STRUCT_UTIMBUF
192
193 #define HAVE_MOUSE 1
194 #define HAVE_H_ERRNO 1
195
196 #ifdef HAVE_NTGUI
197 #define HAVE_WINDOW_SYSTEM 1
198 #define HAVE_MENUS 1
199 #endif
200
201 #define MODE_LINE_BINARY_TEXT(_b_) (NILP ((_b_)->buffer_file_type) ? "T" : "B")
202
203 /* Get some redefinitions in place. */
204
205 #ifdef emacs
206
207 /* Calls that are emulated or shadowed. */
208 #undef access
209 #define access sys_access
210 #undef chdir
211 #define chdir sys_chdir
212 #undef chmod
213 #define chmod sys_chmod
214 #define chown sys_chown
215 #undef close
216 #define close sys_close
217 #undef creat
218 #define creat sys_creat
219 #define ctime sys_ctime
220 #undef dup
221 #define dup sys_dup
222 #undef dup2
223 #define dup2 sys_dup2
224 #define fopen sys_fopen
225 #define link sys_link
226 #define mkdir sys_mkdir
227 #undef mktemp
228 #define mktemp sys_mktemp
229 #undef open
230 #define open sys_open
231 #define pipe sys_pipe
232 #undef read
233 #define read sys_read
234 #define rename sys_rename
235 #define rmdir sys_rmdir
236 #define select sys_select
237 #define sleep sys_sleep
238 #define strerror sys_strerror
239 #undef unlink
240 #define unlink sys_unlink
241 #undef write
242 #define write sys_write
243
244 /* Subprocess calls that are emulated. */
245 #define spawnve sys_spawnve
246 #define wait sys_wait
247 #define kill sys_kill
248 #define signal sys_signal
249
250 /* termcap.c calls that are emulated. */
251 #define tputs sys_tputs
252 #define tgetstr sys_tgetstr
253
254 /* cm.c calls that are emulated. */
255 #define chcheckmagic sys_chcheckmagic
256 #define cmcostinit sys_cmcostinit
257 #define cmgoto sys_cmgoto
258 #define cmputc sys_cmputc
259 #define Wcm_clear sys_Wcm_clear
260
261 #endif /* emacs */
262
263 /* Map to MSVC names. */
264 #define execlp _execlp
265 #define execvp _execvp
266 #define fdopen _fdopen
267 #ifndef fileno
268 #define fileno _fileno
269 #endif
270 #define fsync _commit
271 #define ftruncate _chsize
272 #define getpid _getpid
273 #ifdef _MSC_VER
274 typedef int pid_t;
275 #endif
276 #define isatty _isatty
277 #define logb _logb
278 #define _longjmp longjmp
279 #define lseek _lseek
280 #define popen _popen
281 #define pclose _pclose
282 #define umask _umask
283 #define utimbuf _utimbuf
284 #define index strchr
285 #define rindex strrchr
286 #define strdup _strdup
287 #define strupr _strupr
288 #define strnicmp _strnicmp
289 #define stricmp _stricmp
290 #define tzset _tzset
291
292 #if !defined (_MSC_VER) || (_MSC_VER < 1400)
293 #define tzname _tzname
294 #define utime _utime
295 #endif
296
297 /* This is hacky, but is necessary to avoid warnings about macro
298 redefinitions using the SDK compilers. */
299 #ifndef __STDC__
300 #define __STDC__ 1
301 #define MUST_UNDEF__STDC__
302 #endif
303 #include <direct.h>
304 #include <io.h>
305 #include <stdio.h>
306 #ifdef MUST_UNDEF__STDC__
307 #undef __STDC__
308 #undef MUST_UNDEF__STDC__
309 #endif
310
311 /* Defines that we need that aren't in the standard signal.h. */
312 #define SIGHUP 1 /* Hang up */
313 #define SIGQUIT 3 /* Quit process */
314 #define SIGTRAP 5 /* Trace trap */
315 #define SIGKILL 9 /* Die, die die */
316 #define SIGPIPE 13 /* Write on pipe with no readers */
317 #define SIGALRM 14 /* Alarm */
318 #define SIGCHLD 18 /* Death of child */
319
320 #ifndef NSIG
321 #define NSIG 23
322 #endif
323
324 /* For integration with MSDOS support. */
325 #define getdisk() (_getdrive () - 1)
326 #ifdef emacs
327 #define getdefdir(_drv, _buf) ((_buf[0] = (_drv + 'A' - 1), _buf[1] = ':', _buf[2] = '/', _buf[3] = 0), 1)
328 #else
329 #define getdefdir(_drv, _buf) _getdcwd (_drv, _buf, MAXPATHLEN)
330 #endif
331
332 extern char *get_emacs_configuration (void);
333 extern char *get_emacs_configuration_options (void);
334 #define EMACS_CONFIGURATION get_emacs_configuration ()
335 #define EMACS_CONFIG_OPTIONS get_emacs_configuration_options ()
336
337 /* Define this so that winsock.h definitions don't get included with
338 windows.h. For this to have proper effect, config.h must always be
339 included before windows.h. */
340 #define _WINSOCKAPI_ 1
341 #define _WINSOCK_H
342
343 /* Defines size_t and alloca (). */
344 #ifdef USE_CRT_DLL
345 #define malloc e_malloc
346 #define free e_free
347 #define realloc e_realloc
348 #define calloc e_calloc
349 #endif
350 #include <malloc.h>
351
352 #include <sys/stat.h>
353
354 /* Define for those source files that do not include enough NT system files. */
355 #ifndef NULL
356 #ifdef __cplusplus
357 #define NULL 0
358 #else
359 #define NULL ((void *)0)
360 #endif
361 #endif
362
363 /* For proper declaration of environ. */
364 #include <stdlib.h>
365 #ifndef sys_nerr
366 #define sys_nerr _sys_nerr
367 #endif
368 #include <string.h>
369
370 /* We need a little extra space, see ../../lisp/loadup.el. */
371 #define SYSTEM_PURESIZE_EXTRA 50000
372
373 /* For unexec to work on Alpha systems, we need to put Emacs'
374 initialized data into a separate section from the CRT initialized
375 data (because the Alpha linker freely reorders data variables, even
376 across libraries, so our data and the CRT data get intermingled).
377
378 Starting with MSVC 5.0, we must also place the uninitialized data
379 into its own section. VC5 intermingles uninitialized data from the CRT
380 between Emacs' static uninitialized data and its public uninitialized
381 data. A separate .bss section for Emacs groups both static and
382 public uninitialized together.
383
384 Note that unexw32.c relies on this fact, and must be modified
385 accordingly if this section name is changed, or if this pragma is
386 removed. Also, obviously, all files that define initialized data
387 must include config.h to pick up this pragma. */
388
389 /* Names must be < 8 bytes. */
390 #ifdef _MSC_VER
391 #pragma data_seg("EMDATA")
392 #pragma bss_seg("EMBSS")
393 #endif
394
395 /* #define FULL_DEBUG */
396 /* #define EMACSDEBUG */
397
398 #ifdef EMACSDEBUG
399 extern void _DebPrint (const char *fmt, ...);
400 #define DebPrint(stuff) _DebPrint stuff
401 #else
402 #define DebPrint(stuff)
403 #endif
404
405
406 /* ============================================================ */
407
408 /* arch-tag: 5d4a3a1c-40dc-4dea-9c7c-38fed9ae0eae
409 (do not change this comment) */