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