annotate src/os_mac.h @ 32669:448aef880252

normalize line endings
author Christian Brabandt <cb@256bit.org>
date Mon, 26 Jun 2023 09:54:34 +0200
parents 8f0da069a311
children 695b50472e85
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
32669
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
1 /* vi:set ts=8 sts=4 sw=4 noet:
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
2 *
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
3 * VIM - Vi IMproved by Bram Moolenaar
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
4 *
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
5 * Do ":help uganda" in Vim to read copying and usage conditions.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
6 * Do ":help credits" in Vim to see a list of people who contributed.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
7 */
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
8
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
9 #ifndef OS_MAC__H
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
10 #define OS_MAC__H
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
11
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
12 // Before Including the MacOS specific files,
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
13 // let's set the OPAQUE_TOOLBOX_STRUCTS to 0 so we
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
14 // can access the internal structures.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
15 // (Until fully Carbon compliant)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
16 // TODO: Can we remove this? (Dany)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
17 #if 0
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
18 # define OPAQUE_TOOLBOX_STRUCTS 0
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
19 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
20
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
21 // Include MAC_OS_X_VERSION_* macros
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
22 #ifdef HAVE_AVAILABILITYMACROS_H
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
23 # include <AvailabilityMacros.h>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
24 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
25
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
26 /*
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
27 * Unix interface
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
28 */
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
29 #if defined(__APPLE_CC__) // for Project Builder and ...
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
30 # include <unistd.h>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
31 // Get stat.h or something similar. Comment: How come some OS get in vim.h
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
32 # include <sys/stat.h>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
33 // && defined(HAVE_CURSE)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
34 // The curses.h from MacOS X provides by default some BACKWARD compatibility
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
35 // definition which can cause us problem later on. So we undefine a few of them.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
36 # include <curses.h>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
37 # undef reg
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
38 # undef ospeed
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
39 // OK defined to 0 in MacOS X 10.2 curses! Remove it, we define it to be 1.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
40 # undef OK
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
41 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
42 #include <signal.h>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
43 #include <errno.h>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
44 #include <stdio.h>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
45 #include <stdlib.h>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
46 #include <time.h>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
47 #include <dirent.h>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
48
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
49 /*
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
50 * MacOS specific #define
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
51 */
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
52
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
53 // This will go away when CMD_KEY fully tested
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
54 #define USE_CMD_KEY
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
55 // On MacOS X use the / not the :
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
56 // TODO: Should file such as ~/.vimrc reside instead in
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
57 // ~/Library/Vim or ~/Library/Preferences/org.vim.vim/ ? (Dany)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
58 // When compiled under MacOS X (including CARBON version)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
59 // we use the Unix File path style. Also when UNIX is defined.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
60 #define USE_UNIXFILENAME
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
61
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
62
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
63 /*
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
64 * Generic Vim #define for Mac
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
65 */
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
66
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
67 #define FEAT_SOURCE_FFS
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
68 #define FEAT_SOURCE_FF_MAC
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
69
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
70 #define USE_EXE_NAME // to find $VIM
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
71 #define CASE_INSENSITIVE_FILENAME // ignore case when comparing file names
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
72 #define SPACE_IN_FILENAME
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
73
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
74 #define USE_FNAME_CASE // make ":e os_Mac.c" open the file in its
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
75 // original case, as "os_mac.c"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
76 #define BINARY_FILE_IO
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
77 #define EOL_DEFAULT EOL_MAC
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
78 #define HAVE_AVAIL_MEM
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
79
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
80 #ifndef HAVE_CONFIG_H
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
81 # define HAVE_STRING_H
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
82 # define HAVE_STRCSPN
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
83 # define HAVE_MEMSET
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
84 # define USE_TMPNAM // use tmpnam() instead of mktemp()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
85 # define HAVE_FCNTL_H
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
86 # define HAVE_QSORT
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
87 # define HAVE_ST_MODE // have stat.st_mode
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
88 # define HAVE_MATH_H
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
89
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
90 # if defined(__DATE__) && defined(__TIME__)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
91 # define HAVE_DATE_TIME
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
92 # endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
93 # define HAVE_STRFTIME
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
94 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
95
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
96 /*
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
97 * Names for the EXRC, HELP and temporary files.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
98 * Some of these may have been defined in the makefile.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
99 */
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
100
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
101 #ifndef SYS_VIMRC_FILE
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
102 # define SYS_VIMRC_FILE "$VIM/vimrc"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
103 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
104 #ifndef SYS_GVIMRC_FILE
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
105 # define SYS_GVIMRC_FILE "$VIM/gvimrc"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
106 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
107 #ifndef SYS_MENU_FILE
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
108 # define SYS_MENU_FILE "$VIMRUNTIME/menu.vim"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
109 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
110 #ifndef SYS_OPTWIN_FILE
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
111 # define SYS_OPTWIN_FILE "$VIMRUNTIME/optwin.vim"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
112 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
113 #ifndef VIM_DEFAULTS_FILE
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
114 # define VIM_DEFAULTS_FILE "$VIMRUNTIME/defaults.vim"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
115 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
116 #ifndef EVIM_FILE
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
117 # define EVIM_FILE "$VIMRUNTIME/evim.vim"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
118 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
119
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
120 #ifdef FEAT_GUI
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
121 # ifndef USR_GVIMRC_FILE
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
122 # define USR_GVIMRC_FILE "~/.gvimrc"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
123 # endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
124 # ifndef GVIMRC_FILE
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
125 # define GVIMRC_FILE "_gvimrc"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
126 # endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
127 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
128 #ifndef USR_VIMRC_FILE
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
129 # define USR_VIMRC_FILE "~/.vimrc"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
130 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
131
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
132 #ifndef USR_EXRC_FILE
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
133 # define USR_EXRC_FILE "~/.exrc"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
134 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
135
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
136 #ifndef VIMRC_FILE
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
137 # define VIMRC_FILE "_vimrc"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
138 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
139
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
140 #ifndef EXRC_FILE
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
141 # define EXRC_FILE "_exrc"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
142 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
143
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
144 #ifndef DFLT_HELPFILE
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
145 # define DFLT_HELPFILE "$VIMRUNTIME/doc/help.txt"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
146 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
147
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
148 #ifndef SYNTAX_FNAME
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
149 # define SYNTAX_FNAME "$VIMRUNTIME/syntax/%s.vim"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
150 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
151
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
152 #ifdef FEAT_VIMINFO
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
153 # ifndef VIMINFO_FILE
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
154 # define VIMINFO_FILE "~/.viminfo"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
155 # endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
156 #endif // FEAT_VIMINFO
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
157
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
158 #ifndef DFLT_BDIR
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
159 # define DFLT_BDIR "." // default for 'backupdir'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
160 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
161
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
162 #ifndef DFLT_DIR
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
163 # define DFLT_DIR "." // default for 'directory'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
164 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
165
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
166 #ifndef DFLT_VDIR
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
167 # define DFLT_VDIR "$VIM/vimfiles/view" // default for 'viewdir'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
168 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
169
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
170 #define DFLT_ERRORFILE "errors.err"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
171
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
172 #ifndef DFLT_RUNTIMEPATH
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
173 # define DFLT_RUNTIMEPATH "~/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,~/.vim/after"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
174 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
175 #ifndef CLEAN_RUNTIMEPATH
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
176 # define CLEAN_RUNTIMEPATH "$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
177 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
178
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
179 /*
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
180 * Macintosh has plenty of memory, use large buffers
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
181 */
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
182 #define CMDBUFFSIZE 1024 // size of the command processing buffer
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
183
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
184 #ifndef DFLT_MAXMEM
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
185 # define DFLT_MAXMEM 512 // use up to 512 Kbyte for buffer
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
186 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
187
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
188 #ifndef DFLT_MAXMEMTOT
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
189 # define DFLT_MAXMEMTOT 2048 // use up to 2048 Kbyte for Vim
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
190 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
191
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
192 #define WILDCHAR_LIST "*?[{`$"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
193
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
194 /**************/
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
195 #define mch_rename(src, dst) rename(src, dst)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
196 #define mch_remove(x) unlink((char *)(x))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
197 #ifndef mch_getenv
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
198 # if defined(__APPLE_CC__)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
199 # define mch_getenv(name) ((char_u *)getenv((char *)(name)))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
200 # define mch_setenv(name, val, x) setenv(name, val, x)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
201 # else
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
202 // vim_getenv() is in pty.c
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
203 # define USE_VIMPTY_GETENV
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
204 # define mch_getenv(x) vimpty_getenv(x)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
205 # define mch_setenv(name, val, x) setenv(name, val, x)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
206 # endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
207 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
208
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
209 #ifndef HAVE_CONFIG_H
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
210 # ifdef __APPLE_CC__
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
211 // Assuming compiling for MacOS X
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
212 // Trying to take advantage of the prebinding
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
213 # define HAVE_TGETENT
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
214 # define OSPEED_EXTERN
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
215 # define UP_BC_PC_EXTERN
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
216 # endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
217 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
218
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
219 // Some "prep work" definition to be able to compile the MacOS X
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
220 // version with os_unix.c instead of os_mac.c. Based on the result
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
221 // of ./configure for console MacOS X.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
222
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
223 #ifndef SIGPROTOARG
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
224 # define SIGPROTOARG (int)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
225 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
226 #ifndef SIGDEFARG
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
227 # define SIGDEFARG(s) (s) int s UNUSED;
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
228 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
229 #ifndef SIGDUMMYARG
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
230 # define SIGDUMMYARG 0
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
231 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
232 #undef HAVE_AVAIL_MEM
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
233 #ifndef HAVE_CONFIG_H
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
234 //# define USE_SYSTEM // Output ship do debugger :(, but not compile
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
235 # define HAVE_SYS_WAIT_H 1 // Attempt
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
236 # define HAVE_TERMIOS_H 1
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
237 # define SYS_SELECT_WITH_SYS_TIME 1
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
238 # define HAVE_SELECT 1
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
239 # define HAVE_SYS_SELECT_H 1
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
240 # define HAVE_PUTENV
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
241 # define HAVE_SETENV
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
242 # define HAVE_RENAME
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
243 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
244
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
245 #if !defined(HAVE_CONFIG_H)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
246 # define HAVE_PUTENV
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
247 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
248
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
249 // A Mac constant causing big problem to syntax highlighting
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
250 #define UNKNOWN_CREATOR '\?\?\?\?'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
251
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
252 #ifdef FEAT_RELTIME
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
253
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
254 # include <dispatch/dispatch.h>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
255
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
256 # if !defined(MAC_OS_X_VERSION_10_12) \
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
257 || (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
258 typedef int clockid_t;
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
259 # endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
260 # ifndef CLOCK_REALTIME
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
261 # define CLOCK_REALTIME 0
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
262 # endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
263 # ifndef CLOCK_MONOTONIC
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
264 # define CLOCK_MONOTONIC 1
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
265 # endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
266
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
267 struct itimerspec
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
268 {
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
269 struct timespec it_interval; // timer period
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
270 struct timespec it_value; // initial expiration
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
271 };
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
272
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
273 struct sigevent;
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
274
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
275 struct macos_timer
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
276 {
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
277 dispatch_queue_t tim_queue;
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
278 dispatch_source_t tim_timer;
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
279 void (*tim_func)(union sigval);
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
280 void *tim_arg;
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
281 };
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
282
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
283 typedef struct macos_timer *timer_t;
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
284
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
285 extern int timer_create(
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
286 clockid_t clockid,
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
287 struct sigevent *sevp,
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
288 timer_t *timerid);
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
289
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
290 extern int timer_delete(timer_t timerid);
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
291
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
292 extern int timer_settime(
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
293 timer_t timerid, int flags,
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
294 const struct itimerspec *new_value,
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
295 struct itimerspec *unused);
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
296
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
297 #endif // FEAT_RELTIME
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
298
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32578
diff changeset
299 #endif // OS_MAC__H