diff lwcc/cpp-main.c @ 304:d85d173ba120 ccdev

Checkpoint lwcc development - preprocessor is runnable but nonfunctional The preprocessor is currently runnable but doesn't actually do anything useful. This is just a checkpoint.
author William Astle <lost@l-w.ca>
date Tue, 17 Sep 2013 19:33:41 -0600
parents 4b17780f2777
children 54f213c8fb81
line wrap: on
line diff
--- a/lwcc/cpp-main.c	Tue Sep 17 19:32:14 2013 -0600
+++ b/lwcc/cpp-main.c	Tue Sep 17 19:33:41 2013 -0600
@@ -120,7 +120,6 @@
 	{
 		/* if no input files, work on stdin */
 		retval = process_file("-");
-		retval = 1;
 	}
 	else
 	{
@@ -142,7 +141,7 @@
 int process_file(const char *fn)
 {
 	struct preproc_info *pp;
-	struct token *tok;
+	struct token *tok = NULL;
 	
 	pp = preproc_init(fn);
 	if (!pp)
@@ -150,11 +149,13 @@
 	
 	for (;;)
 	{
-		tok = preproc_next_token(pp);
+		tok = preproc_next(pp);
 		if (tok -> ttype == TOK_EOF)
 			break;
 		token_print(tok, output_fp);
+		token_free(tok);
 	}
+	token_free(tok);
 	preproc_finish(pp);
 	return 0;
 }