]> git.ipfire.org Git - thirdparty/ccache.git/blob - src/envtoconfitems_lookup.c
Refactor conf item lookup code
[thirdparty/ccache.git] / src / envtoconfitems_lookup.c
1 /* ANSI-C code produced by gperf version 3.1 */
2 /* Command-line: gperf src/envtoconfitems.gperf */
3 /* Computed positions: -k'4-5' */
4
5 #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
6 && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
7 && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
8 && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
9 && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
10 && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
11 && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
12 && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
13 && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
14 && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
15 && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
16 && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
17 && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
18 && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
19 && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
20 && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
21 && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
22 && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
23 && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
24 && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
25 && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
26 && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
27 && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
28 /* The character set is not based on ISO-646. */
29 #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gperf@gnu.org>."
30 #endif
31
32 #line 9 "src/envtoconfitems.gperf"
33
34 #include "envtoconfitems.h"
35 #line 12 "src/envtoconfitems.gperf"
36 struct env_to_conf_item;
37 /* maximum key range = 52, duplicates = 0 */
38
39 #ifdef __GNUC__
40 __inline
41 #else
42 #ifdef __cplusplus
43 inline
44 #endif
45 #endif
46 static unsigned int
47 envtoconfitems_hash (register const char *str, register size_t len)
48 {
49 static const unsigned char asso_values[] =
50 {
51 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
52 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
53 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
54 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
55 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
56 0, 54, 54, 54, 54, 54, 54, 54, 54, 54,
57 54, 54, 54, 54, 54, 25, 10, 0, 0, 15,
58 10, 0, 5, 0, 54, 10, 35, 15, 0, 25,
59 0, 54, 15, 20, 0, 0, 15, 54, 54, 0,
60 54, 54, 54, 54, 54, 5, 54, 54, 54, 54,
61 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
62 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
63 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
64 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
65 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
66 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
67 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
68 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
69 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
70 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
71 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
72 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
73 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
74 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
75 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
76 54, 54, 54, 54, 54, 54
77 };
78 register unsigned int hval = len;
79
80 switch (hval)
81 {
82 default:
83 hval += asso_values[(unsigned char)str[4]];
84 /*FALLTHROUGH*/
85 case 4:
86 hval += asso_values[(unsigned char)str[3]];
87 /*FALLTHROUGH*/
88 case 3:
89 case 2:
90 break;
91 }
92 return hval;
93 }
94
95 const struct env_to_conf_item *
96 envtoconfitems_get (register const char *str, register size_t len)
97 {
98 enum
99 {
100 TOTAL_KEYWORDS = 34,
101 MIN_WORD_LENGTH = 2,
102 MAX_WORD_LENGTH = 15,
103 MIN_HASH_VALUE = 2,
104 MAX_HASH_VALUE = 53
105 };
106
107 static const struct env_to_conf_item wordlist[] =
108 {
109 {"",""}, {"",""},
110 #line 15 "src/envtoconfitems.gperf"
111 {"CC", "compiler"},
112 #line 22 "src/envtoconfitems.gperf"
113 {"DIR", "cache_dir"},
114 #line 20 "src/envtoconfitems.gperf"
115 {"CPP2", "run_second_cpp"},
116 #line 23 "src/envtoconfitems.gperf"
117 {"DEBUG", "debug"},
118 {"",""},
119 #line 45 "src/envtoconfitems.gperf"
120 {"TEMPDIR", "temporary_dir"},
121 #line 16 "src/envtoconfitems.gperf"
122 {"COMPILER", "compiler"},
123 #line 36 "src/envtoconfitems.gperf"
124 {"PATH", "path"},
125 #line 43 "src/envtoconfitems.gperf"
126 {"SLOPPINESS", "sloppiness"},
127 {"",""},
128 #line 29 "src/envtoconfitems.gperf"
129 {"HASHDIR", "hash_dir"},
130 #line 17 "src/envtoconfitems.gperf"
131 {"COMPILERCHECK", "compiler_check"},
132 #line 31 "src/envtoconfitems.gperf"
133 {"LIMIT_MULTIPLE", "limit_multiple"},
134 #line 47 "src/envtoconfitems.gperf"
135 {"UNIFY", "unify"},
136 #line 38 "src/envtoconfitems.gperf"
137 {"PREFIX", "prefix_command"},
138 #line 32 "src/envtoconfitems.gperf"
139 {"LOGFILE", "log_file"},
140 #line 33 "src/envtoconfitems.gperf"
141 {"MAXFILES", "max_files"},
142 {"",""},
143 #line 39 "src/envtoconfitems.gperf"
144 {"PREFIX_CPP", "prefix_command_cpp"},
145 #line 24 "src/envtoconfitems.gperf"
146 {"DIRECT", "direct_mode"},
147 #line 14 "src/envtoconfitems.gperf"
148 {"BASEDIR", "base_dir"},
149 #line 18 "src/envtoconfitems.gperf"
150 {"COMPRESS", "compression"},
151 #line 26 "src/envtoconfitems.gperf"
152 {"EXTENSION", "cpp_extension"},
153 #line 44 "src/envtoconfitems.gperf"
154 {"STATS", "stats"},
155 {"",""},
156 #line 34 "src/envtoconfitems.gperf"
157 {"MAXSIZE", "max_size"},
158 #line 19 "src/envtoconfitems.gperf"
159 {"COMPRESSLEVEL", "compression_level"},
160 {"",""},
161 #line 37 "src/envtoconfitems.gperf"
162 {"PCH_EXTSUM", "pch_external_checksum"},
163 {"",""},
164 #line 42 "src/envtoconfitems.gperf"
165 {"RECACHE", "recache"},
166 #line 40 "src/envtoconfitems.gperf"
167 {"READONLY", "read_only"},
168 {"",""},
169 #line 46 "src/envtoconfitems.gperf"
170 {"UMASK", "umask"},
171 {"",""},
172 #line 35 "src/envtoconfitems.gperf"
173 {"NLEVELS", "cache_dir_levels"},
174 #line 21 "src/envtoconfitems.gperf"
175 {"COMMENTS", "keep_comments_cpp"},
176 {"",""},
177 #line 41 "src/envtoconfitems.gperf"
178 {"READONLY_DIRECT", "read_only_direct"},
179 {"",""},
180 #line 25 "src/envtoconfitems.gperf"
181 {"DISABLE", "disable"},
182 #line 28 "src/envtoconfitems.gperf"
183 {"HARDLINK", "hard_link"},
184 {"",""}, {"",""}, {"",""}, {"",""}, {"",""}, {"",""},
185 #line 27 "src/envtoconfitems.gperf"
186 {"EXTRAFILES", "extra_files_to_hash"},
187 {"",""}, {"",""},
188 #line 30 "src/envtoconfitems.gperf"
189 {"IGNOREHEADERS", "ignore_headers_in_manifest"}
190 };
191
192 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
193 {
194 register unsigned int key = envtoconfitems_hash (str, len);
195
196 if (key <= MAX_HASH_VALUE)
197 {
198 register const char *s = wordlist[key].env_name;
199
200 if (*str == *s && !strcmp (str + 1, s + 1))
201 return &wordlist[key];
202 }
203 }
204 return 0;
205 }
206 size_t envtoconfitems_count(void) { return 34; }