Changed the way a Cpp instance is created
This commit is contained in:
parent
cceafc1630
commit
c140c68b05
|
@ -34,6 +34,19 @@ typedef enum _CppFilter
|
||||||
CPP_FILTER_COMMENT = 4
|
CPP_FILTER_COMMENT = 4
|
||||||
} CppFilter;
|
} CppFilter;
|
||||||
|
|
||||||
|
typedef enum _CppOption
|
||||||
|
{
|
||||||
|
CPP_OPTION_NONE = 0,
|
||||||
|
CPP_OPTION_IGNORE_META = 1
|
||||||
|
} CppOption;
|
||||||
|
|
||||||
|
typedef struct _CppPrefs
|
||||||
|
{
|
||||||
|
char const * filename;
|
||||||
|
int filters;
|
||||||
|
int options;
|
||||||
|
} CppPrefs;
|
||||||
|
|
||||||
typedef enum _CppCode
|
typedef enum _CppCode
|
||||||
{
|
{
|
||||||
CPP_CODE_NULL = TC_NULL,
|
CPP_CODE_NULL = TC_NULL,
|
||||||
|
@ -113,7 +126,7 @@ typedef enum _CppCode
|
||||||
|
|
||||||
|
|
||||||
/* functions */
|
/* functions */
|
||||||
Cpp * cpp_new(char const * filename, int filters);
|
Cpp * cpp_new(CppPrefs * prefs);
|
||||||
void cpp_delete(Cpp * cpp);
|
void cpp_delete(Cpp * cpp);
|
||||||
|
|
||||||
/* accessors */
|
/* accessors */
|
||||||
|
|
|
@ -75,7 +75,7 @@ static int _cpp(Prefs * prefs, int filec, char * filev[])
|
||||||
static int _cpp_do(Prefs * prefs, FILE * fp, char const * filename)
|
static int _cpp_do(Prefs * prefs, FILE * fp, char const * filename)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
int filter = CPP_FILTER_WHITESPACE | CPP_FILTER_COMMENT;
|
CppPrefs cppprefs;
|
||||||
Cpp * cpp;
|
Cpp * cpp;
|
||||||
size_t i;
|
size_t i;
|
||||||
size_t j;
|
size_t j;
|
||||||
|
@ -83,9 +83,12 @@ static int _cpp_do(Prefs * prefs, FILE * fp, char const * filename)
|
||||||
Token * token;
|
Token * token;
|
||||||
int code;
|
int code;
|
||||||
|
|
||||||
|
cppprefs.filename = filename;
|
||||||
|
cppprefs.filters = CPP_FILTER_WHITESPACE | CPP_FILTER_COMMENT;
|
||||||
|
cppprefs.options = 0;
|
||||||
if(prefs->flags & PREFS_t)
|
if(prefs->flags & PREFS_t)
|
||||||
filter |= CPP_FILTER_TRIGRAPH;
|
cppprefs.filters |= CPP_FILTER_TRIGRAPH;
|
||||||
if((cpp = cpp_new(filename, filter)) == NULL)
|
if((cpp = cpp_new(&cppprefs)) == NULL)
|
||||||
return _cpp_error();
|
return _cpp_error();
|
||||||
for(i = 0; i < prefs->paths_cnt; i++)
|
for(i = 0; i < prefs->paths_cnt; i++)
|
||||||
if(cpp_path_add(cpp, prefs->paths[i]) != 0)
|
if(cpp_path_add(cpp, prefs->paths[i]) != 0)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user