Mercurial > hg > index.cgi
diff lwcc/cpp.c @ 306:b08787e5b9f3 ccdev
Add include search paths and command line macro definitions
Added command line macro definitions. Also implemented include paths. There
is no default include path; that will be supplied by the driver program.
author | William Astle <lost@l-w.ca> |
---|---|
date | Wed, 18 Sep 2013 20:41:41 -0600 |
parents | 54f213c8fb81 |
children | 670ea8f90212 |
line wrap: on
line diff
--- a/lwcc/cpp.c Wed Sep 18 19:17:52 2013 -0600 +++ b/lwcc/cpp.c Wed Sep 18 20:41:41 2013 -0600 @@ -26,6 +26,7 @@ #include <lw_alloc.h> #include <lw_string.h> +#include <lw_stringlist.h> #include "cpp.h" #include "strpool.h" @@ -58,9 +59,19 @@ pp -> ppeolseen = 1; pp -> lineno = 1; pp -> n = NULL; + pp -> quotelist = lw_stringlist_create(); + pp -> inclist = lw_stringlist_create(); return pp; } +void preproc_add_include(struct preproc_info *pp, char *dir, int sys) +{ + if (sys) + lw_stringlist_addstring(pp -> inclist, dir); + else + lw_stringlist_addstring(pp -> quotelist, dir); +} + struct token *preproc_next_token(struct preproc_info *pp) { struct token *t; @@ -118,6 +129,8 @@ void preproc_finish(struct preproc_info *pp) { fclose(pp -> fp); + lw_stringlist_destroy(pp -> inclist); + lw_stringlist_destroy(pp -> quotelist); if (pp -> curtok) token_free(pp -> curtok); while (pp -> tokqueue)