]>
Commit | Line | Data |
---|---|---|
885824d3 | 1 | /* |
c0de361f | 2 | ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. |
885824d3 | 3 | ** See ../LICENSE for license information. |
4 | ** | |
5 | */ | |
6 | /* | |
7 | ** osd.h | |
8 | */ | |
9 | ||
10 | # ifndef OSD_H | |
11 | # define OSD_H | |
12 | ||
13 | /* Macro to substitute for ## because VAX C currently doesn't allow it. */ | |
14 | # ifdef __STDC__ | |
15 | /* Use an intermediate paste macro so PASTE macro arguments will get */ | |
16 | /* evaluated. Therefore, PASTE(PASTE(a,b),c) will work. */ | |
17 | /*@notfunction@*/ | |
18 | # define IPASTE(L,R) L ## R | |
19 | /*@notfunction@*/ | |
20 | # define PASTE(L,R) IPASTE(L,R) | |
21 | # else | |
22 | /*@notfunction@*/ | |
23 | # define PASTE(L,R ) L/**/R | |
24 | # endif | |
25 | ||
26 | /* Macro to substitute for # because VAX C currently doesn't allow it. */ | |
27 | # ifdef __STDC__ | |
28 | /*@notfunction@*/ | |
29 | # define ISTR(x) # x | |
30 | /*@notfunction@*/ | |
31 | # define STR(x) ISTR(x) | |
32 | # else | |
33 | /*@notfunction@*/ | |
34 | # define ISTR(x) "x" | |
35 | /*@notfunction@*/ | |
36 | # define STR(x) ISTR(x) | |
37 | # endif | |
38 | ||
39 | /* | |
40 | ** MAXPATHLEN defines the longest permissable path length. | |
53a89507 | 41 | ** |
42 | ** POSIX defines PATHMAX in limits.h | |
885824d3 | 43 | */ |
44 | ||
53a89507 | 45 | # ifdef PATH_MAX |
46 | /*@constant size_t MAXPATHLEN; @*/ | |
47 | # define MAXPATHLEN PATH_MAX | |
48 | # else | |
49 | /*@constant size_t MAXPATHLEN; @*/ | |
50 | # define MAXPATHLEN 1024 | |
51 | # endif | |
885824d3 | 52 | |
53 | typedef enum { | |
54 | OSD_FILEFOUND, | |
55 | OSD_FILENOTFOUND, | |
140c27a8 | 56 | OSD_PATHTOOLONG |
57 | } filestatus; | |
885824d3 | 58 | |
28bf4b0b | 59 | extern /*@only@*/ cstring LSLRootName (cstring p_filespec) /*@*/ ; |
885824d3 | 60 | |
61 | extern filestatus | |
28bf4b0b | 62 | osd_getPath (cstring p_path, cstring p_file, /*@out@*/ cstring *p_returnPath) |
885824d3 | 63 | /*@modifies *p_returnPath@*/ ; |
64 | ||
65 | extern filestatus | |
28bf4b0b | 66 | osd_getExePath (cstring p_path, cstring p_file, /*@out@*/ cstring *p_returnPath) |
885824d3 | 67 | /*@modifies *p_returnPath@*/ ; |
68 | ||
28bf4b0b | 69 | extern bool osd_fileExists (cstring p_filespec) /*@*/ ; |
70 | extern /*@observer@*/ cstring | |
71 | osd_getEnvironment (cstring p_env, /*@returned@*/ cstring p_def) /*@*/ ; | |
885824d3 | 72 | |
28bf4b0b | 73 | extern filestatus osd_findOnLarchPath (cstring p_file, /*@out@*/ cstring *p_returnPath) |
885824d3 | 74 | /*@modifies *p_returnPath@*/ ; |
75 | ||
4dd72714 | 76 | extern void osd_setTempError (void) /*@modifies internalState@*/ ; |
77 | ||
28bf4b0b | 78 | extern /*@observer@*/ cstring osd_getHomeDir (void) /*@*/ ; |
885824d3 | 79 | |
28bf4b0b | 80 | extern /*@observer@*/ cstring osd_getEnvironmentVariable (cstring) ; |
885824d3 | 81 | |
885824d3 | 82 | /*@constant int CALL_SUCCESS@*/ |
83 | # define CALL_SUCCESS 0 | |
28bf4b0b | 84 | extern int osd_system (cstring p_cmd) /*@modifies fileSystem@*/ ; |
885824d3 | 85 | |
53a89507 | 86 | extern cstring osd_absolutePath (cstring p_cwd, cstring p_filename) /*@*/ ; |
6fcd0b1e | 87 | extern /*@only@*/ cstring osd_outputPath (cstring p_filename) /*@*/ ; |
53a89507 | 88 | extern void osd_initMod (void) /*@modifies internalState@*/ ; |
6fcd0b1e | 89 | extern void osd_destroyMod (void) /*@modifies internalState@*/ ; |
53a89507 | 90 | |
68de3f33 | 91 | extern bool osd_equalCanonicalPrefix (cstring p_dirpath, cstring p_prefixpath) /*@*/ ; |
92 | ||
28bf4b0b | 93 | extern int osd_unlink (cstring) /*@modifies fileSystem@*/ ; |
94 | extern cstring osd_fixDefine (cstring); | |
95 | extern bool osd_fileIsReadable (cstring); | |
885824d3 | 96 | |
97 | extern bool osd_isConnectChar (char) /*@*/ ; | |
f2b6724f | 98 | extern /*@observer@*/ cstring osd_getCurrentDirectory (void) /*@*/ ; |
885824d3 | 99 | |
100 | # ifdef WIN32 | |
101 | extern int osd_getPid (void) ; | |
102 | # else | |
103 | extern int /*pid_t*/ osd_getPid (void) ; | |
104 | # endif | |
105 | ||
4caf866b | 106 | # ifdef WIN32 |
107 | /* Win32 doesn't support ISO C99 correctly... */ | |
108 | # define snprintf _snprintf | |
109 | # endif | |
110 | ||
111 | /* | |
112 | ** Win32 convention? | |
113 | */ | |
114 | ||
115 | # if defined(__IBMC__) && defined(OS2) | |
116 | # define S_IFMT (unsigned short)0xFFFF | |
117 | # endif | |
118 | ||
119 | # if defined (OS2) || defined (MSDOS) || defined (WIN32) | |
120 | /*@constant observer cstring INCLUDEPATH_VAR@*/ | |
121 | # define INCLUDEPATH_VAR cstring_makeLiteralTemp ("INCLUDE") | |
122 | # else | |
123 | /*@constant observer cstring INCLUDEPATH_VAR@*/ | |
124 | # define INCLUDEPATH_VAR cstring_makeLiteralTemp ("CPATH") | |
125 | # endif | |
126 | ||
127 | #if defined (VMS) | |
128 | ||
129 | /* | |
130 | ** VMS is here, but hasn't been tested for many releases. Not sure if this works. | |
131 | */ | |
132 | ||
133 | /* | |
134 | ** Connection string inserted between directory and filename to make a | |
135 | ** full path name. | |
136 | */ | |
137 | ||
138 | # define CONNECTSTR ":" | |
139 | # define CONNECTCHAR ':' | |
140 | ||
141 | /* Directory separator character for search list. */ | |
142 | /*@constant static char PATH_SEPARATOR; @*/ | |
143 | # define PATH_SEPARATOR ':' | |
144 | ||
145 | # elif defined(MSDOS) || defined(OS2) || defined(WIN32) | |
146 | ||
147 | /* Connection string inserted between directory and filename to make a */ | |
148 | /* full path name. */ | |
149 | ||
150 | /*@constant observer char *CONNECTSTR@*/ | |
151 | # define CONNECTSTR "\\" | |
152 | ||
153 | /*@constant char CONNECTCHAR@*/ | |
154 | # define CONNECTCHAR '\\' | |
155 | ||
156 | # define HASALTCONNECTCHAR | |
157 | ||
158 | /*@constant char ALTCONNECTCHAR@*/ | |
159 | # define ALTCONNECTCHAR '/' | |
160 | ||
161 | /* Directory separator character for search list. */ | |
162 | ||
163 | /*@constant char PATH_SEPARATOR; @*/ | |
164 | # define PATH_SEPARATOR ';' | |
165 | ||
166 | #else | |
167 | /* Connection string inserted between directory and filename to make a */ | |
168 | /* full path name. */ | |
169 | ||
170 | /*@constant observer char *CONNECTSTR@*/ | |
171 | # define CONNECTSTR "/" | |
172 | ||
173 | /*@constant char CONNECTCHAR; @*/ | |
174 | # define CONNECTCHAR '/' | |
175 | ||
176 | /* Directory separator character for search list. */ | |
177 | /*@constant char PATH_SEPARATOR; @*/ | |
178 | # define PATH_SEPARATOR ':' | |
179 | ||
180 | #endif | |
181 | ||
182 | ||
183 | # ifdef P_tmpdir | |
184 | ||
185 | # if defined(OS2) && defined(__IBMC__) | |
186 | /*@constant observer char *DEFAULT_TMPDIR; @*/ | |
187 | # define DEFAULT_TMPDIR "." | |
188 | # else | |
189 | /*@constant observer char *DEFAULT_TMPDIR; @*/ | |
190 | # define DEFAULT_TMPDIR P_tmpdir | |
191 | # endif | |
192 | # else | |
193 | # ifdef WIN32 | |
194 | /*@constant observer char *DEFAULT_TMPDIR; @*/ | |
195 | # define DEFAULT_TMPDIR "\\WINDOWS\\TEMP\\" | |
196 | # else | |
197 | /*@constant observer char *DEFAULT_TMPDIR; @*/ | |
198 | # define DEFAULT_TMPDIR "/tmp/" | |
199 | # endif /* WIN32 */ | |
200 | ||
201 | # endif /* P_tmpdir */ | |
202 | ||
203 | # else | |
204 | # error "Multiple include" | |
205 | # endif | |
8b63eb37 | 206 | \ |
885824d3 | 207 | |
208 | ||
209 |