Fix cursor positioning in partial width windows on TTY.
[bpt/emacs.git] / src / s / ms-w32.h
CommitLineData
95ed0025 1/* System description file for Windows NT.
4b158629 2 Copyright (C) 1993, 1994, 1995, 2001, 2002, 2003, 2004, 2005, 2006,
114f9c96 3 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
95ed0025
RS
4
5This file is part of GNU Emacs.
6
4b158629 7GNU Emacs is free software: you can redistribute it and/or modify
95ed0025 8it under the terms of the GNU General Public License as published by
4b158629
GM
9the Free Software Foundation, either version 3 of the License, or
10(at your option) any later version.
95ed0025
RS
11
12GNU Emacs is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
4b158629 18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
95ed0025
RS
19
20/*
21 * Define symbols to identify the version of Unix this is.
22 * Define all the symbols that apply correctly.
23 */
24
95ed0025
RS
25#ifndef WINDOWSNT
26#define WINDOWSNT
27#endif
28#ifndef DOS_NT
29#define DOS_NT /* MSDOS or WINDOWSNT */
30#endif
31
3360970a
KH
32/* If you are compiling with a non-C calling convention but need to
33 declare vararg routines differently, put it here */
34#define _VARARGS_ __cdecl
35
36/* If you are providing a function to something that will call the
37 function back (like a signal handler and signal, or main) its calling
38 convention must be whatever standard the libraries expect */
39#define _CALLBACK_ __cdecl
40
95ed0025
RS
41/* SYSTEM_TYPE should indicate the kind of system you are using.
42 It sets the Lisp variable system-type. */
43
44#define SYSTEM_TYPE "windows-nt"
45#define SYMS_SYSTEM syms_of_ntterm ()
46
124abc74 47#define NO_MATHERR 1
95ed0025 48
95ed0025
RS
49/* Letter to use in finding device name of first pty,
50 if system supports pty's. 'a' means it is /dev/ptya0 */
51
52#define FIRST_PTY_LETTER 'a'
53
95ed0025
RS
54/*
55 * Define HAVE_TIMEVAL if the system supports the BSD style clock values.
56 * Look in <sys/time.h> for a timeval structure.
57 */
58
124abc74 59#define HAVE_TIMEVAL 1
95ed0025 60
4e36126c
GV
61/* NT supports Winsock which is close enough (with some hacks) */
62
124abc74 63#define HAVE_SOCKETS 1
4e36126c 64
69fd7dbf
KS
65/* But our select implementation doesn't allow us to make non-blocking
66 connects. So until that is fixed, this is necessary: */
67
68#define BROKEN_NON_BLOCKING_CONNECT 1
69
401ea527
KS
70/* And the select implementation does 1-byte read-ahead waiting
71 for received packets, so datagrams are broken too. */
72
73#define BROKEN_DATAGRAM_SOCKETS 1
74
95ed0025
RS
75/* Define this symbol if your system has the functions bcopy, etc. */
76
77#define BSTRING
78#define bzero(b, l) memset(b, 0, l)
7f470eff 79#define bcopy(s, d, l) memmove(d, s, l)
95ed0025
RS
80#define bcmp(a, b, l) memcmp(a, b, l)
81
7f470eff 82/* bcopy (aka memmove aka memcpy at least on x86) under MSVC is quite safe */
124abc74 83#define GAP_USE_BCOPY 1
7f470eff
GV
84#define BCOPY_UPWARD_SAFE 1
85#define BCOPY_DOWNWARD_SAFE 1
86
95ed0025
RS
87/* If your system uses COFF (Common Object File Format) then define the
88 preprocessor symbol "COFF". */
89
124abc74 90#define COFF 1
95ed0025
RS
91
92/* define MAIL_USE_FLOCK if the mailer uses flock
93 to interlock access to /usr/spool/mail/$USER.
94 The alternative is that a lock file named
95 /usr/spool/mail/$USER.lock. */
96
97/* #define MAIL_USE_FLOCK */
124abc74
AI
98#define MAIL_USE_POP 1
99#define MAIL_USE_SYSTEM_LOCK 1
95ed0025 100
95ed0025
RS
101/* If the character used to separate elements of the executable path
102 is not ':', #define this to be the appropriate character constant. */
103#define SEPCHAR ';'
104
cc48c6e7
AI
105#define ORDINARY_LINK 1
106
95ed0025
RS
107/* ============================================================ */
108
109/* Here, add any special hacks needed
110 to make Emacs work on this system. For example,
111 you might define certain system call names that don't
112 exist on your system, or that do different things on
113 your system and must be used only through an encapsulation
114 (Which you should place, by convention, in sysdep.c). */
115
95ed0025 116/* Define this to be the separator between path elements */
4e36126c 117#define DIRECTORY_SEP XINT (Vdirectory_sep_char)
95ed0025
RS
118
119/* Define this to be the separator between devices and paths */
120#define DEVICE_SEP ':'
121
122/* We'll support either convention on NT. */
123#define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\')
124#define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
125
126/* The null device on Windows NT. */
127#define NULL_DEVICE "NUL:"
95ed0025
RS
128
129#ifndef MAXPATHLEN
130#define MAXPATHLEN _MAX_PATH
131#endif
132
f60ae425 133#define HAVE_SOUND 1
124abc74 134#define LISP_FLOAT_TYPE 1
3360970a 135
2a741506 136#undef HAVE_SYS_SELECT_H
124abc74
AI
137#define HAVE_SYS_TIMEB_H 1
138#define HAVE_SYS_TIME_H 1
139#define HAVE_UNISTD_H 1
2a741506
GV
140#undef HAVE_UTIME_H
141#undef HAVE_LINUX_VERSION_H
142#undef HAVE_SYS_SYSTEMINFO_H
143#undef HAVE_TERMIOS_H
144#define HAVE_LIMITS_H 1
124abc74 145#define HAVE_STRING_H 1
c8f7c76b 146#define HAVE_STDLIB_H 1
47539b85 147#define HAVE_PWD_H 1
2a741506 148#define STDC_HEADERS 1
124abc74 149#define TIME_WITH_SYS_TIME 1
4e36126c 150
124abc74
AI
151#define HAVE_GETTIMEOFDAY 1
152#define HAVE_GETHOSTNAME 1
2a741506 153#undef HAVE_GETDOMAINNAME
124abc74
AI
154#define HAVE_DUP2 1
155#define HAVE_RENAME 1
156#define HAVE_CLOSEDIR 1
a5a7d30f 157#define HAVE_FSYNC 1 /* fsync is called _commit in MSVC. */
4e36126c 158
2a741506
GV
159#undef TM_IN_SYS_TIME
160#undef HAVE_TM_ZONE
4e36126c 161
124abc74 162#define HAVE_LONG_FILE_NAMES 1
4e36126c 163
124abc74
AI
164#define HAVE_MKDIR 1
165#define HAVE_RMDIR 1
166#define HAVE_RANDOM 1
2a741506
GV
167#undef HAVE_SYSINFO
168#undef HAVE_LRAND48
124abc74
AI
169#define HAVE_BCOPY 1
170#define HAVE_BCMP 1
171#define HAVE_LOGB 1
172#define HAVE_FREXP 1
173#define HAVE_FMOD 1
2a741506
GV
174#undef HAVE_RINT
175#undef HAVE_CBRT
124abc74 176#define HAVE_FTIME 1
2a741506
GV
177#undef HAVE_RES_INIT /* For -lresolv on Suns. */
178#undef HAVE_SETSID
179#undef HAVE_FPATHCONF
7b7262a7 180#define HAVE_SELECT 1
2a741506
GV
181#define HAVE_MKTIME 1
182#undef HAVE_EUIDACCESS
124abc74 183#define HAVE_GETPAGESIZE 1
2a741506 184#define HAVE_TZSET 1
124abc74 185#define HAVE_SETLOCALE 1
2a741506
GV
186#undef HAVE_UTIMES
187#undef HAVE_SETRLIMIT
188#undef HAVE_SETPGID
189#undef HAVE_GETCWD
124abc74 190#define HAVE_SHUTDOWN 1
b2140d4b 191#define HAVE_STRFTIME 1
2a741506 192
dabe36a8 193#define LOCALTIME_CACHE
99674eec 194#define HAVE_INET_SOCKETS 1
2a741506
GV
195
196#undef HAVE_AIX_SMT_EXP
addedb8e 197#define USE_TOOLKIT_SCROLL_BARS 1
2a741506
GV
198
199/* Define if you have the ANSI `strerror' function.
200 Otherwise you must have the variable `char *sys_errlist[]'. */
124abc74 201#define HAVE_STRERROR 1
2a741506
GV
202
203/* Define if `struct utimbuf' is declared by <utime.h>. */
204#undef HAVE_STRUCT_UTIMBUF
4e36126c 205
124abc74
AI
206#define HAVE_MOUSE 1
207#define HAVE_H_ERRNO 1
1cd47f14 208
4a1ba222 209#ifdef HAVE_NTGUI
124abc74 210#define HAVE_WINDOW_SYSTEM 1
124abc74 211#define HAVE_MENUS 1
4a1ba222
GV
212#endif
213
1cd47f14 214#define MODE_LINE_BINARY_TEXT(_b_) (NILP ((_b_)->buffer_file_type) ? "T" : "B")
95ed0025 215
4e36126c
GV
216/* get some redefinitions in place */
217
124abc74
AI
218#ifdef emacs
219
a14724c8 220/* calls that are emulated or shadowed */
7f470eff 221#undef access
4e36126c 222#define access sys_access
7f470eff 223#undef chdir
4e36126c 224#define chdir sys_chdir
7f470eff 225#undef chmod
4e36126c 226#define chmod sys_chmod
0e20b3a3 227#define chown sys_chown
7f470eff 228#undef close
4e36126c 229#define close sys_close
7f470eff 230#undef creat
4e36126c
GV
231#define creat sys_creat
232#define ctime sys_ctime
7f470eff 233#undef dup
4e36126c 234#define dup sys_dup
7f470eff 235#undef dup2
4e36126c
GV
236#define dup2 sys_dup2
237#define fopen sys_fopen
238#define link sys_link
239#define mkdir sys_mkdir
7f470eff 240#undef mktemp
4e36126c 241#define mktemp sys_mktemp
7f470eff 242#undef open
4e36126c
GV
243#define open sys_open
244#define pipe sys_pipe
7f470eff 245#undef read
4e36126c
GV
246#define read sys_read
247#define rename sys_rename
248#define rmdir sys_rmdir
249#define select sys_select
250#define sleep sys_sleep
a14724c8 251#define strerror sys_strerror
7f470eff 252#undef unlink
4e36126c 253#define unlink sys_unlink
7f470eff 254#undef write
4e36126c
GV
255#define write sys_write
256
4e36126c
GV
257/* subprocess calls that are emulated */
258#define spawnve sys_spawnve
259#define wait sys_wait
260#define kill sys_kill
261#define signal sys_signal
262
91eac4bb
JB
263/* termcap.c calls that are emulated */
264#define tputs sys_tputs
265#define tgetstr sys_tgetstr
266
267/* cm.c calls that are emulated */
268#define chcheckmagic sys_chcheckmagic
269#define cmcostinit sys_cmcostinit
270#define cmgoto sys_cmgoto
271#define cmputc sys_cmputc
272#define Wcm_clear sys_Wcm_clear
273
124abc74
AI
274#endif /* emacs */
275
4e36126c
GV
276/* map to MSVC names */
277#define execlp _execlp
278#define execvp _execvp
4e36126c 279#define fdopen _fdopen
23bf9efb 280#ifndef fileno
4e36126c 281#define fileno _fileno
23bf9efb 282#endif
a5a7d30f
AI
283#define fsync _commit
284#define ftruncate _chsize
4e36126c 285#define getpid _getpid
9b67f3aa
EZ
286#ifdef _MSC_VER
287typedef int pid_t;
288#endif
4e36126c
GV
289#define isatty _isatty
290#define logb _logb
291#define _longjmp longjmp
292#define lseek _lseek
293#define popen _popen
294#define pclose _pclose
4e36126c 295#define umask _umask
719072f5 296#define utimbuf _utimbuf
4e36126c
GV
297#define index strchr
298#define rindex strrchr
bfba227f
AI
299#define strdup _strdup
300#define strupr _strupr
301#define strnicmp _strnicmp
302#define stricmp _stricmp
303#define tzset _tzset
e37b3faf
JR
304
305#if !defined (_MSC_VER) || (_MSC_VER < 1400)
bfba227f 306#define tzname _tzname
bc5f466c 307#define utime _utime
e37b3faf 308#endif
95ed0025 309
7f470eff
GV
310/* this is hacky, but is necessary to avoid warnings about macro
311 redefinitions using the SDK compilers */
312#ifndef __STDC__
313#define __STDC__ 1
314#define MUST_UNDEF__STDC__
315#endif
316#include <direct.h>
317#include <io.h>
318#include <stdio.h>
319#ifdef MUST_UNDEF__STDC__
320#undef __STDC__
321#undef MUST_UNDEF__STDC__
322#endif
323
95ed0025
RS
324/* Defines that we need that aren't in the standard signal.h */
325#define SIGHUP 1 /* Hang up */
326#define SIGQUIT 3 /* Quit process */
327#define SIGTRAP 5 /* Trace trap */
328#define SIGKILL 9 /* Die, die die */
329#define SIGPIPE 13 /* Write on pipe with no readers */
330#define SIGALRM 14 /* Alarm */
331#define SIGCHLD 18 /* Death of child */
332
bfba227f
AI
333#ifndef NSIG
334#define NSIG 23
335#endif
336
95ed0025
RS
337/* For integration with MSDOS support. */
338#define getdisk() (_getdrive () - 1)
445f44d2
RS
339#ifdef emacs
340#define getdefdir(_drv, _buf) ((_buf[0] = (_drv + 'A' - 1), _buf[1] = ':', _buf[2] = '/', _buf[3] = 0), 1)
341#else
95ed0025 342#define getdefdir(_drv, _buf) _getdcwd (_drv, _buf, MAXPATHLEN)
445f44d2 343#endif
95ed0025 344
bfba227f
AI
345extern char *get_emacs_configuration (void);
346extern char *get_emacs_configuration_options (void);
3360970a 347#define EMACS_CONFIGURATION get_emacs_configuration ()
bfba227f 348#define EMACS_CONFIG_OPTIONS get_emacs_configuration_options ()
3360970a 349
4e36126c
GV
350/* Define this so that winsock.h definitions don't get included with
351 windows.h. For this to have proper effect, config.h must always be
352 included before windows.h. */
95ed0025 353#define _WINSOCKAPI_ 1
bfba227f 354#define _WINSOCK_H
95ed0025 355
1cd47f14 356/* Defines size_t and alloca (). */
bfba227f
AI
357#ifdef USE_CRT_DLL
358#define malloc e_malloc
359#define free e_free
360#define realloc e_realloc
361#define calloc e_calloc
362#endif
1cd47f14
KH
363#include <malloc.h>
364
3360970a 365#include <sys/stat.h>
3360970a 366
177c0ea7 367/* Define for those source files that do not include enough NT
3360970a
KH
368 system files. */
369#ifndef NULL
370#ifdef __cplusplus
371#define NULL 0
372#else
373#define NULL ((void *)0)
374#endif
375#endif
896c0d8b 376
4a1ba222
GV
377/* For proper declaration of environ. */
378#include <stdlib.h>
bfba227f
AI
379#ifndef sys_nerr
380#define sys_nerr _sys_nerr
381#endif
4e36126c 382#include <string.h>
4a1ba222 383
517d7b9f 384/* We need a little extra space, see ../../lisp/loadup.el. */
ff709c3a 385#define SYSTEM_PURESIZE_EXTRA 50000
e3be3bfd 386
7f470eff
GV
387/* For unexec to work on Alpha systems, we need to put Emacs'
388 initialized data into a separate section from the CRT initialized
389 data (because the Alpha linker freely reorders data variables, even
390 across libraries, so our data and the CRT data get intermingled).
391
392 Starting with MSVC 5.0, we must also place the uninitialized data
393 into its own section. VC5 intermingles uninitialized data from the CRT
394 between Emacs' static uninitialized data and its public uninitialized
395 data. A separate .bss section for Emacs groups both static and
517d7b9f 396 public uninitialized together.
7f470eff 397
517d7b9f 398 Note that unexw32.c relies on this fact, and must be modified
7f470eff
GV
399 accordingly if this section name is changed, or if this pragma is
400 removed. Also, obviously, all files that define initialized data
401 must include config.h to pick up this pragma. */
402
403/* Names must be < 8 bytes */
52c7f9ee 404#ifdef _MSC_VER
7f470eff
GV
405#pragma data_seg("EMDATA")
406#pragma bss_seg("EMBSS")
52c7f9ee 407#endif
7f470eff
GV
408
409/* #define FULL_DEBUG */
410/* #define EMACSDEBUG */
411
412#ifdef EMACSDEBUG
413extern void _DebPrint (const char *fmt, ...);
414#define DebPrint(stuff) _DebPrint stuff
415#else
416#define DebPrint(stuff)
417#endif
418
419
3360970a 420/* ============================================================ */
ab5796a9
MB
421
422/* arch-tag: 5d4a3a1c-40dc-4dea-9c7c-38fed9ae0eae
423 (do not change this comment) */