comparison include/filenames.h @ 63:b7f97abdc517 gcc-4.6-20100522

update gcc from gcc-4.5.0 to gcc-4.6
author ryoma <e075725@ie.u-ryukyu.ac.jp>
date Mon, 24 May 2010 12:47:05 +0900
parents a06113de4d67
children f6334be47118
comparison
equal deleted inserted replaced
56:3c8a44c06a95 63:b7f97abdc517
3 These are here because some non-Posix (a.k.a. DOSish) systems have 3 These are here because some non-Posix (a.k.a. DOSish) systems have
4 drive letter brain-damage at the beginning of an absolute file name, 4 drive letter brain-damage at the beginning of an absolute file name,
5 use forward- and back-slash in path names interchangeably, and 5 use forward- and back-slash in path names interchangeably, and
6 some of them have case-insensitive file names. 6 some of them have case-insensitive file names.
7 7
8 Copyright 2000, 2001, 2007 Free Software Foundation, Inc. 8 Copyright 2000, 2001, 2007, 2010 Free Software Foundation, Inc.
9 9
10 This file is part of BFD, the Binary File Descriptor library. 10 This file is part of BFD, the Binary File Descriptor library.
11 11
12 This program is free software; you can redistribute it and/or modify 12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by 13 it under the terms of the GNU General Public License as published by
29 #ifdef __cplusplus 29 #ifdef __cplusplus
30 extern "C" { 30 extern "C" {
31 #endif 31 #endif
32 32
33 #if defined(__MSDOS__) || defined(_WIN32) || defined(__OS2__) || defined (__CYGWIN__) 33 #if defined(__MSDOS__) || defined(_WIN32) || defined(__OS2__) || defined (__CYGWIN__)
34 34 # ifndef HAVE_DOS_BASED_FILE_SYSTEM
35 #ifndef HAVE_DOS_BASED_FILE_SYSTEM 35 # define HAVE_DOS_BASED_FILE_SYSTEM 1
36 #define HAVE_DOS_BASED_FILE_SYSTEM 1 36 # endif
37 # define HAS_DRIVE_SPEC(f) HAS_DOS_DRIVE_SPEC (f)
38 # define IS_DIR_SEPARATOR(c) IS_DOS_DIR_SEPARATOR (c)
39 # define IS_ABSOLUTE_PATH(f) IS_DOS_ABSOLUTE_PATH (f)
40 #else /* not DOSish */
41 # define HAS_DRIVE_SPEC(f) (0)
42 # define IS_DIR_SEPARATOR(c) IS_UNIX_DIR_SEPARATOR (c)
43 # define IS_ABSOLUTE_PATH(f) IS_UNIX_ABSOLUTE_PATH (f)
37 #endif 44 #endif
38 45
39 #define IS_DIR_SEPARATOR(c) ((c) == '/' || (c) == '\\') 46 #define IS_DIR_SEPARATOR_1(dos_based, c) \
40 /* Note that IS_ABSOLUTE_PATH accepts d:foo as well, although it is 47 (((c) == '/') \
41 only semi-absolute. This is because the users of IS_ABSOLUTE_PATH 48 || (((c) == '\\') && (dos_based)))
42 want to know whether to prepend the current working directory to
43 a file name, which should not be done with a name like d:foo. */
44 #define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0]) || (((f)[0]) && ((f)[1] == ':')))
45 49
46 #else /* not DOSish */ 50 #define HAS_DRIVE_SPEC_1(dos_based, f) \
51 ((f)[0] && ((f)[1] == ':') && (dos_based))
47 52
48 #define IS_DIR_SEPARATOR(c) ((c) == '/') 53 /* Remove the drive spec from F, assuming HAS_DRIVE_SPEC (f).
49 #define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0])) 54 The result is a pointer to the remainder of F. */
55 #define STRIP_DRIVE_SPEC(f) ((f) + 2)
50 56
51 #endif /* not DOSish */ 57 #define IS_DOS_DIR_SEPARATOR(c) IS_DIR_SEPARATOR_1 (1, c)
58 #define IS_DOS_ABSOLUTE_PATH(f) IS_ABSOLUTE_PATH_1 (1, f)
59 #define HAS_DOS_DRIVE_SPEC(f) HAS_DRIVE_SPEC_1 (1, f)
60
61 #define IS_UNIX_DIR_SEPARATOR(c) IS_DIR_SEPARATOR_1 (0, c)
62 #define IS_UNIX_ABSOLUTE_PATH(f) IS_ABSOLUTE_PATH_1 (0, f)
63
64 /* Note that when DOS_BASED is true, IS_ABSOLUTE_PATH accepts d:foo as
65 well, although it is only semi-absolute. This is because the users
66 of IS_ABSOLUTE_PATH want to know whether to prepend the current
67 working directory to a file name, which should not be done with a
68 name like d:foo. */
69 #define IS_ABSOLUTE_PATH_1(dos_based, f) \
70 (IS_DIR_SEPARATOR_1 (dos_based, (f)[0]) \
71 || HAS_DRIVE_SPEC_1 (dos_based, f))
52 72
53 extern int filename_cmp (const char *s1, const char *s2); 73 extern int filename_cmp (const char *s1, const char *s2);
54 #define FILENAME_CMP(s1, s2) filename_cmp(s1, s2) 74 #define FILENAME_CMP(s1, s2) filename_cmp(s1, s2)
55 75
56 #ifdef __cplusplus 76 #ifdef __cplusplus