1 /* vi:set ts=8 sts=4 sw=4 noet: 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 #if 0 15 # define OPAQUE_TOOLBOX_STRUCTS 0 16 #endif 17 18 // Include MAC_OS_X_VERSION_* macros 19 #ifdef HAVE_AVAILABILITYMACROS_H 20 # include <AvailabilityMacros.h> 21 #endif 22 23 /* 24 * Unix interface 25 */ 26 #if defined(__APPLE_CC__) // for Project Builder and ... 27 # include <unistd.h> 28 // Get stat.h or something similar. Comment: How come some OS get in in vim.h 29 # include <sys/stat.h> 30 // && defined(HAVE_CURSE) 31 // The curses.h from MacOS X provides by default some BACKWARD compatibility 32 // definition which can cause us problem later on. So we undefine a few of them. 33 # include <curses.h> 34 # undef reg 35 # undef ospeed 36 // OK defined to 0 in MacOS X 10.2 curses! Remove it, we define it to be 1. 37 # undef OK 38 #endif 39 #include <signal.h> 40 #include <errno.h> 41 #include <stdio.h> 42 #include <stdlib.h> 43 #include <time.h> 44 #include <dirent.h> 45 46 /* 47 * MacOS specific #define 48 */ 49 50 // This will go away when CMD_KEY fully tested 51 #define USE_CMD_KEY 52 // On MacOS X use the / not the : 53 // TODO: Should file such as ~/.vimrc reside instead in 54 // ~/Library/Vim or ~/Library/Preferences/org.vim.vim/ ? (Dany) 55 // When compiled under MacOS X (including CARBON version) 56 // we use the Unix File path style. Also when UNIX is defined. 57 #define USE_UNIXFILENAME 58 59 60 /* 61 * Generic Vim #define for Mac 62 */ 63 64 #define FEAT_SOURCE_FFS 65 #define FEAT_SOURCE_FF_MAC 66 67 #define USE_EXE_NAME // to find $VIM 68 #define CASE_INSENSITIVE_FILENAME // ignore case when comparing file names 69 #define SPACE_IN_FILENAME 70 71 #define USE_FNAME_CASE // make ":e os_Mac.c" open the file in its 72 // original case, as "os_mac.c" 73 #define BINARY_FILE_IO 74 #define EOL_DEFAULT EOL_MAC 75 #define HAVE_AVAIL_MEM 76 77 #ifndef HAVE_CONFIG_H 78 # define HAVE_STRING_H 79 # define HAVE_STRCSPN 80 # define HAVE_MEMSET 81 # define USE_TMPNAM // use tmpnam() instead of mktemp() 82 # define HAVE_FCNTL_H 83 # define HAVE_QSORT 84 # define HAVE_ST_MODE // have stat.st_mode 85 # define HAVE_MATH_H 86 87 # if defined(__DATE__) && defined(__TIME__) 88 # define HAVE_DATE_TIME 89 # endif 90 # define HAVE_STRFTIME 91 #endif 92 93 /* 94 * Names for the EXRC, HELP and temporary files. 95 * Some of these may have been defined in the makefile. 96 */ 97 98 #ifndef SYS_VIMRC_FILE 99 # define SYS_VIMRC_FILE "$VIM/vimrc" 100 #endif 101 #ifndef SYS_GVIMRC_FILE 102 # define SYS_GVIMRC_FILE "$VIM/gvimrc" 103 #endif 104 #ifndef SYS_MENU_FILE 105 # define SYS_MENU_FILE "$VIMRUNTIME/menu.vim" 106 #endif 107 #ifndef SYS_OPTWIN_FILE 108 # define SYS_OPTWIN_FILE "$VIMRUNTIME/optwin.vim" 109 #endif 110 #ifndef VIM_DEFAULTS_FILE 111 # define VIM_DEFAULTS_FILE "$VIMRUNTIME/defaults.vim" 112 #endif 113 #ifndef EVIM_FILE 114 # define EVIM_FILE "$VIMRUNTIME/evim.vim" 115 #endif 116 117 #ifdef FEAT_GUI 118 # ifndef USR_GVIMRC_FILE 119 # define USR_GVIMRC_FILE "~/.gvimrc" 120 # endif 121 # ifndef GVIMRC_FILE 122 # define GVIMRC_FILE "_gvimrc" 123 # endif 124 #endif 125 #ifndef USR_VIMRC_FILE 126 # define USR_VIMRC_FILE "~/.vimrc" 127 #endif 128 129 #ifndef USR_EXRC_FILE 130 # define USR_EXRC_FILE "~/.exrc" 131 #endif 132 133 #ifndef VIMRC_FILE 134 # define VIMRC_FILE "_vimrc" 135 #endif 136 137 #ifndef EXRC_FILE 138 # define EXRC_FILE "_exrc" 139 #endif 140 141 #ifndef DFLT_HELPFILE 142 # define DFLT_HELPFILE "$VIMRUNTIME/doc/help.txt" 143 #endif 144 145 #ifndef FILETYPE_FILE 146 # define FILETYPE_FILE "filetype.vim" 147 #endif 148 #ifndef FTPLUGIN_FILE 149 # define FTPLUGIN_FILE "ftplugin.vim" 150 #endif 151 #ifndef INDENT_FILE 152 # define INDENT_FILE "indent.vim" 153 #endif 154 #ifndef FTOFF_FILE 155 # define FTOFF_FILE "ftoff.vim" 156 #endif 157 #ifndef FTPLUGOF_FILE 158 # define FTPLUGOF_FILE "ftplugof.vim" 159 #endif 160 #ifndef INDOFF_FILE 161 # define INDOFF_FILE "indoff.vim" 162 #endif 163 164 #ifndef SYNTAX_FNAME 165 # define SYNTAX_FNAME "$VIMRUNTIME/syntax/%s.vim" 166 #endif 167 168 #ifdef FEAT_VIMINFO 169 # ifndef VIMINFO_FILE 170 # define VIMINFO_FILE "~/.viminfo" 171 # endif 172 #endif // FEAT_VIMINFO 173 174 #ifndef DFLT_BDIR 175 # define DFLT_BDIR "." // default for 'backupdir' 176 #endif 177 178 #ifndef DFLT_DIR 179 # define DFLT_DIR "." // default for 'directory' 180 #endif 181 182 #ifndef DFLT_VDIR 183 # define DFLT_VDIR "$VIM/vimfiles/view" // default for 'viewdir' 184 #endif 185 186 #define DFLT_ERRORFILE "errors.err" 187 188 #ifndef DFLT_RUNTIMEPATH 189 # define DFLT_RUNTIMEPATH "~/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,~/.vim/after" 190 #endif 191 #ifndef CLEAN_RUNTIMEPATH 192 # define CLEAN_RUNTIMEPATH "$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after" 193 #endif 194 195 /* 196 * Macintosh has plenty of memory, use large buffers 197 */ 198 #define CMDBUFFSIZE 1024 // size of the command processing buffer 199 200 #ifndef DFLT_MAXMEM 201 # define DFLT_MAXMEM 512 // use up to 512 Kbyte for buffer 202 #endif 203 204 #ifndef DFLT_MAXMEMTOT 205 # define DFLT_MAXMEMTOT 2048 // use up to 2048 Kbyte for Vim 206 #endif 207 208 #define WILDCHAR_LIST "*?[{`$" 209 210 /**************/ 211 #define mch_rename(src, dst) rename(src, dst) 212 #define mch_remove(x) unlink((char *)(x)) 213 #ifndef mch_getenv 214 # if defined(__APPLE_CC__) 215 # define mch_getenv(name) ((char_u *)getenv((char *)(name))) 216 # define mch_setenv(name, val, x) setenv(name, val, x) 217 # else 218 // vim_getenv() is in pty.c 219 # define USE_VIMPTY_GETENV 220 # define mch_getenv(x) vimpty_getenv(x) 221 # define mch_setenv(name, val, x) setenv(name, val, x) 222 # endif 223 #endif 224 225 #ifndef HAVE_CONFIG_H 226 # ifdef __APPLE_CC__ 227 // Assuming compiling for MacOS X 228 // Trying to take advantage of the prebinding 229 # define HAVE_TGETENT 230 # define OSPEED_EXTERN 231 # define UP_BC_PC_EXTERN 232 # endif 233 #endif 234 235 // Some "prep work" definition to be able to compile the MacOS X 236 // version with os_unix.c instead of os_mac.c. Based on the result 237 // of ./configure for console MacOS X. 238 239 #ifndef SIGPROTOARG 240 # define SIGPROTOARG (int) 241 #endif 242 #ifndef SIGDEFARG 243 # define SIGDEFARG(s) (s) int s UNUSED; 244 #endif 245 #ifndef SIGDUMMYARG 246 # define SIGDUMMYARG 0 247 #endif 248 #undef HAVE_AVAIL_MEM 249 #ifndef HAVE_CONFIG_H 250 # define RETSIGTYPE void 251 # define SIGRETURN return 252 //# define USE_SYSTEM // Output ship do debugger :(, but not compile 253 # define HAVE_SYS_WAIT_H 1 // Attempt 254 # define HAVE_TERMIOS_H 1 255 # define SYS_SELECT_WITH_SYS_TIME 1 256 # define HAVE_SELECT 1 257 # define HAVE_SYS_SELECT_H 1 258 # define HAVE_PUTENV 259 # define HAVE_SETENV 260 # define HAVE_RENAME 261 #endif 262 263 #if !defined(HAVE_CONFIG_H) 264 # define HAVE_PUTENV 265 #endif 266 267 // A Mac constant causing big problem to syntax highlighting 268 #define UNKNOWN_CREATOR '\?\?\?\?' 269