Mercurial > vim
annotate src/os_mac.h @ 15547:1dd0a47f4be2 v8.1.0781
patch 8.1.0781: build error when using if_xcmdsrv.c
commit https://github.com/vim/vim/commit/a502caab8bd396316a6eb5cb821b0a0df55c502a
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jan 19 18:23:41 2019 +0100
patch 8.1.0781: build error when using if_xcmdsrv.c
Problem: Build error when using if_xcmdsrv.c.
Solution: Add missing part of 8.1.0779.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 19 Jan 2019 18:30:07 +0100 |
parents | aa9c7588d30a |
children | 62b3805506b3 |
rev | line source |
---|---|
10042
4aead6a9b7a9
commit https://github.com/vim/vim/commit/edf3f97ae2af024708ebb4ac614227327033ca47
Christian Brabandt <cb@256bit.org>
parents:
9669
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 /* Before Including the MacOS specific files, | |
10 * lets set the OPAQUE_TOOLBOX_STRUCTS to 0 so we | |
11 * can access the internal structures. | |
12 * (Until fully Carbon compliant) | |
13 * TODO: Can we remove this? (Dany) | |
14 */ | |
15 #if 0 | |
16 # define OPAQUE_TOOLBOX_STRUCTS 0 | |
17 #endif | |
18 | |
5409 | 19 /* Include MAC_OS_X_VERSION_* macros */ |
20 #ifdef HAVE_AVAILABILITYMACROS_H | |
21 # include <AvailabilityMacros.h> | |
22 #endif | |
23 | |
7 | 24 /* |
25 * Macintosh machine-dependent things. | |
18 | 26 * |
27 * Include the Mac header files, unless also compiling with X11 (the header | |
28 * files have many conflicts). | |
7 | 29 */ |
2309
543ea69d037f
Add clipboard support in Mac console. (Bjorn Winckler)
Bram Moolenaar <bram@vim.org>
parents:
2214
diff
changeset
|
30 #ifdef FEAT_GUI_MAC |
841 | 31 # include <Quickdraw.h> /* Apple calls it QuickDraw.h... */ |
18 | 32 # include <ToolUtils.h> |
33 # include <LowMem.h> | |
34 # include <Scrap.h> | |
35 # include <Sound.h> | |
36 # include <TextUtils.h> | |
37 # include <Memory.h> | |
38 # include <OSUtils.h> | |
39 # include <Files.h> | |
40 # ifdef FEAT_MBYTE | |
41 # include <Script.h> | |
42 # endif | |
7 | 43 #endif |
44 | |
45 /* | |
46 * Unix interface | |
47 */ | |
48 #if defined(__APPLE_CC__) /* for Project Builder and ... */ | |
49 # include <unistd.h> | |
50 /* Get stat.h or something similar. Comment: How come some OS get in in vim.h */ | |
51 # include <sys/stat.h> | |
718 | 52 /* && defined(HAVE_CURSE) */ |
4352 | 53 /* The curses.h from MacOS X provides by default some BACKWARD compatibility |
7 | 54 * definition which can cause us problem later on. So we undefine a few of them. */ |
55 # include <curses.h> | |
56 # undef reg | |
57 # undef ospeed | |
58 /* OK defined to 0 in MacOS X 10.2 curses! Remove it, we define it to be 1. */ | |
59 # undef OK | |
60 #endif | |
61 #include <signal.h> | |
62 #include <errno.h> | |
63 #include <stdio.h> | |
64 #include <stdlib.h> | |
65 #include <time.h> | |
718 | 66 #include <dirent.h> |
7 | 67 |
68 /* | |
69 * MacOS specific #define | |
70 */ | |
71 | |
72 /* This will go away when CMD_KEY fully tested */ | |
73 #define USE_CMD_KEY | |
74 /* On MacOS X use the / not the : */ | |
75 /* TODO: Should file such as ~/.vimrc reside instead in | |
76 * ~/Library/Vim or ~/Library/Preferences/org.vim.vim/ ? (Dany) | |
77 */ | |
78 /* When compiled under MacOS X (including CARBON version) | |
20 | 79 * we use the Unix File path style. Also when UNIX is defined. */ |
12716
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
80 #define USE_UNIXFILENAME |
7 | 81 |
82 | |
83 /* | |
84 * Generic Vim #define | |
85 */ | |
86 | |
87 #define FEAT_SOURCE_FFS | |
88 #define FEAT_SOURCE_FF_MAC | |
89 | |
90 #define USE_EXE_NAME /* to find $VIM */ | |
91 #define CASE_INSENSITIVE_FILENAME /* ignore case when comparing file names */ | |
92 #define SPACE_IN_FILENAME | |
93 #define BREAKCHECK_SKIP 32 /* call mch_breakcheck() each time, it's | |
20 | 94 quite fast. Did I forgot to update the |
95 comment */ | |
7 | 96 |
584 | 97 #define USE_FNAME_CASE /* make ":e os_Mac.c" open the file in its |
98 original case, as "os_mac.c" */ | |
7 | 99 #define BINARY_FILE_IO |
100 #define EOL_DEFAULT EOL_MAC | |
101 #define HAVE_AVAIL_MEM | |
102 | |
103 #ifndef HAVE_CONFIG_H | |
104 # define HAVE_STRING_H | |
105 # define HAVE_STRCSPN | |
106 # define HAVE_MEMSET | |
107 # define USE_TMPNAM /* use tmpnam() instead of mktemp() */ | |
108 # define HAVE_FCNTL_H | |
109 # define HAVE_QSORT | |
110 # define HAVE_ST_MODE /* have stat.st_mode */ | |
1619 | 111 # define HAVE_MATH_H |
7 | 112 |
113 # if defined(__DATE__) && defined(__TIME__) | |
114 # define HAVE_DATE_TIME | |
115 # endif | |
116 # define HAVE_STRFTIME | |
117 #endif | |
118 | |
119 /* | |
120 * Names for the EXRC, HELP and temporary files. | |
121 * Some of these may have been defined in the makefile. | |
122 */ | |
123 | |
124 #ifndef SYS_VIMRC_FILE | |
12716
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
125 # define SYS_VIMRC_FILE "$VIM/vimrc" |
7 | 126 #endif |
127 #ifndef SYS_GVIMRC_FILE | |
12716
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
128 # define SYS_GVIMRC_FILE "$VIM/gvimrc" |
7 | 129 #endif |
130 #ifndef SYS_MENU_FILE | |
12716
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
131 # define SYS_MENU_FILE "$VIMRUNTIME/menu.vim" |
7 | 132 #endif |
133 #ifndef SYS_OPTWIN_FILE | |
12716
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
134 # define SYS_OPTWIN_FILE "$VIMRUNTIME/optwin.vim" |
7 | 135 #endif |
9669
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
5409
diff
changeset
|
136 #ifndef VIM_DEFAULTS_FILE |
12716
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
137 # define VIM_DEFAULTS_FILE "$VIMRUNTIME/defaults.vim" |
9669
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
5409
diff
changeset
|
138 #endif |
7 | 139 #ifndef EVIM_FILE |
12716
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
140 # define EVIM_FILE "$VIMRUNTIME/evim.vim" |
7 | 141 #endif |
142 | |
143 #ifdef FEAT_GUI | |
144 # ifndef USR_GVIMRC_FILE | |
12716
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
145 # define USR_GVIMRC_FILE "~/.gvimrc" |
7 | 146 # endif |
147 # ifndef GVIMRC_FILE | |
148 # define GVIMRC_FILE "_gvimrc" | |
149 # endif | |
150 #endif | |
151 #ifndef USR_VIMRC_FILE | |
12716
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
152 # define USR_VIMRC_FILE "~/.vimrc" |
7 | 153 #endif |
154 | |
155 #ifndef USR_EXRC_FILE | |
12716
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
156 # define USR_EXRC_FILE "~/.exrc" |
7 | 157 #endif |
158 | |
159 #ifndef VIMRC_FILE | |
160 # define VIMRC_FILE "_vimrc" | |
161 #endif | |
162 | |
163 #ifndef EXRC_FILE | |
164 # define EXRC_FILE "_exrc" | |
165 #endif | |
166 | |
167 #ifndef DFLT_HELPFILE | |
12716
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
168 # define DFLT_HELPFILE "$VIMRUNTIME/doc/help.txt" |
7 | 169 #endif |
170 | |
171 #ifndef FILETYPE_FILE | |
172 # define FILETYPE_FILE "filetype.vim" | |
173 #endif | |
174 #ifndef FTPLUGIN_FILE | |
175 # define FTPLUGIN_FILE "ftplugin.vim" | |
176 #endif | |
177 #ifndef INDENT_FILE | |
178 # define INDENT_FILE "indent.vim" | |
179 #endif | |
180 #ifndef FTOFF_FILE | |
181 # define FTOFF_FILE "ftoff.vim" | |
182 #endif | |
183 #ifndef FTPLUGOF_FILE | |
184 # define FTPLUGOF_FILE "ftplugof.vim" | |
185 #endif | |
186 #ifndef INDOFF_FILE | |
187 # define INDOFF_FILE "indoff.vim" | |
188 #endif | |
189 | |
190 #ifndef SYNTAX_FNAME | |
12716
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
191 # define SYNTAX_FNAME "$VIMRUNTIME/syntax/%s.vim" |
7 | 192 #endif |
193 | |
194 #ifdef FEAT_VIMINFO | |
195 # ifndef VIMINFO_FILE | |
12716
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
196 # define VIMINFO_FILE "~/.viminfo" |
7 | 197 # endif |
198 #endif /* FEAT_VIMINFO */ | |
199 | |
200 #ifndef DFLT_BDIR | |
201 # define DFLT_BDIR "." /* default for 'backupdir' */ | |
202 #endif | |
203 | |
204 #ifndef DFLT_DIR | |
205 # define DFLT_DIR "." /* default for 'directory' */ | |
206 #endif | |
207 | |
208 #ifndef DFLT_VDIR | |
2214
f8222d1f9a73
Included patch for persistent undo. Lots of changes and added test.
Bram Moolenaar <bram@vim.org>
parents:
1936
diff
changeset
|
209 # define DFLT_VDIR "$VIM/vimfiles/view" /* default for 'viewdir' */ |
7 | 210 #endif |
211 | |
212 #define DFLT_ERRORFILE "errors.err" | |
18 | 213 |
214 #ifndef DFLT_RUNTIMEPATH | |
12716
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
215 # define DFLT_RUNTIMEPATH "~/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,~/.vim/after" |
7 | 216 #endif |
13361
65c29bd4548b
patch 8.0.1554: custom plugins loaded with --clean
Christian Brabandt <cb@256bit.org>
parents:
12716
diff
changeset
|
217 #ifndef CLEAN_RUNTIMEPATH |
65c29bd4548b
patch 8.0.1554: custom plugins loaded with --clean
Christian Brabandt <cb@256bit.org>
parents:
12716
diff
changeset
|
218 # define CLEAN_RUNTIMEPATH "$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after" |
65c29bd4548b
patch 8.0.1554: custom plugins loaded with --clean
Christian Brabandt <cb@256bit.org>
parents:
12716
diff
changeset
|
219 #endif |
7 | 220 |
221 /* | |
222 * Macintosh has plenty of memory, use large buffers | |
223 */ | |
224 #define CMDBUFFSIZE 1024 /* size of the command processing buffer */ | |
225 | |
226 #ifndef DFLT_MAXMEM | |
227 # define DFLT_MAXMEM 512 /* use up to 512 Kbyte for buffer */ | |
228 #endif | |
229 | |
230 #ifndef DFLT_MAXMEMTOT | |
231 # define DFLT_MAXMEMTOT 2048 /* use up to 2048 Kbyte for Vim */ | |
232 #endif | |
233 | |
234 #define WILDCHAR_LIST "*?[{`$" | |
235 | |
236 /**************/ | |
237 #define mch_rename(src, dst) rename(src, dst) | |
238 #define mch_remove(x) unlink((char *)(x)) | |
239 #ifndef mch_getenv | |
12716
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
240 # if defined(__APPLE_CC__) |
7 | 241 # define mch_getenv(name) ((char_u *)getenv((char *)(name))) |
242 # define mch_setenv(name, val, x) setenv(name, val, x) | |
243 # else | |
244 /* vim_getenv() is in pty.c */ | |
245 # define USE_VIMPTY_GETENV | |
246 # define mch_getenv(x) vimpty_getenv(x) | |
247 # define mch_setenv(name, val, x) setenv(name, val, x) | |
248 # endif | |
249 #endif | |
250 | |
251 #ifndef HAVE_CONFIG_H | |
252 # ifdef __APPLE_CC__ | |
253 /* Assuming compiling for MacOS X */ | |
254 /* Trying to take advantage of the prebinding */ | |
255 # define HAVE_TGETENT | |
256 # define OSPEED_EXTERN | |
257 # define UP_BC_PC_EXTERN | |
258 # endif | |
259 #endif | |
260 | |
261 /* Some "prep work" definition to be able to compile the MacOS X | |
5409 | 262 * version with os_unix.c instead of os_mac.c. Based on the result |
7 | 263 * of ./configure for console MacOS X. |
264 */ | |
265 | |
12716
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
266 #ifndef SIGPROTOARG |
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
267 # define SIGPROTOARG (int) |
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
268 #endif |
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
269 #ifndef SIGDEFARG |
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
270 # define SIGDEFARG(s) (s) int s UNUSED; |
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
271 #endif |
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
272 #ifndef SIGDUMMYARG |
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
273 # define SIGDUMMYARG 0 |
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
274 #endif |
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
275 #undef HAVE_AVAIL_MEM |
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
276 #ifndef HAVE_CONFIG_H |
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
277 # define RETSIGTYPE void |
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
278 # define SIGRETURN return |
7 | 279 /*# define USE_SYSTEM */ /* Output ship do debugger :(, but ot compile */ |
12716
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
280 # define HAVE_SYS_WAIT_H 1 /* Attempt */ |
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
281 # define HAVE_TERMIOS_H 1 |
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
282 # define SYS_SELECT_WITH_SYS_TIME 1 |
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
283 # define HAVE_SELECT 1 |
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
284 # define HAVE_SYS_SELECT_H 1 |
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
285 # define HAVE_PUTENV |
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
286 # define HAVE_SETENV |
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
287 # define HAVE_RENAME |
7 | 288 #endif |
289 | |
12716
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
290 #if !defined(HAVE_CONFIG_H) |
7 | 291 # define HAVE_PUTENV |
292 #endif | |
293 | |
294 /* A Mac constant causing big problem to syntax highlighting */ | |
295 #define UNKNOWN_CREATOR '\?\?\?\?' |