Nuke arch-tags.
[emacs.git] / src / s / ms-w32.h
blob18e3fd2982e63421f530343681ce4716d4284b4c
1 /* System description file for Windows NT.
3 Copyright (C) 1993, 1994, 1995, 2001, 2002, 2003, 2004, 2005, 2006,
4 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
6 This file is part of GNU Emacs.
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.
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.
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/>. */
21 /* Define symbols to identify the version of Unix this is.
22 Define all the symbols that apply correctly. */
24 #ifndef WINDOWSNT
25 #define WINDOWSNT
26 #endif
27 #ifndef DOS_NT
28 #define DOS_NT /* MSDOS or WINDOWSNT */
29 #endif
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
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
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"
44 #define NO_MATHERR 1
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'
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
54 /* NT supports Winsock which is close enough (with some hacks). */
55 #define HAVE_SOCKETS 1
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
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
65 #define MAIL_USE_POP 1
66 #define MAIL_USE_SYSTEM_LOCK 1
68 /* If the character used to separate elements of the executable path
69 is not ':', #define this to be the appropriate character constant. */
70 #define SEPCHAR ';'
72 #define ORDINARY_LINK 1
74 /* ============================================================ */
76 /* Here, add any special hacks needed to make Emacs work on this
77 system. For example, you might define certain system call names
78 that don't exist on your system, or that do different things on
79 your system and must be used only through an encapsulation (which
80 you should place, by convention, in sysdep.c). */
82 /* Define this to be the separator between devices and paths. */
83 #define DEVICE_SEP ':'
85 /* We'll support either convention on NT. */
86 #define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\')
87 #define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
89 #include <sys/types.h>
90 struct sigaction {
91 int sa_flags;
92 void (*sa_handler)(int);
93 sigset_t sa_mask;
95 #define SIG_BLOCK 1
96 #define SIG_SETMASK 2
97 #define SIG_UNBLOCK 3
99 /* The null device on Windows NT. */
100 #define NULL_DEVICE "NUL:"
102 #ifndef MAXPATHLEN
103 #define MAXPATHLEN _MAX_PATH
104 #endif
106 #define HAVE_SOUND 1
107 #define LISP_FLOAT_TYPE 1
109 #define HAVE_SYS_TIMEB_H 1
110 #define HAVE_SYS_TIME_H 1
111 #define HAVE_UNISTD_H 1
112 #undef HAVE_UTIME_H
113 #undef HAVE_LINUX_VERSION_H
114 #undef HAVE_SYS_SYSTEMINFO_H
115 #define HAVE_LIMITS_H 1
116 #define HAVE_STRING_H 1
117 #define HAVE_STDLIB_H 1
118 #define HAVE_PWD_H 1
119 #define STDC_HEADERS 1
120 #define TIME_WITH_SYS_TIME 1
122 #define HAVE_GETTIMEOFDAY 1
123 #define HAVE_GETHOSTNAME 1
124 #undef HAVE_GETDOMAINNAME
125 #define HAVE_DUP2 1
126 #define HAVE_RENAME 1
127 #define HAVE_CLOSEDIR 1
128 #define HAVE_FSYNC 1 /* fsync is called _commit in MSVC. */
130 #undef TM_IN_SYS_TIME
131 #undef HAVE_TM_ZONE
133 #define HAVE_LONG_FILE_NAMES 1
135 #define HAVE_MKDIR 1
136 #define HAVE_RMDIR 1
137 #define HAVE_RANDOM 1
138 #undef HAVE_SYSINFO
139 #undef HAVE_LRAND48
140 #define HAVE_MEMCMP 1
141 #define HAVE_MEMCPY 1
142 #define HAVE_MEMMOVE 1
143 #define HAVE_MEMSET 1
144 #define HAVE_LOGB 1
145 #define HAVE_FREXP 1
146 #define HAVE_FMOD 1
147 #undef HAVE_RINT
148 #undef HAVE_CBRT
149 #define HAVE_FTIME 1
150 #undef HAVE_RES_INIT /* For -lresolv on Suns. */
151 #undef HAVE_SETSID
152 #undef HAVE_FPATHCONF
153 #define HAVE_SELECT 1
154 #define HAVE_MKTIME 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 #undef HAVE_GETCWD
163 #define HAVE_SHUTDOWN 1
164 #define HAVE_STRFTIME 1
166 #define LOCALTIME_CACHE
167 #define HAVE_INET_SOCKETS 1
169 #undef HAVE_AIX_SMT_EXP
170 #define USE_TOOLKIT_SCROLL_BARS 1
172 /* Define if you have the ANSI `strerror' function.
173 Otherwise you must have the variable `char *sys_errlist[]'. */
174 #define HAVE_STRERROR 1
176 /* Define if `struct utimbuf' is declared by <utime.h>. */
177 #undef HAVE_STRUCT_UTIMBUF
179 #define HAVE_MOUSE 1
180 #define HAVE_H_ERRNO 1
182 #ifdef HAVE_NTGUI
183 #define HAVE_WINDOW_SYSTEM 1
184 #define HAVE_MENUS 1
185 #endif
187 #define MODE_LINE_BINARY_TEXT(_b_) (NILP ((_b_)->buffer_file_type) ? "T" : "B")
189 /* Get some redefinitions in place. */
191 #ifdef emacs
193 /* Calls that are emulated or shadowed. */
194 #undef access
195 #define access sys_access
196 #undef chdir
197 #define chdir sys_chdir
198 #undef chmod
199 #define chmod sys_chmod
200 #define chown sys_chown
201 #undef close
202 #define close sys_close
203 #undef creat
204 #define creat sys_creat
205 #define ctime sys_ctime
206 #undef dup
207 #define dup sys_dup
208 #undef dup2
209 #define dup2 sys_dup2
210 #define fopen sys_fopen
211 #define link sys_link
212 #define mkdir sys_mkdir
213 #undef mktemp
214 #define mktemp sys_mktemp
215 #undef open
216 #define open sys_open
217 #define pipe sys_pipe
218 #undef read
219 #define read sys_read
220 #define rename sys_rename
221 #define rmdir sys_rmdir
222 #define select sys_select
223 #define sleep sys_sleep
224 #define strerror sys_strerror
225 #undef unlink
226 #define unlink sys_unlink
227 #undef write
228 #define write sys_write
230 /* Subprocess calls that are emulated. */
231 #define spawnve sys_spawnve
232 #define wait sys_wait
233 #define kill sys_kill
234 #define signal sys_signal
236 /* termcap.c calls that are emulated. */
237 #define tputs sys_tputs
238 #define tgetstr sys_tgetstr
240 /* cm.c calls that are emulated. */
241 #define chcheckmagic sys_chcheckmagic
242 #define cmcostinit sys_cmcostinit
243 #define cmgoto sys_cmgoto
244 #define cmputc sys_cmputc
245 #define Wcm_clear sys_Wcm_clear
247 #endif /* emacs */
249 /* Map to MSVC names. */
250 #define execlp _execlp
251 #define execvp _execvp
252 #define fdopen _fdopen
253 #ifndef fileno
254 #define fileno _fileno
255 #endif
256 #define fsync _commit
257 #define ftruncate _chsize
258 #define getpid _getpid
259 #ifdef _MSC_VER
260 typedef int pid_t;
261 #endif
262 #define isatty _isatty
263 #define logb _logb
264 #define _longjmp longjmp
265 #define lseek _lseek
266 #define popen _popen
267 #define pclose _pclose
268 #define umask _umask
269 #define utimbuf _utimbuf
270 #define strdup _strdup
271 #define strupr _strupr
272 #define strnicmp _strnicmp
273 #define stricmp _stricmp
274 #define tzset _tzset
276 #if !defined (_MSC_VER) || (_MSC_VER < 1400)
277 #define tzname _tzname
278 #define utime _utime
279 #endif
281 /* This is hacky, but is necessary to avoid warnings about macro
282 redefinitions using the SDK compilers. */
283 #ifndef __STDC__
284 #define __STDC__ 1
285 #define MUST_UNDEF__STDC__
286 #endif
287 #include <direct.h>
288 #include <io.h>
289 #include <stdio.h>
290 #ifdef MUST_UNDEF__STDC__
291 #undef __STDC__
292 #undef MUST_UNDEF__STDC__
293 #endif
295 /* Defines that we need that aren't in the standard signal.h. */
296 #define SIGHUP 1 /* Hang up */
297 #define SIGQUIT 3 /* Quit process */
298 #define SIGTRAP 5 /* Trace trap */
299 #define SIGKILL 9 /* Die, die die */
300 #define SIGPIPE 13 /* Write on pipe with no readers */
301 #define SIGALRM 14 /* Alarm */
302 #define SIGCHLD 18 /* Death of child */
304 #ifndef NSIG
305 #define NSIG 23
306 #endif
308 /* For integration with MSDOS support. */
309 #define getdisk() (_getdrive () - 1)
310 #ifdef emacs
311 #define getdefdir(_drv, _buf) ((_buf[0] = (_drv + 'A' - 1), _buf[1] = ':', _buf[2] = '/', _buf[3] = 0), 1)
312 #else
313 #define getdefdir(_drv, _buf) _getdcwd (_drv, _buf, MAXPATHLEN)
314 #endif
316 extern char *get_emacs_configuration (void);
317 extern char *get_emacs_configuration_options (void);
318 #define EMACS_CONFIGURATION get_emacs_configuration ()
319 #define EMACS_CONFIG_OPTIONS get_emacs_configuration_options ()
321 /* Define this so that winsock.h definitions don't get included with
322 windows.h. For this to have proper effect, config.h must always be
323 included before windows.h. */
324 #define _WINSOCKAPI_ 1
325 #define _WINSOCK_H
327 /* Defines size_t and alloca (). */
328 #ifdef USE_CRT_DLL
329 #define malloc e_malloc
330 #define free e_free
331 #define realloc e_realloc
332 #define calloc e_calloc
333 #endif
334 #include <malloc.h>
336 #include <sys/stat.h>
338 /* Define for those source files that do not include enough NT system files. */
339 #ifndef NULL
340 #ifdef __cplusplus
341 #define NULL 0
342 #else
343 #define NULL ((void *)0)
344 #endif
345 #endif
347 /* For proper declaration of environ. */
348 #include <stdlib.h>
349 #ifndef sys_nerr
350 #define sys_nerr _sys_nerr
351 #endif
352 #include <string.h>
354 /* We need a little extra space, see ../../lisp/loadup.el. */
355 #define SYSTEM_PURESIZE_EXTRA 50000
357 /* For unexec to work on Alpha systems, we need to put Emacs'
358 initialized data into a separate section from the CRT initialized
359 data (because the Alpha linker freely reorders data variables, even
360 across libraries, so our data and the CRT data get intermingled).
362 Starting with MSVC 5.0, we must also place the uninitialized data
363 into its own section. VC5 intermingles uninitialized data from the CRT
364 between Emacs' static uninitialized data and its public uninitialized
365 data. A separate .bss section for Emacs groups both static and
366 public uninitialized together.
368 Note that unexw32.c relies on this fact, and must be modified
369 accordingly if this section name is changed, or if this pragma is
370 removed. Also, obviously, all files that define initialized data
371 must include config.h to pick up this pragma. */
373 /* Names must be < 8 bytes. */
374 #ifdef _MSC_VER
375 #pragma data_seg("EMDATA")
376 #pragma bss_seg("EMBSS")
377 #endif
379 /* #define FULL_DEBUG */
380 /* #define EMACSDEBUG */
382 #ifdef EMACSDEBUG
383 extern void _DebPrint (const char *fmt, ...);
384 #define DebPrint(stuff) _DebPrint stuff
385 #else
386 #define DebPrint(stuff)
387 #endif
390 /* ============================================================ */