Mercurial > hg > xemacs-beta
annotate src/sysfile.h @ 4742:4cf435fcebbc
Make #'letf not error if handed a #'values form.
lisp/ChangeLog addition:
2009-11-14 Aidan Kehoe <kehoea@parhasard.net>
* cl-macs.el (letf):
Check whether arguments to #'values are bound, and make them
unbound after evaluating BODY; document the limitations of this
macro.
tests/ChangeLog addition:
2009-11-14 Aidan Kehoe <kehoea@parhasard.net>
* automated/lisp-tests.el:
Don't call Known-Bug-Expect-Failure now that the particular letf
bug it tickled is fixed.
| author | Aidan Kehoe <kehoea@parhasard.net> |
|---|---|
| date | Sat, 14 Nov 2009 11:43:09 +0000 |
| parents | d261888e5069 |
| children | aa5ed11f473b |
| 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 |
| 89 #ifndef STDERR_FILENO | |
| 90 #define STDIN_FILENO 0 | |
| 91 #define STDOUT_FILENO 1 | |
| 92 #define STDERR_FILENO 2 | |
| 93 #endif | |
| 94 | |
| 95 #ifndef O_RDONLY | |
| 96 #define O_RDONLY 0 | |
| 97 #endif | |
| 98 | |
| 99 #ifndef O_WRONLY | |
| 100 #define O_WRONLY 1 | |
| 101 #endif | |
| 102 | |
| 103 #ifndef O_RDWR | |
| 104 #define O_RDWR 2 | |
| 105 #endif | |
| 106 | |
| 107 /* file opening defaults */ | |
| 108 #ifndef OPEN_BINARY | |
| 109 #ifdef O_BINARY | |
| 110 #define OPEN_BINARY O_BINARY | |
| 111 #else | |
| 112 #define OPEN_BINARY (0) | |
| 113 #endif | |
| 114 #endif | |
| 115 | |
| 116 #ifndef OPEN_TEXT | |
| 117 #ifdef O_TEXT | |
| 118 #define OPEN_TEXT O_TEXT | |
| 119 #else | |
| 120 #define OPEN_TEXT (0) | |
| 121 #endif | |
| 122 #endif | |
| 123 | |
| 124 #ifndef CREAT_MODE | |
| 442 | 125 #ifdef WIN32_NATIVE |
| 428 | 126 #define CREAT_MODE (S_IREAD | S_IWRITE) |
| 127 #else | |
| 128 #define CREAT_MODE (0666) | |
| 129 #endif | |
| 130 #endif | |
| 131 | |
| 132 #ifndef READ_TEXT | |
| 133 #ifdef O_TEXT | |
| 134 #define READ_TEXT "rt" | |
| 135 #else | |
| 136 #define READ_TEXT "r" | |
| 137 #endif | |
| 138 #endif | |
| 139 | |
| 140 #ifndef READ_BINARY | |
| 141 #ifdef O_BINARY | |
| 142 #define READ_BINARY "rb" | |
| 143 #else | |
| 144 #define READ_BINARY "r" | |
| 145 #endif | |
| 146 #endif | |
| 147 | |
| 442 | 148 #ifndef READ_PLUS_TEXT |
| 149 #ifdef O_TEXT | |
| 150 #define READ_PLUS_TEXT "r+t" | |
| 151 #else | |
| 152 #define READ_PLUS_TEXT "r+" | |
| 153 #endif | |
| 154 #endif | |
| 155 | |
| 156 #ifndef READ_PLUS_BINARY | |
| 157 #ifdef O_BINARY | |
| 158 #define READ_PLUS_BINARY "r+b" | |
| 159 #else | |
| 160 #define READ_PLUS_BINARY "r+" | |
| 161 #endif | |
| 162 #endif | |
| 163 | |
| 164 #ifndef WRITE_TEXT | |
| 165 #ifdef O_TEXT | |
| 166 #define WRITE_TEXT "wt" | |
| 167 #else | |
| 168 #define WRITE_TEXT "w" | |
| 169 #endif | |
| 170 #endif | |
| 171 | |
| 428 | 172 #ifndef WRITE_BINARY |
| 173 #ifdef O_BINARY | |
| 174 #define WRITE_BINARY "wb" | |
| 175 #else | |
| 176 #define WRITE_BINARY "w" | |
| 177 #endif | |
| 178 #endif | |
| 179 | |
| 771 | 180 #ifndef APPEND_TEXT |
| 181 #ifdef O_TEXT | |
| 182 #define APPEND_TEXT "at" | |
| 183 #else | |
| 184 #define APPEND_TEXT "a" | |
| 185 #endif | |
| 186 #endif | |
| 187 | |
| 188 #ifndef APPEND_BINARY | |
| 189 #ifdef O_BINARY | |
| 190 #define APPEND_BINARY "ab" | |
| 191 #else | |
| 192 #define APPEND_BINARY "a" | |
| 193 #endif | |
| 194 #endif | |
| 195 | |
| 428 | 196 #ifndef O_NONBLOCK |
| 197 #ifdef O_NDELAY | |
| 198 #define O_NONBLOCK O_NDELAY | |
| 199 #else | |
| 200 #define O_NONBLOCK 04000 | |
| 201 #endif | |
| 202 #endif | |
| 203 | |
| 204 #if !S_IRUSR | |
| 205 # if S_IREAD | |
| 206 # define S_IRUSR S_IREAD | |
| 207 # else | |
| 208 # define S_IRUSR 00400 | |
| 209 # endif | |
| 210 #endif | |
| 211 | |
| 212 #if !S_IWUSR | |
| 213 # if S_IWRITE | |
| 214 # define S_IWUSR S_IWRITE | |
| 215 # else | |
| 216 # define S_IWUSR 00200 | |
| 217 # endif | |
| 218 #endif | |
| 219 | |
| 220 #if !S_IXUSR | |
| 221 # if S_IEXEC | |
| 222 # define S_IXUSR S_IEXEC | |
| 223 # else | |
| 224 # define S_IXUSR 00100 | |
| 225 # endif | |
| 226 #endif | |
| 227 | |
| 228 #ifdef STAT_MACROS_BROKEN | |
| 229 #undef S_ISBLK | |
| 230 #undef S_ISCHR | |
| 231 #undef S_ISDIR | |
| 232 #undef S_ISFIFO | |
| 233 #undef S_ISLNK | |
| 234 #undef S_ISMPB | |
| 235 #undef S_ISMPC | |
| 236 #undef S_ISNWK | |
| 237 #undef S_ISREG | |
| 238 #undef S_ISSOCK | |
| 239 #endif /* STAT_MACROS_BROKEN. */ | |
| 240 | |
| 2526 | 241 #ifdef WIN32_NATIVE |
| 242 /* This is the standard value for S_IFLNK. All of the S_... flags that | |
| 243 exist in the MSVCRT have standard values, so their bit tests will | |
| 244 magically work. */ | |
| 245 #define S_IFLNK 0120000 | |
| 246 #endif | |
| 247 | |
| 428 | 248 #if !defined(S_ISBLK) && defined(S_IFBLK) |
| 249 #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) | |
| 250 #endif | |
| 251 #if !defined(S_ISCHR) && defined(S_IFCHR) | |
| 252 #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) | |
| 253 #endif | |
| 254 #if !defined(S_ISDIR) && defined(S_IFDIR) | |
| 255 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) | |
| 256 #endif | |
| 257 #if !defined(S_ISREG) && defined(S_IFREG) | |
| 258 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) | |
| 259 #endif | |
| 260 #if !defined(S_ISFIFO) && defined(S_IFIFO) | |
| 261 #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) | |
| 262 #endif | |
| 263 #if !defined(S_ISLNK) && defined(S_IFLNK) | |
| 264 #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) | |
| 265 #endif | |
| 266 #if !defined(S_ISSOCK) && defined(S_IFSOCK) | |
| 267 #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) | |
| 268 #endif | |
| 269 #if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */ | |
| 270 #define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB) | |
| 271 #define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC) | |
| 272 #endif | |
| 273 #if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */ | |
| 274 #define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK) | |
| 275 #endif | |
| 276 | |
| 2421 | 277 /* Determining the maximum pathname length. |
| 278 | |
| 279 NOTE: IN GENERAL, YOU SHOULD NOT USE THIS. | |
| 280 If at all possible, avoid using fixed-length buffers of any sort. | |
| 281 You cannot guarantee on many systems that pathnames won't exceed | |
| 282 these limits for one reason or another. | |
| 283 | |
| 284 Unfortunately, there is no universal agreement over whether these | |
| 285 values should include a final null-terminator or not. Even recent | |
| 286 versions of Linux (circa 2002) are switching from the not-including- | |
| 287 terminator kind to the including-terminator kind. So we assume that | |
| 288 the including-terminator kind will be even (usually is), and round | |
| 289 up as necessary. */ | |
| 290 | |
| 291 #define ROUND_UP_TO_EVEN_NUMBER(val) (((val + 1) >> 1) << 1) | |
| 292 #ifdef PATH_MAX | |
| 293 # define QXE_PATH_MAX ROUND_UP_TO_EVEN_NUMBER (PATH_MAX) | |
| 294 #elif defined (_MAX_PATH) | |
| 558 | 295 /* MS Win -- and preferable to _POSIX_PATH_MAX, which is also defined */ |
| 2421 | 296 # define QXE_PATH_MAX ROUND_UP_TO_EVEN_NUMBER (_MAX_PATH) |
| 297 #elif defined (_POSIX_PATH_MAX) | |
| 298 # define QXE_PATH_MAX ROUND_UP_TO_EVEN_NUMBER (_POSIX_PATH_MAX) | |
| 299 #elif defined (MAXPATHLEN) | |
| 300 # define QXE_PATH_MAX ROUND_UP_TO_EVEN_NUMBER (MAXPATHLEN) | |
| 301 #else | |
| 302 # define QXE_PATH_MAX 1024 | |
| 442 | 303 #endif |
| 304 | |
| 2421 | 305 /* Client .c files should use PATH_MAX_INTERNAL or PATH_MAX_EXTERNAL |
| 306 if they must use either one at all. */ | |
| 307 | |
| 308 /* Use for internally formatted text, which can potentially have up to | |
| 309 four bytes per character */ | |
| 310 #define PATH_MAX_INTERNAL (QXE_PATH_MAX * MAX_ICHAR_LEN) | |
| 311 /* Use for externally formatted text. */ | |
| 312 #define PATH_MAX_EXTERNAL (QXE_PATH_MAX * MAX_XETCHAR_SIZE) | |
| 313 | |
| 442 | 314 /* The following definitions are needed under Windows, at least */ |
| 315 #ifndef X_OK | |
| 316 # define X_OK 1 | |
| 317 #endif | |
| 428 | 318 |
| 442 | 319 #ifndef R_OK |
| 320 # define R_OK 4 | |
| 321 #endif | |
| 322 | |
| 771 | 323 #ifndef D_OK |
| 324 # define D_OK 8 | |
| 325 #endif | |
| 326 | |
| 442 | 327 #ifndef W_OK |
| 328 # define W_OK 2 | |
| 329 #endif | |
| 330 | |
| 331 #ifndef F_OK | |
| 332 # define F_OK 0 | |
| 428 | 333 #endif |
| 334 | |
| 335 #ifndef FD_CLOEXEC | |
| 336 # define FD_CLOEXEC 1 | |
| 337 #endif | |
| 338 | |
| 771 | 339 #ifdef emacs |
| 340 | |
| 428 | 341 /* Emacs needs to use its own definitions of certain system calls on |
| 342 some systems (like SunOS 4.1 and USG systems, where the read system | |
| 343 call is interruptible but Emacs expects it not to be; and under | |
| 344 MULE, where all filenames need to be converted to external format). | |
| 345 | |
| 771 | 346 We used to play preprocessor games, but in the long run that just leads |
| 347 you to ruin. So we explicitly put in the new calls, even if the source | |
| 348 gets marginally less pretty. | |
| 428 | 349 |
| 771 | 350 Current files where we don't use retry_ or qxe_ versions: |
| 428 | 351 |
| 771 | 352 -- all sound files except ntplay.c (includes esd.c libsst.[ch] libst.h |
| 353 linuxplay.c sgiplay.c sunplay.c | |
| 354 hpplay.c nas.c) | |
| 355 -- all unex* files | |
| 356 -- hftctl.c | |
| 357 -- lib-src files | |
| 358 */ | |
| 428 | 359 |
| 771 | 360 ssize_t retry_read (int, void *, size_t); |
| 361 ssize_t retry_write (int, const void *, size_t); | |
| 362 int retry_open (const Extbyte *path, int oflag, ...); | |
| 867 | 363 int qxe_open (const Ibyte *path, int oflag, ...); |
| 364 int qxe_interruptible_open (const Ibyte *path, int oflag, int mode); | |
| 771 | 365 int retry_close (int); |
| 366 Bytecount read_allowing_quit (int fildes, void *buf, Bytecount size); | |
| 367 Bytecount write_allowing_quit (int fildes, const void *buf, | |
| 368 Bytecount size); | |
| 428 | 369 |
| 370 /* Now the stdio versions ... */ | |
| 371 | |
| 771 | 372 size_t retry_fread (void *, size_t, size_t, FILE *); |
| 373 size_t retry_fwrite (const void *, size_t, size_t, FILE *); | |
| 2367 | 374 FILE *retry_fopen (const Extbyte *path, const Ascbyte *mode); |
| 375 FILE *qxe_fopen (const Ibyte *path, const Ascbyte *mode); | |
| 771 | 376 int retry_fclose (FILE *); |
| 428 | 377 |
| 378 /* encapsulations: file-information calls */ | |
| 379 | |
| 867 | 380 int qxe_access (const Ibyte *path, int mode); |
| 381 int qxe_eaccess (const Ibyte *path, int mode); | |
| 382 int qxe_lstat (const Ibyte *path, struct stat *buf); | |
| 383 int qxe_readlink (const Ibyte *path, Ibyte *buf, size_t bufsiz); | |
| 771 | 384 int qxe_fstat (int fd, struct stat *buf); |
| 867 | 385 int qxe_stat (const Ibyte *path, struct stat *buf); |
| 2526 | 386 Ibyte *qxe_realpath (const Ibyte *path, Ibyte resolved_path [], |
| 387 Boolint links_only); | |
| 428 | 388 |
| 389 /* encapsulations: file-manipulation calls */ | |
| 390 | |
| 867 | 391 int qxe_chmod (const Ibyte *path, mode_t mode); |
| 771 | 392 |
| 393 #if defined (HAVE_LINK) | |
| 3025 | 394 int qxe_link (const Ibyte *existing, const Ibyte *new_); |
| 771 | 395 #endif /* defined (HAVE_LINK) */ |
| 396 | |
| 3025 | 397 int qxe_rename (const Ibyte *old, const Ibyte *new_); |
| 771 | 398 |
| 399 #if defined (HAVE_SYMLINK) | |
| 867 | 400 int qxe_symlink (const Ibyte *name1, const Ibyte *name2); |
| 771 | 401 #endif /* defined (HAVE_SYMLINK) */ |
| 402 | |
| 867 | 403 int qxe_unlink (const Ibyte *path); |
| 771 | 404 |
| 1467 | 405 /* definition in filemode.c |
| 406 must be declared here to ensure that struct stat is properly formed | |
| 407 on systems like SCO 3.2v5 */ | |
| 408 void filemodestring (struct stat *, char *); | |
| 409 | |
| 2526 | 410 #ifdef WIN32_ANY |
| 411 extern int mswindows_shortcuts_are_symlinks; | |
| 412 #endif | |
| 413 | |
| 771 | 414 #endif /* emacs */ |
| 415 | |
| 416 | |
| 417 #ifndef HAVE_H_ERRNO | |
| 418 extern int h_errno; | |
| 428 | 419 #endif |
| 420 | |
| 771 | 421 #ifndef HAVE_DUP2 |
| 422 int dup2 (int oldd, int newd); | |
| 428 | 423 #endif |
| 424 | |
| 771 | 425 #ifndef HAVE_STRERROR |
| 426 /* X11R6 defines strerror as a macro */ | |
| 427 # ifdef strerror | |
| 428 # undef strerror | |
| 429 # endif | |
| 430 const char *strerror (int); | |
| 428 | 431 #endif |
| 432 | |
| 771 | 433 |
| 434 | |
| 435 /* | |
| 436 DEFAULT_DIRECTORY_SEP is the default value of Vdirectory_sep_char. | |
| 437 DIRECTORY_SEP is the currently preferred separator between elements | |
| 438 of a path, when paths are canonicalized. | |
| 439 DEVICE_SEP is the separator between devices and paths (might not | |
| 440 be defined). | |
| 441 SEPCHAR is the separator between paths in a path search string | |
| 442 (e.g. the PATH environment variable). | |
| 443 IS_DIRECTORY_SEP() returns true if the character is any directory | |
| 444 separator (there might be more than one allowed on a system.). | |
| 445 IS_DEVICE_SEP() returns true if the character is a device separator. | |
| 446 IS_ANY_SEP() returns true if the character is a directory or device | |
| 447 separator. | |
| 448 */ | |
| 449 | |
| 450 /* We used to put some of this stuff in the s+m files for the various | |
| 451 types of MS Windows, but that's disingenuous. The various definitions | |
| 452 above were specifically created for MS Windows, and the "if not, then | |
| 453 let's define the defaults" stuff (formerly in lisp.h) specifically knows | |
| 454 about what is going to get redefined and how, and code all over the | |
| 455 place that works with filenames has to conditionalize on WIN32_NATIVE | |
| 456 anyway. It's much clearer if we put all related definitions in one | |
| 457 place. (In fact, I discovered a number of bugs in the process.) | |
| 458 | |
| 459 S+M files should be used for simple on-off or multiple-choice settings, | |
| 460 or possibly string settings. Anything that gets to the level of | |
| 461 programming should be elsewhere, and anything that ends up having | |
| 462 lots of complicated interactions scattered around in many files should | |
| 463 be consolidated. */ | |
| 464 | |
| 465 #ifdef WIN32_NATIVE | |
| 466 | |
| 467 #define SEPCHAR ';' | |
| 468 #define DEFAULT_DIRECTORY_SEP '\\' | |
| 428 | 469 |
| 3379 | 470 #ifdef emacs |
| 867 | 471 DECLARE_INLINE_HEADER (Ibyte sysfile_get_directory_sep (void)) |
| 771 | 472 { |
| 473 if (!CHARP (Vdirectory_sep_char) | |
| 474 || (XCHAR (Vdirectory_sep_char) != '/' | |
| 475 && XCHAR (Vdirectory_sep_char) != '\\')) | |
| 476 { | |
| 477 warn_when_safe | |
| 478 (Qfile_name, Qerror, | |
| 479 "`directory-sep-char' set to invalid %s: resetting to %c.", | |
| 480 DEFAULT_DIRECTORY_SEP); | |
| 481 Vdirectory_sep_char = make_char (DEFAULT_DIRECTORY_SEP); | |
| 482 } | |
| 483 | |
| 484 return XCHAR (Vdirectory_sep_char); | |
| 485 } | |
| 486 #define DIRECTORY_SEP sysfile_get_directory_sep() | |
| 487 | |
|
4736
d261888e5069
Fix Win32 native build after my DEFAULT_DIRECTORY_FALLBACK change, thanks Vin!
Aidan Kehoe <kehoea@parhasard.net>
parents:
4733
diff
changeset
|
488 #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
|
489 |
|
d261888e5069
Fix Win32 native build after my DEFAULT_DIRECTORY_FALLBACK change, thanks Vin!
Aidan Kehoe <kehoea@parhasard.net>
parents:
4733
diff
changeset
|
490 #else /* not emacs */ |
| 3379 | 491 |
| 492 /* The above Lisp variables are not available to make-docfile, etc. */ | |
| 493 #define DIRECTORY_SEP DEFAULT_DIRECTORY_SEP | |
| 494 | |
| 495 #endif /* emacs */ | |
| 496 | |
| 771 | 497 #else /* not WIN32_NATIVE */ |
| 498 | |
| 499 #define SEPCHAR ':' | |
| 500 #define DEFAULT_DIRECTORY_SEP '/' | |
| 501 #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
|
502 #define DEFAULT_DIRECTORY_FALLBACK ((const CIbyte *)"/") |
| 771 | 503 |
| 504 #endif /* WIN32_NATIVE */ | |
| 505 | |
| 428 | 506 |
| 1315 | 507 #ifdef WIN32_ANY |
| 771 | 508 |
| 509 #define DEVICE_SEP ':' | |
| 510 | |
| 511 #define IS_DEVICE_SEP(c) ((c) == DEVICE_SEP) | |
| 512 | |
| 3379 | 513 #ifdef emacs |
| 514 | |
| 867 | 515 DECLARE_INLINE_HEADER (int IS_DIRECTORY_SEP (Ichar c)) |
| 771 | 516 { |
| 517 return (c == '/' || c == '\\'); | |
| 518 } | |
| 519 | |
| 867 | 520 DECLARE_INLINE_HEADER (int IS_ANY_SEP (Ichar c)) |
| 771 | 521 { |
| 522 return (c == '/' || c == '\\' || c == ':'); | |
| 523 } | |
| 524 | |
| 3379 | 525 #else /* emacs */ |
| 526 | |
| 527 /* The Ichar typedef is not available to make-docfile, etc. */ | |
| 528 | |
| 529 DECLARE_INLINE_HEADER (int IS_DIRECTORY_SEP (int c)) | |
| 530 { | |
| 531 return (c == '/' || c == '\\'); | |
| 532 } | |
| 533 | |
| 534 DECLARE_INLINE_HEADER (int IS_ANY_SEP (int c)) | |
| 535 { | |
| 536 return (c == '/' || c == '\\' || c == ':'); | |
| 537 } | |
| 538 | |
| 539 #endif | |
| 540 | |
| 1315 | 541 #else /* not WIN32_ANY */ |
| 771 | 542 |
| 543 #define IS_DEVICE_SEP(c) 0 | |
| 544 #define IS_DIRECTORY_SEP(c) ((c) == DIRECTORY_SEP) | |
| 545 #define IS_ANY_SEP(c) IS_DIRECTORY_SEP (c) | |
| 546 | |
| 1315 | 547 #endif /* WIN32_ANY */ |
| 771 | 548 |
| 3368 | 549 /* How long can a source filename be in DOC (including "\037S" at the start |
| 550 and "\n" at the end) ? */ | |
| 551 #define DOC_MAX_FILENAME_LENGTH 2048 | |
| 552 | |
| 553 #ifdef emacs | |
| 554 | |
| 2526 | 555 #if defined (WIN32_NATIVE) |
| 556 #define PATHNAME_RESOLVE_LINKS(path, pathout) \ | |
| 557 do \ | |
| 558 { \ | |
| 559 if (mswindows_shortcuts_are_symlinks) \ | |
| 560 { \ | |
| 561 Ibyte *_prl_path_ = (Ibyte *) (path); \ | |
| 562 Ibyte _prl_path2_[PATH_MAX_INTERNAL]; \ | |
| 563 \ | |
| 564 if (!qxe_realpath (_prl_path_, _prl_path2_, 1)) \ | |
| 565 (pathout) = _prl_path_; \ | |
| 566 else \ | |
| 567 IBYTE_STRING_TO_ALLOCA (_prl_path2_, pathout); \ | |
| 568 } \ | |
| 569 else (pathout) = (Ibyte *) (path); \ | |
| 570 } while (0) | |
| 571 #else | |
| 572 #define PATHNAME_RESOLVE_LINKS(path, pathout) ((pathout) = (Ibyte *) (path)) | |
| 573 #endif | |
| 574 | |
| 575 #define LISP_PATHNAME_RESOLVE_LINKS(path, pathout) \ | |
| 576 PATHNAME_RESOLVE_LINKS (XSTRING_DATA (path), pathout) | |
| 577 | |
| 578 /* The documentation in VC++ claims that the pathname library functions | |
| 579 accept strings in the current locale-specific encoding, but that's | |
| 580 false, because they just call the native Win32 routines directly, which | |
| 581 always use the system-default encoding (which is what Qmswindows_tstr | |
| 582 will give us when not XEUNICODE_P). */ | |
| 583 #ifdef WIN32_NATIVE | |
| 584 # define PATHNAME_CONVERT_OUT(path, pathout) \ | |
| 585 do \ | |
| 586 { \ | |
| 587 const Ibyte *_pco_path_; \ | |
| 588 PATHNAME_RESOLVE_LINKS (path, _pco_path_); \ | |
| 589 C_STRING_TO_TSTR (_pco_path_, pathout); \ | |
| 590 } while (0) | |
| 591 #else | |
| 592 # define PATHNAME_CONVERT_OUT(path, pathout) \ | |
| 593 C_STRING_TO_EXTERNAL (path, pathout, Qfile_name) | |
| 594 #endif | |
| 595 | |
| 596 #define LISP_PATHNAME_CONVERT_OUT(path, pathout) \ | |
| 597 PATHNAME_CONVERT_OUT (XSTRING_DATA (path), pathout) | |
| 598 | |
| 771 | 599 #endif /* emacs */ |
| 600 | |
| 440 | 601 #endif /* INCLUDED_sysfile_h_ */ |
