Mercurial > hg > index.cgi
comparison lwcc/cpp.h @ 495:5b8871fd7503
Merged previous lwcc development branch into mainline.
author | William Astle <lost@l-w.ca> |
---|---|
date | Mon, 05 Aug 2019 21:27:09 -0600 |
parents | 670ea8f90212 |
children |
comparison
equal
deleted
inserted
replaced
493:6073f4a33475 | 495:5b8871fd7503 |
---|---|
1 /* | |
2 lwcc/cpp.h | |
3 | |
4 Copyright © 2013 William Astle | |
5 | |
6 This file is part of LWTOOLS. | |
7 | |
8 LWTOOLS is free software: you can redistribute it and/or modify it under the | |
9 terms of the GNU General Public License as published by the Free Software | |
10 Foundation, either version 3 of the License, or (at your option) any later | |
11 version. | |
12 | |
13 This program is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
16 more details. | |
17 | |
18 You should have received a copy of the GNU General Public License along with | |
19 this program. If not, see <http://www.gnu.org/licenses/>. | |
20 */ | |
21 | |
22 #ifndef cpp_h_seen___ | |
23 #define cpp_h_seen___ | |
24 | |
25 #include <stdio.h> | |
26 | |
27 #include <lw_stringlist.h> | |
28 | |
29 //#include "symbol.h" | |
30 #include "token.h" | |
31 | |
32 #define TOKBUFSIZE 32 | |
33 | |
34 struct expand_e | |
35 { | |
36 struct expand_e *next; | |
37 struct symtab_e *s; // symbol table entry of the expanding symbol | |
38 }; | |
39 | |
40 struct preproc_info | |
41 { | |
42 const char *fn; | |
43 FILE *fp; | |
44 struct token *tokqueue; | |
45 struct token *curtok; | |
46 void (*errorcb)(const char *); | |
47 void (*warningcb)(const char *); | |
48 int eolstate; // internal for use in handling newlines | |
49 int lineno; // the current input line number | |
50 int column; // the current input column | |
51 int trigraphs; // nonzero if we're going to handle trigraphs | |
52 int ra; | |
53 int qseen; | |
54 int ungetbufl; | |
55 int ungetbufs; | |
56 int *ungetbuf; | |
57 int unget; | |
58 int eolseen; | |
59 int nlseen; | |
60 int ppeolseen; // nonzero if we've seen only whitespace (or nothing) since a newline | |
61 int skip_level; // nonzero if we're in a false conditional | |
62 int found_level; // nonzero if we're in a true conditional | |
63 int else_level; // for counting #else directives | |
64 int else_skip_level; // ditto | |
65 struct symtab_e *sh; // the preprocessor's symbol table | |
66 struct token *sourcelist; // for expanding a list of tokens | |
67 struct expand_e *expand_list; // record of which macros are currently being expanded | |
68 char *lexstr; // for lexing a string (token pasting) | |
69 int lexstrloc; // ditto | |
70 struct preproc_info *n; // next in file stack | |
71 struct preproc_info *filestack; // stack of saved files during include | |
72 struct lw_strpool *strpool; | |
73 lw_stringlist_t quotelist; | |
74 lw_stringlist_t inclist; | |
75 }; | |
76 | |
77 extern struct preproc_info *preproc_init(const char *); | |
78 extern struct token *preproc_next_token(struct preproc_info *); | |
79 extern struct token *preproc_next_processed_token(struct preproc_info *); | |
80 extern void preproc_finish(struct preproc_info *); | |
81 extern void preproc_register_error_callback(struct preproc_info *, void (*)(const char *)); | |
82 extern void preproc_register_warning_callback(struct preproc_info *, void (*)(const char *)); | |
83 extern void preproc_throw_error(struct preproc_info *, const char *, ...); | |
84 extern void preproc_throw_warning(struct preproc_info *, const char *, ...); | |
85 extern void preproc_unget_token(struct preproc_info *, struct token *); | |
86 extern void preproc_add_include(struct preproc_info *, char *, int); | |
87 extern void preproc_add_macro(struct preproc_info *, char *); | |
88 extern struct token *preproc_next(struct preproc_info *); | |
89 | |
90 #endif // cpp_h_seen___ |