diff lwcc/cpp.c @ 308:670ea8f90212 ccdev

Converted preproc logic to library and moved some utility stuff to lwlib The strbuf and strpool stuff is generally useful so move it to lwlib where other such things live. Also, package the preprocessor logic into a library for easy use in multiple places.
author William Astle <lost@l-w.ca>
date Sat, 21 Sep 2013 13:33:54 -0600
parents b08787e5b9f3
children
line wrap: on
line diff
--- a/lwcc/cpp.c	Sat Sep 21 12:27:48 2013 -0600
+++ b/lwcc/cpp.c	Sat Sep 21 13:33:54 2013 -0600
@@ -27,9 +27,9 @@
 #include <lw_alloc.h>
 #include <lw_string.h>
 #include <lw_stringlist.h>
-
+#include <lw_strpool.h>
 #include "cpp.h"
-#include "strpool.h"
+
 
 struct token *preproc_lex_next_token(struct preproc_info *);
 
@@ -51,8 +51,8 @@
 	
 	pp = lw_alloc(sizeof(struct preproc_info));
 	memset(pp, 0, sizeof(struct preproc_info));
-	pp -> strpool = strpool_create();
-	pp -> fn = strpool_strdup(pp -> strpool, fn);
+	pp -> strpool = lw_strpool_create();
+	pp -> fn = lw_strpool_strdup(pp -> strpool, fn);
 	pp -> fp = fp;
 	pp -> ra = CPP_NOUNG;
 	pp -> unget = CPP_NOUNG;
@@ -138,7 +138,7 @@
 		preproc_next_token(pp);
 		token_free(pp -> curtok);
 	}
-	strpool_free(pp -> strpool);
+	lw_strpool_free(pp -> strpool);
 	lw_free(pp);
 }