comparison lwcc/cpp.h @ 295:4b17780f2777 ccdev

Checkpoint lwcc development Changed tactics with the preprocessor. Instead of getting clever and trying to do things the "fast" way, instead, just tokenize the whole input and process it that way. Also, set up so the preprocessor and compiler can be integrated instead of having to have a specifically correct output for the preprocessed file. Also removed the subdirectories in the lwcc directory. It made things more complicated than they needed to be.
author William Astle <lost@l-w.ca>
date Thu, 12 Sep 2013 22:06:26 -0600
parents
children 83fcc1ed6ad6
comparison
equal deleted inserted replaced
294:048adfee2933 295:4b17780f2777
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 "token.h"
28
29 #define TOKBUFSIZE 32
30
31 struct preproc_info
32 {
33 const char *fn;
34 FILE *fp;
35 struct token *tokbuf[TOKBUFSIZE];
36 struct token *tokqueue;
37 int tokbuf_ptr;
38 void (*errorcb)(const char *);
39 void (*warningcb)(const char *);
40 int eolstate;
41 int lineno;
42 int column;
43 int trigraphs;
44 int ra;
45 int qseen;
46 int ungetbufl;
47 int ungetbufs;
48 int *ungetbuf;
49 int unget;
50 int eolseen;
51 int nlseen;
52 };
53
54 extern struct preproc_info *preproc_init(const char *);
55 extern struct token *preproc_next_token(struct preproc_info *);
56 extern void preproc_finish(struct preproc_info *);
57 extern void preproc_register_error_callback(struct preproc_info *, void (*)(const char *));
58 extern void preproc_register_warning_callback(struct preproc_info *, void (*)(const char *));
59 extern void preproc_throw_error(struct preproc_info *, const char *, ...);
60 extern void preproc_throw_warning(struct preproc_info *, const char *, ...);
61 #endif // cpp_h_seen___