OSDN Git Service

2000-04-25 Zack Weinberg <zack@wolery.cumb.org>
[pf3gnuchains/gcc-fork.git] / gcc / cpplib.h
1 /* Definitions for CPP library.
2    Copyright (C) 1995, 96-99, 2000 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 #ifndef __GCC_CPPLIB__
23 #define __GCC_CPPLIB__
24
25 #include <sys/types.h>
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 typedef struct cpp_reader cpp_reader;
32 typedef struct cpp_buffer cpp_buffer;
33 typedef struct cpp_options cpp_options;
34 typedef struct cpp_printer cpp_printer;
35 typedef struct cpp_token cpp_token;
36 typedef struct cpp_toklist cpp_toklist;
37 typedef struct cpp_name cpp_name;
38
39 /* The first two groups, apart from '=', can appear in preprocessor
40    expressions.  This allows a lookup table to be implemented in
41    _cpp_parse_expr.
42
43    The first group, to CPP_LAST_EQ, can be immediately followed by an
44    '='.  The lexer needs operators ending in '=', like ">>=", to be in
45    the same order as their counterparts without the '=', like ">>".  */
46
47 /* Positions in the table.  */
48 #define CPP_LAST_EQ CPP_LSHIFT
49 #define CPP_FIRST_DIGRAPH CPP_HASH
50
51 #define TTYPE_TABLE                             \
52   T(CPP_EQ = 0,         "=")                    \
53   T(CPP_NOT,            "!")                    \
54   T(CPP_GREATER,        ">")    /* compare */   \
55   T(CPP_LESS,           "<")                    \
56   T(CPP_PLUS,           "+")    /* math */      \
57   T(CPP_MINUS,          "-")                    \
58   T(CPP_MULT,           "*")                    \
59   T(CPP_DIV,            "/")                    \
60   T(CPP_MOD,            "%")                    \
61   T(CPP_AND,            "&")    /* bit ops */   \
62   T(CPP_OR,             "|")                    \
63   T(CPP_XOR,            "^")                    \
64   T(CPP_COMPL,          "~")                    \
65   T(CPP_RSHIFT,         ">>")                   \
66   T(CPP_LSHIFT,         "<<")                   \
67 \
68   T(CPP_AND_AND,        "&&")   /* logical */   \
69   T(CPP_OR_OR,          "||")                   \
70   T(CPP_QUERY,          "?")                    \
71   T(CPP_COLON,          ":")                    \
72   T(CPP_COMMA,          ",")    /* grouping */  \
73   T(CPP_OPEN_PAREN,     "(")                    \
74   T(CPP_CLOSE_PAREN,    ")")                    \
75   T(CPP_EQ_EQ,          "==")   /* compare */   \
76   T(CPP_NOT_EQ,         "!=")                   \
77   T(CPP_GREATER_EQ,     ">=")                   \
78   T(CPP_LESS_EQ,        "<=")                   \
79 \
80   T(CPP_PLUS_EQ,        "+=")   /* math */      \
81   T(CPP_MINUS_EQ,       "-=")                   \
82   T(CPP_MULT_EQ,        "*=")                   \
83   T(CPP_DIV_EQ,         "/=")                   \
84   T(CPP_MOD_EQ,         "%=")                   \
85   T(CPP_AND_EQ,         "&=")   /* bit ops */   \
86   T(CPP_OR_EQ,          "|=")                   \
87   T(CPP_XOR_EQ,         "^=")                   \
88   T(CPP_COMPL_EQ,       "~=")                   \
89   T(CPP_RSHIFT_EQ,      ">>=")                  \
90   T(CPP_LSHIFT_EQ,      "<<=")                  \
91   /* Digraphs together, beginning with CPP_FIRST_DIGRAPH.  */   \
92   T(CPP_HASH,           "#")    /* digraphs */  \
93   T(CPP_PASTE,          "##")                   \
94   T(CPP_OPEN_SQUARE,    "[")                    \
95   T(CPP_CLOSE_SQUARE,   "]")                    \
96   T(CPP_OPEN_BRACE,     "{")                    \
97   T(CPP_CLOSE_BRACE,    "}")                    \
98   /* The remainder of the punctuation.  Order is not significant. */    \
99   T(CPP_SEMICOLON,      ";")    /* structure */ \
100   T(CPP_ELLIPSIS,       "...")                  \
101   T(CPP_BACKSLASH,      "\\")                   \
102   T(CPP_PLUS_PLUS,      "++")   /* increment */ \
103   T(CPP_MINUS_MINUS,    "--")                   \
104   T(CPP_DEREF,          "->")   /* accessors */ \
105   T(CPP_DOT,            ".")                    \
106   T(CPP_SCOPE,          "::")                   \
107   T(CPP_DEREF_STAR,     "->*")                  \
108   T(CPP_DOT_STAR,       ".*")                   \
109   T(CPP_MIN,            "<?")   /* extension */ \
110   T(CPP_MAX,            ">?")                   \
111   H(CPP_OTHER,          spell_other) /* stray punctuation */ \
112 \
113   H(CPP_NAME,           spell_name)     /* word */      \
114   N(CPP_INT,            0)              /* 23 */        \
115   N(CPP_FLOAT,          0)              /* 3.14159 */   \
116   H(CPP_NUMBER,         spell_name)     /* 34_be+ta  */ \
117   H(CPP_CHAR,           spell_char)     /* 'char' */    \
118   H(CPP_WCHAR,          spell_char)     /* L'char' */   \
119   H(CPP_STRING,         spell_string)   /* "string" */  \
120   H(CPP_WSTRING,        spell_string)   /* L"string" */ \
121 \
122   H(CPP_C_COMMENT,      spell_comment)  /* Only if output comments.  */ \
123   H(CPP_CPP_COMMENT,    spell_comment)  /* Only if output comments.  */ \
124   H(CPP_CHILL_COMMENT,  spell_comment)  /* Only if output comments.  */ \
125   N(CPP_MACRO_ARG,      0)              /* Macro argument.  */          \
126   N(CPP_SUBLIST,        0)              /* Sublist.  */                 \
127   E(CPP_VSPACE,         "\n")           /* End of line.  */             \
128   N(CPP_EOF,            0)              /* End of file.  */             \
129   N(CPP_HEADER_NAME,    0)              /* <stdio.h> in #include */     \
130   N(CPP_ASSERTION,      0)              /* (...) in #assert */          \
131 \
132   /* Obsolete - will be removed when no code uses them still.  */       \
133   H(CPP_COMMENT,        0)              /* Only if output comments.  */ \
134   N(CPP_HSPACE,         0)              /* Horizontal white space.  */  \
135   N(CPP_POP,            0)              /* End of buffer.  */           \
136   N(CPP_DIRECTIVE,      0)              /* #define and the like */      \
137   N(CPP_MACRO,          0)              /* Like a NAME, but expanded.  */
138
139 #define T(e, s) e,
140 #define H(e, s) e,
141 #define N(e, s) e,
142 #define E(e, s) e,
143 enum cpp_ttype
144 {
145   TTYPE_TABLE
146   N_TTYPES
147 };
148 #undef T
149 #undef H
150 #undef N
151 #undef E
152
153 /* Payload of a NAME, NUMBER, FLOAT, STRING, or COMMENT token.  */
154 struct cpp_name
155 {
156   unsigned int len;
157   unsigned int offset;          /* from list->namebuf */
158 };
159
160 #define TOK_NAME(list, token) ((list)->namebuf + (token)->val.name.offset)
161
162 /* Flags for the cpp_token structure.  */
163 #define PREV_WHITESPACE     1   /* If whitespace before this token.  */
164 #define DIGRAPH             2   /* If it was a digraph.  */
165 #define UNSIGNED_INT        4   /* If int preprocessing token unsigned.  */
166
167 /* A preprocessing token.
168    This has been carefully packed and should occupy 16 bytes on
169    both 32- and 64-bit hosts.  */
170 struct cpp_token
171 {
172   unsigned short col;                   /* starting column of this token */
173 #ifdef ENUM_BITFIELDS_ARE_UNSIGNED
174   enum cpp_ttype type : CHAR_BIT;       /* node type */
175 #else
176   unsigned char type;
177 #endif
178   unsigned char flags;                  /* flags - see above */
179   unsigned int aux;                     /* CPP_OTHER character.  Hash of a
180                                            NAME, or something - see uses
181                                            in the code */
182   union
183   {
184     struct cpp_name name;               /* a string */
185     HOST_WIDEST_INT integer;            /* an integer */
186   } val;
187 };
188
189 /* Directive flags.  */
190 #define SYNTAX_INCLUDE (1 << 8)
191 #define SYNTAX_ASSERT  (1 << 9)
192
193 typedef int (*directive_handler) PARAMS ((cpp_reader *));
194 typedef int (*parse_cleanup_t) PARAMS ((cpp_buffer *, cpp_reader *));
195
196 struct cpp_toklist
197 {
198   cpp_token *tokens;            /* actual tokens as an array */
199   unsigned int tokens_used;     /* tokens used */
200   unsigned int tokens_cap;      /* tokens allocated */
201
202   unsigned char *namebuf;       /* names buffer */
203   unsigned int name_used;       /* _bytes_ used */
204   unsigned int name_cap;        /* _bytes_ allocated */
205
206   unsigned int line;            /* starting line number */
207
208   /* Comment copying.  */
209   cpp_token *comments;          /* comment tokens.  */
210   unsigned int comments_used;   /* comment tokens used.  */
211   unsigned int comments_cap;    /* comment token capacity.  */
212
213   /* Only used if tokens[0].type == CPP_DIRECTIVE.  This is the
214      handler to call after lexing the rest of this line.  The flags
215      indicate whether the rest of the line gets special treatment
216      during lexing (#include, #if, #assert, #unassert).  */
217   directive_handler dir_handler;
218   unsigned short dir_flags;
219 };
220
221 struct cpp_buffer
222 {
223   const unsigned char *cur;      /* current position */
224   const unsigned char *rlimit; /* end of valid data */
225   const unsigned char *buf;      /* entire buffer */
226   const unsigned char *line_base; /* start of current line */
227   const unsigned char *mark;  /* Saved position for lengthy backtrack. */
228
229   struct cpp_buffer *prev;
230
231   /* Filename specified with #line command.  */
232   const char *nominal_fname;
233   /* Actual directory of this file, used only for "" includes */
234   struct file_name_list *actual_dir;
235
236   /* Pointer into the include hash table.  Used for include_next and
237      to record control macros. */
238   struct ihash *ihash;
239
240   parse_cleanup_t cleanup;
241
242   /* If the buffer is the expansion of a macro, this points to the
243      macro's hash table entry.  */
244   struct hashnode *macro;
245
246   /* Value of if_stack at start of this file.
247      Used to prohibit unmatched #endif (etc) in an include file.  */
248   struct if_stack *if_stack;
249
250   /* Line number at line_base (above). */
251   unsigned int lineno;
252
253   /* True if this is a header file included using <FILENAME>.  */
254   char system_header_p;
255
256   /* True if end-of-file has already been hit once in this buffer.  */
257   char seen_eof;
258
259   /* True if buffer contains escape sequences.
260      Currently there are two kinds:
261      "\r-" means following identifier should not be macro-expanded.
262      "\r " means a token-separator.  This turns into " " in final output
263           if not stringizing and needed to separate tokens; otherwise nothing.
264      Any other two-character sequence beginning with \r is an error.
265
266      If this is NOT set, then \r is a one-character escape meaning backslash
267      newline.  This is guaranteed not to occur in the middle of a token.
268      The two interpretations of \r do not conflict, because the two-character
269      escapes are used only in macro buffers, and backslash-newline is removed
270      from macro expansion text in collect_expansion and/or macarg.  */
271   char has_escapes;
272
273   /* Used by the C++ frontend to implement redirected input (such as for
274      default argument and/or template parsing).  */
275   char manual_pop;
276
277   /* True if we have already warned about C++ comments in this file.
278      The warning happens only for C89 extended mode with -pedantic on,
279      or for -Wtraditional, and only once per file (otherwise it would
280      be far too noisy).  */
281   char warned_cplusplus_comments;
282
283   /* True if this buffer's data is mmapped.  */
284   char mapped;
285 };
286
287 struct file_name_map_list;
288 struct htab;
289
290 /* Maximum nesting of cpp_buffers.  We use a static limit, partly for
291    efficiency, and partly to limit runaway recursion.  */
292 #define CPP_STACK_MAX 200
293
294 /* Values for opts.dump_macros.
295   dump_only means inhibit output of the preprocessed text
296              and instead output the definitions of all user-defined
297              macros in a form suitable for use as input to cpp.
298    dump_names means pass #define and the macro name through to output.
299    dump_definitions means pass the whole definition (plus #define) through
300 */
301 enum { dump_none = 0, dump_only, dump_names, dump_definitions };
302
303 /* This structure is nested inside struct cpp_reader, and
304    carries all the options visible to the command line.  */
305 struct cpp_options
306 {
307   /* Name of input and output files.  */
308   const char *in_fname;
309   const char *out_fname;
310
311   /* Pending options - -D, -U, -A, -I, -ixxx. */
312   struct cpp_pending *pending;
313
314   /* File name which deps are being written to.  This is 0 if deps are
315      being written to stdout.  */
316   const char *deps_file;
317
318   /* Target-name to write with the dependency information.  */
319   char *deps_target;
320
321   /* Search paths for include files.  */
322   struct file_name_list *quote_include;  /* First dir to search for "file" */
323   struct file_name_list *bracket_include;/* First dir to search for <file> */
324
325   /* Map between header names and file names, used only on DOS where
326      file names are limited in length.  */
327   struct file_name_map_list *map_list;
328
329   /* Directory prefix that should replace `/usr/lib/gcc-lib/TARGET/VERSION'
330      in the standard include file directories.  */
331   const char *include_prefix;
332   unsigned int include_prefix_len;
333
334   /* Non-0 means -v, so print the full set of include dirs.  */
335   unsigned char verbose;
336
337   /* Nonzero means use extra default include directories for C++.  */
338   unsigned char cplusplus;
339
340   /* Nonzero means handle cplusplus style comments */
341   unsigned char cplusplus_comments;
342
343   /* Nonzero means handle #import, for objective C.  */
344   unsigned char objc;
345
346   /* Nonzero means this is an assembly file, so ignore unrecognized
347      directives and the "# 33" form of #line, both of which are
348      probably comments.  Also, permit unbalanced ' strings (again,
349      likely to be in comments).  */
350   unsigned char lang_asm;
351
352   /* Nonzero means this is Fortran, and we don't know where the
353      comments are, so permit unbalanced ' strings.  Unlike lang_asm,
354      this does not ignore unrecognized directives.  */
355   unsigned char lang_fortran;
356
357   /* Nonzero means handle CHILL comment syntax and output CHILL string
358      delimiters for __DATE__ etc. */
359   unsigned char chill;
360
361   /* Nonzero means don't copy comments into the output file.  */
362   unsigned char discard_comments;
363
364   /* Nonzero means process the ANSI trigraph sequences.  */
365   unsigned char trigraphs;
366
367   /* Nonzero means print the names of included files rather than the
368      preprocessed output.  1 means just the #include "...", 2 means
369      #include <...> as well.  */
370   unsigned char print_deps;
371
372   /* Nonzero if missing .h files in -M output are assumed to be
373      generated files and not errors.  */
374   unsigned char print_deps_missing_files;
375
376   /* If true, fopen (deps_file, "a") else fopen (deps_file, "w"). */
377   unsigned char print_deps_append;
378
379   /* Nonzero means print names of header files (-H).  */
380   unsigned char print_include_names;
381
382   /* Nonzero means cpp_pedwarn causes a hard error.  */
383   unsigned char pedantic_errors;
384
385   /* Nonzero means don't print warning messages.  */
386   unsigned char inhibit_warnings;
387
388   /* Nonzero means don't print error messages.  Has no option to
389      select it, but can be set by a user of cpplib (e.g. fix-header).  */
390   unsigned char inhibit_errors;
391
392   /* Nonzero means warn if slash-star appears in a comment.  */
393   unsigned char warn_comments;
394
395   /* Nonzero means warn if there are any trigraphs.  */
396   unsigned char warn_trigraphs;
397
398   /* Nonzero means warn if #import is used.  */
399   unsigned char warn_import;
400
401   /* Nonzero means warn if a macro argument is (or would be)
402      stringified with -traditional, and warn about directives
403      with the # indented from the beginning of the line.  */
404   unsigned char warn_traditional;
405
406   /* Nonzero means turn warnings into errors.  */
407   unsigned char warnings_are_errors;
408
409   /* Nonzero causes output not to be done, but directives such as
410      #define that have side effects are still obeyed.  */
411   unsigned char no_output;
412
413   /* Nonzero means we should look for header.gcc files that remap file
414      names.  */
415   unsigned char remap;
416
417   /* Nonzero means don't output line number information.  */
418   unsigned char no_line_commands;
419
420   /* Nonzero means -I- has been seen, so don't look for #include "foo"
421      the source-file directory.  */
422   unsigned char ignore_srcdir;
423
424   /* Zero means dollar signs are punctuation. */
425   unsigned char dollars_in_ident;
426
427   /* Nonzero means try to imitate old fashioned non-ANSI preprocessor.  */
428   unsigned char traditional;
429
430   /* Nonzero means warn if undefined identifiers are evaluated in an #if.  */
431   unsigned char warn_undef;
432
433   /* Nonzero for the 1989 C Standard, including corrigenda and amendments.  */
434   unsigned char c89;
435
436   /* Nonzero for the 1999 C Standard, including corrigenda and amendments.  */
437   unsigned char c99;
438
439   /* Nonzero means give all the error messages the ANSI standard requires.  */
440   unsigned char pedantic;
441
442   /* Nonzero means we're looking at already preprocessed code, so don't
443      bother trying to do macro expansion and whatnot.  */
444   unsigned char preprocessed;
445
446   /* Nonzero disables all the standard directories for headers.  */
447   unsigned char no_standard_includes;
448
449   /* Nonzero disables the C++-specific standard directories for headers.  */
450   unsigned char no_standard_cplusplus_includes;
451
452   /* Nonzero means dump macros in some fashion - see above.  */
453   unsigned char dump_macros;
454
455   /* Nonzero means pass all #define and #undef directives which we
456      actually process through to the output stream.  This feature is
457      used primarily to allow cc1 to record the #defines and #undefs
458      for the sake of debuggers which understand about preprocessor
459      macros, but it may also be useful with -E to figure out how
460      symbols are defined, and where they are defined.  */
461   unsigned char debug_output;
462
463   /* Nonzero means pass #include lines through to the output.  */
464   unsigned char dump_includes;
465
466   /* Print column number in error messages.  */
467   unsigned char show_column;
468 };
469
470
471 /* A cpp_reader encapsulates the "state" of a pre-processor run.
472    Applying cpp_get_token repeatedly yields a stream of pre-processor
473    tokens.  Usually, there is only one cpp_reader object active. */
474
475 struct cpp_reader
476 {
477   /* Top of buffer stack.  */
478   cpp_buffer *buffer;
479
480   /* Token list used by get_directive_token.  */
481   cpp_toklist directbuf;
482
483   /* A buffer used for both for cpp_get_token's output, and also internally. */
484   unsigned char *token_buffer;
485   /* Allocated size of token_buffer.  CPP_RESERVE allocates space.  */
486   unsigned int token_buffer_size;
487   /* End of the written part of token_buffer. */
488   unsigned char *limit;
489
490   /* Error counter for exit code */
491   unsigned int errors;
492
493   /* Line where a newline was first seen in a string constant.  */
494   unsigned int multiline_string_line;
495
496   /* Current depth in #include directives that use <...>.  */
497   unsigned int system_include_depth;
498
499   /* Current depth of buffer stack. */
500   unsigned int buffer_stack_depth;
501
502   /* Hash table of macros and assertions.  See cpphash.c */
503   struct htab *hashtab;
504
505   /* Hash table of other included files.  See cppfiles.c */
506   struct htab *all_include_files;
507
508   /* Chain of `actual directory' file_name_list entries,
509      for "" inclusion. */
510   struct file_name_list *actual_dirs;
511
512   /* Current maximum length of directory names in the search path
513      for include files.  (Altered as we get more of them.)  */
514   unsigned int max_include_len;
515
516   struct if_stack *if_stack;
517   const unsigned char *potential_control_macro;
518
519   /* Buffer of -M output.  */
520   struct deps *deps;
521
522   /* A buffer used only by read_and_prescan (in cppfiles.c), which is
523      allocated once per cpp_reader object to keep it off the stack.  */
524   unsigned char *input_buffer;
525   size_t input_buffer_len;
526
527   /* User visible options.  */
528   struct cpp_options opts;
529
530   /* Nonzero means we have printed (while error reporting) a list of
531      containing files that matches the current status.  */
532   unsigned char input_stack_listing_current;
533
534   /* If non-zero, macros are not expanded.  */
535   unsigned char no_macro_expand;
536
537   /* If non-zero, directives cause a hard error.  Used when parsing
538      macro arguments.  */
539   unsigned char no_directives;
540
541   /* We're printed a warning recommending against using #import.  */
542   unsigned char import_warning;
543
544   /* If true, characters between '<' and '>' are a single (string) token.  */
545   unsigned char parsing_include_directive;
546
547   /* If true, # introduces an assertion (see do_assert) */
548   unsigned char parsing_if_directive;
549
550   /* If true, # and ## are the STRINGIZE and TOKPASTE operators */
551   unsigned char parsing_define_directive;
552
553   /* True if escape sequences (as described for has_escapes in
554      parse_buffer) should be emitted.  */
555   unsigned char output_escapes;
556
557   /* 0: Have seen non-white-space on this line.
558      1: Only seen white space so far on this line.
559      2: Only seen white space so far in this file.  */
560   unsigned char only_seen_white;
561
562   /* True after cpp_start_read completes.  Used to inhibit some
563      warnings while parsing the command line.  */
564   unsigned char done_initializing;
565 };
566
567 /* struct cpp_printer encapsulates state used to convert the stream of
568    tokens coming from cpp_get_token back into a text file.  Not
569    everyone wants to do that, hence we separate the function.  */
570
571 struct cpp_printer
572 {
573   FILE *outf;                   /* stream to write to */
574   const char *last_fname;       /* previous file name */
575   unsigned int last_bsd;        /* did we just push? */
576   unsigned int lineno;          /* line currently being written */
577   unsigned int written;         /* low water mark in token buffer */
578 };
579
580 #define CPP_FATAL_LIMIT 1000
581 /* True if we have seen a "fatal" error. */
582 #define CPP_FATAL_ERRORS(READER) ((READER)->errors >= CPP_FATAL_LIMIT)
583
584 /* Macros for manipulating the token_buffer. */
585
586 /* Number of characters currently in PFILE's output buffer. */
587 #define CPP_WRITTEN(PFILE) ((size_t)((PFILE)->limit - (PFILE)->token_buffer))
588 #define CPP_PWRITTEN(PFILE) ((PFILE)->limit)
589 #define CPP_ADJUST_WRITTEN(PFILE,DELTA) ((PFILE)->limit += (DELTA))
590 #define CPP_SET_WRITTEN(PFILE,N) ((PFILE)->limit = (PFILE)->token_buffer + (N))
591
592 #define CPP_OPTION(PFILE, OPTION) ((PFILE)->opts.OPTION)
593 #define CPP_BUFFER(PFILE) ((PFILE)->buffer)
594 #define CPP_BUF_LINE(BUF) ((BUF)->lineno)
595 #define CPP_BUF_COL(BUF) ((BUF)->cur - (BUF)->line_base)
596
597 /* Name under which this program was invoked.  */
598 extern const char *progname;
599
600 extern void _cpp_lex_file PARAMS((cpp_reader *));
601 extern int cpp_handle_options PARAMS ((cpp_reader *, int, char **));
602 extern enum cpp_ttype cpp_get_token PARAMS ((cpp_reader *));
603 extern enum cpp_ttype cpp_get_non_space_token PARAMS ((cpp_reader *));
604
605 extern void cpp_reader_init PARAMS ((cpp_reader *));
606 extern cpp_printer *cpp_printer_init PARAMS ((cpp_reader *, cpp_printer *));
607 extern int cpp_start_read PARAMS ((cpp_reader *, cpp_printer *, const char *));
608 extern void cpp_output_tokens PARAMS ((cpp_reader *, cpp_printer *));
609 extern void cpp_output_list PARAMS ((cpp_reader *, cpp_printer *,
610                                      const cpp_toklist *));
611 extern void cpp_finish PARAMS ((cpp_reader *, cpp_printer *));
612 extern void cpp_cleanup PARAMS ((cpp_reader *));
613
614 extern cpp_buffer *cpp_file_buffer PARAMS((cpp_reader *));
615 extern void cpp_define PARAMS ((cpp_reader *, const char *));
616 extern void cpp_assert PARAMS ((cpp_reader *, const char *));
617 extern void cpp_undef  PARAMS ((cpp_reader *, const char *));
618 extern void cpp_unassert PARAMS ((cpp_reader *, const char *));
619
620 extern void cpp_free_token_list PARAMS ((cpp_toklist *));
621
622 /* N.B. The error-message-printer prototypes have not been nicely
623    formatted because exgettext needs to see 'msgid' on the same line
624    as the name of the function in order to work properly.  Only the
625    string argument gets a name in an effort to keep the lines from
626    getting ridiculously oversized.  */
627
628 extern void cpp_ice PARAMS ((cpp_reader *, const char *msgid, ...))
629   ATTRIBUTE_PRINTF_2;
630 extern void cpp_fatal PARAMS ((cpp_reader *, const char *msgid, ...))
631   ATTRIBUTE_PRINTF_2;
632 extern void cpp_error PARAMS ((cpp_reader *, const char *msgid, ...))
633   ATTRIBUTE_PRINTF_2;
634 extern void cpp_warning PARAMS ((cpp_reader *, const char *msgid, ...))
635   ATTRIBUTE_PRINTF_2;
636 extern void cpp_pedwarn PARAMS ((cpp_reader *, const char *msgid, ...))
637   ATTRIBUTE_PRINTF_2;
638 extern void cpp_notice PARAMS ((cpp_reader *, const char *msgid, ...))
639   ATTRIBUTE_PRINTF_2;
640 extern void cpp_error_with_line PARAMS ((cpp_reader *, int, int, const char *msgid, ...))
641   ATTRIBUTE_PRINTF_4;
642 extern void cpp_warning_with_line PARAMS ((cpp_reader *, int, int, const char *msgid, ...))
643   ATTRIBUTE_PRINTF_4;
644 extern void cpp_pedwarn_with_line PARAMS ((cpp_reader *, int, int, const char *msgid, ...))
645   ATTRIBUTE_PRINTF_4;
646 extern void cpp_pedwarn_with_file_and_line PARAMS ((cpp_reader *, const char *, int, int, const char *msgid, ...))
647   ATTRIBUTE_PRINTF_5;
648 extern void cpp_error_from_errno        PARAMS ((cpp_reader *, const char *));
649 extern void cpp_notice_from_errno       PARAMS ((cpp_reader *, const char *));
650
651 /* In cpplex.c */
652 extern cpp_buffer *cpp_push_buffer      PARAMS ((cpp_reader *,
653                                                  const unsigned char *, long));
654 extern cpp_buffer *cpp_pop_buffer       PARAMS ((cpp_reader *));
655 extern void cpp_scan_buffer             PARAMS ((cpp_reader *, cpp_printer *));
656 extern void cpp_scan_buffer_nooutput    PARAMS ((cpp_reader *));
657
658
659
660 /* In cpphash.c */
661 extern int cpp_defined                  PARAMS ((cpp_reader *,
662                                                  const unsigned char *, int));
663
664 /* In cppfiles.c */
665 extern int cpp_included                 PARAMS ((cpp_reader *, const char *));
666 extern int cpp_read_file                PARAMS ((cpp_reader *, const char *));
667
668 #ifdef __cplusplus
669 }
670 #endif
671 #endif /* __GCC_CPPLIB__ */