Changed the way Cpp instances are created

This commit is contained in:
Pierre Pronchery 2009-07-31 01:38:05 +00:00
parent c140c68b05
commit 850832c21d
2 changed files with 6 additions and 3 deletions

View File

@ -34,6 +34,7 @@ typedef enum _CppScope
struct _Cpp
{
int options;
/* for include directives */
CppParser * parser;
char ** paths;

View File

@ -40,7 +40,7 @@ struct _CppDefine /* FIXME use a hash table */
/* public */
/* functions */
/* cpp_new */
Cpp * cpp_new(char const * filename, int filters)
Cpp * cpp_new(CppPrefs * prefs)
{
Cpp * cpp;
String * p;
@ -49,8 +49,10 @@ Cpp * cpp_new(char const * filename, int filters)
if((cpp = object_new(sizeof(*cpp))) == NULL)
return NULL;
memset(cpp, 0, sizeof(*cpp));
cpp->parser = cppparser_new(cpp, NULL, filename, filters);
if((p = string_new(filename)) != NULL)
cpp->options = prefs->options;
cpp->parser = cppparser_new(cpp, NULL, prefs->filename,
prefs->filters);
if((p = string_new(prefs->filename)) != NULL)
{
r |= cpp_path_add(cpp, dirname(p)); /* FIXME inclusion order */
string_delete(p);