diff options
author | David Walter Seikel | 2013-01-13 17:29:19 +1000 |
---|---|---|
committer | David Walter Seikel | 2013-01-13 17:29:19 +1000 |
commit | 07274513e984f0b5544586c74508ccd16e7dcafa (patch) | |
tree | b32ff2a9136fbc1a4a6a0ed1e4d79cde0f5f16d9 /libraries/edje/src/bin/epp/cpplib.h | |
parent | Added Irrlicht 1.8, but without all the Windows binaries. (diff) | |
download | SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.zip SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.gz SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.bz2 SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.xz |
Remove EFL, since it's been released now.
Diffstat (limited to '')
-rw-r--r-- | libraries/edje/src/bin/epp/cpplib.h | 641 |
1 files changed, 0 insertions, 641 deletions
diff --git a/libraries/edje/src/bin/epp/cpplib.h b/libraries/edje/src/bin/epp/cpplib.h deleted file mode 100644 index 5653dd2..0000000 --- a/libraries/edje/src/bin/epp/cpplib.h +++ /dev/null | |||
@@ -1,641 +0,0 @@ | |||
1 | /* Definitions for CPP library. | ||
2 | Copyright (C) 1995 Free Software Foundation, Inc. | ||
3 | Written by Per Bothner, 1994-95. | ||
4 | |||
5 | This program is free software; you can redistribute it and/or modify it | ||
6 | under the terms of the GNU General Public License as published by the | ||
7 | Free Software Foundation; either version 2, or (at your option) any | ||
8 | later version. | ||
9 | |||
10 | This program is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with this program; if not, write to the Free Software | ||
17 | Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | ||
18 | |||
19 | In other words, you are welcome to use, share and improve this program. | ||
20 | You are forbidden to forbid anyone else to use, share and improve | ||
21 | what you give them. Help stamp out software-hoarding! */ | ||
22 | |||
23 | #include <stdarg.h> | ||
24 | #include <sys/types.h> | ||
25 | #include <sys/stat.h> | ||
26 | |||
27 | #ifndef HOST_BITS_PER_WIDE_INT | ||
28 | |||
29 | #if HOST_BITS_PER_LONG > HOST_BITS_PER_INT | ||
30 | #define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONG | ||
31 | #define HOST_WIDE_INT long | ||
32 | #else | ||
33 | #define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_INT | ||
34 | #define HOST_WIDE_INT int | ||
35 | #endif | ||
36 | |||
37 | #endif | ||
38 | |||
39 | #define STATIC_BUFFERS | ||
40 | |||
41 | typedef struct cpp_reader cpp_reader; | ||
42 | typedef struct cpp_buffer cpp_buffer; | ||
43 | typedef struct cpp_options cpp_options; | ||
44 | |||
45 | enum cpp_token { | ||
46 | CPP_EOF = -1, | ||
47 | CPP_OTHER = 0, | ||
48 | CPP_COMMENT = 1, | ||
49 | CPP_HSPACE, | ||
50 | CPP_VSPACE, /* newlines and #line directives */ | ||
51 | CPP_NAME, | ||
52 | CPP_NUMBER, | ||
53 | CPP_CHAR, | ||
54 | CPP_STRING, | ||
55 | CPP_DIRECTIVE, | ||
56 | CPP_LPAREN, /* "(" */ | ||
57 | CPP_RPAREN, /* ")" */ | ||
58 | CPP_LBRACE, /* "{" */ | ||
59 | CPP_RBRACE, /* "}" */ | ||
60 | CPP_COMMA, /* "," */ | ||
61 | CPP_SEMICOLON, /* ";" */ | ||
62 | CPP_3DOTS, /* "..." */ | ||
63 | /* POP_TOKEN is returned when we've popped a cpp_buffer. */ | ||
64 | CPP_POP | ||
65 | }; | ||
66 | |||
67 | typedef enum cpp_token (*parse_underflow_t) (cpp_reader *); | ||
68 | typedef int (*parse_cleanup_t) (cpp_buffer *, cpp_reader *); | ||
69 | |||
70 | /* A parse_marker indicates a previous position, | ||
71 | which we can backtrack to. */ | ||
72 | |||
73 | struct parse_marker { | ||
74 | cpp_buffer *buf; | ||
75 | struct parse_marker *next; | ||
76 | int position; | ||
77 | }; | ||
78 | |||
79 | extern int cpp_handle_options(cpp_reader * pfile, int, char **); | ||
80 | extern enum cpp_token cpp_get_token(cpp_reader * pfile); | ||
81 | extern void cpp_skip_hspace(cpp_reader * pfile); | ||
82 | |||
83 | /* Maintain and search list of included files, for #import. */ | ||
84 | |||
85 | #define IMPORT_HASH_SIZE 31 | ||
86 | |||
87 | struct import_file { | ||
88 | char *name; | ||
89 | ino_t inode; | ||
90 | dev_t dev; | ||
91 | struct import_file *next; | ||
92 | }; | ||
93 | |||
94 | /* If we have a huge buffer, may need to cache more recent counts */ | ||
95 | #define CPP_LINE_BASE(BUF) ((BUF)->buf + (BUF)->line_base) | ||
96 | |||
97 | enum dump_type { | ||
98 | dump_none = 0, dump_only, dump_names, dump_definitions | ||
99 | }; | ||
100 | |||
101 | struct cpp_buffer { | ||
102 | unsigned char *buf; | ||
103 | unsigned char *cur; | ||
104 | unsigned char *rlimit; /* end of valid data */ | ||
105 | unsigned char *alimit; /* end of allocated buffer */ | ||
106 | unsigned char *prev; /* start of current token */ | ||
107 | |||
108 | const char *fname; | ||
109 | /* Filename specified with #line command. */ | ||
110 | const char *nominal_fname; | ||
111 | |||
112 | /* Record where in the search path this file was found. | ||
113 | * For #include_next. */ | ||
114 | struct file_name_list *dir; | ||
115 | |||
116 | long line_base; | ||
117 | long lineno; /* Line number at CPP_LINE_BASE. */ | ||
118 | long colno; /* Column number at CPP_LINE_BASE. */ | ||
119 | #ifndef STATIC_BUFFERS | ||
120 | cpp_buffer *chain; | ||
121 | #endif | ||
122 | parse_underflow_t underflow; | ||
123 | parse_cleanup_t cleanup; | ||
124 | void *data; | ||
125 | struct parse_marker *marks; | ||
126 | /* Value of if_stack at start of this file. | ||
127 | * Used to prohibit unmatched #endif (etc) in an include file. */ | ||
128 | struct if_stack *if_stack; | ||
129 | |||
130 | /* True if this is a header file included using <FILENAME>. */ | ||
131 | char system_header_p; | ||
132 | char seen_eof; | ||
133 | |||
134 | /* True if buffer contains escape sequences. | ||
135 | * Currently there are are only two kind: | ||
136 | * "@-" means following identifier should not be macro-expanded. | ||
137 | * "@ " means a token-separator. This turns into " " in final output | ||
138 | * if not stringizing and needed to separate tokens; otherwise nothing. | ||
139 | * "@@" means a normal '@'. | ||
140 | * (An '@' inside a string stands for itself and is never an escape.) */ | ||
141 | char has_escapes; | ||
142 | }; | ||
143 | |||
144 | struct cpp_pending; /* Forward declaration - for C++. */ | ||
145 | struct file_name_map_list; | ||
146 | |||
147 | typedef struct assertion_hashnode ASSERTION_HASHNODE; | ||
148 | |||
149 | #define ASSERTION_HASHSIZE 37 | ||
150 | |||
151 | #ifdef STATIC_BUFFERS | ||
152 | /* Maximum nesting of cpp_buffers. We use a static limit, partly for | ||
153 | efficiency, and partly to limit runaway recursion. */ | ||
154 | #define CPP_STACK_MAX 200 | ||
155 | #endif | ||
156 | |||
157 | struct cpp_reader { | ||
158 | unsigned char *limit; | ||
159 | parse_underflow_t get_token; | ||
160 | cpp_buffer *buffer; | ||
161 | #ifdef STATIC_BUFFERS | ||
162 | cpp_buffer buffer_stack[CPP_STACK_MAX]; | ||
163 | #endif | ||
164 | |||
165 | int errors; /* Error counter for exit code */ | ||
166 | void *data; | ||
167 | |||
168 | unsigned char *token_buffer; | ||
169 | int token_buffer_size; | ||
170 | |||
171 | /* Line where a newline was first seen in a string constant. */ | ||
172 | int multiline_string_line; | ||
173 | |||
174 | /* Current depth in #include directives that use <...>. */ | ||
175 | int system_include_depth; | ||
176 | |||
177 | /* List of included files that contained #pragma once. */ | ||
178 | struct file_name_list *dont_repeat_files; | ||
179 | |||
180 | /* List of other included files. | ||
181 | * If ->control_macro if nonzero, the file had a #ifndef | ||
182 | * around the entire contents, and ->control_macro gives the macro name. */ | ||
183 | struct file_name_list *all_include_files; | ||
184 | |||
185 | /* Current maximum length of directory names in the search path | ||
186 | * for include files. (Altered as we get more of them.) */ | ||
187 | int max_include_len; | ||
188 | |||
189 | /* Hash table of files already included with #include or #import. */ | ||
190 | struct import_file *import_hash_table[IMPORT_HASH_SIZE]; | ||
191 | |||
192 | struct if_stack *if_stack; | ||
193 | |||
194 | /* Nonzero means we are inside an IF during a -pcp run. In this mode | ||
195 | * macro expansion is done, and preconditions are output for all macro | ||
196 | * uses requiring them. */ | ||
197 | char pcp_inside_if; | ||
198 | |||
199 | /* Nonzero means we have printed (while error reporting) a list of | ||
200 | * containing files that matches the current status. */ | ||
201 | char input_stack_listing_current; | ||
202 | |||
203 | /* If non-zero, macros are not expanded. */ | ||
204 | char no_macro_expand; | ||
205 | |||
206 | /* Print column number in error messages. */ | ||
207 | char show_column; | ||
208 | |||
209 | /* We're printed a warning recommending against using #import. */ | ||
210 | char import_warning; | ||
211 | |||
212 | /* If true, character between '<' and '>' are a single (string) token. */ | ||
213 | char parsing_include_directive; | ||
214 | |||
215 | /* True if escape sequences (as described for has_escapes in | ||
216 | * parse_buffer) should be emitted. */ | ||
217 | char output_escapes; | ||
218 | |||
219 | /* 0: Have seen non-white-space on this line. | ||
220 | * 1: Only seen white space so far on this line. | ||
221 | * 2: Only seen white space so far in this file. */ | ||
222 | char only_seen_white; | ||
223 | |||
224 | /* Nonzero means this file was included with a -imacros or -include | ||
225 | * command line and should not be recorded as an include file. */ | ||
226 | |||
227 | int no_record_file; | ||
228 | |||
229 | long lineno; | ||
230 | |||
231 | struct tm *timebuf; | ||
232 | |||
233 | ASSERTION_HASHNODE *assertion_hashtab[ASSERTION_HASHSIZE]; | ||
234 | |||
235 | /* Buffer of -M output. */ | ||
236 | char *deps_buffer; | ||
237 | |||
238 | /* Number of bytes allocated in above. */ | ||
239 | int deps_allocated_size; | ||
240 | |||
241 | /* Number of bytes used. */ | ||
242 | int deps_size; | ||
243 | |||
244 | /* Number of bytes since the last newline. */ | ||
245 | int deps_column; | ||
246 | }; | ||
247 | |||
248 | #define CPP_BUF_PEEK(BUFFER) \ | ||
249 | ((BUFFER)->cur < (BUFFER)->rlimit ? *(BUFFER)->cur : EOF) | ||
250 | #define CPP_BUF_GET(BUFFER) \ | ||
251 | ((BUFFER)->cur < (BUFFER)->rlimit ? *(BUFFER)->cur++ : EOF) | ||
252 | #define CPP_FORWARD(BUFFER, N) ((BUFFER)->cur += (N)) | ||
253 | |||
254 | /* Number of characters currently in PFILE's output buffer. */ | ||
255 | #define CPP_WRITTEN(PFILE) ((PFILE)->limit - (PFILE)->token_buffer) | ||
256 | #define CPP_PWRITTEN(PFILE) ((PFILE)->limit) | ||
257 | |||
258 | /* Make sure PFILE->token_buffer has space for at least N more characters. */ | ||
259 | #define CPP_RESERVE(PFILE, N) \ | ||
260 | ((unsigned int)(CPP_WRITTEN (PFILE) + N) > (unsigned int) (PFILE)->token_buffer_size \ | ||
261 | && (cpp_grow_buffer (PFILE, N), 0)) | ||
262 | |||
263 | /* Append string STR (of length N) to PFILE's output buffer. | ||
264 | Assume there is enough space. */ | ||
265 | #define CPP_PUTS_Q(PFILE, STR, N) \ | ||
266 | do { memcpy ((PFILE)->limit, STR, (N)); (PFILE)->limit += (N); } while(0) | ||
267 | /* Append string STR (of length N) to PFILE's output buffer. Make space. */ | ||
268 | #define CPP_PUTS(PFILE, STR, N) \ | ||
269 | do { CPP_RESERVE(PFILE, N); CPP_PUTS_Q(PFILE, STR,N); } while(0) | ||
270 | /* Append character CH to PFILE's output buffer. Assume sufficient space. */ | ||
271 | #define CPP_PUTC_Q(PFILE, CH) (*(PFILE)->limit++ = (CH)) | ||
272 | /* Append character CH to PFILE's output buffer. Make space if need be. */ | ||
273 | #define CPP_PUTC(PFILE, CH) \ | ||
274 | do { CPP_RESERVE (PFILE, 1); CPP_PUTC_Q (PFILE, CH); } while(0) | ||
275 | /* Make sure PFILE->limit is followed by '\0'. */ | ||
276 | #define CPP_NUL_TERMINATE_Q(PFILE) (*(PFILE)->limit = 0) | ||
277 | #define CPP_NUL_TERMINATE(PFILE) \ | ||
278 | do { CPP_RESERVE(PFILE, 1); *(PFILE)->limit = 0; } while(0) | ||
279 | #define CPP_ADJUST_WRITTEN(PFILE,DELTA) ((PFILE)->limit += (DELTA)) | ||
280 | #define CPP_SET_WRITTEN(PFILE,N) ((PFILE)->limit = (PFILE)->token_buffer + (N)) | ||
281 | |||
282 | #define CPP_OPTIONS(PFILE) ((cpp_options*)(PFILE)->data) | ||
283 | #define CPP_BUFFER(PFILE) ((PFILE)->buffer) | ||
284 | #ifdef STATIC_BUFFERS | ||
285 | #define CPP_PREV_BUFFER(BUFFER) ((BUFFER)+1) | ||
286 | #define CPP_NULL_BUFFER(PFILE) (&(PFILE)->buffer_stack[CPP_STACK_MAX]) | ||
287 | #else | ||
288 | #define CPP_PREV_BUFFER(BUFFER) ((BUFFER)->chain) | ||
289 | #define CPP_NULL_BUFFER(PFILE) ((cpp_buffer*)0) | ||
290 | #endif | ||
291 | |||
292 | /* Pointed to by parse_file::data. */ | ||
293 | struct cpp_options { | ||
294 | const char *in_fname; | ||
295 | |||
296 | /* Name of output file, for error messages. */ | ||
297 | const char *out_fname; | ||
298 | |||
299 | struct file_name_map_list *map_list; | ||
300 | |||
301 | /* Non-0 means -v, so print the full set of include dirs. */ | ||
302 | char verbose; | ||
303 | |||
304 | /* Nonzero means use extra default include directories for C++. */ | ||
305 | |||
306 | char cplusplus; | ||
307 | |||
308 | /* Nonzero means handle cplusplus style comments */ | ||
309 | |||
310 | char cplusplus_comments; | ||
311 | |||
312 | /* Nonzero means handle #import, for objective C. */ | ||
313 | |||
314 | char objc; | ||
315 | |||
316 | /* Nonzero means this is an assembly file, and allow | ||
317 | * unknown directives, which could be comments. */ | ||
318 | |||
319 | int lang_asm; | ||
320 | |||
321 | /* Nonzero means turn NOTREACHED into #pragma NOTREACHED etc */ | ||
322 | |||
323 | char for_lint; | ||
324 | |||
325 | /* Nonzero means handle CHILL comment syntax | ||
326 | * and output CHILL string delimiter for __DATE___ etc. */ | ||
327 | |||
328 | char chill; | ||
329 | |||
330 | /* Nonzero means copy comments into the output file. */ | ||
331 | |||
332 | char put_out_comments; | ||
333 | |||
334 | /* Nonzero means don't process the ANSI trigraph sequences. */ | ||
335 | |||
336 | char no_trigraphs; | ||
337 | |||
338 | /* Nonzero means print the names of included files rather than | ||
339 | * the preprocessed output. 1 means just the #include "...", | ||
340 | * 2 means #include <...> as well. */ | ||
341 | |||
342 | char print_deps; | ||
343 | |||
344 | /* Nonzero if missing .h files in -M output are assumed to be generated | ||
345 | * files and not errors. */ | ||
346 | |||
347 | char print_deps_missing_files; | ||
348 | |||
349 | /* If true, fopen (deps_file, "a") else fopen (deps_file, "w"). */ | ||
350 | char print_deps_append; | ||
351 | |||
352 | /* Nonzero means print names of header files (-H). */ | ||
353 | |||
354 | char print_include_names; | ||
355 | |||
356 | /* Nonzero means try to make failure to fit ANSI C an error. */ | ||
357 | |||
358 | char pedantic_errors; | ||
359 | |||
360 | /* Nonzero means don't print warning messages. -w. */ | ||
361 | |||
362 | char inhibit_warnings; | ||
363 | |||
364 | /* Nonzero means warn if slash-star appears in a comment. */ | ||
365 | |||
366 | char warn_comments; | ||
367 | |||
368 | /* Nonzero means warn if there are any trigraphs. */ | ||
369 | |||
370 | char warn_trigraphs; | ||
371 | |||
372 | /* Nonzero means warn if #import is used. */ | ||
373 | |||
374 | char warn_import; | ||
375 | |||
376 | /* Nonzero means warn if a macro argument is (or would be) | ||
377 | * stringified with -traditional. */ | ||
378 | |||
379 | char warn_stringify; | ||
380 | |||
381 | /* Nonzero means turn warnings into errors. */ | ||
382 | |||
383 | char warnings_are_errors; | ||
384 | |||
385 | /* Nonzero causes output not to be done, | ||
386 | * but directives such as #define that have side effects | ||
387 | * are still obeyed. */ | ||
388 | |||
389 | char no_output; | ||
390 | |||
391 | /* Nonzero means don't output line number information. */ | ||
392 | |||
393 | char no_line_commands; | ||
394 | |||
395 | /* Nonzero means output the text in failing conditionals, | ||
396 | inside #failed ... #endfailed. */ | ||
397 | |||
398 | char output_conditionals; | ||
399 | |||
400 | /* Nonzero means -I- has been seen, | ||
401 | * so don't look for #include "foo" the source-file directory. */ | ||
402 | char ignore_srcdir; | ||
403 | |||
404 | /* Zero means dollar signs are punctuation. | ||
405 | -$ stores 0; -traditional may store 1. Default is 1 for VMS, 0 otherwise. | ||
406 | This must be 0 for correct processing of this ANSI C program: | ||
407 | #define foo(a) #a | ||
408 | #define lose(b) foo (b) | ||
409 | #define test$ | ||
410 | lose (test) */ | ||
411 | char dollars_in_ident; | ||
412 | #ifndef DOLLARS_IN_IDENTIFIERS | ||
413 | #define DOLLARS_IN_IDENTIFIERS 1 | ||
414 | #endif | ||
415 | |||
416 | /* Nonzero means try to imitate old fashioned non-ANSI preprocessor. */ | ||
417 | char traditional; | ||
418 | |||
419 | /* Nonzero means give all the error messages the ANSI standard requires. */ | ||
420 | char pedantic; | ||
421 | |||
422 | char done_initializing; | ||
423 | |||
424 | struct file_name_list *include; /* First dir to search */ | ||
425 | /* First dir to search for <file> */ | ||
426 | /* This is the first element to use for #include <...>. | ||
427 | * If it is 0, use the entire chain for such includes. */ | ||
428 | struct file_name_list *first_bracket_include; | ||
429 | /* This is the first element in the chain that corresponds to | ||
430 | * a directory of system header files. */ | ||
431 | struct file_name_list *first_system_include; | ||
432 | struct file_name_list *last_include; /* Last in chain */ | ||
433 | |||
434 | /* Chain of include directories to put at the end of the other chain. */ | ||
435 | struct file_name_list *after_include; | ||
436 | struct file_name_list *last_after_include; /* Last in chain */ | ||
437 | |||
438 | /* Chain to put at the start of the system include files. */ | ||
439 | struct file_name_list *before_system; | ||
440 | struct file_name_list *last_before_system; /* Last in chain */ | ||
441 | |||
442 | /* Directory prefix that should replace `/usr' in the standard | ||
443 | * include file directories. */ | ||
444 | char *include_prefix; | ||
445 | |||
446 | char inhibit_predefs; | ||
447 | char no_standard_includes; | ||
448 | char no_standard_cplusplus_includes; | ||
449 | |||
450 | /* dump_only means inhibit output of the preprocessed text | ||
451 | and instead output the definitions of all user-defined | ||
452 | macros in a form suitable for use as input to cccp. | ||
453 | dump_names means pass #define and the macro name through to output. | ||
454 | dump_definitions means pass the whole definition (plus #define) through | ||
455 | */ | ||
456 | |||
457 | enum dump_type dump_macros; | ||
458 | |||
459 | /* Nonzero means pass all #define and #undef directives which we actually | ||
460 | process through to the output stream. This feature is used primarily | ||
461 | to allow cc1 to record the #defines and #undefs for the sake of | ||
462 | debuggers which understand about preprocessor macros, but it may | ||
463 | also be useful with -E to figure out how symbols are defined, and | ||
464 | where they are defined. */ | ||
465 | int debug_output; | ||
466 | |||
467 | /* Pending -D, -U and -A options, in reverse order. */ | ||
468 | struct cpp_pending *pending; | ||
469 | |||
470 | /* File name which deps are being written to. | ||
471 | * This is 0 if deps are being written to stdout. */ | ||
472 | char *deps_file; | ||
473 | |||
474 | /* Target-name to write with the dependency information. */ | ||
475 | char *deps_target; | ||
476 | }; | ||
477 | |||
478 | #define CPP_TRADITIONAL(PFILE) (CPP_OPTIONS(PFILE)-> traditional) | ||
479 | #define CPP_PEDANTIC(PFILE) (CPP_OPTIONS (PFILE)->pedantic) | ||
480 | #define CPP_PRINT_DEPS(PFILE) (CPP_OPTIONS (PFILE)->print_deps) | ||
481 | |||
482 | /* Name under which this program was invoked. */ | ||
483 | |||
484 | extern char *progname; | ||
485 | |||
486 | /* The structure of a node in the hash table. The hash table | ||
487 | has entries for all tokens defined by #define commands (type T_MACRO), | ||
488 | plus some special tokens like __LINE__ (these each have their own | ||
489 | type, and the appropriate code is run when that type of node is seen. | ||
490 | It does not contain control words like "#define", which are recognized | ||
491 | by a separate piece of code. */ | ||
492 | |||
493 | /* different flavors of hash nodes --- also used in keyword table */ | ||
494 | enum node_type { | ||
495 | T_DEFINE = 1, /* the `#define' keyword */ | ||
496 | T_INCLUDE, /* the `#include' keyword */ | ||
497 | T_INCLUDE_NEXT, /* the `#include_next' keyword */ | ||
498 | T_IMPORT, /* the `#import' keyword */ | ||
499 | T_IFDEF, /* the `#ifdef' keyword */ | ||
500 | T_IFNDEF, /* the `#ifndef' keyword */ | ||
501 | T_IF, /* the `#if' keyword */ | ||
502 | T_ELSE, /* `#else' */ | ||
503 | T_PRAGMA, /* `#pragma' */ | ||
504 | T_ELIF, /* `#elif' */ | ||
505 | T_UNDEF, /* `#undef' */ | ||
506 | T_LINE, /* `#line' */ | ||
507 | T_ERROR, /* `#error' */ | ||
508 | T_WARNING, /* `#warning' */ | ||
509 | T_ENDIF, /* `#endif' */ | ||
510 | T_SCCS, /* `#sccs', used on system V. */ | ||
511 | T_IDENT, /* `#ident', used on system V. */ | ||
512 | T_ASSERT, /* `#assert', taken from system V. */ | ||
513 | T_UNASSERT, /* `#unassert', taken from system V. */ | ||
514 | T_SPECLINE, /* special symbol `__LINE__' */ | ||
515 | T_DATE, /* `__DATE__' */ | ||
516 | T_FILE, /* `__FILE__' */ | ||
517 | T_BASE_FILE, /* `__BASE_FILE__' */ | ||
518 | T_INCLUDE_LEVEL, /* `__INCLUDE_LEVEL__' */ | ||
519 | T_VERSION, /* `__VERSION__' */ | ||
520 | T_SIZE_TYPE, /* `__SIZE_TYPE__' */ | ||
521 | T_PTRDIFF_TYPE, /* `__PTRDIFF_TYPE__' */ | ||
522 | T_WCHAR_TYPE, /* `__WCHAR_TYPE__' */ | ||
523 | T_USER_LABEL_PREFIX_TYPE, /* `__USER_LABEL_PREFIX__' */ | ||
524 | T_REGISTER_PREFIX_TYPE, /* `__REGISTER_PREFIX__' */ | ||
525 | T_TIME, /* `__TIME__' */ | ||
526 | T_CONST, /* Constant value, used by `__STDC__' */ | ||
527 | T_MACRO, /* macro defined by `#define' */ | ||
528 | T_DISABLED, /* macro temporarily turned off for rescan */ | ||
529 | T_SPEC_DEFINED, /* special `defined' macro for use in #if statements */ | ||
530 | T_PCSTRING, /* precompiled string (hashval is KEYDEF *) */ | ||
531 | T_UNUSED /* Used for something not defined. */ | ||
532 | }; | ||
533 | |||
534 | /* Structure allocated for every #define. For a simple replacement | ||
535 | such as | ||
536 | #define foo bar , | ||
537 | nargs = -1, the `pattern' list is null, and the expansion is just | ||
538 | the replacement text. Nargs = 0 means a functionlike macro with no args, | ||
539 | e.g., | ||
540 | #define getchar() getc (stdin) . | ||
541 | When there are args, the expansion is the replacement text with the | ||
542 | args squashed out, and the reflist is a list describing how to | ||
543 | build the output from the input: e.g., "3 chars, then the 1st arg, | ||
544 | then 9 chars, then the 3rd arg, then 0 chars, then the 2nd arg". | ||
545 | The chars here come from the expansion. Whatever is left of the | ||
546 | expansion after the last arg-occurrence is copied after that arg. | ||
547 | Note that the reflist can be arbitrarily long--- | ||
548 | its length depends on the number of times the arguments appear in | ||
549 | the replacement text, not how many args there are. Example: | ||
550 | #define f(x) x+x+x+x+x+x+x would have replacement text "++++++" and | ||
551 | pattern list | ||
552 | { (0, 1), (1, 1), (1, 1), ..., (1, 1), NULL } | ||
553 | where (x, y) means (nchars, argno). */ | ||
554 | |||
555 | typedef struct reflist reflist; | ||
556 | struct reflist { | ||
557 | reflist *next; | ||
558 | char stringify; /* nonzero if this arg was preceded by a | ||
559 | * # operator. */ | ||
560 | char raw_before; /* Nonzero if a ## operator before arg. */ | ||
561 | char raw_after; /* Nonzero if a ## operator after arg. */ | ||
562 | char rest_args; /* Nonzero if this arg. absorbs the rest */ | ||
563 | int nchars; /* Number of literal chars to copy before | ||
564 | * this arg occurrence. */ | ||
565 | int argno; /* Number of arg to substitute (origin-0) */ | ||
566 | }; | ||
567 | |||
568 | typedef struct definition DEFINITION; | ||
569 | struct definition { | ||
570 | int nargs; | ||
571 | int length; /* length of expansion string */ | ||
572 | int predefined; /* True if the macro was builtin or */ | ||
573 | /* came from the command line */ | ||
574 | unsigned char *expansion; | ||
575 | int line; /* Line number of definition */ | ||
576 | const char *file; /* File of definition */ | ||
577 | char rest_args; /* Nonzero if last arg. absorbs the rest */ | ||
578 | reflist *pattern; | ||
579 | union { | ||
580 | /* Names of macro args, concatenated in reverse order | ||
581 | * with comma-space between them. | ||
582 | * The only use of this is that we warn on redefinition | ||
583 | * if this differs between the old and new definitions. */ | ||
584 | unsigned char *argnames; | ||
585 | } args; | ||
586 | }; | ||
587 | |||
588 | extern unsigned char is_idchar[256]; | ||
589 | |||
590 | /* Stack of conditionals currently in progress | ||
591 | (including both successful and failing conditionals). */ | ||
592 | |||
593 | struct if_stack { | ||
594 | struct if_stack *next; /* for chaining to the next stack frame */ | ||
595 | const char *fname; /* copied from input when frame is made */ | ||
596 | int lineno; /* similarly */ | ||
597 | int if_succeeded; /* true if a leg of this if-group | ||
598 | * has been passed through rescan */ | ||
599 | unsigned char *control_macro; /* For #ifndef at start of file, | ||
600 | * this is the macro name tested. */ | ||
601 | enum node_type type; /* type of last directive seen in this group */ | ||
602 | }; | ||
603 | typedef struct if_stack IF_STACK_FRAME; | ||
604 | |||
605 | extern void cpp_buf_line_and_col(cpp_buffer *, long *, long *); | ||
606 | extern cpp_buffer *cpp_file_buffer(cpp_reader *); | ||
607 | extern void cpp_define(cpp_reader *, unsigned char *); | ||
608 | |||
609 | extern void cpp_error(cpp_reader * pfile, const char *msg, ...); | ||
610 | extern void cpp_warning(cpp_reader * pfile, const char *msg, ...); | ||
611 | extern void cpp_pedwarn(cpp_reader * pfile, const char *msg, ...); | ||
612 | extern void cpp_fatal(const char *msg, ...); | ||
613 | extern void cpp_file_line_for_message(cpp_reader * pfile, | ||
614 | const char *filename, int line, | ||
615 | int column); | ||
616 | extern void cpp_perror_with_name(cpp_reader * pfile, const char *name); | ||
617 | extern void cpp_pfatal_with_name(cpp_reader * pfile, const char *name); | ||
618 | extern void cpp_message(cpp_reader * pfile, int is_error, | ||
619 | const char *msg, ...); | ||
620 | extern void cpp_message_v(cpp_reader * pfile, int is_error, | ||
621 | const char *msg, va_list args); | ||
622 | |||
623 | extern void cpp_grow_buffer(cpp_reader * pfile, long n); | ||
624 | extern int cpp_parse_escape(cpp_reader * pfile, char **string_ptr); | ||
625 | |||
626 | void cpp_print_containing_files(cpp_reader * pfile); | ||
627 | HOST_WIDE_INT cpp_parse_expr(cpp_reader * pfile); | ||
628 | void skip_rest_of_line(cpp_reader * pfile); | ||
629 | void init_parse_file(cpp_reader * pfile); | ||
630 | void init_parse_options(struct cpp_options *opts); | ||
631 | int push_parse_file(cpp_reader * pfile, const char *fname); | ||
632 | void cpp_finish(cpp_reader * pfile); | ||
633 | int cpp_read_check_assertion(cpp_reader * pfile); | ||
634 | |||
635 | void *xmalloc(unsigned size); | ||
636 | void *xrealloc(void *old, unsigned size); | ||
637 | void *xcalloc(unsigned number, unsigned size); | ||
638 | |||
639 | #ifdef __EMX__ | ||
640 | #define PATH_SEPARATOR ';' | ||
641 | #endif | ||