Mercurial > vim
annotate src/os_win32.h @ 20331:85b7b3c3e19a
Added tag v8.2.0720 for changeset a7dbf32b5cc058e90d40a7c44811db15ab05f225
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 09 May 2020 16:15:04 +0200 |
parents | 1cae476a7c82 |
children | fc859aea8cec |
rev | line source |
---|---|
10042
4aead6a9b7a9
commit https://github.com/vim/vim/commit/edf3f97ae2af024708ebb4ac614227327033ca47
Christian Brabandt <cb@256bit.org>
parents:
7838
diff
changeset
|
1 /* vi:set ts=8 sts=4 sw=4 noet: |
7 | 2 * |
3 * VIM - Vi IMproved by Bram Moolenaar | |
4 * | |
5 * Do ":help uganda" in Vim to read copying and usage conditions. | |
6 * Do ":help credits" in Vim to see a list of people who contributed. | |
7 */ | |
8 | |
9 /* | |
10 * Win32 (Windows NT and Windows 95) machine-dependent things. | |
11 */ | |
12 | |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
13 #include "os_dos.h" // common MS-DOS and Win32 stuff |
7 | 14 #ifndef __CYGWIN__ |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
15 // cproto fails on missing include files |
3927 | 16 # ifndef PROTO |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
17 # include <direct.h> // for _mkdir() |
3927 | 18 # endif |
7 | 19 #endif |
20 | |
21 #define BINARY_FILE_IO | |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
22 #define USE_EXE_NAME // use argv[0] for $VIM |
7 | 23 #define USE_TERM_CONSOLE |
24 #ifndef HAVE_STRING_H | |
25 # define HAVE_STRING_H | |
26 #endif | |
1620 | 27 #ifndef HAVE_MATH_H |
28 # define HAVE_MATH_H | |
29 #endif | |
7 | 30 #define HAVE_STRCSPN |
31 #ifndef __GNUC__ | |
32 #define HAVE_STRICMP | |
33 #define HAVE_STRNICMP | |
34 #endif | |
35 #ifndef HAVE_STRFTIME | |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
36 # define HAVE_STRFTIME // guessed |
7 | 37 #endif |
38 #define HAVE_MEMSET | |
39 #ifndef HAVE_LOCALE_H | |
40 # define HAVE_LOCALE_H 1 | |
41 #endif | |
42 #ifndef HAVE_FCNTL_H | |
43 # define HAVE_FCNTL_H | |
44 #endif | |
45 #define HAVE_QSORT | |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
46 #define HAVE_ST_MODE // have stat.st_mode |
7 | 47 |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
48 #define FEAT_SHORTCUT // resolve shortcuts |
7 | 49 |
16606
7e733046db1d
patch 8.1.1306: Borland support is outdated and doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
16451
diff
changeset
|
50 #if (!defined(_MSC_VER) || _MSC_VER > 1020) |
7 | 51 /* |
52 * Access Control List (actually security info). | |
16606
7e733046db1d
patch 8.1.1306: Borland support is outdated and doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
16451
diff
changeset
|
53 * MSVC has acl stuff only in 5.0, not in 4.2, don't know about 4.3. |
7 | 54 */ |
55 # define HAVE_ACL | |
56 #endif | |
57 | |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
58 #define USE_FNAME_CASE // adjust case of file names |
18354
9f51d0cef8da
patch 8.1.2171: mouse support not always available
Bram Moolenaar <Bram@vim.org>
parents:
16606
diff
changeset
|
59 #if !defined(FEAT_CLIPBOARD) |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
60 # define FEAT_CLIPBOARD // include clipboard support |
7 | 61 #endif |
62 #if defined(__DATE__) && defined(__TIME__) | |
63 # define HAVE_DATE_TIME | |
64 #endif | |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
65 #ifndef FEAT_GUI_MSWIN // GUI works different |
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
66 # define BREAKCHECK_SKIP 1 // call mch_breakcheck() each time, it's fast |
7 | 67 #endif |
68 | |
7460
1420ccc9f610
commit https://github.com/vim/vim/commit/ee2739787f1e996739541bb60e6003b892497e03
Christian Brabandt <cb@256bit.org>
parents:
5735
diff
changeset
|
69 #define HAVE_TOTAL_MEM |
1420ccc9f610
commit https://github.com/vim/vim/commit/ee2739787f1e996739541bb60e6003b892497e03
Christian Brabandt <cb@256bit.org>
parents:
5735
diff
changeset
|
70 |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
71 #define HAVE_PUTENV // at least Bcc 5.2 and MSC have it |
7 | 72 |
16451
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
15868
diff
changeset
|
73 #if defined(FEAT_GUI_MSWIN) && !defined(VIMDLL) |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
74 # define NO_CONSOLE // don't included console-only code |
7 | 75 #endif |
76 | |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
77 // toupper() is not really broken, but it's very slow. Probably because of |
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
78 // using Unicode characters on Windows NT |
7 | 79 #define BROKEN_TOUPPER |
80 | |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
81 #define FNAME_ILLEGAL "\"*?><|" // illegal characters in a file name |
7 | 82 |
14597
27e814e21594
patch 8.1.0312: wrong type for flags used in signal handlers
Christian Brabandt <cb@256bit.org>
parents:
10781
diff
changeset
|
83 #include <signal.h> |
7 | 84 #include <stdlib.h> |
85 #include <time.h> | |
2241
60da25e3aab7
Correct use of long instead of off_t for file size. (James Vega)
Bram Moolenaar <bram@vim.org>
parents:
1620
diff
changeset
|
86 #include <sys/types.h> |
7 | 87 |
88 #ifndef STRICT | |
89 # define STRICT | |
90 #endif | |
91 #ifndef COBJMACROS | |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
92 # define COBJMACROS // For OLE: Enable "friendlier" access to objects |
7 | 93 #endif |
3927 | 94 #ifndef PROTO |
95 # include <windows.h> | |
5225
8f983df0299f
updated for version 7.4a.038
Bram Moolenaar <bram@vim.org>
parents:
5049
diff
changeset
|
96 # ifndef SM_CXPADDEDBORDER |
8f983df0299f
updated for version 7.4a.038
Bram Moolenaar <bram@vim.org>
parents:
5049
diff
changeset
|
97 # define SM_CXPADDEDBORDER 92 |
8f983df0299f
updated for version 7.4a.038
Bram Moolenaar <bram@vim.org>
parents:
5049
diff
changeset
|
98 # endif |
3927 | 99 #endif |
7 | 100 |
101 /* | |
102 * Win32 has plenty of memory, use large buffers | |
103 */ | |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
104 #define CMDBUFFSIZE 1024 // size of the command processing buffer |
7 | 105 |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
106 // _MAX_PATH is only 260 (stdlib.h), but we want more for the 'path' option, |
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
107 // thus use a larger number. |
7 | 108 #define MAXPATHL 1024 |
109 | |
110 #ifndef BASENAMELEN | |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
111 # define BASENAMELEN (_MAX_PATH - 5) // length of base of file name |
7 | 112 #endif |
113 | |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
114 #define TEMPNAMELEN _MAX_PATH // length of temp file name path |
7 | 115 |
116 #ifndef DFLT_MAXMEM | |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
117 # define DFLT_MAXMEM (2*1024) // use up to 2 Mbyte for a buffer |
7 | 118 #endif |
119 | |
120 #ifndef DFLT_MAXMEMTOT | |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
121 # define DFLT_MAXMEMTOT (5*1024) // use up to 5 Mbyte for Vim |
7 | 122 #endif |
123 | |
5376 | 124 /* |
125 * Reparse Point | |
126 */ | |
127 #ifndef FILE_ATTRIBUTE_REPARSE_POINT | |
128 # define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400 | |
129 #endif | |
130 #ifndef IO_REPARSE_TAG_MOUNT_POINT | |
131 # define IO_REPARSE_TAG_MOUNT_POINT 0xA0000003 | |
132 #endif | |
133 #ifndef IO_REPARSE_TAG_SYMLINK | |
134 # define IO_REPARSE_TAG_SYMLINK 0xA000000C | |
135 #endif | |
136 | |
16606
7e733046db1d
patch 8.1.1306: Borland support is outdated and doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
16451
diff
changeset
|
137 #if defined(_MSC_VER) |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
138 // Support for __try / __except. All versions of MSVC are |
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
139 // expected to have this. Any other compilers that support it? |
7 | 140 # define HAVE_TRY_EXCEPT 1 |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
141 # include <malloc.h> // for _resetstkoflw() |
7 | 142 # if defined(_MSC_VER) && (_MSC_VER >= 1300) |
143 # define RESETSTKOFLW _resetstkoflw | |
144 # else | |
145 # define RESETSTKOFLW myresetstkoflw | |
146 # define MYRESETSTKOFLW | |
147 # endif | |
148 #endif | |
149 | |
150 /* | |
151 * Some simple debugging macros that look and behave a lot like their | |
152 * namesakes in MFC. | |
153 */ | |
154 | |
155 #ifdef _DEBUG | |
156 | |
157 # if defined(_MSC_VER) && (_MSC_VER >= 1000) | |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
158 // Use the new debugging tools in Visual C++ 4.x |
7 | 159 # include <crtdbg.h> |
160 # define ASSERT(f) _ASSERT(f) | |
161 # else | |
162 # include <assert.h> | |
163 # define ASSERT(f) assert(f) | |
164 # endif | |
165 | |
166 # define TRACE Trace | |
167 # define TRACE0(sz) Trace(_T("%s"), _T(sz)) | |
168 # define TRACE1(sz, p1) Trace(_T(sz), p1) | |
169 # define TRACE2(sz, p1, p2) Trace(_T(sz), p1, p2) | |
170 # define TRACE3(sz, p1, p2, p3) Trace(_T(sz), p1, p2, p3) | |
171 # define TRACE4(sz, p1, p2, p3, p4) Trace(_T(sz), p1, p2, p3, p4) | |
172 | |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
173 // In debug version, writes trace messages to debug stream |
7 | 174 void __cdecl |
175 Trace(char *pszFormat, ...); | |
176 | |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
177 #else // !_DEBUG |
7 | 178 |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
179 // These macros should all compile away to nothing |
7 | 180 # define ASSERT(f) ((void)0) |
181 # define TRACE 1 ? (void)0 : printf | |
182 # define TRACE0(sz) | |
183 # define TRACE1(sz, p1) | |
184 # define TRACE2(sz, p1, p2) | |
185 # define TRACE3(sz, p1, p2, p3) | |
186 # define TRACE4(sz, p1, p2, p3, p4) | |
187 | |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
188 #endif // !_DEBUG |
7 | 189 |
190 | |
191 #define ASSERT_POINTER(p, type) \ | |
192 ASSERT(((p) != NULL) && IsValidAddress((p), sizeof(type), FALSE)) | |
193 | |
194 #define ASSERT_NULL_OR_POINTER(p, type) \ | |
195 ASSERT(((p) == NULL) || IsValidAddress((p), sizeof(type), FALSE)) | |
196 | |
10781
c96534dd2b2f
patch 8.0.0280: problem setting multi-byte environment var on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
10264
diff
changeset
|
197 #ifndef HAVE_SETENV |
c96534dd2b2f
patch 8.0.0280: problem setting multi-byte environment var on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
10264
diff
changeset
|
198 # define HAVE_SETENV |
c96534dd2b2f
patch 8.0.0280: problem setting multi-byte environment var on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
10264
diff
changeset
|
199 #endif |
7 | 200 #define mch_getenv(x) (char_u *)getenv((char *)(x)) |
16606
7e733046db1d
patch 8.1.1306: Borland support is outdated and doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
16451
diff
changeset
|
201 #define vim_mkdir(x, y) mch_mkdir(x) |
3010 | 202 |
18753
6e3dc2d630c2
patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
203 // Enable common dialogs input unicode from IME if possible. |
15605
62b3805506b3
patch 8.1.0810: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
14822
diff
changeset
|
204 #define pDispatchMessage DispatchMessageW |
62b3805506b3
patch 8.1.0810: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
14822
diff
changeset
|
205 #define pGetMessage GetMessageW |
62b3805506b3
patch 8.1.0810: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
14822
diff
changeset
|
206 #define pIsDialogMessage IsDialogMessageW |
62b3805506b3
patch 8.1.0810: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
14822
diff
changeset
|
207 #define pPeekMessage PeekMessageW |