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