Mercurial > vim
comparison src/os_mswin.c @ 35466:9982c22412af v9.1.0502
patch 9.1.0502: MS-Windows: too much legacy code
Commit: https://github.com/vim/vim/commit/56f587b3f81f403bb0546c6892b3273b2a9e954f
Author: K.Takata <kentkt@csc.jp>
Date: Wed Jun 19 19:56:03 2024 +0200
patch 9.1.0502: MS-Windows: too much legacy code
Problem: MS-Windows: too much legacy code
Solution: Clean up old code
(Ken Takata)
* Remove very old codes for Cygwin version of GCC.
Nowadays Cygwin GCC cannot be used for building Win32 Vim.
(The `-mno-cygwin` option was removed in Cygwin GCC4.)
* Remove old codes for old versions of MinGW.
Remove `__MINGW32__` as much as possible.
* Adjust makefile.
closes: #15044
Signed-off-by: K.Takata <kentkt@csc.jp>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 19 Jun 2024 20:00:09 +0200 |
parents | d31e86eb4c4b |
children | 6e98e7638914 |
comparison
equal
deleted
inserted
replaced
35465:6c310db41aac | 35466:9982c22412af |
---|---|
16 #include "vim.h" | 16 #include "vim.h" |
17 | 17 |
18 #include <sys/types.h> | 18 #include <sys/types.h> |
19 #include <signal.h> | 19 #include <signal.h> |
20 #include <limits.h> | 20 #include <limits.h> |
21 | |
22 // cproto fails on missing include files | |
21 #ifndef PROTO | 23 #ifndef PROTO |
22 # include <process.h> | 24 # include <process.h> |
23 #endif | |
24 | |
25 #undef chdir | |
26 #ifdef __GNUC__ | |
27 # ifndef __MINGW32__ | |
28 # include <dirent.h> | |
29 # endif | |
30 #else | |
31 # include <direct.h> | 25 # include <direct.h> |
32 #endif | 26 |
33 | |
34 #ifndef PROTO | |
35 # if !defined(FEAT_GUI_MSWIN) | 27 # if !defined(FEAT_GUI_MSWIN) |
36 # include <shellapi.h> | 28 # include <shellapi.h> |
37 # endif | 29 # endif |
38 | 30 |
39 # if defined(FEAT_PRINTER) && !defined(FEAT_POSTSCRIPT) | 31 # if defined(FEAT_PRINTER) && !defined(FEAT_POSTSCRIPT) |
40 # include <dlgs.h> | 32 # include <dlgs.h> |
41 # include <winspool.h> | 33 # include <winspool.h> |
42 # include <commdlg.h> | 34 # include <commdlg.h> |
43 # endif | 35 # endif |
44 | |
45 #endif // PROTO | 36 #endif // PROTO |
46 | |
47 #ifdef __MINGW32__ | |
48 # ifndef FROM_LEFT_1ST_BUTTON_PRESSED | |
49 # define FROM_LEFT_1ST_BUTTON_PRESSED 0x0001 | |
50 # endif | |
51 # ifndef RIGHTMOST_BUTTON_PRESSED | |
52 # define RIGHTMOST_BUTTON_PRESSED 0x0002 | |
53 # endif | |
54 # ifndef FROM_LEFT_2ND_BUTTON_PRESSED | |
55 # define FROM_LEFT_2ND_BUTTON_PRESSED 0x0004 | |
56 # endif | |
57 # ifndef FROM_LEFT_3RD_BUTTON_PRESSED | |
58 # define FROM_LEFT_3RD_BUTTON_PRESSED 0x0008 | |
59 # endif | |
60 # ifndef FROM_LEFT_4TH_BUTTON_PRESSED | |
61 # define FROM_LEFT_4TH_BUTTON_PRESSED 0x0010 | |
62 # endif | |
63 | |
64 /* | |
65 * EventFlags | |
66 */ | |
67 # ifndef MOUSE_MOVED | |
68 # define MOUSE_MOVED 0x0001 | |
69 # endif | |
70 # ifndef DOUBLE_CLICK | |
71 # define DOUBLE_CLICK 0x0002 | |
72 # endif | |
73 #endif | |
74 | 37 |
75 /* | 38 /* |
76 * When generating prototypes for Win32 on Unix, these lines make the syntax | 39 * When generating prototypes for Win32 on Unix, these lines make the syntax |
77 * errors disappear. They do not need to be correct. | 40 * errors disappear. They do not need to be correct. |
78 */ | 41 */ |
142 | 105 |
143 #ifdef FEAT_JOB_CHANNEL | 106 #ifdef FEAT_JOB_CHANNEL |
144 int WSInitialized = FALSE; // WinSock is initialized | 107 int WSInitialized = FALSE; // WinSock is initialized |
145 #endif | 108 #endif |
146 | 109 |
147 // Don't generate prototypes here, because some systems do have these | |
148 // functions. | |
149 #if defined(__GNUC__) && !defined(PROTO) | |
150 # ifndef __MINGW32__ | |
151 int _stricoll(char *a, char *b) | |
152 { | |
153 // the ANSI-ish correct way is to use strxfrm(): | |
154 char a_buff[512], b_buff[512]; // file names, so this is enough on Win32 | |
155 strxfrm(a_buff, a, 512); | |
156 strxfrm(b_buff, b, 512); | |
157 return strcoll(a_buff, b_buff); | |
158 } | |
159 | |
160 char * _fullpath(char *buf, char *fname, int len) | |
161 { | |
162 LPTSTR toss; | |
163 | |
164 return (char *)GetFullPathName(fname, len, buf, &toss); | |
165 } | |
166 # endif | |
167 | |
168 # if !defined(__MINGW32__) || (__GNUC__ < 4) | |
169 int _chdrive(int drive) | |
170 { | |
171 char temp [3] = "-:"; | |
172 temp[0] = drive + 'A' - 1; | |
173 return !SetCurrentDirectory(temp); | |
174 } | |
175 # endif | |
176 #endif | |
177 | |
178 | 110 |
179 #ifndef PROTO | 111 #ifndef PROTO |
180 /* | 112 /* |
181 * Save the instance handle of the exe/dll. | 113 * Save the instance handle of the exe/dll. |
182 */ | 114 */ |