XEmacs 21.2.24 "Hecate".
[chise/xemacs-chise.git.1] / src / s / windowsnt.h
1 /* System description file for Windows NT.
2    Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
3
4 This file is part of GNU Emacs.
5
6 GNU Emacs is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GNU Emacs is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with XEmacs; see the file COPYING.  If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.  */
20
21 /* Synched up with: FSF 19.31. */
22
23 #ifndef WINDOWSNT
24 #define WINDOWSNT
25 #endif
26
27 #ifndef DOS_NT
28 #define DOS_NT  /* MSDOS or WINDOWSNT */
29 #endif
30
31 /* In case non-Microsoft compiler is used, we fake _MSC_VER */
32 #ifndef _MSC_VER
33 #define _MSC_VER  1
34 #endif
35
36 typedef unsigned short mode_t;
37 /* typedef long ptrdiff_t; -kkm */
38 typedef int pid_t;
39
40 #include <stddef.h>
41
42 /* If you are compiling with a non-C calling convention but need to
43    declare vararg routines differently, put it here */
44 #define _VARARGS_ __cdecl
45
46 /* If you are providing a function to something that will call the
47    function back (like a signal handler and signal, or main) its calling
48    convention must be whatever standard the libraries expect */
49 #define _CALLBACK_ __cdecl
50
51 /* SYSTEM_TYPE should indicate the kind of system you are using.
52  It sets the Lisp variable system-type.  */
53
54 #define SYSTEM_TYPE "windows-nt"
55
56 #define NO_MATHERR
57
58 #define SIZEOF_SHORT 2
59 #define SIZEOF_INT 4
60 #define SIZEOF_LONG 4
61 #define SIZEOF_LONG_LONG 8
62 #define SIZEOF_VOID_P 4
63
64 /* NOMULTIPLEJOBS should be defined if your system's shell
65  does not have "job control" (the ability to stop a program,
66  run some other program, then continue the first one).  */
67
68 /* #define NOMULTIPLEJOBS */
69
70 /* Letter to use in finding device name of first pty,
71   if system supports pty's.  'a' means it is /dev/ptya0  */
72
73 #define FIRST_PTY_LETTER 'a'
74
75 /*
76  *      Define HAVE_TIMEVAL if the system supports the BSD style clock values.
77  *      Look in <sys/time.h> for a timeval structure.
78  */
79
80 #define HAVE_TIMEVAL
81
82 /*
83  *      Define HAVE_SELECT if the system supports the `select' system call.
84  */
85
86 /* #define HAVE_SELECT */
87
88 /*
89  *      Define HAVE_PTYS if the system supports pty devices.
90  */
91
92 /* #define HAVE_PTYS */
93
94 /* If your system uses COFF (Common Object File Format) then define the
95    preprocessor symbol "COFF". */
96
97 #define COFF
98
99 /* NT supports Winsock which is close enough (with some hacks) */
100
101 #define HAVE_SOCKETS
102
103 /* define MAIL_USE_FLOCK if the mailer uses flock
104    to interlock access to /usr/spool/mail/$USER.
105    The alternative is that a lock file named
106    /usr/spool/mail/$USER.lock.  */
107
108 /* #define MAIL_USE_FLOCK */
109 #define MAIL_USE_POP
110 #define MAIL_USE_SYSTEM_LOCK
111
112 /* If the character used to separate elements of the executable path
113    is not ':', #define this to be the appropriate character constant.  */
114 #define SEPCHAR ';'
115
116 /* ============================================================ */
117
118 /* Here, add any special hacks needed
119    to make Emacs work on this system.  For example,
120    you might define certain system call names that don't
121    exist on your system, or that do different things on
122    your system and must be used only through an encapsulation
123    (Which you should place, by convention, in sysdep.c).  */
124
125 /* XEmacs file I/O for DOS text files requires FILE_CODING */
126 #define FILE_CODING
127
128 extern Lisp_Object Vdirectory_sep_char;
129 #define DIRECTORY_SEP ((char)XCHARVAL(Vdirectory_sep_char))
130
131 /* Define this to be the separator between devices and paths */
132 #define DEVICE_SEP ':'
133
134 /* We'll support either convention on NT.  */
135 #define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\')
136 #define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
137
138 /* The null device on Windows NT. */
139 #define NULL_DEVICE     "NUL:"
140 #define EXEC_SUFFIXES   ".exe:.com:.bat:.cmd:"
141
142 #ifndef MAXPATHLEN
143 #define MAXPATHLEN      _MAX_PATH
144 #endif
145
146 #define LISP_FLOAT_TYPE
147
148 #define HAVE_GETTIMEOFDAY
149 #define HAVE_GETHOSTNAME
150 #define HAVE_DUP2
151 #define HAVE_RENAME
152 #define HAVE_CLOSEDIR
153
154 #define HAVE_TZNAME
155
156 #define HAVE_LONG_FILE_NAMES
157
158 #define HAVE_MKDIR
159 #define HAVE_RMDIR
160 #define HAVE_RANDOM
161 #define HAVE_LOGB
162 #define HAVE_FREXP
163 #define HAVE_FMOD
164 #define HAVE_FTIME
165 #define HAVE_MKTIME
166
167 #define HAVE_MOUSE
168 #define HAVE_H_ERRNO
169 #define HAVE_STRUCT_UTIMBUF
170
171 #ifdef HAVE_NTGUI
172 #define HAVE_WINDOW_SYSTEM
173 #define HAVE_FACES
174 #endif
175
176 #define HAVE_STRCASECMP
177
178 /* Compatibility macros. Some used to be routines in nt.c */
179 #define strcasecmp(x,y) _stricmp(x,y)
180 #define random() (rand() << 15 | rand())
181 #define srandom(seed) (srand(seed))
182 #define setpgrp(pid,gid)
183
184 #define MODE_LINE_BINARY_TEXT(_b_) (NILP ((_b_)->buffer_file_type) ? "T" : "B")
185
186 /* get some redefinitions in place */
187
188 #if 0
189 /* IO calls that are emulated or shadowed */
190 #define access  sys_access
191 #define chdir   sys_chdir
192 #define chmod   sys_chmod
193 #define close   sys_close
194 #define creat   sys_creat
195 #define ctime sys_ctime
196 #define dup     sys_dup
197 #define dup2    sys_dup2
198 #define fopen   sys_fopen
199 #define link    sys_link
200 #define mktemp  sys_mktemp
201 #define open    sys_open
202 #define read    sys_read
203 #define rename  sys_rename
204 #define unlink  sys_unlink
205 #define write   sys_write
206 #define mkdir   sys_mkdir
207 #define rmdir   sys_rmdir
208
209 #endif
210
211 #if 0
212 /* this is hacky, but is necessary to avoid warnings about macro
213    redefinitions using the SDK compilers */
214 #ifndef __STDC__
215 #define __STDC__ 1
216 #define MUST_UNDEF__STDC__
217 #endif
218 #include <direct.h>
219 #include <io.h>
220 #include <stdio.h>
221 #ifdef MUST_UNDEF__STDC__
222 #undef __STDC__
223 #undef MUST_UNDEF__STDC__
224 #endif
225 #endif
226
227 #include <stdio.h>
228
229
230 /* IO calls that are emulated or shadowed */
231 #define pipe    sys_pipe
232 int sys_pipe (int * phandles);
233
234 #ifndef HAVE_X_WINDOWS
235 #define sleep   sys_sleep
236 void sleep (int seconds);
237 #endif
238
239 /* subprocess calls that are emulated */
240 #define spawnve sys_spawnve
241 int spawnve (int mode, CONST char *cmdname, 
242              CONST char * CONST *argv, CONST char *CONST *envp);
243
244 #define wait    sys_wait
245 int wait (int *status);
246
247 #define kill    sys_kill
248 int kill (int pid, int sig);
249
250 /* map to MSVC names */
251 #define popen     _popen
252 #define pclose    _pclose
253
254 #if 0
255 #define chdir     _chdir
256 #define execlp    _execlp
257 #define execvp    _execvp
258 #define fcloseall _fcloseall
259 #define fdopen    _fdopen
260 #define fgetchar  _fgetchar
261 #define fileno    _fileno
262 #define flushall  _flushall
263 #define fputchar  _fputchar
264 #define getw      _getw
265 #define getpid    _getpid
266 #define isatty    _isatty
267 #define logb      _logb
268 #define _longjmp  longjmp
269 #define lseek     _lseek
270 #define putw      _putw
271 #define umask     _umask
272 /* #define utime     _utime */
273 /* #define index     strchr */
274 /* #define rindex    strrchr */
275 #define read      _read
276 #define write     _write
277 #define getcwd    _getcwd
278
279 #ifdef HAVE_NTGUI
280 #define abort   win32_abort
281 #endif
282
283 #endif /* 0 */
284
285 typedef int uid_t;
286 typedef int gid_t;
287 typedef int pid_t;
288 typedef int ssize_t;
289
290 /* Encapsulation of system calls */
291 #ifndef DONT_ENCAPSULATE
292 #define getpid sys_getpid
293 pid_t getpid (void);
294 #endif
295
296 /* Random global functions called everywhere. Implemented in nt.c */
297 /* #### Most of these are FSFisms and must be avoided */
298 /* #### All of these are FSFisms and must be avoided */
299 void dostounix_filename (char *p);
300 void unixtodos_filename (char *p);
301 int crlf_to_lf (int n, unsigned char *buf, unsigned int *lf_count);
302
303 char *getwd (char *dir);
304
305 void *sbrk (unsigned long increment);
306
307 struct passwd;
308 struct passwd *getpwuid (uid_t uid);
309 struct passwd *getpwnam (const char *name);
310 uid_t getuid (void);
311 uid_t geteuid (void);
312 gid_t getgid (void);
313 gid_t getegid (void);
314
315 /* Setitimer is emulated */
316 #define HAVE_SETITIMER
317
318 /* We now have emulation for some signals */
319 #define HAVE_SIGHOLD
320 #define sigset(s,h) msw_sigset(s,h)
321 #define sighold(s) msw_sighold(s)
322 #define sigrelse(s) msw_sigrelse(s)
323 #define sigpause(s) msw_sigpause(s)
324 #define signal sigset
325
326 /* Defines that we need that aren't in the standard signal.h  */
327 #define SIGHUP  1               /* Hang up */
328 #define SIGQUIT 3               /* Quit process */
329 #define SIGKILL 9               /* Die, die die */
330 #define SIGALRM 14              /* Alarm */
331 #define SIGPROF 29              /* Profiling timer exp */
332
333 /* For integration with MSDOS support.  */
334 #define getdisk()               (_getdrive () - 1)
335 #define getdefdir(_drv, _buf)   _getdcwd (_drv, _buf, MAXPATHLEN)
336
337 #if 0 /* they do. -kkm */
338 /* Define this so that winsock.h definitions don't get included when windows.h
339    is...  I don't know if they do the right thing for emacs.  For this to
340    have proper effect, config.h must always be included before windows.h.  */
341 #define _WINSOCKAPI_    1
342 #endif /* 0 */
343
344 /* Defines size_t and alloca ().  */
345 #include <malloc.h>
346
347 #include <sys/stat.h>
348
349 /* Define for those source files that do not include enough NT 
350    system files.  */
351 #ifndef NULL
352 #ifdef __cplusplus
353 #define NULL    0
354 #else
355 #define NULL    ((void *)0)
356 #endif
357 #endif
358
359 /* For proper declaration of environ.  */
360 #include <stdlib.h>
361 #include <string.h>
362
363 /* Define process implementation */
364 #define HAVE_WIN32_PROCESSES
365
366 /* We need a little extra space, see ../../lisp/loadup.el */
367 #define SYSTEM_PURESIZE_EXTRA 15000
368
369 /* ============================================================ */
370
371 /* See unexnt.c */
372 #if (_MSC_VER >= 1100)
373 #define DUMP_SEPARATE_SECTION
374 #endif
375 #ifdef DUMP_SEPARATE_SECTION
376 #pragma data_seg("xdata")
377 #pragma bss_seg("xdata")
378 #endif
379
380 #ifdef HAVE_SCROLLBARS
381 /* Ensure the NT 4 mouse definitions in winuser.h are available */
382  #ifndef _WIN32_WINNT
383   #define _WIN32_WINNT 0x0400
384  #endif
385 #endif