Commit 4f0bb2e4 authored by Alexandre Julliard's avatar Alexandre Julliard

wrc: Support only single directories with the -I option.

parent 747905c6
......@@ -54,7 +54,7 @@ static const char usage[] =
" --help Display this help and exit\n"
" -h Generate headers\n"
" -H file Name of header file (default is infile.h)\n"
" -I path Set include search dir to path (multiple -I allowed)\n"
" -I directory Add directory to the include search path (multiple -I allowed)\n"
" --local-stubs=file Write empty stubs for call_as/local methods to file\n"
" -m32, -m64 Set the target architecture (Win32 or Win64)\n"
" -N Do not preprocess input\n"
......
......@@ -102,7 +102,7 @@ names. The default output filename is \fBdlldata.c\fR.
.PP
.B Preprocessor options:
.IP "\fB-I \fIpath\fR"
Add a header search directory to path. Multiple search
Add a directory to the include search path. Multiple include
directories are allowed.
.IP "\fB-D \fIid\fR[\fB=\fIval\fR]"
Define preprocessor macro \fIid\fR with value \fIval\fR.
......
......@@ -54,9 +54,9 @@ struct define
};
static struct list cmdline_defines = LIST_INIT( cmdline_defines );
static struct strarray includes;
static char *wpp_lookup(const char *name, int type, const char *parent_name,
char **include_path, int include_path_count)
static char *wpp_lookup(const char *name, int type, const char *parent_name)
{
char *cpy;
char *cptr;
......@@ -96,9 +96,9 @@ static char *wpp_lookup(const char *name, int type, const char *parent_name,
free( path );
}
/* Search -I path */
for(i = 0; i < include_path_count; i++)
for(i = 0; i < includes.count; i++)
{
path = strmake("%s/%s", include_path[i], cpy);
path = strmake("%s/%s", includes.str[i], cpy);
fd = open( path, O_RDONLY );
if (fd != -1)
{
......@@ -294,28 +294,11 @@ pp_entry_t *pp_add_macro(char *id, char *args[], int nargs, mtext_t *exp)
* Include management
*-------------------------------------------------------------------------
*/
#if defined(_WIN32) || defined(__MSDOS__)
#define INCLUDESEPARATOR ";"
#else
#define INCLUDESEPARATOR ":"
#endif
static char **includepath;
static int nincludepath = 0;
void wpp_add_include_path(const char *path)
{
char *tok;
char *cpy = xstrdup(path);
tok = strtok(cpy, INCLUDESEPARATOR);
while(tok)
{
if(*tok) {
char *dir;
char *dir = xstrdup(path);
char *cptr;
dir = xstrdup(tok);
for(cptr = dir; *cptr; cptr++)
{
/* Convert to forward slash */
......@@ -323,22 +306,14 @@ void wpp_add_include_path(const char *path)
*cptr = '/';
}
/* Kill eventual trailing '/' */
if(*(cptr = dir + strlen(dir)-1) == '/')
*cptr = '\0';
if(*(cptr = dir + strlen(dir)-1) == '/') *cptr = '\0';
/* Add to list */
includepath = xrealloc(includepath, (nincludepath+1) * sizeof(*includepath));
includepath[nincludepath] = dir;
nincludepath++;
}
tok = strtok(NULL, INCLUDESEPARATOR);
}
free(cpy);
strarray_add( &includes, dir );
}
char *wpp_find_include(const char *name, const char *parent_name)
{
return wpp_lookup(name, !!parent_name, parent_name, includepath, nincludepath);
return wpp_lookup(name, !!parent_name, parent_name);
}
void *pp_open_include(const char *name, int type, const char *parent_name, char **newpath)
......@@ -346,7 +321,7 @@ void *pp_open_include(const char *name, int type, const char *parent_name, char
char *path;
void *fp;
if (!(path = wpp_lookup(name, type, parent_name, includepath, nincludepath))) return NULL;
if (!(path = wpp_lookup(name, type, parent_name))) return NULL;
fp = fopen(path, "rt");
if (fp)
......
......@@ -51,7 +51,7 @@ static const char usage[] =
" -fo FILE Synonym for -o for compatibility with windres\n"
" -h, --help Prints this summary\n"
" -i, --input=FILE The name of the input file\n"
" -I, --include-dir=PATH Set include search dir to path (multiple -I allowed)\n"
" -I, --include-dir=DIR Add dir to the include search path (multiple -I allowed)\n"
" -J, --input-format=FORMAT The input format (either `rc' or `rc16')\n"
" -l, --language=LANG Set default language to LANG (default is neutral {0, 0})\n"
" -m16 Build a 16-bit resource file\n"
......
......@@ -46,10 +46,9 @@ will use the first non-option argument as the input file name. If there
are no non-option arguments, then \fBwrc\fR will read from standard input.
.TP
.I \fB\-I\fR, \fB\-\-include\-dir\fR=\fIpath\fR
Add \fIpath\fR to include search directories. \fIpath\fR may contain
multiple directories, separated with ':'. It is allowed to specify
\fB\-I\fR multiple times. Include files are searched in the order in
which the \fB\-I\fR options were specified.
Add \fIpath\fR to the list of directories to search for includes. It
is allowed to specify \fB\-I\fR multiple times. Include files are
searched in the order in which the \fB\-I\fR options were specified.
.br
The search is compatible with gcc, in which '<>' quoted filenames are
searched exclusively via the \fB\-I\fR set path, whereas the '""' quoted
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment