Mercurial > hg > xemacs-beta
annotate src/sysfile.h @ 4854:95c4ced5c07c
fix compile problems
-------------------- ChangeLog entries follow: --------------------
src/ChangeLog addition:
2010-01-14 Ben Wing <ben@xemacs.org>
* glyphs-eimage.c:
Turn on fixes for conflicts between jmorecfg.h and windows.h on
Cygwin, too.
* emacs.c (debug_can_access_memory):
* lisp.h:
Declare function const void * to avoid warnings.
* sysfile.h:
Include syswindows.h on Windows to avoid problems using things like
PATHNAME_CONVERT_OUT.
* sysfile.h (X_OK):
* dialog-msw.c (handle_directory_proc):
* dialog-msw.c (handle_directory_dialog_box):
* nt.c (Fmswindows_short_file_name):
* sysdep.c (qxe_allocating_getcwd):
* syswindows.h (LOCAL_FILE_FORMAT_TO_TSTR):
* unexcw.c (unexec):
* unexnt.c (_start):
* win32.c (mswindows_read_link_1):
Rename PATH_MAX_EXTERNAL to PATH_MAX_TSTR to reflect its actual
semantics.
* unexcw.c:
Remove include of syswindows.h that had been added because
sysfile.h didn't include it.
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Thu, 14 Jan 2010 01:25:16 -0600 |
parents | b3ea9c582280 |
children | 5ab6dc5d789e |
rev | line source |
---|---|
428 | 1 /* |
2 Copyright (C) 1995 Free Software Foundation, Inc. | |
2421 | 3 Copyright (C) 2000, 2001, 2002, 2004 Ben Wing. |
428 | 4 |
5 This file is part of XEmacs. | |
6 | |
7 XEmacs is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
9 Free Software Foundation; either version 2, or (at your option) any | |
10 later version. | |
11 | |
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
18 along with XEmacs; see the file COPYING. If not, write to | |
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
20 Boston, MA 02111-1307, USA. */ | |
21 | |
22 /* Synched up with: Not really in FSF. */ | |
23 | |
440 | 24 #ifndef INCLUDED_sysfile_h_ |
25 #define INCLUDED_sysfile_h_ | |
26 | |
771 | 27 /* The anonymous voice of the past says: |
28 Must come before sysfile.h | |
29 | |
30 So instead we just put it here. --ben */ | |
31 #ifdef HAVE_LIBGEN_H | |
32 #include <libgen.h> | |
33 #endif | |
34 | |
428 | 35 #include <errno.h> |
36 | |
442 | 37 #ifndef WIN32_NATIVE |
573 | 38 # include <sys/errno.h> /* <errno.h> does not always imply this */ |
428 | 39 #endif |
40 | |
41 #ifdef HAVE_UNISTD_H | |
558 | 42 # include <unistd.h> |
428 | 43 #endif |
44 | |
45 #ifndef INCLUDED_FCNTL | |
46 # define INCLUDED_FCNTL | |
47 # include <fcntl.h> | |
48 #endif /* INCLUDED_FCNTL */ | |
49 | |
558 | 50 /* The anonymous voice of the past says: |
428 | 51 In some systems loading it twice is suicidal. */ |
558 | 52 #ifndef INCLUDED_SYS_TYPES |
53 # define INCLUDED_SYS_TYPES | |
54 # include <sys/types.h> /* some typedefs are used in sys/file.h */ | |
55 #endif /* INCLUDED_SYS_TYPES */ | |
442 | 56 |
57 #ifndef WIN32_NATIVE | |
558 | 58 # include <sys/file.h> |
442 | 59 #endif |
60 | |
1467 | 61 /* Some systems (SCO 3.2v5) do #define stat ... in this header. So it |
62 _must_ be included before any use of struct stat. Most emacs files | |
63 should include sysfile.h. The unex*.c include <sys/stat.h> directly. */ | |
428 | 64 #include <sys/stat.h> |
442 | 65 |
1315 | 66 #ifdef WIN32_ANY |
558 | 67 # include <io.h> |
68 #endif | |
69 | |
70 #ifdef WIN32_NATIVE | |
71 # include <direct.h> | |
72 #else | |
442 | 73 /* Some configuration files' definitions for the LOAD_AVE_CVT macro |
74 (like sparc.h's) use macros like FSCALE, defined here. */ | |
558 | 75 # ifdef HAVE_GTK |
462 | 76 /* I hate GTK */ |
558 | 77 # undef MIN |
78 # undef MAX | |
79 # endif /* HAVE_GTK */ | |
80 # include <sys/param.h> | |
609 | 81 /* As per Martin's recommendation, we do not include this. There was |
82 a comment stating that stuff from here was needed on NeXT, Cygwin, | |
83 and sunplay.c. However, Cygwin includes this automatically from | |
84 fcntl.h, and Martin says that a "conforming" system should never | |
85 need this. We will put it back if necessary on systems requiring it. */ | |
86 /* # include <sys/fcntl.h> */ | |
777 | 87 #endif /* WIN32_NATIVE */ |
428 | 88 |
4854 | 89 /* Needed for C_STRING_TO_TSTR, MAX_XETCHAR_SIZE below; but syswindows.h |
90 depends on lisp.h being previously included. */ | |
91 #if defined (WIN32_ANY) && defined (emacs) | |
92 # include "syswindows.h" | |
93 #endif | |
94 | |
428 | 95 #ifndef STDERR_FILENO |
96 #define STDIN_FILENO 0 | |
97 #define STDOUT_FILENO 1 | |
98 #define STDERR_FILENO 2 | |
99 #endif | |
100 | |
101 #ifndef O_RDONLY | |
102 #define O_RDONLY 0 | |
103 #endif | |
104 | |
105 #ifndef O_WRONLY | |
106 #define O_WRONLY 1 | |
107 #endif | |
108 | |
109 #ifndef O_RDWR | |
110 #define O_RDWR 2 | |
111 #endif | |
112 | |
113 /* file opening defaults */ | |
114 #ifndef OPEN_BINARY | |
115 #ifdef O_BINARY | |
116 #define OPEN_BINARY O_BINARY | |
117 #else | |
118 #define OPEN_BINARY (0) | |
119 #endif | |
120 #endif | |
121 | |
122 #ifndef OPEN_TEXT | |
123 #ifdef O_TEXT | |
124 #define OPEN_TEXT O_TEXT | |
125 #else | |
126 #define OPEN_TEXT (0) | |
127 #endif | |
128 #endif | |
129 | |
130 #ifndef CREAT_MODE | |
442 | 131 #ifdef WIN32_NATIVE |
428 | 132 #define CREAT_MODE (S_IREAD | S_IWRITE) |
133 #else | |
134 #define CREAT_MODE (0666) | |
135 #endif | |
136 #endif | |
137 | |
138 #ifndef READ_TEXT | |
139 #ifdef O_TEXT | |
140 #define READ_TEXT "rt" | |
141 #else | |
142 #define READ_TEXT "r" | |
143 #endif | |
144 #endif | |
145 | |
146 #ifndef READ_BINARY | |
147 #ifdef O_BINARY | |
148 #define READ_BINARY "rb" | |
149 #else | |
150 #define READ_BINARY "r" | |
151 #endif | |
152 #endif | |
153 | |
442 | 154 #ifndef READ_PLUS_TEXT |
155 #ifdef O_TEXT | |
156 #define READ_PLUS_TEXT "r+t" | |
157 #else | |
158 #define READ_PLUS_TEXT "r+" | |
159 #endif | |
160 #endif | |
161 | |
162 #ifndef READ_PLUS_BINARY | |
163 #ifdef O_BINARY | |
164 #define READ_PLUS_BINARY "r+b" | |
165 #else | |
166 #define READ_PLUS_BINARY "r+" | |
167 #endif | |
168 #endif | |
169 | |
170 #ifndef WRITE_TEXT | |
171 #ifdef O_TEXT | |
172 #define WRITE_TEXT "wt" | |
173 #else | |
174 #define WRITE_TEXT "w" | |
175 #endif | |
176 #endif | |
177 | |
428 | 178 #ifndef WRITE_BINARY |
179 #ifdef O_BINARY | |
180 #define WRITE_BINARY "wb" | |
181 #else | |
182 #define WRITE_BINARY "w" | |
183 #endif | |
184 #endif | |
185 | |
771 | 186 #ifndef APPEND_TEXT |
187 #ifdef O_TEXT | |
188 #define APPEND_TEXT "at" | |
189 #else | |
190 #define APPEND_TEXT "a" | |
191 #endif | |
192 #endif | |
193 | |
194 #ifndef APPEND_BINARY | |
195 #ifdef O_BINARY | |
196 #define APPEND_BINARY "ab" | |
197 #else | |
198 #define APPEND_BINARY "a" | |
199 #endif | |
200 #endif | |
201 | |
428 | 202 #ifndef O_NONBLOCK |
203 #ifdef O_NDELAY | |
204 #define O_NONBLOCK O_NDELAY | |
205 #else | |
206 #define O_NONBLOCK 04000 | |
207 #endif | |
208 #endif | |
209 | |
210 #if !S_IRUSR | |
211 # if S_IREAD | |
212 # define S_IRUSR S_IREAD | |
213 # else | |
214 # define S_IRUSR 00400 | |
215 # endif | |
216 #endif | |
217 | |
218 #if !S_IWUSR | |
219 # if S_IWRITE | |
220 # define S_IWUSR S_IWRITE | |
221 # else | |
222 # define S_IWUSR 00200 | |
223 # endif | |
224 #endif | |
225 | |
226 #if !S_IXUSR | |
227 # if S_IEXEC | |
228 # define S_IXUSR S_IEXEC | |
229 # else | |
230 # define S_IXUSR 00100 | |
231 # endif | |
232 #endif | |
233 | |
234 #ifdef STAT_MACROS_BROKEN | |
235 #undef S_ISBLK | |
236 #undef S_ISCHR | |
237 #undef S_ISDIR | |
238 #undef S_ISFIFO | |
239 #undef S_ISLNK | |
240 #undef S_ISMPB | |
241 #undef S_ISMPC | |
242 #undef S_ISNWK | |
243 #undef S_ISREG | |
244 #undef S_ISSOCK | |
245 #endif /* STAT_MACROS_BROKEN. */ | |
246 | |
2526 | 247 #ifdef WIN32_NATIVE |
248 /* This is the standard value for S_IFLNK. All of the S_... flags that | |
249 exist in the MSVCRT have standard values, so their bit tests will | |
250 magically work. */ | |
251 #define S_IFLNK 0120000 | |
252 #endif | |
253 | |
428 | 254 #if !defined(S_ISBLK) && defined(S_IFBLK) |
255 #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) | |
256 #endif | |
257 #if !defined(S_ISCHR) && defined(S_IFCHR) | |
258 #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) | |
259 #endif | |
260 #if !defined(S_ISDIR) && defined(S_IFDIR) | |
261 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) | |
262 #endif | |
263 #if !defined(S_ISREG) && defined(S_IFREG) | |
264 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) | |
265 #endif | |
266 #if !defined(S_ISFIFO) && defined(S_IFIFO) | |
267 #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) | |
268 #endif | |
269 #if !defined(S_ISLNK) && defined(S_IFLNK) | |
270 #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) | |
271 #endif | |
272 #if !defined(S_ISSOCK) && defined(S_IFSOCK) | |
273 #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) | |
274 #endif | |
275 #if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */ | |
276 #define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB) | |
277 #define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC) | |
278 #endif | |
279 #if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */ | |
280 #define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK) | |
281 #endif | |
282 | |
2421 | 283 /* Determining the maximum pathname length. |
284 | |
285 NOTE: IN GENERAL, YOU SHOULD NOT USE THIS. | |
286 If at all possible, avoid using fixed-length buffers of any sort. | |
287 You cannot guarantee on many systems that pathnames won't exceed | |
288 these limits for one reason or another. | |
289 | |
290 Unfortunately, there is no universal agreement over whether these | |
291 values should include a final null-terminator or not. Even recent | |
292 versions of Linux (circa 2002) are switching from the not-including- | |
293 terminator kind to the including-terminator kind. So we assume that | |
294 the including-terminator kind will be even (usually is), and round | |
295 up as necessary. */ | |
296 | |
297 #define ROUND_UP_TO_EVEN_NUMBER(val) (((val + 1) >> 1) << 1) | |
298 #ifdef PATH_MAX | |
299 # define QXE_PATH_MAX ROUND_UP_TO_EVEN_NUMBER (PATH_MAX) | |
300 #elif defined (_MAX_PATH) | |
558 | 301 /* MS Win -- and preferable to _POSIX_PATH_MAX, which is also defined */ |
2421 | 302 # define QXE_PATH_MAX ROUND_UP_TO_EVEN_NUMBER (_MAX_PATH) |
303 #elif defined (_POSIX_PATH_MAX) | |
304 # define QXE_PATH_MAX ROUND_UP_TO_EVEN_NUMBER (_POSIX_PATH_MAX) | |
305 #elif defined (MAXPATHLEN) | |
306 # define QXE_PATH_MAX ROUND_UP_TO_EVEN_NUMBER (MAXPATHLEN) | |
307 #else | |
308 # define QXE_PATH_MAX 1024 | |
442 | 309 #endif |
310 | |
4854 | 311 /* Client .c files should use PATH_MAX_INTERNAL or PATH_MAX_TCHAR |
2421 | 312 if they must use either one at all. */ |
313 | |
314 /* Use for internally formatted text, which can potentially have up to | |
315 four bytes per character */ | |
316 #define PATH_MAX_INTERNAL (QXE_PATH_MAX * MAX_ICHAR_LEN) | |
4854 | 317 #ifdef WIN32_ANY |
318 /* Use for externally formatted text in TCHAR's. */ | |
319 #define PATH_MAX_TCHAR (QXE_PATH_MAX * MAX_XETCHAR_SIZE) | |
320 #endif | |
2421 | 321 |
442 | 322 /* The following definitions are needed under Windows, at least */ |
323 #ifndef X_OK | |
324 # define X_OK 1 | |
325 #endif | |
428 | 326 |
442 | 327 #ifndef R_OK |
328 # define R_OK 4 | |
329 #endif | |
330 | |
771 | 331 #ifndef D_OK |
332 # define D_OK 8 | |
333 #endif | |
334 | |
442 | 335 #ifndef W_OK |
336 # define W_OK 2 | |
337 #endif | |
338 | |
339 #ifndef F_OK | |
340 # define F_OK 0 | |
428 | 341 #endif |
342 | |
343 #ifndef FD_CLOEXEC | |
344 # define FD_CLOEXEC 1 | |
345 #endif | |
346 | |
771 | 347 #ifdef emacs |
348 | |
428 | 349 /* Emacs needs to use its own definitions of certain system calls on |
350 some systems (like SunOS 4.1 and USG systems, where the read system | |
351 call is interruptible but Emacs expects it not to be; and under | |
352 MULE, where all filenames need to be converted to external format). | |
353 | |
771 | 354 We used to play preprocessor games, but in the long run that just leads |
355 you to ruin. So we explicitly put in the new calls, even if the source | |
356 gets marginally less pretty. | |
428 | 357 |
771 | 358 Current files where we don't use retry_ or qxe_ versions: |
428 | 359 |
771 | 360 -- all sound files except ntplay.c (includes esd.c libsst.[ch] libst.h |
361 linuxplay.c sgiplay.c sunplay.c | |
362 hpplay.c nas.c) | |
363 -- all unex* files | |
364 -- lib-src files | |
365 */ | |
428 | 366 |
771 | 367 ssize_t retry_read (int, void *, size_t); |
368 ssize_t retry_write (int, const void *, size_t); | |
369 int retry_open (const Extbyte *path, int oflag, ...); | |
867 | 370 int qxe_open (const Ibyte *path, int oflag, ...); |
371 int qxe_interruptible_open (const Ibyte *path, int oflag, int mode); | |
771 | 372 int retry_close (int); |
373 Bytecount read_allowing_quit (int fildes, void *buf, Bytecount size); | |
374 Bytecount write_allowing_quit (int fildes, const void *buf, | |
375 Bytecount size); | |
428 | 376 |
377 /* Now the stdio versions ... */ | |
378 | |
771 | 379 size_t retry_fread (void *, size_t, size_t, FILE *); |
380 size_t retry_fwrite (const void *, size_t, size_t, FILE *); | |
2367 | 381 FILE *retry_fopen (const Extbyte *path, const Ascbyte *mode); |
382 FILE *qxe_fopen (const Ibyte *path, const Ascbyte *mode); | |
771 | 383 int retry_fclose (FILE *); |
428 | 384 |
385 /* encapsulations: file-information calls */ | |
386 | |
867 | 387 int qxe_access (const Ibyte *path, int mode); |
388 int qxe_eaccess (const Ibyte *path, int mode); | |
389 int qxe_lstat (const Ibyte *path, struct stat *buf); | |
390 int qxe_readlink (const Ibyte *path, Ibyte *buf, size_t bufsiz); | |
771 | 391 int qxe_fstat (int fd, struct stat *buf); |
867 | 392 int qxe_stat (const Ibyte *path, struct stat *buf); |
2526 | 393 Ibyte *qxe_realpath (const Ibyte *path, Ibyte resolved_path [], |
394 Boolint links_only); | |
428 | 395 |
396 /* encapsulations: file-manipulation calls */ | |
397 | |
867 | 398 int qxe_chmod (const Ibyte *path, mode_t mode); |
771 | 399 |
400 #if defined (HAVE_LINK) | |
3025 | 401 int qxe_link (const Ibyte *existing, const Ibyte *new_); |
771 | 402 #endif /* defined (HAVE_LINK) */ |
403 | |
3025 | 404 int qxe_rename (const Ibyte *old, const Ibyte *new_); |
771 | 405 |
406 #if defined (HAVE_SYMLINK) | |
867 | 407 int qxe_symlink (const Ibyte *name1, const Ibyte *name2); |
771 | 408 #endif /* defined (HAVE_SYMLINK) */ |
409 | |
867 | 410 int qxe_unlink (const Ibyte *path); |
771 | 411 |
1467 | 412 /* definition in filemode.c |
413 must be declared here to ensure that struct stat is properly formed | |
414 on systems like SCO 3.2v5 */ | |
415 void filemodestring (struct stat *, char *); | |
416 | |
2526 | 417 #ifdef WIN32_ANY |
418 extern int mswindows_shortcuts_are_symlinks; | |
419 #endif | |
420 | |
771 | 421 #endif /* emacs */ |
422 | |
423 | |
424 #ifndef HAVE_H_ERRNO | |
425 extern int h_errno; | |
428 | 426 #endif |
427 | |
771 | 428 #ifndef HAVE_DUP2 |
429 int dup2 (int oldd, int newd); | |
428 | 430 #endif |
431 | |
771 | 432 #ifndef HAVE_STRERROR |
433 /* X11R6 defines strerror as a macro */ | |
434 # ifdef strerror | |
435 # undef strerror | |
436 # endif | |
437 const char *strerror (int); | |
428 | 438 #endif |
439 | |
771 | 440 |
441 | |
442 /* | |
443 DEFAULT_DIRECTORY_SEP is the default value of Vdirectory_sep_char. | |
444 DIRECTORY_SEP is the currently preferred separator between elements | |
445 of a path, when paths are canonicalized. | |
446 DEVICE_SEP is the separator between devices and paths (might not | |
447 be defined). | |
448 SEPCHAR is the separator between paths in a path search string | |
449 (e.g. the PATH environment variable). | |
450 IS_DIRECTORY_SEP() returns true if the character is any directory | |
451 separator (there might be more than one allowed on a system.). | |
452 IS_DEVICE_SEP() returns true if the character is a device separator. | |
453 IS_ANY_SEP() returns true if the character is a directory or device | |
454 separator. | |
455 */ | |
456 | |
457 /* We used to put some of this stuff in the s+m files for the various | |
458 types of MS Windows, but that's disingenuous. The various definitions | |
459 above were specifically created for MS Windows, and the "if not, then | |
460 let's define the defaults" stuff (formerly in lisp.h) specifically knows | |
461 about what is going to get redefined and how, and code all over the | |
462 place that works with filenames has to conditionalize on WIN32_NATIVE | |
463 anyway. It's much clearer if we put all related definitions in one | |
464 place. (In fact, I discovered a number of bugs in the process.) | |
465 | |
466 S+M files should be used for simple on-off or multiple-choice settings, | |
467 or possibly string settings. Anything that gets to the level of | |
468 programming should be elsewhere, and anything that ends up having | |
469 lots of complicated interactions scattered around in many files should | |
470 be consolidated. */ | |
471 | |
472 #ifdef WIN32_NATIVE | |
473 | |
474 #define SEPCHAR ';' | |
475 #define DEFAULT_DIRECTORY_SEP '\\' | |
428 | 476 |
3379 | 477 #ifdef emacs |
867 | 478 DECLARE_INLINE_HEADER (Ibyte sysfile_get_directory_sep (void)) |
771 | 479 { |
480 if (!CHARP (Vdirectory_sep_char) | |
481 || (XCHAR (Vdirectory_sep_char) != '/' | |
482 && XCHAR (Vdirectory_sep_char) != '\\')) | |
483 { | |
484 warn_when_safe | |
485 (Qfile_name, Qerror, | |
486 "`directory-sep-char' set to invalid %s: resetting to %c.", | |
487 DEFAULT_DIRECTORY_SEP); | |
488 Vdirectory_sep_char = make_char (DEFAULT_DIRECTORY_SEP); | |
489 } | |
490 | |
491 return XCHAR (Vdirectory_sep_char); | |
492 } | |
493 #define DIRECTORY_SEP sysfile_get_directory_sep() | |
494 | |
4736
d261888e5069
Fix Win32 native build after my DEFAULT_DIRECTORY_FALLBACK change, thanks Vin!
Aidan Kehoe <kehoea@parhasard.net>
parents:
4733
diff
changeset
|
495 #define DEFAULT_DIRECTORY_FALLBACK ((const CIbyte *)"C:\\") |
d261888e5069
Fix Win32 native build after my DEFAULT_DIRECTORY_FALLBACK change, thanks Vin!
Aidan Kehoe <kehoea@parhasard.net>
parents:
4733
diff
changeset
|
496 |
d261888e5069
Fix Win32 native build after my DEFAULT_DIRECTORY_FALLBACK change, thanks Vin!
Aidan Kehoe <kehoea@parhasard.net>
parents:
4733
diff
changeset
|
497 #else /* not emacs */ |
3379 | 498 |
499 /* The above Lisp variables are not available to make-docfile, etc. */ | |
500 #define DIRECTORY_SEP DEFAULT_DIRECTORY_SEP | |
501 | |
502 #endif /* emacs */ | |
503 | |
771 | 504 #else /* not WIN32_NATIVE */ |
505 | |
506 #define SEPCHAR ':' | |
507 #define DEFAULT_DIRECTORY_SEP '/' | |
508 #define DIRECTORY_SEP '/' | |
4736
d261888e5069
Fix Win32 native build after my DEFAULT_DIRECTORY_FALLBACK change, thanks Vin!
Aidan Kehoe <kehoea@parhasard.net>
parents:
4733
diff
changeset
|
509 #define DEFAULT_DIRECTORY_FALLBACK ((const CIbyte *)"/") |
771 | 510 |
511 #endif /* WIN32_NATIVE */ | |
512 | |
428 | 513 |
1315 | 514 #ifdef WIN32_ANY |
771 | 515 |
516 #define DEVICE_SEP ':' | |
517 | |
518 #define IS_DEVICE_SEP(c) ((c) == DEVICE_SEP) | |
519 | |
3379 | 520 #ifdef emacs |
521 | |
867 | 522 DECLARE_INLINE_HEADER (int IS_DIRECTORY_SEP (Ichar c)) |
771 | 523 { |
524 return (c == '/' || c == '\\'); | |
525 } | |
526 | |
867 | 527 DECLARE_INLINE_HEADER (int IS_ANY_SEP (Ichar c)) |
771 | 528 { |
529 return (c == '/' || c == '\\' || c == ':'); | |
530 } | |
531 | |
3379 | 532 #else /* emacs */ |
533 | |
534 /* The Ichar typedef is not available to make-docfile, etc. */ | |
535 | |
536 DECLARE_INLINE_HEADER (int IS_DIRECTORY_SEP (int c)) | |
537 { | |
538 return (c == '/' || c == '\\'); | |
539 } | |
540 | |
541 DECLARE_INLINE_HEADER (int IS_ANY_SEP (int c)) | |
542 { | |
543 return (c == '/' || c == '\\' || c == ':'); | |
544 } | |
545 | |
546 #endif | |
547 | |
1315 | 548 #else /* not WIN32_ANY */ |
771 | 549 |
550 #define IS_DEVICE_SEP(c) 0 | |
551 #define IS_DIRECTORY_SEP(c) ((c) == DIRECTORY_SEP) | |
552 #define IS_ANY_SEP(c) IS_DIRECTORY_SEP (c) | |
553 | |
1315 | 554 #endif /* WIN32_ANY */ |
771 | 555 |
3368 | 556 /* How long can a source filename be in DOC (including "\037S" at the start |
557 and "\n" at the end) ? */ | |
558 #define DOC_MAX_FILENAME_LENGTH 2048 | |
559 | |
560 #ifdef emacs | |
561 | |
2526 | 562 #if defined (WIN32_NATIVE) |
563 #define PATHNAME_RESOLVE_LINKS(path, pathout) \ | |
564 do \ | |
565 { \ | |
566 if (mswindows_shortcuts_are_symlinks) \ | |
567 { \ | |
568 Ibyte *_prl_path_ = (Ibyte *) (path); \ | |
569 Ibyte _prl_path2_[PATH_MAX_INTERNAL]; \ | |
570 \ | |
571 if (!qxe_realpath (_prl_path_, _prl_path2_, 1)) \ | |
572 (pathout) = _prl_path_; \ | |
573 else \ | |
574 IBYTE_STRING_TO_ALLOCA (_prl_path2_, pathout); \ | |
575 } \ | |
576 else (pathout) = (Ibyte *) (path); \ | |
577 } while (0) | |
578 #else | |
579 #define PATHNAME_RESOLVE_LINKS(path, pathout) ((pathout) = (Ibyte *) (path)) | |
580 #endif | |
581 | |
582 #define LISP_PATHNAME_RESOLVE_LINKS(path, pathout) \ | |
583 PATHNAME_RESOLVE_LINKS (XSTRING_DATA (path), pathout) | |
584 | |
585 /* The documentation in VC++ claims that the pathname library functions | |
586 accept strings in the current locale-specific encoding, but that's | |
587 false, because they just call the native Win32 routines directly, which | |
588 always use the system-default encoding (which is what Qmswindows_tstr | |
589 will give us when not XEUNICODE_P). */ | |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4759
diff
changeset
|
590 #define PATHNAME_CONVERT_OUT_TSTR(path, pathout) \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4759
diff
changeset
|
591 do \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4759
diff
changeset
|
592 { \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4759
diff
changeset
|
593 const Ibyte *_pco_path_; \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4759
diff
changeset
|
594 PATHNAME_RESOLVE_LINKS (path, _pco_path_); \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4759
diff
changeset
|
595 C_STRING_TO_TSTR (_pco_path_, pathout); \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4759
diff
changeset
|
596 } while (0) |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4759
diff
changeset
|
597 |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4759
diff
changeset
|
598 #define PATHNAME_CONVERT_OUT_UTF_8(path, pathout) \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4759
diff
changeset
|
599 do \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4759
diff
changeset
|
600 { \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4759
diff
changeset
|
601 const Ibyte *_pco_path_; \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4759
diff
changeset
|
602 PATHNAME_RESOLVE_LINKS (path, _pco_path_); \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4759
diff
changeset
|
603 C_STRING_TO_EXTERNAL (_pco_path_, pathout, Qutf_8); \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4759
diff
changeset
|
604 } while (0) |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4759
diff
changeset
|
605 |
2526 | 606 #ifdef WIN32_NATIVE |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4759
diff
changeset
|
607 #define PATHNAME_CONVERT_OUT(path, pathout) \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4759
diff
changeset
|
608 PATHNAME_CONVERT_OUT_TSTR (path, pathout) |
2526 | 609 #else |
610 # define PATHNAME_CONVERT_OUT(path, pathout) \ | |
611 C_STRING_TO_EXTERNAL (path, pathout, Qfile_name) | |
612 #endif | |
613 | |
614 #define LISP_PATHNAME_CONVERT_OUT(path, pathout) \ | |
615 PATHNAME_CONVERT_OUT (XSTRING_DATA (path), pathout) | |
616 | |
771 | 617 #endif /* emacs */ |
618 | |
440 | 619 #endif /* INCLUDED_sysfile_h_ */ |