Debian Codegraph @

const/inc.c

raw
1 #define PERL_constant_NOTFOUND 1
2 #define PERL_constant_NOTDEF 2
3 #define PERL_constant_ISIV 3
4 #define PERL_constant_ISNO 4
5 #define PERL_constant_ISNV 5
6 #define PERL_constant_ISPV 6
7 #define PERL_constant_ISPVN 7
8 #define PERL_constant_ISSV 8
9 #define PERL_constant_ISUNDEF 9
10 #define PERL_constant_ISUV 10
11 #define PERL_constant_ISYES 11
12
13 #ifndef NVTYPE
14 typedef double NV; /* 5.6 and later define NVTYPE, and typedef NV to it. */
15 #endif
16 #ifndef aTHX_
17 #define aTHX_ /* 5.6 or later define this for threading support. */
18 #endif
19 #ifndef pTHX_
20 #define pTHX_ /* 5.6 or later define this for threading support. */
21 #endif
22
23 static int
24 constant_11 (pTHX_ const char *name, IV *iv_return) {
25 /* When generated this function returned values for the list of names given
26 here. However, subsequent manual editing may have added or removed some.
27 MAGIC_CHECK MAGIC_DEBUG MAGIC_ERROR */
28 /* Offset 6 gives the best switch position. */
29 switch (name[6]) {
30 case 'C':
31 if (memEQ(name, "MAGIC_CHECK", 11)) {
32 /* ^ */
33 #ifdef MAGIC_CHECK
34 *iv_return = MAGIC_CHECK;
35 return PERL_constant_ISIV;
36 #else
37 return PERL_constant_NOTDEF;
38 #endif
39 }
40 break;
41 case 'D':
42 if (memEQ(name, "MAGIC_DEBUG", 11)) {
43 /* ^ */
44 #ifdef MAGIC_DEBUG
45 *iv_return = MAGIC_DEBUG;
46 return PERL_constant_ISIV;
47 #else
48 return PERL_constant_NOTDEF;
49 #endif
50 }
51 break;
52 case 'E':
53 if (memEQ(name, "MAGIC_ERROR", 11)) {
54 /* ^ */
55 #ifdef MAGIC_ERROR
56 *iv_return = MAGIC_ERROR;
57 return PERL_constant_ISIV;
58 #else
59 return PERL_constant_NOTDEF;
60 #endif
61 }
62 break;
63 }
64 return PERL_constant_NOTFOUND;
65 }
66
67 static int
68 constant_21 (pTHX_ const char *name, IV *iv_return) {
69 /* When generated this function returned values for the list of names given
70 here. However, subsequent manual editing may have added or removed some.
71 MAGIC_PARAM_BYTES_MAX MAGIC_PARAM_INDIR_MAX MAGIC_PARAM_REGEX_MAX */
72 /* Offset 16 gives the best switch position. */
73 switch (name[16]) {
74 case 'R':
75 if (memEQ(name, "MAGIC_PARAM_INDIR_MAX", 21)) {
76 /* ^ */
77 #ifdef MAGIC_PARAM_INDIR_MAX
78 *iv_return = MAGIC_PARAM_INDIR_MAX;
79 return PERL_constant_ISIV;
80 #else
81 return PERL_constant_NOTDEF;
82 #endif
83 }
84 break;
85 case 'S':
86 if (memEQ(name, "MAGIC_PARAM_BYTES_MAX", 21)) {
87 /* ^ */
88 #ifdef MAGIC_PARAM_BYTES_MAX
89 *iv_return = MAGIC_PARAM_BYTES_MAX;
90 return PERL_constant_ISIV;
91 #else
92 return PERL_constant_NOTDEF;
93 #endif
94 }
95 break;
96 case 'X':
97 if (memEQ(name, "MAGIC_PARAM_REGEX_MAX", 21)) {
98 /* ^ */
99 #ifdef MAGIC_PARAM_REGEX_MAX
100 *iv_return = MAGIC_PARAM_REGEX_MAX;
101 return PERL_constant_ISIV;
102 #else
103 return PERL_constant_NOTDEF;
104 #endif
105 }
106 break;
107 }
108 return PERL_constant_NOTFOUND;
109 }
110
111 static int
112 constant_25 (pTHX_ const char *name, IV *iv_return) {
113 /* When generated this function returned values for the list of names given
114 here. However, subsequent manual editing may have added or removed some.
115 MAGIC_PARAM_ELF_NOTES_MAX MAGIC_PARAM_ELF_PHNUM_MAX
116 MAGIC_PARAM_ELF_SHNUM_MAX */
117 /* Offset 16 gives the best switch position. */
118 switch (name[16]) {
119 case 'N':
120 if (memEQ(name, "MAGIC_PARAM_ELF_NOTES_MAX", 25)) {
121 /* ^ */
122 #ifdef MAGIC_PARAM_ELF_NOTES_MAX
123 *iv_return = MAGIC_PARAM_ELF_NOTES_MAX;
124 return PERL_constant_ISIV;
125 #else
126 return PERL_constant_NOTDEF;
127 #endif
128 }
129 break;
130 case 'P':
131 if (memEQ(name, "MAGIC_PARAM_ELF_PHNUM_MAX", 25)) {
132 /* ^ */
133 #ifdef MAGIC_PARAM_ELF_PHNUM_MAX
134 *iv_return = MAGIC_PARAM_ELF_PHNUM_MAX;
135 return PERL_constant_ISIV;
136 #else
137 return PERL_constant_NOTDEF;
138 #endif
139 }
140 break;
141 case 'S':
142 if (memEQ(name, "MAGIC_PARAM_ELF_SHNUM_MAX", 25)) {
143 /* ^ */
144 #ifdef MAGIC_PARAM_ELF_SHNUM_MAX
145 *iv_return = MAGIC_PARAM_ELF_SHNUM_MAX;
146 return PERL_constant_ISIV;
147 #else
148 return PERL_constant_NOTDEF;
149 #endif
150 }
151 break;
152 }
153 return PERL_constant_NOTFOUND;
154 }
155
156 static int
157 constant (pTHX_ const char *name, STRLEN len, IV *iv_return) {
158 /* Initially switch on the length of the name. */
159 /* When generated this function returned values for the list of names given
160 in this section of perl code. Rather than manually editing these functions
161 to add or remove constants, which would result in this comment and section
162 of code becoming inaccurate, we recommend that you edit this section of
163 code, and use it to regenerate a new set of constant functions which you
164 then use to replace the originals.
165
166 Regenerate these constant functions by feeding this entire source file to
167 perl -x
168
169 #!/home/autarch/perl5/perlbrew/perls/perl-5.30.1/bin/perl -w
170 use ExtUtils::Constant qw (constant_types C_constant XS_constant);
171
172 my $types = {map {($_, 1)} qw(IV)};
173 my @names = (qw(MAGIC_CHECK MAGIC_COMPRESS MAGIC_CONTINUE MAGIC_DEBUG
174 MAGIC_DEVICES MAGIC_ERROR MAGIC_MIME MAGIC_NONE
175 MAGIC_PARAM_BYTES_MAX MAGIC_PARAM_ELF_NOTES_MAX
176 MAGIC_PARAM_ELF_PHNUM_MAX MAGIC_PARAM_ELF_SHNUM_MAX
177 MAGIC_PARAM_INDIR_MAX MAGIC_PARAM_NAME_MAX MAGIC_PARAM_REGEX_MAX
178 MAGIC_PRESERVE_ATIME MAGIC_RAW MAGIC_SYMLINK));
179
180 print constant_types(), "\n"; # macro defs
181 foreach (C_constant ("File::LibMagic", 'constant', 'IV', $types, undef, 3, @names) ) {
182 print $_, "\n"; # C constant subs
183 }
184 print "\n#### XS Section:\n";
185 print XS_constant ("File::LibMagic", $types);
186 __END__
187 */
188
189 switch (len) {
190 case 9:
191 if (memEQ(name, "MAGIC_RAW", 9)) {
192 #ifdef MAGIC_RAW
193 *iv_return = MAGIC_RAW;
194 return PERL_constant_ISIV;
195 #else
196 return PERL_constant_NOTDEF;
197 #endif
198 }
199 break;
200 case 10:
201 /* Names all of length 10. */
202 /* MAGIC_MIME MAGIC_NONE */
203 /* Offset 6 gives the best switch position. */
204 switch (name[6]) {
205 case 'M':
206 if (memEQ(name, "MAGIC_MIME", 10)) {
207 /* ^ */
208 #ifdef MAGIC_MIME
209 *iv_return = MAGIC_MIME;
210 return PERL_constant_ISIV;
211 #else
212 return PERL_constant_NOTDEF;
213 #endif
214 }
215 break;
216 case 'N':
217 if (memEQ(name, "MAGIC_NONE", 10)) {
218 /* ^ */
219 #ifdef MAGIC_NONE
220 *iv_return = MAGIC_NONE;
221 return PERL_constant_ISIV;
222 #else
223 return PERL_constant_NOTDEF;
224 #endif
225 }
226 break;
227 }
228 break;
229 case 11:
230 return constant_11 (aTHX_ name, iv_return);
231 break;
232 case 13:
233 /* Names all of length 13. */
234 /* MAGIC_DEVICES MAGIC_SYMLINK */
235 /* Offset 9 gives the best switch position. */
236 switch (name[9]) {
237 case 'I':
238 if (memEQ(name, "MAGIC_DEVICES", 13)) {
239 /* ^ */
240 #ifdef MAGIC_DEVICES
241 *iv_return = MAGIC_DEVICES;
242 return PERL_constant_ISIV;
243 #else
244 return PERL_constant_NOTDEF;
245 #endif
246 }
247 break;
248 case 'L':
249 if (memEQ(name, "MAGIC_SYMLINK", 13)) {
250 /* ^ */
251 #ifdef MAGIC_SYMLINK
252 *iv_return = MAGIC_SYMLINK;
253 return PERL_constant_ISIV;
254 #else
255 return PERL_constant_NOTDEF;
256 #endif
257 }
258 break;
259 }
260 break;
261 case 14:
262 /* Names all of length 14. */
263 /* MAGIC_COMPRESS MAGIC_CONTINUE */
264 /* Offset 8 gives the best switch position. */
265 switch (name[8]) {
266 case 'M':
267 if (memEQ(name, "MAGIC_COMPRESS", 14)) {
268 /* ^ */
269 #ifdef MAGIC_COMPRESS
270 *iv_return = MAGIC_COMPRESS;
271 return PERL_constant_ISIV;
272 #else
273 return PERL_constant_NOTDEF;
274 #endif
275 }
276 break;
277 case 'N':
278 if (memEQ(name, "MAGIC_CONTINUE", 14)) {
279 /* ^ */
280 #ifdef MAGIC_CONTINUE
281 *iv_return = MAGIC_CONTINUE;
282 return PERL_constant_ISIV;
283 #else
284 return PERL_constant_NOTDEF;
285 #endif
286 }
287 break;
288 }
289 break;
290 case 20:
291 /* Names all of length 20. */
292 /* MAGIC_PARAM_NAME_MAX MAGIC_PRESERVE_ATIME */
293 /* Offset 13 gives the best switch position. */
294 switch (name[13]) {
295 case 'A':
296 if (memEQ(name, "MAGIC_PARAM_NAME_MAX", 20)) {
297 /* ^ */
298 #ifdef MAGIC_PARAM_NAME_MAX
299 *iv_return = MAGIC_PARAM_NAME_MAX;
300 return PERL_constant_ISIV;
301 #else
302 return PERL_constant_NOTDEF;
303 #endif
304 }
305 break;
306 case 'E':
307 if (memEQ(name, "MAGIC_PRESERVE_ATIME", 20)) {
308 /* ^ */
309 #ifdef MAGIC_PRESERVE_ATIME
310 *iv_return = MAGIC_PRESERVE_ATIME;
311 return PERL_constant_ISIV;
312 #else
313 return PERL_constant_NOTDEF;
314 #endif
315 }
316 break;
317 }
318 break;
319 case 21:
320 return constant_21 (aTHX_ name, iv_return);
321 break;
322 case 25:
323 return constant_25 (aTHX_ name, iv_return);
324 break;
325 }
326 return PERL_constant_NOTFOUND;
327 }
328