Build fix for clang.
[vim-cocoa.git] / src / os_mac.h
blob2e4c62754606a563ce587e9cb9c9dc0f51f242e0
1 /* vi:set ts=8 sts=4 sw=4:
3 * VIM - Vi IMproved by Bram Moolenaar
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 */
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)
15 #if 0
16 # define OPAQUE_TOOLBOX_STRUCTS 0
17 #endif
20 * Macintosh machine-dependent things.
22 * Include the Mac header files, unless also compiling with X11 (the header
23 * files have many conflicts).
25 #ifndef FEAT_X11
26 #if 0
27 # include <Quickdraw.h> /* Apple calls it QuickDraw.h... */
28 # include <ToolUtils.h>
29 # include <LowMem.h>
30 # include <Scrap.h>
31 # include <Sound.h>
32 # include <TextUtils.h>
33 # include <Memory.h>
34 # include <OSUtils.h>
35 # include <Files.h>
36 # ifdef FEAT_MBYTE
37 # include <Script.h>
38 # endif
39 #endif
40 #endif
43 * Unix interface
45 #if defined(__APPLE_CC__) /* for Project Builder and ... */
46 # include <unistd.h>
47 /* Get stat.h or something similar. Comment: How come some OS get in in vim.h */
48 # include <sys/stat.h>
49 /* && defined(HAVE_CURSE) */
50 /* The curses.h from MacOS X provides by default some BACKWARD compatibilty
51 * definition which can cause us problem later on. So we undefine a few of them. */
52 # include <curses.h>
53 # undef reg
54 # undef ospeed
55 /* OK defined to 0 in MacOS X 10.2 curses! Remove it, we define it to be 1. */
56 # undef OK
57 #endif
58 #include <signal.h>
59 #include <errno.h>
60 #include <stdio.h>
61 #include <stdlib.h>
62 #include <time.h>
63 #include <dirent.h>
66 * MacOS specific #define
69 /* This will go away when CMD_KEY fully tested */
70 #define USE_CMD_KEY
71 /* On MacOS X use the / not the : */
72 /* TODO: Should file such as ~/.vimrc reside instead in
73 * ~/Library/Vim or ~/Library/Preferences/org.vim.vim/ ? (Dany)
75 /* When compiled under MacOS X (including CARBON version)
76 * we use the Unix File path style. Also when UNIX is defined. */
77 # define USE_UNIXFILENAME
81 * Generic Vim #define
84 #define FEAT_SOURCE_FFS
85 #define FEAT_SOURCE_FF_MAC
87 #define USE_EXE_NAME /* to find $VIM */
88 #define CASE_INSENSITIVE_FILENAME /* ignore case when comparing file names */
89 #define SPACE_IN_FILENAME
90 #define BREAKCHECK_SKIP 32 /* call mch_breakcheck() each time, it's
91 quite fast. Did I forgot to update the
92 comment */
95 #define USE_FNAME_CASE /* make ":e os_Mac.c" open the file in its
96 original case, as "os_mac.c" */
97 #define BINARY_FILE_IO
98 #define EOL_DEFAULT EOL_MAC
99 #ifndef MACOS_X_UNIX /* I hope that switching these two lines */
100 # define USE_CR /* does what I want -- BNF */
101 # define NO_CONSOLE /* don't include console mode */
102 #endif
103 #define HAVE_AVAIL_MEM
105 #ifndef HAVE_CONFIG_H
106 /* #define SYNC_DUP_CLOSE sync() a file with dup() and close() */
107 # define HAVE_STRING_H
108 # define HAVE_STRCSPN
109 # define HAVE_MEMSET
110 # define USE_TMPNAM /* use tmpnam() instead of mktemp() */
111 # define HAVE_FCNTL_H
112 # define HAVE_QSORT
113 # define HAVE_ST_MODE /* have stat.st_mode */
114 # define HAVE_MATH_H
116 # if defined(__DATE__) && defined(__TIME__)
117 # define HAVE_DATE_TIME
118 # endif
119 # define HAVE_STRFTIME
120 #endif
123 * Names for the EXRC, HELP and temporary files.
124 * Some of these may have been defined in the makefile.
127 #ifndef SYS_VIMRC_FILE
128 # define SYS_VIMRC_FILE "$VIM/vimrc"
129 #endif
130 #ifndef SYS_GVIMRC_FILE
131 # define SYS_GVIMRC_FILE "$VIM/gvimrc"
132 #endif
133 #ifndef SYS_MENU_FILE
134 # define SYS_MENU_FILE "$VIMRUNTIME/menu.vim"
135 #endif
136 #ifndef SYS_OPTWIN_FILE
137 # define SYS_OPTWIN_FILE "$VIMRUNTIME/optwin.vim"
138 #endif
139 #ifndef EVIM_FILE
140 # define EVIM_FILE "$VIMRUNTIME/evim.vim"
141 #endif
143 #ifdef FEAT_GUI
144 # ifndef USR_GVIMRC_FILE
145 # define USR_GVIMRC_FILE "~/.gvimrc"
146 # endif
147 # ifndef GVIMRC_FILE
148 # define GVIMRC_FILE "_gvimrc"
149 # endif
150 #endif
151 #ifndef USR_VIMRC_FILE
152 # define USR_VIMRC_FILE "~/.vimrc"
153 #endif
155 #ifndef USR_EXRC_FILE
156 # define USR_EXRC_FILE "~/.exrc"
157 #endif
159 #ifndef VIMRC_FILE
160 # define VIMRC_FILE "_vimrc"
161 #endif
163 #ifndef EXRC_FILE
164 # define EXRC_FILE "_exrc"
165 #endif
167 #ifndef DFLT_HELPFILE
168 # define DFLT_HELPFILE "$VIMRUNTIME/doc/help.txt"
169 #endif
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
190 #ifndef SYNTAX_FNAME
191 # define SYNTAX_FNAME "$VIMRUNTIME/syntax/%s.vim"
192 #endif
194 #ifdef FEAT_VIMINFO
195 # ifndef VIMINFO_FILE
196 # define VIMINFO_FILE "~/.viminfo"
197 # endif
198 #endif /* FEAT_VIMINFO */
200 #ifndef DFLT_BDIR
201 # define DFLT_BDIR "." /* default for 'backupdir' */
202 #endif
204 #ifndef DFLT_DIR
205 # define DFLT_DIR "." /* default for 'directory' */
206 #endif
208 #ifndef DFLT_VDIR
209 # define DFLT_VDIR "$VIM/vimfiles/view" /* default for 'viewdir' */
210 #endif
212 #define DFLT_ERRORFILE "errors.err"
214 #ifndef DFLT_RUNTIMEPATH
215 # define DFLT_RUNTIMEPATH "~/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,~/.vim/after"
216 #endif
219 * Macintosh has plenty of memory, use large buffers
221 #define CMDBUFFSIZE 1024 /* size of the command processing buffer */
223 #if !defined(MACOS_X_UNIX)
224 # define MAXPATHL 256 /* Limited by the Pascal Strings */
225 # define BASENAMELEN (32-5-1) /* length of base of filename */
226 #endif
228 #ifndef DFLT_MAXMEM
229 # define DFLT_MAXMEM 512 /* use up to 512 Kbyte for buffer */
230 #endif
232 #ifndef DFLT_MAXMEMTOT
233 # define DFLT_MAXMEMTOT 2048 /* use up to 2048 Kbyte for Vim */
234 #endif
236 #define WILDCHAR_LIST "*?[{`$"
238 /**************/
239 #define mch_rename(src, dst) rename(src, dst)
240 #define mch_remove(x) unlink((char *)(x))
241 #ifndef mch_getenv
242 # if defined(__MRC__) || defined(__SC__)
243 # define mch_getenv(name) ((char_u *)getenv((char *)(name)))
244 # define mch_setenv(name, val, x) setenv((name), (val))
245 # elif defined(__APPLE_CC__)
246 # define mch_getenv(name) ((char_u *)getenv((char *)(name)))
247 /*# define mch_setenv(name, val, x) setenv((name), (val)) */ /* Obsoleted by Dany on Oct 30, 2001 */
248 # define mch_setenv(name, val, x) setenv(name, val, x)
249 # else
250 /* vim_getenv() is in pty.c */
251 # define USE_VIMPTY_GETENV
252 # define mch_getenv(x) vimpty_getenv(x)
253 # define mch_setenv(name, val, x) setenv(name, val, x)
254 # endif
255 #endif
257 #ifndef HAVE_CONFIG_H
258 # ifdef __APPLE_CC__
259 /* Assuming compiling for MacOS X */
260 /* Trying to take advantage of the prebinding */
261 # define HAVE_TGETENT
262 # define OSPEED_EXTERN
263 # define UP_BC_PC_EXTERN
264 # endif
265 #endif
267 /* Some "prep work" definition to be able to compile the MacOS X
268 * version with os_unix.x instead of os_mac.c. Based on the result
269 * of ./configure for console MacOS X.
272 #ifdef MACOS_X_UNIX
273 # define SIGPROTOARG (int)
274 # define SIGDEFARG(s) (s) int s;
275 # define SIGDUMMYARG 0
276 # undef HAVE_AVAIL_MEM
277 # ifndef HAVE_CONFIG_H
278 # define RETSIGTYPE void
279 # define SIGRETURN return
280 /*# define USE_SYSTEM */ /* Output ship do debugger :(, but ot compile */
281 # define HAVE_SYS_WAIT_H 1 /* Attempt */
282 # define HAVE_TERMIOS_H 1
283 # define SYS_SELECT_WITH_SYS_TIME 1
284 # define HAVE_SELECT 1
285 # define HAVE_SYS_SELECT_H 1
286 # define HAVE_PUTENV
287 # define HAVE_SETENV
288 # define HAVE_RENAME
289 # endif
290 # define mch_chdir(s) chdir(s)
291 #endif
293 #if defined(MACOS_X) && !defined(HAVE_CONFIG_H)
294 # define HAVE_PUTENV
295 #endif
297 /* A Mac constant causing big problem to syntax highlighting */
298 #define UNKNOWN_CREATOR '\?\?\?\?'
301 * for debugging
303 #ifdef MACOS_X
304 # ifdef _DEBUG
305 # define TRACE Trace
306 void Trace(char *fmt, ...);
307 # else
308 # define TRACE 1 ? (void)0 : printf
309 # endif
310 #endif