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