Add wide font support to Core Text renderer
[MacVim/KaoriYa.git] / src / os_mac.h
blob860ef81b98d8b5bfd5f7a5d74e00ab77278683e9
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 # ifdef FEAT_GUI_MACVIM
27 /* Don't include Carbon here to avoid polluting the global namespace. */
28 /* # include <Carbon/Carbon.h> */
29 # else
30 # include <Quickdraw.h> /* Apple calls it QuickDraw.h... */
31 # include <ToolUtils.h>
32 # include <LowMem.h>
33 # include <Scrap.h>
34 # include <Sound.h>
35 # include <TextUtils.h>
36 # include <Memory.h>
37 # include <OSUtils.h>
38 # include <Files.h>
39 # ifdef FEAT_MBYTE
40 # include <Script.h>
41 # endif
42 # endif
43 #endif
46 * Unix interface
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>
52 /* && defined(HAVE_CURSE) */
53 /* The curses.h from MacOS X provides by default some BACKWARD compatibilty
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>
66 #include <dirent.h>
69 * MacOS specific #define
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)
78 /* When compiled under MacOS X (including CARBON version)
79 * we use the Unix File path style. Also when UNIX is defined. */
80 # define USE_UNIXFILENAME
84 * Generic Vim #define
87 #define FEAT_SOURCE_FFS
88 #define FEAT_SOURCE_FF_MAC
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
94 quite fast. Did I forgot to update the
95 comment */
98 #define USE_FNAME_CASE /* make ":e os_Mac.c" open the file in its
99 original case, as "os_mac.c" */
100 #define BINARY_FILE_IO
101 #define EOL_DEFAULT EOL_MAC
102 #ifndef MACOS_X_UNIX /* I hope that switching these two lines */
103 # define USE_CR /* does what I want -- BNF */
104 # define NO_CONSOLE /* don't include console mode */
105 #endif
106 #define HAVE_AVAIL_MEM
108 #ifndef HAVE_CONFIG_H
109 /* #define SYNC_DUP_CLOSE sync() a file with dup() and close() */
110 # define HAVE_STRING_H
111 # define HAVE_STRCSPN
112 # define HAVE_MEMSET
113 # define USE_TMPNAM /* use tmpnam() instead of mktemp() */
114 # define HAVE_FCNTL_H
115 # define HAVE_QSORT
116 # define HAVE_ST_MODE /* have stat.st_mode */
117 # define HAVE_MATH_H
119 # if defined(__DATE__) && defined(__TIME__)
120 # define HAVE_DATE_TIME
121 # endif
122 # define HAVE_STRFTIME
123 #endif
126 * Names for the EXRC, HELP and temporary files.
127 * Some of these may have been defined in the makefile.
130 #ifndef SYS_VIMRC_FILE
131 # define SYS_VIMRC_FILE "$VIM/vimrc"
132 #endif
133 #ifndef SYS_GVIMRC_FILE
134 # define SYS_GVIMRC_FILE "$VIM/gvimrc"
135 #endif
136 #ifndef SYS_MENU_FILE
137 # define SYS_MENU_FILE "$VIMRUNTIME/menu.vim"
138 #endif
139 #ifndef SYS_OPTWIN_FILE
140 # define SYS_OPTWIN_FILE "$VIMRUNTIME/optwin.vim"
141 #endif
142 #ifndef EVIM_FILE
143 # define EVIM_FILE "$VIMRUNTIME/evim.vim"
144 #endif
146 #ifdef FEAT_GUI
147 # ifndef USR_GVIMRC_FILE
148 # define USR_GVIMRC_FILE "~/.gvimrc"
149 # endif
150 # ifndef GVIMRC_FILE
151 # define GVIMRC_FILE "_gvimrc"
152 # endif
153 #endif
154 #ifndef USR_VIMRC_FILE
155 # define USR_VIMRC_FILE "~/.vimrc"
156 #endif
158 #ifndef USR_EXRC_FILE
159 # define USR_EXRC_FILE "~/.exrc"
160 #endif
162 #ifndef VIMRC_FILE
163 # define VIMRC_FILE "_vimrc"
164 #endif
166 #ifndef EXRC_FILE
167 # define EXRC_FILE "_exrc"
168 #endif
170 #ifndef DFLT_HELPFILE
171 # define DFLT_HELPFILE "$VIMRUNTIME/doc/help.txt"
172 #endif
174 #ifndef FILETYPE_FILE
175 # define FILETYPE_FILE "filetype.vim"
176 #endif
177 #ifndef FTPLUGIN_FILE
178 # define FTPLUGIN_FILE "ftplugin.vim"
179 #endif
180 #ifndef INDENT_FILE
181 # define INDENT_FILE "indent.vim"
182 #endif
183 #ifndef FTOFF_FILE
184 # define FTOFF_FILE "ftoff.vim"
185 #endif
186 #ifndef FTPLUGOF_FILE
187 # define FTPLUGOF_FILE "ftplugof.vim"
188 #endif
189 #ifndef INDOFF_FILE
190 # define INDOFF_FILE "indoff.vim"
191 #endif
193 #ifndef SYNTAX_FNAME
194 # define SYNTAX_FNAME "$VIMRUNTIME/syntax/%s.vim"
195 #endif
197 #ifdef FEAT_VIMINFO
198 # ifndef VIMINFO_FILE
199 # define VIMINFO_FILE "~/.viminfo"
200 # endif
201 #endif /* FEAT_VIMINFO */
203 #ifndef DFLT_BDIR
204 # define DFLT_BDIR "." /* default for 'backupdir' */
205 #endif
207 #ifndef DFLT_DIR
208 # define DFLT_DIR "." /* default for 'directory' */
209 #endif
211 #ifndef DFLT_VDIR
212 # define DFLT_VDIR "$VIM/vimfiles/view" /* default for 'viewdir' */
213 #endif
215 #define DFLT_ERRORFILE "errors.err"
217 #ifndef DFLT_RUNTIMEPATH
218 # define DFLT_RUNTIMEPATH "~/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,~/.vim/after"
219 #endif
222 * Macintosh has plenty of memory, use large buffers
224 #define CMDBUFFSIZE 1024 /* size of the command processing buffer */
226 #if !defined(MACOS_X_UNIX)
227 # define MAXPATHL 256 /* Limited by the Pascal Strings */
228 # define BASENAMELEN (32-5-1) /* length of base of filename */
229 #endif
231 #ifndef DFLT_MAXMEM
232 # define DFLT_MAXMEM 512 /* use up to 512 Kbyte for buffer */
233 #endif
235 #ifndef DFLT_MAXMEMTOT
236 # define DFLT_MAXMEMTOT 2048 /* use up to 2048 Kbyte for Vim */
237 #endif
239 #define WILDCHAR_LIST "*?[{`$"
241 /**************/
242 #define mch_rename(src, dst) rename(src, dst)
243 #define mch_remove(x) unlink((char *)(x))
244 #ifndef mch_getenv
245 # if defined(__MRC__) || defined(__SC__)
246 # define mch_getenv(name) ((char_u *)getenv((char *)(name)))
247 # define mch_setenv(name, val, x) setenv((name), (val))
248 # elif defined(__APPLE_CC__)
249 # define mch_getenv(name) ((char_u *)getenv((char *)(name)))
250 /*# define mch_setenv(name, val, x) setenv((name), (val)) */ /* Obsoleted by Dany on Oct 30, 2001 */
251 # define mch_setenv(name, val, x) setenv(name, val, x)
252 # else
253 /* vim_getenv() is in pty.c */
254 # define USE_VIMPTY_GETENV
255 # define mch_getenv(x) vimpty_getenv(x)
256 # define mch_setenv(name, val, x) setenv(name, val, x)
257 # endif
258 #endif
260 #ifndef HAVE_CONFIG_H
261 # ifdef __APPLE_CC__
262 /* Assuming compiling for MacOS X */
263 /* Trying to take advantage of the prebinding */
264 # define HAVE_TGETENT
265 # define OSPEED_EXTERN
266 # define UP_BC_PC_EXTERN
267 # endif
268 #endif
270 /* Some "prep work" definition to be able to compile the MacOS X
271 * version with os_unix.x instead of os_mac.c. Based on the result
272 * of ./configure for console MacOS X.
275 #ifdef MACOS_X_UNIX
276 # ifndef SIGPROTOARG
277 # define SIGPROTOARG (int)
278 # endif
279 # ifndef SIGDEFARG
280 # define SIGDEFARG(s) (s) int s UNUSED;
281 # endif
282 # ifndef SIGDUMMYARG
283 # define SIGDUMMYARG 0
284 # endif
285 # undef HAVE_AVAIL_MEM
286 # ifndef HAVE_CONFIG_H
287 # define RETSIGTYPE void
288 # define SIGRETURN return
289 /*# define USE_SYSTEM */ /* Output ship do debugger :(, but ot compile */
290 # define HAVE_SYS_WAIT_H 1 /* Attempt */
291 # define HAVE_TERMIOS_H 1
292 # define SYS_SELECT_WITH_SYS_TIME 1
293 # define HAVE_SELECT 1
294 # define HAVE_SYS_SELECT_H 1
295 # define HAVE_PUTENV
296 # define HAVE_SETENV
297 # define HAVE_RENAME
298 # endif
299 #endif
301 #if defined(MACOS_X) && !defined(HAVE_CONFIG_H)
302 # define HAVE_PUTENV
303 #endif
305 /* A Mac constant causing big problem to syntax highlighting */
306 #define UNKNOWN_CREATOR '\?\?\?\?'
309 * for debugging
311 #ifdef MACOS_X
312 # ifdef _DEBUG
313 # define TRACE Trace
314 void Trace(char *fmt, ...);
315 # else
316 # define TRACE 1 ? (void)0 : printf
317 # endif
318 #endif