Used Variables instead of Options, in SConstruct
[mcc.git] / cpp_main.c
blob04f38834e3eef40dc37574598718afe3ce976d1e
1 #include "cpp.h"
3 int cpp_main(int argc, char **argv)
5 struct cpp s_cpp, *cpp = &s_cpp;
6 const char *old_name = NULL;
7 int old_linenum = 0;
9 cpp_init(cpp);
10 cpp_include_file(cpp, "<stdin>", stdin, false);
11 do {
12 cpp_read_line(cpp);
13 if (cpp->line_buf){
14 cpp_process_line(cpp);
15 if (cpp->line_buf){
16 if (old_name != cpp->line_loc.name
17 || old_linenum != cpp->line_loc.line - 1){
18 old_name = cpp->line_loc.name;
19 old_linenum = cpp->line_loc.line;
20 printf("# %d \"%s\"\n", old_linenum, old_name);
21 } else {
22 old_linenum++;
24 fputs(cpp->line_buf, stdout);
25 fputc('\n', stdout);
28 } while (cpp->include_top);
29 cpp_delete(cpp);
31 return 0;