wpp: Explicitly pass include type to the lookup callback function.

Also, always pass the parent name to the callback, d3dcompiler needs
that information.
This commit is contained in:
Matteo Bruni 2012-06-13 18:04:21 +02:00 committed by Alexandre Julliard
parent 8b0d3d9f9a
commit 80034de243
5 changed files with 13 additions and 13 deletions

View File

@ -143,7 +143,7 @@ static void wpp_warning(const char *file, int line, int col, const char *near,
wpp_write_message_var("\n");
}
static char *wpp_lookup_mem(const char *filename, const char *parent_name,
static char *wpp_lookup_mem(const char *filename, int type, const char *parent_name,
char **include_path, int include_path_count)
{
/* Here we return always ok. We will maybe fail on the next wpp_open_mem */

View File

@ -29,12 +29,12 @@ struct wpp_callbacks
/* I/O callbacks */
/* Looks for a file to include, returning the path where it is found */
/* parent_name is the directory of the parent source file (for local
* includes), includepath is an array of additional include paths */
char *(*lookup)( const char *filename, const char *parent_name,
/* The type param is true for local (#include "filename.h") includes */
/* parent_name is the directory of the parent source file, includepath
* is an array of additional include paths */
char *(*lookup)( const char *filename, int type, const char *parent_name,
char **include_path, int include_path_count );
/* Opens an include file */
/* The type param is true if it is a local ("...") include */
void *(*open)( const char *filename, int type );
/* Closes a previously opened file */
void (*close)( void *file );

View File

@ -1601,7 +1601,7 @@ void pp_do_include(char *fname, int type)
/* Undo the effect of the quotation */
fname[n-1] = '\0';
if((fp = pp_open_include(fname+1, type ? pp_status.input : NULL, &newpath)) == NULL)
if((fp = pp_open_include(fname+1, type, pp_status.input, &newpath)) == NULL)
{
ppy_error("Unable to open include file %s", fname+1);
return;

View File

@ -115,7 +115,7 @@ char *pp_xstrdup(const char *str)
return memcpy(s, str, len);
}
static char *wpp_default_lookup(const char *name, const char *parent_name,
static char *wpp_default_lookup(const char *name, int type, const char *parent_name,
char **include_path, int include_path_count)
{
char *cpy;
@ -144,7 +144,7 @@ static char *wpp_default_lookup(const char *name, const char *parent_name,
}
*cptr = '\0';
if(parent_name)
if(type && parent_name)
{
/* Search directory of parent include and then -I path */
const char *p;
@ -507,17 +507,17 @@ int wpp_add_include_path(const char *path)
char *wpp_find_include(const char *name, const char *parent_name)
{
return wpp_default_lookup(name, parent_name, includepath, nincludepath);
return wpp_default_lookup(name, !!parent_name, parent_name, includepath, nincludepath);
}
void *pp_open_include(const char *name, const char *parent_name, char **newpath)
void *pp_open_include(const char *name, int type, const char *parent_name, char **newpath)
{
char *path;
void *fp;
if (!(path = wpp_callbacks->lookup(name, parent_name, includepath,
if (!(path = wpp_callbacks->lookup(name, type, parent_name, includepath,
nincludepath))) return NULL;
fp = wpp_callbacks->open(path, !!parent_name);
fp = wpp_callbacks->open(path, type);
if (fp)
{

View File

@ -207,7 +207,7 @@ void pp_pop_define_state(void);
pp_entry_t *pp_add_define(const char *def, const char *text);
pp_entry_t *pp_add_macro(char *ident, marg_t *args[], int nargs, mtext_t *exp);
void pp_del_define(const char *name);
void *pp_open_include(const char *name, const char *parent_name, char **newpath);
void *pp_open_include(const char *name, int type, const char *parent_name, char **newpath);
void pp_push_if(pp_if_state_t s);
void pp_next_if_state(int);
pp_if_state_t pp_pop_if(void);