]> code.delx.au - gnu-emacs/blob - src/s/ms-w32.h
Merge from emacs-24 branch
[gnu-emacs] / src / s / ms-w32.h
1 /* System description file for Windows NT.
2
3 Copyright (C) 1993-1995, 2001-2012 Free Software Foundation, Inc.
4
5 This file is part of GNU Emacs.
6
7 GNU Emacs is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 GNU Emacs is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19
20 /* Define symbols to identify the version of Unix this is.
21 Define all the symbols that apply correctly. */
22
23 #ifndef WINDOWSNT
24 #define WINDOWSNT
25 #endif
26 #ifndef DOS_NT
27 #define DOS_NT /* MSDOS or WINDOWSNT */
28 #endif
29
30 /* If you are compiling with a non-C calling convention but need to
31 declare vararg routines differently, put it here. */
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
36 convention must be whatever standard the libraries expect. */
37 #define _CALLBACK_ __cdecl
38
39 /* SYSTEM_TYPE should indicate the kind of system you are using.
40 It sets the Lisp variable system-type. */
41 #define SYSTEM_TYPE "windows-nt"
42
43 #define NO_MATHERR 1
44
45 /* Letter to use in finding device name of first pty,
46 if system supports pty's. 'a' means it is /dev/ptya0 */
47 #define FIRST_PTY_LETTER 'a'
48
49 /* Define HAVE_TIMEVAL if the system supports the BSD style clock values.
50 Look in <sys/time.h> for a timeval structure. */
51 #define HAVE_TIMEVAL 1
52
53 /* NT supports Winsock which is close enough (with some hacks). */
54 #define HAVE_SOCKETS 1
55
56 /* But our select implementation doesn't allow us to make non-blocking
57 connects. So until that is fixed, this is necessary: */
58 #define BROKEN_NON_BLOCKING_CONNECT 1
59
60 /* And the select implementation does 1-byte read-ahead waiting
61 for received packets, so datagrams are broken too. */
62 #define BROKEN_DATAGRAM_SOCKETS 1
63
64 #define MAIL_USE_POP 1
65 #define MAIL_USE_SYSTEM_LOCK 1
66
67 /* If the character used to separate elements of the executable path
68 is not ':', #define this to be the appropriate character constant. */
69 #define SEPCHAR ';'
70
71 #define ORDINARY_LINK 1
72
73 /* ============================================================ */
74
75 /* Here, add any special hacks needed to make Emacs work on this
76 system. For example, you might define certain system call names
77 that don't exist on your system, or that do different things on
78 your system and must be used only through an encapsulation (which
79 you should place, by convention, in sysdep.c). */
80
81 /* Define this to be the separator between devices and paths. */
82 #define DEVICE_SEP ':'
83
84 /* We'll support either convention on NT. */
85 #define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\')
86 #define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
87
88 #include <sys/types.h>
89
90 #ifdef _MSC_VER
91 typedef unsigned long sigset_t;
92 typedef int ssize_t;
93 #endif
94
95 struct 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
104 /* The null device on Windows NT. */
105 #define NULL_DEVICE "NUL:"
106
107 #ifndef MAXPATHLEN
108 #define MAXPATHLEN _MAX_PATH
109 #endif
110
111 #define HAVE_SOUND 1
112 #define LISP_FLOAT_TYPE 1
113
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 #define HAVE_PWD_H 1
121 #define TIME_WITH_SYS_TIME 1
122
123 #define HAVE_GETTIMEOFDAY 1
124 #define HAVE_GETHOSTNAME 1
125 #undef HAVE_GETDOMAINNAME
126 #define HAVE_DUP2 1
127 #define HAVE_RENAME 1
128 #define HAVE_CLOSEDIR 1
129 #define HAVE_FSYNC 1 /* fsync is called _commit in MSVC. */
130
131 #undef TM_IN_SYS_TIME
132 #undef HAVE_TM_ZONE
133
134 #define HAVE_LONG_FILE_NAMES 1
135
136 #define HAVE_MKDIR 1
137 #define HAVE_RMDIR 1
138 #define HAVE_RANDOM 1
139 #undef HAVE_SYSINFO
140 #undef HAVE_LRAND48
141 #define HAVE_MEMCMP 1
142 #define HAVE_MEMCPY 1
143 #define HAVE_MEMMOVE 1
144 #define HAVE_MEMSET 1
145 #define HAVE_LOGB 1
146 #define HAVE_FREXP 1
147 #define HAVE_FMOD 1
148 #undef HAVE_RINT
149 #undef HAVE_CBRT
150 #define HAVE_FTIME 1
151 #undef HAVE_RES_INIT /* For -lresolv on Suns. */
152 #undef HAVE_SETSID
153 #undef HAVE_FPATHCONF
154 #define HAVE_SELECT 1
155 #undef HAVE_EUIDACCESS
156 #define HAVE_GETPAGESIZE 1
157 #define HAVE_TZSET 1
158 #define HAVE_SETLOCALE 1
159 #undef HAVE_UTIMES
160 #undef HAVE_SETRLIMIT
161 #undef HAVE_SETPGID
162 /* If you think about defining HAVE_GETCWD, don't: the alternative
163 getwd is redefined on w32.c, and does not really return the current
164 directory, to get the desired results elsewhere in Emacs */
165 #undef HAVE_GETCWD
166 #define HAVE_SHUTDOWN 1
167
168 #define LOCALTIME_CACHE
169 #define HAVE_INET_SOCKETS 1
170
171 #undef HAVE_AIX_SMT_EXP
172 #define USE_TOOLKIT_SCROLL_BARS 1
173
174 /* Define if you have the ANSI `strerror' function.
175 Otherwise you must have the variable `char *sys_errlist[]'. */
176 #define HAVE_STRERROR 1
177
178 /* Define if `struct utimbuf' is declared by <utime.h>. */
179 #undef HAVE_STRUCT_UTIMBUF
180
181 #define HAVE_MOUSE 1
182 #define HAVE_H_ERRNO 1
183
184 #ifdef HAVE_NTGUI
185 #define HAVE_WINDOW_SYSTEM 1
186 #define HAVE_MENUS 1
187 #endif
188
189 /* Get some redefinitions in place. */
190
191 #ifdef emacs
192
193 #ifdef _MSC_VER
194 #include <sys/timeb.h>
195 #include <sys/stat.h>
196 #include <signal.h>
197
198 /* MSVC gets link-time errors without these redirections. */
199 #define fstat(a, b) sys_fstat(a, b)
200 #define stat(a, b) sys_stat(a, b)
201 #define utime sys_utime
202 #endif
203
204 /* Calls that are emulated or shadowed. */
205 #undef access
206 #define access sys_access
207 #undef chdir
208 #define chdir sys_chdir
209 #undef chmod
210 #define chmod sys_chmod
211 #define chown sys_chown
212 #undef close
213 #define close sys_close
214 #undef creat
215 #define creat sys_creat
216 #define ctime sys_ctime
217 #undef dup
218 #define dup sys_dup
219 #undef dup2
220 #define dup2 sys_dup2
221 #define fopen sys_fopen
222 #define link sys_link
223 #define localtime sys_localtime
224 #define mkdir sys_mkdir
225 #undef mktemp
226 #define mktemp sys_mktemp
227 #undef open
228 #define open sys_open
229 #define pipe sys_pipe
230 #undef read
231 #define read sys_read
232 #define rename sys_rename
233 #define rmdir sys_rmdir
234 #define select sys_select
235 #define sleep sys_sleep
236 #define strerror sys_strerror
237 #undef unlink
238 #define unlink sys_unlink
239 #undef write
240 #define write sys_write
241
242 /* Subprocess calls that are emulated. */
243 #define spawnve sys_spawnve
244 #define wait sys_wait
245 #define kill sys_kill
246 #define signal sys_signal
247
248 /* termcap.c calls that are emulated. */
249 #define tputs sys_tputs
250 #define tgetstr sys_tgetstr
251
252 /* cm.c calls that are emulated. */
253 #define chcheckmagic sys_chcheckmagic
254 #define cmcostinit sys_cmcostinit
255 #define cmgoto sys_cmgoto
256 #define cmputc sys_cmputc
257 #define Wcm_clear sys_Wcm_clear
258
259 #endif /* emacs */
260
261 /* Map to MSVC names. */
262 #define execlp _execlp
263 #define execvp _execvp
264 #define fdopen _fdopen
265 #ifndef fileno
266 #define fileno _fileno
267 #endif
268 #define fsync _commit
269 #define ftruncate _chsize
270 #define getpid _getpid
271 #ifdef _MSC_VER
272 typedef int pid_t;
273 #define snprintf _snprintf
274 #define strtoll _strtoi64
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 #ifndef _MSC_VER
284 #define utimbuf _utimbuf
285 #endif
286 #define strdup _strdup
287 #define strupr _strupr
288 #define strnicmp _strnicmp
289 #define stricmp _stricmp
290 #define tzset _tzset
291
292 /* Include time.h before redirecting tzname, since MSVC's time.h
293 defines _tzname to call a function, but also declares tzname a
294 2-element array. Having the redirection before including the
295 header thus has the effect of declaring a function that returns an
296 array, and triggers an error message. */
297 #include <time.h>
298 #define tzname _tzname
299 #if !defined (_MSC_VER) || (_MSC_VER < 1400)
300 #undef utime
301 #define utime _utime
302 #endif
303
304 /* This is hacky, but is necessary to avoid warnings about macro
305 redefinitions using the SDK compilers. */
306 #ifndef __STDC__
307 #define __STDC__ 1
308 #define MUST_UNDEF__STDC__
309 #endif
310 #include <direct.h>
311 #include <io.h>
312 #include <stdio.h>
313 #ifdef MUST_UNDEF__STDC__
314 #undef __STDC__
315 #undef MUST_UNDEF__STDC__
316 #endif
317
318 /* Defines that we need that aren't in the standard signal.h. */
319 #define SIGHUP 1 /* Hang up */
320 #define SIGQUIT 3 /* Quit process */
321 #define SIGTRAP 5 /* Trace trap */
322 #define SIGKILL 9 /* Die, die die */
323 #define SIGPIPE 13 /* Write on pipe with no readers */
324 #define SIGALRM 14 /* Alarm */
325 #define SIGCHLD 18 /* Death of child */
326
327 #ifndef NSIG
328 #define NSIG 23
329 #endif
330
331 /* For integration with MSDOS support. */
332 #define getdisk() (_getdrive () - 1)
333 #ifdef emacs
334 #define getdefdir(_drv, _buf) ((_buf[0] = (_drv + 'A' - 1), _buf[1] = ':', _buf[2] = '/', _buf[3] = 0), 1)
335 #else
336 #define getdefdir(_drv, _buf) _getdcwd (_drv, _buf, MAXPATHLEN)
337 #endif
338
339 extern char *get_emacs_configuration (void);
340 extern char *get_emacs_configuration_options (void);
341 #define EMACS_CONFIGURATION get_emacs_configuration ()
342 #define EMACS_CONFIG_OPTIONS get_emacs_configuration_options ()
343
344 /* Define this so that winsock.h definitions don't get included with
345 windows.h. For this to have proper effect, config.h must always be
346 included before windows.h. */
347 #define _WINSOCKAPI_ 1
348 #define _WINSOCK_H
349
350 /* Defines size_t and alloca (). */
351 #ifdef emacs
352 #define malloc e_malloc
353 #define free e_free
354 #define realloc e_realloc
355 #define calloc e_calloc
356 #endif
357 #ifdef _MSC_VER
358 #define alloca _alloca
359 #else
360 #include <malloc.h>
361 #endif
362
363 #include <sys/stat.h>
364
365 /* Define for those source files that do not include enough NT system files. */
366 #ifndef NULL
367 #ifdef __cplusplus
368 #define NULL 0
369 #else
370 #define NULL ((void *)0)
371 #endif
372 #endif
373
374 /* For proper declaration of environ. */
375 #include <stdlib.h>
376 #ifndef sys_nerr
377 #define sys_nerr _sys_nerr
378 #endif
379 #include <string.h>
380
381 extern int getloadavg (double *, int);
382
383 /* We need a little extra space, see ../../lisp/loadup.el. */
384 #define SYSTEM_PURESIZE_EXTRA 50000
385
386 /* For unexec to work on Alpha systems, we need to put Emacs'
387 initialized data into a separate section from the CRT initialized
388 data (because the Alpha linker freely reorders data variables, even
389 across libraries, so our data and the CRT data get intermingled).
390
391 Starting with MSVC 5.0, we must also place the uninitialized data
392 into its own section. VC5 intermingles uninitialized data from the CRT
393 between Emacs' static uninitialized data and its public uninitialized
394 data. A separate .bss section for Emacs groups both static and
395 public uninitialized together.
396
397 Note that unexw32.c relies on this fact, and must be modified
398 accordingly if this section name is changed, or if this pragma is
399 removed. Also, obviously, all files that define initialized data
400 must include config.h to pick up this pragma. */
401
402 /* Names must be < 8 bytes. */
403 #ifdef _MSC_VER
404 #pragma data_seg("EMDATA")
405 #pragma bss_seg("EMBSS")
406 #endif
407
408 /* #define FULL_DEBUG */
409 /* #define EMACSDEBUG */
410
411 #ifdef EMACSDEBUG
412 extern void _DebPrint (const char *fmt, ...);
413 #define DebPrint(stuff) _DebPrint stuff
414 #else
415 #define DebPrint(stuff)
416 #endif
417
418
419 /* ============================================================ */