Mercurial > hg > CbC > CbC_gcc
annotate include/filenames.h @ 155:da32f4b04d38
fix __code name conflict
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 25 May 2020 17:51:46 +0900 |
parents | 1830386684a0 |
children |
rev | line source |
---|---|
0 | 1 /* Macros for taking apart, interpreting and processing file names. |
2 | |
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, | |
5 use forward- and back-slash in path names interchangeably, and | |
6 some of them have case-insensitive file names. | |
7 | |
145 | 8 Copyright (C) 2000-2020 Free Software Foundation, Inc. |
0 | 9 |
10 This file is part of BFD, the Binary File Descriptor library. | |
11 | |
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 | |
14 the Free Software Foundation; either version 2 of the License, or | |
15 (at your option) any later version. | |
16 | |
17 This program is distributed in the hope that it will be useful, | |
18 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 GNU General Public License for more details. | |
21 | |
22 You should have received a copy of the GNU General Public License | |
23 along with this program; if not, write to the Free Software | |
24 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ | |
25 | |
26 #ifndef FILENAMES_H | |
27 #define FILENAMES_H | |
28 | |
111 | 29 #include "hashtab.h" /* for hashval_t */ |
30 | |
0 | 31 #ifdef __cplusplus |
32 extern "C" { | |
33 #endif | |
34 | |
35 #if defined(__MSDOS__) || defined(_WIN32) || defined(__OS2__) || defined (__CYGWIN__) | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
36 # ifndef HAVE_DOS_BASED_FILE_SYSTEM |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
37 # define HAVE_DOS_BASED_FILE_SYSTEM 1 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
38 # endif |
111 | 39 # ifndef HAVE_CASE_INSENSITIVE_FILE_SYSTEM |
40 # define HAVE_CASE_INSENSITIVE_FILE_SYSTEM 1 | |
41 # endif | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
42 # define HAS_DRIVE_SPEC(f) HAS_DOS_DRIVE_SPEC (f) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
43 # define IS_DIR_SEPARATOR(c) IS_DOS_DIR_SEPARATOR (c) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
44 # define IS_ABSOLUTE_PATH(f) IS_DOS_ABSOLUTE_PATH (f) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
45 #else /* not DOSish */ |
111 | 46 # if defined(__APPLE__) |
47 # ifndef HAVE_CASE_INSENSITIVE_FILE_SYSTEM | |
48 # define HAVE_CASE_INSENSITIVE_FILE_SYSTEM 1 | |
49 # endif | |
50 # endif /* __APPLE__ */ | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
51 # define HAS_DRIVE_SPEC(f) (0) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
52 # define IS_DIR_SEPARATOR(c) IS_UNIX_DIR_SEPARATOR (c) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
53 # define IS_ABSOLUTE_PATH(f) IS_UNIX_ABSOLUTE_PATH (f) |
0 | 54 #endif |
55 | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
56 #define IS_DIR_SEPARATOR_1(dos_based, c) \ |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
57 (((c) == '/') \ |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
58 || (((c) == '\\') && (dos_based))) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
59 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
60 #define HAS_DRIVE_SPEC_1(dos_based, f) \ |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
61 ((f)[0] && ((f)[1] == ':') && (dos_based)) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
62 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
63 /* Remove the drive spec from F, assuming HAS_DRIVE_SPEC (f). |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
64 The result is a pointer to the remainder of F. */ |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
65 #define STRIP_DRIVE_SPEC(f) ((f) + 2) |
0 | 66 |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
67 #define IS_DOS_DIR_SEPARATOR(c) IS_DIR_SEPARATOR_1 (1, c) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
68 #define IS_DOS_ABSOLUTE_PATH(f) IS_ABSOLUTE_PATH_1 (1, f) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
69 #define HAS_DOS_DRIVE_SPEC(f) HAS_DRIVE_SPEC_1 (1, f) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
70 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
71 #define IS_UNIX_DIR_SEPARATOR(c) IS_DIR_SEPARATOR_1 (0, c) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
72 #define IS_UNIX_ABSOLUTE_PATH(f) IS_ABSOLUTE_PATH_1 (0, f) |
0 | 73 |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
74 /* Note that when DOS_BASED is true, IS_ABSOLUTE_PATH accepts d:foo as |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
75 well, although it is only semi-absolute. This is because the users |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
76 of IS_ABSOLUTE_PATH want to know whether to prepend the current |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
77 working directory to a file name, which should not be done with a |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
78 name like d:foo. */ |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
79 #define IS_ABSOLUTE_PATH_1(dos_based, f) \ |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
80 (IS_DIR_SEPARATOR_1 (dos_based, (f)[0]) \ |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
81 || HAS_DRIVE_SPEC_1 (dos_based, f)) |
0 | 82 |
83 extern int filename_cmp (const char *s1, const char *s2); | |
84 #define FILENAME_CMP(s1, s2) filename_cmp(s1, s2) | |
85 | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
86 extern int filename_ncmp (const char *s1, const char *s2, |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
87 size_t n); |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
88 |
111 | 89 extern hashval_t filename_hash (const void *s); |
90 | |
91 extern int filename_eq (const void *s1, const void *s2); | |
92 | |
93 extern int canonical_filename_eq (const char *a, const char *b); | |
94 | |
0 | 95 #ifdef __cplusplus |
96 } | |
97 #endif | |
98 | |
99 #endif /* FILENAMES_H */ |