Remove the no longer needed -m option, ignore -r for compatibility

with rc.
Rename -B to --endianess, -d to --debug, -W to --pedantic.
Add a new -U,--undefine option to undefined preprocessor symbols.
Cleanup the help message (order the long options alphabetically).
This commit is contained in:
Dimitrie O. Paun 2003-03-28 19:31:49 +00:00 committed by Alexandre Julliard
parent 45247de05b
commit 29ba6163aa
5 changed files with 93 additions and 93 deletions

View File

@ -66,7 +66,7 @@ MAKEDEP = $(TOOLSDIR)/tools/makedep
WRC = $(TOOLSDIR)/tools/wrc/wrc WRC = $(TOOLSDIR)/tools/wrc/wrc
WMC = $(TOOLSDIR)/tools/wmc/wmc WMC = $(TOOLSDIR)/tools/wmc/wmc
WIDL = $(TOOLSDIR)/tools/widl/widl WIDL = $(TOOLSDIR)/tools/widl/widl
WRCFLAGS = -m --nostdinc $(EXTRAWRCFLAGS) WRCFLAGS = --nostdinc $(EXTRAWRCFLAGS)
LDPATH = @LDPATH@ LDPATH = @LDPATH@
DLLDIR = $(TOPOBJDIR)/dlls DLLDIR = $(TOPOBJDIR)/dlls
LIBPORT = -L$(TOPOBJDIR)/libs/port -lwine_port LIBPORT = -L$(TOPOBJDIR)/libs/port -lwine_port

View File

@ -2994,9 +2994,5 @@ static int rsrcid_to_token(int lookahead)
return lookahead; return lookahead;
} }
if(remap) return token;
return token;
else
yywarning("Usertype uses reserved type ID %d, which is used by %s", yylval.num, type);
return lookahead;
} }

View File

@ -56,37 +56,39 @@
static char usage[] = static char usage[] =
"Usage: wrc [options...] [infile[.rc|.res]] [outfile]\n" "Usage: wrc [options...] [infile[.rc|.res]] [outfile]\n"
" -B x Set output byte-order x={n[ative], l[ittle], b[ig]}\n"
" (win32 only; default is " ENDIAN "-endian)\n"
" -d n Set debug level to 'n'\n"
" -D id[=val] Define preprocessor identifier id=val\n" " -D id[=val] Define preprocessor identifier id=val\n"
" -E Preprocess only\n" " -E Preprocess only\n"
" -F target Ignored for compatibility with windres\n" " -F target Ignored for compatibility with windres\n"
" -h Prints this summary.\n" " -h Prints this summary\n"
" -i file The name of the input file.\n" " -i file The name of the input file\n"
" -I path Set include search dir to path (multiple -I allowed)\n" " -I path Set include search dir to path (multiple -I allowed)\n"
" -J format The input format (either `rc' or `rc16')\n" " -J format The input format (either `rc' or `rc16')\n"
" -l lan Set default language to lan (default is neutral {0, 0})\n" " -l lan Set default language to lan (default is neutral {0, 0})\n"
" -m Do not remap numerical resource IDs\n"
" -o file Output to file (default is infile.res)\n" " -o file Output to file (default is infile.res)\n"
" -O format The output format (either `res' or `res16`).\n" " -O format The output format (either `res' or `res16`)\n"
" -v Enable verbose mode.\n" " -r Ignored for compatibility with rc\n"
" -W Enable pedantic warnings\n" " -U id Undefine preprocessor identifier id\n"
" -v Enable verbose mode\n"
"The following long options are supported:\n" "The following long options are supported:\n"
" --input Synonym for -i.\n" " --debug=nn Set debug level to 'nn'\n"
" --input-format Synonym for -J.\n" " --define Synonym for -D\n"
" --output Synonym for -o.\n" " --endianess=e Set output byte-order e={n[ative], l[ittle], b[ig]}\n"
" --output-format Synonym for -O.\n" " (win32 only; default is " ENDIAN "-endian)\n"
" --target Synonym for -F.\n" " --help Synonym for -h\n"
" --preprocessor Specifies the preprocessor to use, including arguments.\n" " --include-dir Synonym for -I\n"
" --include-dir Synonym for -I.\n" " --input Synonym for -i\n"
" --define Synonym for -D.\n" " --input-format Synonym for -J\n"
" --language Synonym for -l.\n" " --language Synonym for -l\n"
" --nostdinc Disables searching the standard include path.\n" " --no-use-temp-file Ignored for compatibility with windres\n"
" --use-temp-file Ignored for compatibility with windres.\n" " --nostdinc Disables searching the standard include path\n"
" --no-use-temp-file Ignored for compatibility with windres.\n" " --output Synonym for -o\n"
" --help Synonym for -h.\n" " --output-format Synonym for -O\n"
" --version Print version and exit.\n" " --pedantic Enable pedantic warnings\n"
" --preprocessor Specifies the preprocessor to use, including arguments\n"
" --target Synonym for -F\n"
" --undefine Synonym for -U\n"
" --use-temp-file Ignored for compatibility with windres\n"
" --version Print version and exit\n"
"Input is taken from stdin if no sourcefile specified.\n" "Input is taken from stdin if no sourcefile specified.\n"
"Debug level 'n' is a bitmask with following meaning:\n" "Debug level 'n' is a bitmask with following meaning:\n"
" * 0x01 Tell which resource is parsed (verbose mode)\n" " * 0x01 Tell which resource is parsed (verbose mode)\n"
@ -155,11 +157,6 @@ int preprocess_only = 0;
*/ */
int no_preprocess = 0; int no_preprocess = 0;
/*
* Cleared when _not_ to remap resource types (-m option)
*/
int remap = 1;
char *output_name; /* The name given by the -o option */ char *output_name; /* The name given by the -o option */
char *input_name; /* The name given on the command-line */ char *input_name; /* The name given on the command-line */
char *temp_name; /* Temporary file for preprocess pipe */ char *temp_name; /* Temporary file for preprocess pipe */
@ -177,21 +174,25 @@ static void rm_tempfile(void);
static void segvhandler(int sig); static void segvhandler(int sig);
static const char* short_options = static const char* short_options =
"B:d:D:EF:hi:I:J:l:mo:O:vW"; "D:EF:hi:I:J:l:o:O:rU:v";
static struct option long_options[] = { static struct option long_options[] = {
{ "debug", 1, 0, 6 },
{ "define", 1, 0, 'D' },
{ "endianess", 1, 0, 7 },
{ "help", 0, 0, 'h' },
{ "include-dir", 1, 0, 'I' },
{ "input", 1, 0, 'i' }, { "input", 1, 0, 'i' },
{ "input-format", 1, 0, 'J' }, { "input-format", 1, 0, 'J' },
{ "language", 1, 0, 'l' },
{ "no-use-temp-file", 0, 0, 3 },
{ "nostdinc", 0, 0, 1 },
{ "output", 1, 0, 'o' }, { "output", 1, 0, 'o' },
{ "output-format", 1, 0, 'O' }, { "output-format", 1, 0, 'O' },
{ "target", 1, 0, 'F' }, { "pendantic", 0, 0, 8 },
{ "preprocessor", 1, 0, 4 }, { "preprocessor", 1, 0, 4 },
{ "include-dir", 1, 0, 'I' }, { "target", 1, 0, 'F' },
{ "define", 1, 0, 'D' }, { "undefine", 1, 0, 'U' },
{ "language", 1, 0, 'l' },
{ "nostdinc", 0, 0, 1 },
{ "use-temp-file", 0, 0, 2 }, { "use-temp-file", 0, 0, 2 },
{ "no-use-temp-file", 0, 0, 3 },
{ "help", 0, 0, 'h' },
{ "version", 0, 0, 5 }, { "version", 0, 0, 5 },
{ 0, 0, 0, 0 } { 0, 0, 0, 0 }
}; };
@ -212,6 +213,16 @@ int main(int argc,char *argv[])
now = time(NULL); now = time(NULL);
/* Set the default defined stuff */
wpp_add_cmdline_define("__WRC__=" WRC_EXP_STRINGIZE(WRC_MAJOR_VERSION));
wpp_add_cmdline_define("__WRC_MINOR__=" WRC_EXP_STRINGIZE(WRC_MINOR_VERSION));
wpp_add_cmdline_define("__WRC_MICRO__=" WRC_EXP_STRINGIZE(WRC_MICRO_VERSION));
wpp_add_cmdline_define("__WRC_PATCH__=" WRC_EXP_STRINGIZE(WRC_MICRO_VERSION));
wpp_add_cmdline_define("RC_INVOKED=1");
wpp_add_cmdline_define("__WIN32__=1");
wpp_add_cmdline_define("__FLAT__=1");
/* First rebuild the commandline to put in destination */ /* First rebuild the commandline to put in destination */
/* Could be done through env[], but not all OS-es support it */ /* Could be done through env[], but not all OS-es support it */
cmdlen = 4; /* for "wrc " */ cmdlen = 4; /* for "wrc " */
@ -247,7 +258,10 @@ int main(int argc,char *argv[])
printf(version_string); printf(version_string);
exit(0); exit(0);
break; break;
case 'B': case 6:
debuglevel = strtol(optarg, NULL, 0);
break;
case 7:
switch(optarg[0]) switch(optarg[0])
{ {
case 'n': case 'n':
@ -267,8 +281,9 @@ int main(int argc,char *argv[])
lose++; lose++;
} }
break; break;
case 'd': case 8:
debuglevel = strtol(optarg, NULL, 0); pedantic = 1;
wpp_set_pedantic(1);
break; break;
case 'D': case 'D':
wpp_add_cmdline_define(optarg); wpp_add_cmdline_define(optarg);
@ -302,24 +317,28 @@ int main(int argc,char *argv[])
currentlanguage = new_language(PRIMARYLANGID(lan), SUBLANGID(lan)); currentlanguage = new_language(PRIMARYLANGID(lan), SUBLANGID(lan));
} }
break; break;
case 'm':
remap = 0;
break;
case 'o': case 'o':
if (!output_name) output_name = strdup(optarg); if (!output_name) output_name = strdup(optarg);
else error("Too many output files.\n"); else error("Too many output files.\n");
break; break;
case 'O': case 'O':
if (strcmp(optarg, "res16") == 0) win32 = 0; if (strcmp(optarg, "res16") == 0)
{
win32 = 0;
wpp_del_define("__WIN32__");
wpp_del_define("__FLAT__");
}
else if (strcmp(optarg, "res")) warning("Output format %s not supported.", optarg); else if (strcmp(optarg, "res")) warning("Output format %s not supported.", optarg);
break; break;
case 'r':
/* ignored for compatibility with rc */
break;
case 'U':
wpp_del_define(optarg);
break;
case 'v': case 'v':
debuglevel = DEBUGLEVEL_CHAT; debuglevel = DEBUGLEVEL_CHAT;
break; break;
case 'W':
pedantic = 1;
wpp_set_pedantic(1);
break;
default: default:
lose++; lose++;
break; break;
@ -367,20 +386,6 @@ int main(int argc,char *argv[])
(debuglevel & DEBUGLEVEL_PPTRACE) != 0, (debuglevel & DEBUGLEVEL_PPTRACE) != 0,
(debuglevel & DEBUGLEVEL_PPMSG) != 0 ); (debuglevel & DEBUGLEVEL_PPMSG) != 0 );
/* Set the default defined stuff */
wpp_add_cmdline_define("__WRC__=" WRC_EXP_STRINGIZE(WRC_MAJOR_VERSION));
wpp_add_cmdline_define("__WRC_MINOR__=" WRC_EXP_STRINGIZE(WRC_MINOR_VERSION));
wpp_add_cmdline_define("__WRC_MICRO__=" WRC_EXP_STRINGIZE(WRC_MICRO_VERSION));
wpp_add_cmdline_define("__WRC_PATCH__=" WRC_EXP_STRINGIZE(WRC_MICRO_VERSION));
wpp_add_cmdline_define("RC_INVOKED=1");
if(win32)
{
wpp_add_cmdline_define("__WIN32__=1");
wpp_add_cmdline_define("__FLAT__=1");
}
/* Check if the user set a language, else set default */ /* Check if the user set a language, else set default */
if(!currentlanguage) if(!currentlanguage)
currentlanguage = new_language(0, 0); currentlanguage = new_language(0, 0);

View File

@ -56,7 +56,6 @@ extern int pedantic;
extern int byteorder; extern int byteorder;
extern int preprocess_only; extern int preprocess_only;
extern int no_preprocess; extern int no_preprocess;
extern int remap;
extern char *output_name; extern char *output_name;
extern char *input_name; extern char *input_name;

View File

@ -20,17 +20,17 @@ specified with \fI-o\fR, then \fBwrc\fR will write the output to
no inputfile was given. no inputfile was given.
.SH OPTIONS .SH OPTIONS
.TP .TP
.I \fB\-B\fR \fIx\fR .I \fB\-\-debug\fR=\fInn\fR
Win32 only; set output byte\-ordering, where \fIx\fR is one of n[ative], Set debug level to \fInn\fR. The value is a bitmask consisting of
1=verbose, 2=dump internals, 4=resource parser trace, 8=preprocessor
messages, 16=preprocessor scanner and 32=preprocessor parser trace.
.TP
.I \fB\-\-endianess\fR=\fIe\fR
Win32 only; set output byte\-ordering, where \fIe\fR is one of n[ative],
l[ittle] or b[ig]. Only resources in source-form can be reorderd. Native l[ittle] or b[ig]. Only resources in source-form can be reorderd. Native
ordering depends on the system on which \fBwrc\fR was built. You can see ordering depends on the system on which \fBwrc\fR was built. You can see
the native ordering by typing \fIwrc \-h\fR. the native ordering by typing \fIwrc \-h\fR.
.TP .TP
.I \fB\-d\fR \fIn\fR
Set debug level to \fIn\fR. The value is a bitmask consisting of
1=verbose, 2=dump internals, 4=resource parser trace, 8=preprocessor
messages, 16=preprocessor scanner and 32=preprocessor parser trace.
.TP
.I \fB\-D\fR, \fB\-\-define\fR=\fIid[=val]\fR .I \fB\-D\fR, \fB\-\-define\fR=\fIid[=val]\fR
Define preprocessor identifier \fIid\fR to (optionally) value \fIval\fR. Define preprocessor identifier \fIid\fR to (optionally) value \fIval\fR.
See also See also
@ -43,7 +43,7 @@ outputfile was selected. The output is compatible with what gcc would
generate. generate.
.TP .TP
.I \fB\-F\fR, \fB\-\-target\fR .I \fB\-F\fR, \fB\-\-target\fR
Ignored for compatibility with windres. Ignored for compatibility with \fIwindres\fR.
.TP .TP
.I \fB\-h\fR, \fB\-\-help\fR .I \fB\-h\fR, \fB\-\-help\fR
Prints a summary message and exits. Prints a summary message and exits.
@ -72,23 +72,12 @@ input to 'rc16' disables the recognition of win32 keywords.
Set default language to \fIlan\fR. Default is the neutral language 0 Set default language to \fIlan\fR. Default is the neutral language 0
(i.e. "LANGUAGE 0, 0"). (i.e. "LANGUAGE 0, 0").
.TP .TP
.I \fB\-m\fR
Do not remap numerical resource type-IDs onto standard resources. This will
cause all numerical resource type\-IDs to be treated as user\-type resources
and will not be checked nor byte\-reversed. Without this option, resources
with, for example, type\-ID 2 are parsed as bitmaps and other type\-IDs will
map onto their respective standard type.
Use this option with caution because it can create problems when compiling for,
for example, big\-endian platforms. The \fI\-m\fR option is usefull for
source\-files that contain overlapping type\-IDs, or when the format of the
resource is not 100% compliant.
.TP
.I \fB\-\-nostdinc\fR .I \fB\-\-nostdinc\fR
Do not search the standard include path, look for include files only Do not search the standard include path, look for include files only
in the directories explicitly specified with the \fI\-I\fR option. in the directories explicitly specified with the \fI\-I\fR option.
.TP .TP
.I \fB\-\-no\-use\-temp\-file\fR .I \fB\-\-no\-use\-temp\-file\fR
Ignored for compatibility with windres. Ignored for compatibility with \fIwindres\fR.
.TP .TP
.I \fB\-o\fR, \fB\-\-output\fR=\fIfile\fR .I \fB\-o\fR, \fB\-\-output\fR=\fIfile\fR
Write output to \fIfile\fR. Default is \fBinputfile.res\fR Write output to \fIfile\fR. Default is \fBinputfile.res\fR
@ -99,23 +88,34 @@ from standard input.
Sets the output format. The supported formats are 'res' and 'res16'. Sets the output format. The supported formats are 'res' and 'res16'.
If this option is not specified, format defaults to 'res'. If this option is not specified, format defaults to 'res'.
.TP .TP
.I \fB\-\-pedantic\fR
Enable pedantic warnings. Notably redefinition of #define statements can
be discovered with this option.
.TP
.I \fB\-r\fR
Ignored for compatibility with \fIrc\fR.
.TP
.I \fB\-\-preprocessor\fR=\fIprogram\fR .I \fB\-\-preprocessor\fR=\fIprogram\fR
This option may be used to specify the preprocessor to use, including any This option may be used to specify the preprocessor to use, including any
leading arguments. If not specified, \fBwrc\fR uses its builtin processor. leading arguments. If not specified, \fBwrc\fR uses its builtin processor.
To disable preprocessing, use \fB--preprocessor=cat\fR. To disable preprocessing, use \fB--preprocessor=cat\fR.
.TP .TP
.I \fB\-U\fR, \fB\-\-undefine\fR=\fIid\fR
Undefine preprocessor identifier \fIid\fR. Please note that only macros
defined up to this point are undefined by this command. However, these
include the special macros defined automatically by \fIwrc\fR.
See also
.B PREPROCESSOR
below.
.TP
.I \fB\-\-use\-temp\-file\fR .I \fB\-\-use\-temp\-file\fR
Ignored for compatibility with windres. Ignored for compatibility with \fIwindres\fR.
.TP .TP
.I \fB\-v\fR .I \fB\-v\fR
Turns on verbose mode (equivalent to -d 1). Turns on verbose mode (equivalent to -d 1).
.TP .TP
.I \fB\-\-version\fR .I \fB\-\-version\fR
Print version end exit. Print version end exit.
.TP
.I \fB\-W\fR
Enable pedantic warnings. Notably redefinition of #define statements can
be discovered with this option.
.SH PREPROCESSOR .SH PREPROCESSOR
The preprocessor is ANSI\-C compatible with some of the extensions of The preprocessor is ANSI\-C compatible with some of the extensions of
the gcc preprocessor. the gcc preprocessor.