annotate src/os_win16.h @ 4223:5c0652f455c9 v7.3.863

updated for version 7.3.863 Problem: Problem with 'ambiwidth' detection for ANSI terminal. Solution: Work around not recognizing a term response. (Hayaki Saito)
author Bram Moolenaar <bram@vim.org>
date Sat, 16 Mar 2013 14:33:36 +0100
parents e6d8b44065bc
children 04736b4030ec
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 /* vi:set ts=8 sts=4 sw=4:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 * VIM - Vi IMproved by Bram Moolenaar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 * Do ":help uganda" in Vim to read copying and usage conditions.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 * Do ":help credits" in Vim to see a list of people who contributed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 * Win16 (Windows 3.1x) machine-dependent things.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 #include "os_dos.h" /* common MS-DOS and Windows stuff */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 #define BINARY_FILE_IO
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 #define USE_EXE_NAME /* use argv[0] for $VIM */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 #define SYNC_DUP_CLOSE /* sync() a file with dup() and close() */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 #define USE_TERM_CONSOLE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 #define HAVE_STRING_H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 #define HAVE_STRCSPN
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 #define HAVE_STRICMP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 #define HAVE_STRNICMP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 #define HAVE_STRFTIME /* guessed */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 #define HAVE_MEMSET
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 #define USE_TMPNAM /* use tmpnam() instead of mktemp() */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 #define HAVE_LOCALE_H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 #define HAVE_FCNTL_H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 #define HAVE_QSORT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 #define HAVE_ST_MODE /* have stat.st_mode */
1624
18ee39301b82 updated for version 7.2a
vimboss
parents: 379
diff changeset
30 #define HAVE_MATH_H
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 //#define USE_FNAME_CASE /* adjust case of file names */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 #ifndef FEAT_CLIPBOARD
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 # define FEAT_CLIPBOARD /* include clipboard support */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 #if defined(__DATE__) && defined(__TIME__)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 # define HAVE_DATE_TIME
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 #define HAVE_AVAIL_MEM
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 #define SHORT_FNAME /* always 8.3 file name */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 #define SMALL_MALLOC /* 16 bit storage allocation */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 #ifdef __BORLANDC__
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 # define HAVE_PUTENV /* at least Bcc 5.2 has it */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 #ifdef FEAT_GUI_W16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 # define NO_CONSOLE /* don't included console-only code */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 /* toupper() is not really broken, but it's very slow. Probably because of
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 * using unicde characters on Windows NT */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 #define BROKEN_TOUPPER
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 #define FNAME_ILLEGAL "\"*?><|" /* illegal characters in a file name */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 #ifndef SIZEOF_INT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 # define SIZEOF_INT 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 typedef long off_t;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 #include <stdlib.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 #include <time.h>
3927
e6d8b44065bc updated for version 7.3.719
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
66
e6d8b44065bc updated for version 7.3.719
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
67 /* cproto fails on missing include files */
e6d8b44065bc updated for version 7.3.719
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
68 #ifndef PROTO
e6d8b44065bc updated for version 7.3.719
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
69 # include <dos.h>
e6d8b44065bc updated for version 7.3.719
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
70 # include <dir.h>
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71
3927
e6d8b44065bc updated for version 7.3.719
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
72 # ifndef STRICT
e6d8b44065bc updated for version 7.3.719
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
73 # define STRICT
e6d8b44065bc updated for version 7.3.719
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
74 # endif
e6d8b44065bc updated for version 7.3.719
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
75 # ifndef COBJMACROS
e6d8b44065bc updated for version 7.3.719
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
76 # define COBJMACROS /* For OLE: Enable "friendlier" access to objects */
e6d8b44065bc updated for version 7.3.719
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
77 # endif
e6d8b44065bc updated for version 7.3.719
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
78 # include <windows.h>
e6d8b44065bc updated for version 7.3.719
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
79
e6d8b44065bc updated for version 7.3.719
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
80 #endif /* PROTO */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 * plenty of memory, use large buffers
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 #define CMDBUFFSIZE 1024 /* size of the command processing buffer */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 #define BASENAMELEN (MAXPATHL-5) /* length of base of file name */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 #ifndef DFLT_MAXMEM
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 # define DFLT_MAXMEM (256) /* use up to 256K for a buffer*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 #ifndef DFLT_MAXMEMTOT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 # define DFLT_MAXMEMTOT (5*1024) /* use up to 5 Mbyte for Vim */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 * Some simple debugging macros that look and behave a lot like their
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 * namesakes in MFC.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 #ifdef _DEBUG
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 # if defined(_MSC_VER) && (_MSC_VER >= 1000)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 /* Use the new debugging tools in Visual C++ 4.x */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 # include <crtdbg.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 # define ASSERT(f) _ASSERT(f)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 # else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 # include <assert.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 # define ASSERT(f) assert(f)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 # define TRACE Trace
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 # define TRACE0(sz) Trace(_T("%s"), _T(sz))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 # define TRACE1(sz, p1) Trace(_T(sz), p1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117 # define TRACE2(sz, p1, p2) Trace(_T(sz), p1, p2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 # define TRACE3(sz, p1, p2, p3) Trace(_T(sz), p1, p2, p3)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120 /* In debug version, writes trace messages to debug stream */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121 void __cdecl
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 Trace(char *pszFormat, ...);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 #else /* !_DEBUG */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 /* These macros should all compile away to nothing */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 # define ASSERT(f) ((void)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 # define TRACE 1 ? (void)0 : printf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 # define TRACE0(sz)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 # define TRACE1(sz, p1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 # define TRACE2(sz, p1, p2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132 # define TRACE3(sz, p1, p2, p3)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 #endif /* !_DEBUG */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 #define ASSERT_POINTER(p, type) \
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 ASSERT(((p) != NULL) && IsValidAddress((p), sizeof(type), FALSE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140 #define ASSERT_NULL_OR_POINTER(p, type) \
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 ASSERT(((p) == NULL) || IsValidAddress((p), sizeof(type), FALSE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143 #define mch_setenv(name, val, x) setenv(name, val, x)