Mercurial > hg > index.cgi
comparison lwcc/cpp/cpp.h @ 292:40ecbd5da481 ccdev
Part one of the C preprocessor
This is part one of the C preprocessor. It finds and then fails to intepret
directives. Also handles line splicing and trigraphs.
author | William Astle <lost@l-w.ca> |
---|---|
date | Sun, 08 Sep 2013 21:58:12 -0600 |
parents | |
children | c419b3b3d43f |
comparison
equal
deleted
inserted
replaced
291:83f682ed4d65 | 292:40ecbd5da481 |
---|---|
1 /* | |
2 lwcc/cpp/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 enum | |
28 { | |
29 CPP_NOUNG = -3, | |
30 CPP_EOL = -2, | |
31 CPP_EOF = -1, | |
32 }; | |
33 | |
34 struct file_stack_e | |
35 { | |
36 const char *fn; | |
37 FILE *fp; | |
38 struct file_stack_e *next; | |
39 int line; | |
40 int col; | |
41 int eolstate; // end of line state for interpreting \r\n \n\r \n \r | |
42 int ra; // read ahead byte for trigraph scan | |
43 int qseen; // number of ? seen during trigraph scan | |
44 int unget; // character that has been "ungot" | |
45 int curc; // the most recent character retrieved | |
46 }; | |
47 | |
48 extern FILE *output_fp; | |
49 extern int trigraphs; | |
50 extern struct file_stack_e *file_stack; | |
51 | |
52 extern int process_file(const char *); | |
53 | |
54 extern void do_error(const char *, ...); | |
55 extern void do_warning(const char *, ...); | |
56 | |
57 #endif // cpp_h_seen___ |