Mercurial > vim
annotate src/os_win32.h @ 3100:fc0804089b29 v7.3.321
updated for version 7.3.321
Problem: Code not following Vim style.
Solution: Fix the style. (Elias Diem)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Wed, 21 Sep 2011 19:50:05 +0200 |
parents | e5b17a5f6516 |
children | d24d309c365f |
rev | line source |
---|---|
7 | 1 /* vi:set ts=8 sts=4 sw=4: |
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__ | |
15 #include <direct.h> /* for _mkdir() */ | |
16 #endif | |
17 | |
638 | 18 /* Stop the VC2005 compiler from nagging. */ |
19 #if _MSC_VER >= 1400 | |
20 # define _CRT_SECURE_NO_DEPRECATE | |
21 # define _CRT_NONSTDC_NO_DEPRECATE | |
22 #endif | |
23 | |
7 | 24 #define BINARY_FILE_IO |
25 #define USE_EXE_NAME /* use argv[0] for $VIM */ | |
26 #define SYNC_DUP_CLOSE /* sync() a file with dup() and close() */ | |
27 #define USE_TERM_CONSOLE | |
28 #ifndef HAVE_STRING_H | |
29 # define HAVE_STRING_H | |
30 #endif | |
1620 | 31 #ifndef HAVE_MATH_H |
32 # define HAVE_MATH_H | |
33 #endif | |
7 | 34 #define HAVE_STRCSPN |
35 #ifndef __GNUC__ | |
36 #define HAVE_STRICMP | |
37 #define HAVE_STRNICMP | |
38 #endif | |
39 #ifndef HAVE_STRFTIME | |
40 # define HAVE_STRFTIME /* guessed */ | |
41 #endif | |
42 #define HAVE_MEMSET | |
43 #ifndef HAVE_LOCALE_H | |
44 # define HAVE_LOCALE_H 1 | |
45 #endif | |
46 #ifndef HAVE_FCNTL_H | |
47 # define HAVE_FCNTL_H | |
48 #endif | |
49 #ifndef HAVE_STDARG_H | |
50 # define HAVE_STDARG_H | |
51 #endif | |
52 #define HAVE_QSORT | |
53 #define HAVE_ST_MODE /* have stat.st_mode */ | |
54 | |
55 #define FEAT_SHORTCUT /* resolve shortcuts */ | |
56 | |
57 #if !defined(__MINGW32__) \ | |
58 && !defined(__CYGWIN__) \ | |
59 && (!defined(__BORLANDC__) || __BORLANDC__ >= 0x550) \ | |
60 && (!defined(_MSC_VER) || _MSC_VER > 1020) | |
61 /* | |
62 * Access Control List (actually security info). | |
63 * Mingw and Cygwin don't have the acl stuff. | |
64 * Borland only in version 5.5 and later. | |
65 * MSVC in 5.0, not in 4.2, don't know about 4.3. | |
66 */ | |
67 # define HAVE_ACL | |
68 #endif | |
69 | |
70 #define USE_FNAME_CASE /* adjust case of file names */ | |
71 #if !defined(FEAT_CLIPBOARD) && defined(FEAT_VISUAL) && defined(FEAT_MOUSE) | |
72 # define FEAT_CLIPBOARD /* include clipboard support */ | |
73 #endif | |
74 #if defined(__DATE__) && defined(__TIME__) | |
75 # define HAVE_DATE_TIME | |
76 #endif | |
77 #ifndef FEAT_GUI_W32 /* GUI works different */ | |
78 # define BREAKCHECK_SKIP 1 /* call mch_breakcheck() each time, it's fast */ | |
79 #endif | |
80 #define HAVE_AVAIL_MEM | |
81 | |
82 #define HAVE_PUTENV /* at least Bcc 5.2 and MSC have it */ | |
83 | |
84 #ifdef FEAT_GUI_W32 | |
85 # define NO_CONSOLE /* don't included console-only code */ | |
86 #endif | |
87 | |
88 /* toupper() is not really broken, but it's very slow. Probably because of | |
89 * using Unicode characters on Windows NT */ | |
90 #define BROKEN_TOUPPER | |
91 | |
92 #define FNAME_ILLEGAL "\"*?><|" /* illegal characters in a file name */ | |
93 | |
94 #include <stdlib.h> | |
95 #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
|
96 #include <sys/types.h> |
7 | 97 |
98 #ifndef STRICT | |
99 # define STRICT | |
100 #endif | |
101 #ifndef COBJMACROS | |
102 # define COBJMACROS /* For OLE: Enable "friendlier" access to objects */ | |
103 #endif | |
104 #include <windows.h> | |
105 | |
106 /* | |
107 * Win32 has plenty of memory, use large buffers | |
108 */ | |
109 #define CMDBUFFSIZE 1024 /* size of the command processing buffer */ | |
110 | |
111 /* _MAX_PATH is only 256 (stdlib.h), but we want more for the 'path' option, | |
112 * thus use a larger number. */ | |
113 #define MAXPATHL 1024 | |
114 | |
115 #ifndef BASENAMELEN | |
116 # define BASENAMELEN (_MAX_PATH - 5) /* length of base of file name */ | |
117 #endif | |
118 | |
119 #define TEMPNAMELEN _MAX_PATH /* length of temp file name path */ | |
120 | |
121 #ifndef DFLT_MAXMEM | |
122 # define DFLT_MAXMEM (2*1024) /* use up to 2 Mbyte for a buffer */ | |
123 #endif | |
124 | |
125 #ifndef DFLT_MAXMEMTOT | |
126 # define DFLT_MAXMEMTOT (5*1024) /* use up to 5 Mbyte for Vim */ | |
127 #endif | |
128 | |
129 #if defined(_MSC_VER) || defined(__BORLANDC__) | |
130 /* Support for __try / __except. All versions of MSVC and Borland C are | |
131 * expected to have this. Any other compilers that support it? */ | |
132 # define HAVE_TRY_EXCEPT 1 | |
133 # include <malloc.h> /* for _resetstkoflw() */ | |
134 # if defined(_MSC_VER) && (_MSC_VER >= 1300) | |
135 # define RESETSTKOFLW _resetstkoflw | |
136 # else | |
137 # define RESETSTKOFLW myresetstkoflw | |
138 # define MYRESETSTKOFLW | |
139 # endif | |
140 #endif | |
141 | |
142 /* | |
143 * Some simple debugging macros that look and behave a lot like their | |
144 * namesakes in MFC. | |
145 */ | |
146 | |
147 #ifdef _DEBUG | |
148 | |
149 # if defined(_MSC_VER) && (_MSC_VER >= 1000) | |
150 /* Use the new debugging tools in Visual C++ 4.x */ | |
151 # include <crtdbg.h> | |
152 # define ASSERT(f) _ASSERT(f) | |
153 # else | |
154 # include <assert.h> | |
155 # define ASSERT(f) assert(f) | |
156 # endif | |
157 | |
158 # define TRACE Trace | |
159 # define TRACE0(sz) Trace(_T("%s"), _T(sz)) | |
160 # define TRACE1(sz, p1) Trace(_T(sz), p1) | |
161 # define TRACE2(sz, p1, p2) Trace(_T(sz), p1, p2) | |
162 # define TRACE3(sz, p1, p2, p3) Trace(_T(sz), p1, p2, p3) | |
163 # define TRACE4(sz, p1, p2, p3, p4) Trace(_T(sz), p1, p2, p3, p4) | |
164 | |
165 /* In debug version, writes trace messages to debug stream */ | |
166 void __cdecl | |
167 Trace(char *pszFormat, ...); | |
168 | |
169 #else /* !_DEBUG */ | |
170 | |
171 /* These macros should all compile away to nothing */ | |
172 # define ASSERT(f) ((void)0) | |
173 # define TRACE 1 ? (void)0 : printf | |
174 # define TRACE0(sz) | |
175 # define TRACE1(sz, p1) | |
176 # define TRACE2(sz, p1, p2) | |
177 # define TRACE3(sz, p1, p2, p3) | |
178 # define TRACE4(sz, p1, p2, p3, p4) | |
179 | |
180 #endif /* !_DEBUG */ | |
181 | |
182 | |
183 #define ASSERT_POINTER(p, type) \ | |
184 ASSERT(((p) != NULL) && IsValidAddress((p), sizeof(type), FALSE)) | |
185 | |
186 #define ASSERT_NULL_OR_POINTER(p, type) \ | |
187 ASSERT(((p) == NULL) || IsValidAddress((p), sizeof(type), FALSE)) | |
188 | |
189 #define mch_setenv(name, val, x) setenv(name, val, x) | |
190 #define mch_getenv(x) (char_u *)getenv((char *)(x)) | |
191 #ifdef __BORLANDC__ | |
192 # define vim_mkdir(x, y) mkdir(x) | |
193 #else | |
2803 | 194 # define vim_mkdir(x, y) mch_mkdir(x) |
7 | 195 #endif |
3010 | 196 |
197 /* Enable common dialogs input unicode from IME if posible. */ | |
198 #ifdef FEAT_MBYTE | |
199 /* The variables are defined in os_win32.c. */ | |
200 extern LRESULT (WINAPI *pDispatchMessage)(LPMSG); | |
201 extern BOOL (WINAPI *pGetMessage)(LPMSG, HWND, UINT, UINT); | |
202 extern BOOL (WINAPI *pIsDialogMessage)(HWND, LPMSG); | |
203 extern BOOL (WINAPI *pPeekMessage)(LPMSG, HWND, UINT, UINT, UINT); | |
204 #else | |
205 # define pDispatchMessage DispatchMessage | |
206 # define pGetMessage GetMessage | |
207 # define pIsDialogMessage IsDialogMessage | |
208 # define pPeekMessage PeekMessage | |
209 #endif |