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