Mercurial > hg > index.cgi
comparison lwcc/cpp/file.c @ 294:048adfee2933 ccdev
Checkpoint on lwcc-cpp development
This checkpoint includes a tokenizer and basic implementation of #if,
#ifdef, #ifndef, #else, #endif, #elif, and #undef along with basic symbol
table management.
author | William Astle <lost@l-w.ca> |
---|---|
date | Tue, 10 Sep 2013 19:56:05 -0600 |
parents | c419b3b3d43f |
children |
comparison
equal
deleted
inserted
replaced
293:c419b3b3d43f | 294:048adfee2933 |
---|---|
266 file_stack -> unget = c2; | 266 file_stack -> unget = c2; |
267 } | 267 } |
268 file_stack -> curc = c; | 268 file_stack -> curc = c; |
269 return c; | 269 return c; |
270 } | 270 } |
271 | |
272 void skip_eol(void) | |
273 { | |
274 int c; | |
275 for (;;) | |
276 { | |
277 c = fetch_byte(); | |
278 if (c == CPP_EOF || c == CPP_EOL) | |
279 { | |
280 unfetch_byte(c); | |
281 return; | |
282 } | |
283 if (c == '/') | |
284 { | |
285 c = munch_comment(); | |
286 if (c > 0) | |
287 { | |
288 while (c--) | |
289 outchr(CPP_EOL); | |
290 } | |
291 } | |
292 } | |
293 } | |
294 | |
271 | 295 |
272 /* This function opens (if not stdin) the file f and pushes it onto the | 296 /* This function opens (if not stdin) the file f and pushes it onto the |
273 top of the input file stack. It then proceeds to process the file | 297 top of the input file stack. It then proceeds to process the file |
274 and return. Nonzero return means the file could not be opened. */ | 298 and return. Nonzero return means the file could not be opened. */ |
275 int process_file(const char *f) | 299 int process_file(const char *f) |