wrc: -B -d -r -U -W

Dimitrie O. Paun dpaun at rogers.com
Thu Mar 27 18:07:57 CST 2003


OK,

I've decide to rename some seldom used options (-B, -d, -W) to
long names. This makes it clearer what's asked of wrc (which may
be a consideration for something that's used rarely), but most
importantly it keeps the short option namespace clean. Needless to
say, this is important as we share it with both windres and rc,
so less chance of conflicts in the future. As an added benefit,
the options now resemble options in other programs with similar
semantics, such as -pedantic in gcc.

Also note that we define the special defines _before_ we start
processing the options, since -U is supposed to be able to also
undefine the default defines.

This is it. I think. :)

ChangeLog
  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).

Index: Make.rules.in
===================================================================
RCS file: /var/cvs/wine/Make.rules.in,v
retrieving revision 1.150
diff -u -r1.150 Make.rules.in
--- Make.rules.in	23 Mar 2003 20:00:04 -0000	1.150
+++ Make.rules.in	27 Mar 2003 20:45:52 -0000
@@ -66,7 +66,7 @@
 WRC          = $(TOOLSDIR)/tools/wrc/wrc
 WMC          = $(TOOLSDIR)/tools/wmc/wmc
 WIDL         = $(TOOLSDIR)/tools/widl/widl
-WRCFLAGS     = -m --nostdinc $(EXTRAWRCFLAGS)
+WRCFLAGS     = --nostdinc $(EXTRAWRCFLAGS)
 LDPATH       = @LDPATH@
 DLLDIR       = $(TOPOBJDIR)/dlls
 LIBPORT      = -L$(TOPOBJDIR)/libs/port -lwine_port
Index: tools/wrc/parser.y
===================================================================
RCS file: /var/cvs/wine/tools/wrc/parser.y,v
retrieving revision 1.34
diff -u -r1.34 parser.y
--- tools/wrc/parser.y	19 Dec 2002 04:14:38 -0000	1.34
+++ tools/wrc/parser.y	27 Mar 2003 20:45:32 -0000
@@ -2994,9 +2994,5 @@
 		return lookahead;
 	}
 
-	if(remap)
-		return token;
-	else
-		yywarning("Usertype uses reserved type ID %d, which is used by %s", yylval.num, type);
-	return lookahead;
+	return token;
 }
Index: tools/wrc/wrc.c
===================================================================
RCS file: /var/cvs/wine/tools/wrc/wrc.c,v
retrieving revision 1.32
diff -u -r1.32 wrc.c
--- tools/wrc/wrc.c	27 Mar 2003 18:37:59 -0000	1.32
+++ tools/wrc/wrc.c	27 Mar 2003 21:49:41 -0000
@@ -56,37 +56,39 @@
 
 static char usage[] =
 	"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"
 	"   -E          Preprocess only\n"
 	"   -F target	Ignored for compatibility with windres\n"
-	"   -h		Prints this summary.\n"
-	"   -i file	The name of the input file.\n"
+	"   -h		Prints this summary\n"
+	"   -i file	The name of the input file\n"
 	"   -I path     Set include search dir to path (multiple -I allowed)\n"
 	"   -J format	The input format (either `rc' or `rc16')\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 format	The output format (either `res' or `res16`).\n"
-	"   -v          Enable verbose mode.\n"
-	"   -W          Enable pedantic warnings\n"
+	"   -O format	The output format (either `res' or `res16`)\n"
+	"   -r		Ignored for compatibility with rc\n"
+	"   -U id       Undefine preprocessor identifier id\n"
+	"   -v          Enable verbose mode\n"
 	"The following long options are supported:\n"
-	"   --input		Synonym for -i.\n"
-	"   --input-format	Synonym for -J.\n"
-	"   --output		Synonym for -o.\n"
-	"   --output-format	Synonym for -O.\n"
-	"   --target		Synonym for -F.\n"
-	"   --preprocessor	Specifies the preprocessor to use, including arguments.\n"
-	"   --include-dir	Synonym for -I.\n"
-	"   --define		Synonym for -D.\n"
-	"   --language		Synonym for -l.\n"
-	"   --nostdinc		Disables searching the standard include path.\n"
-	"   --use-temp-file	Ignored for compatibility with windres.\n"
-	"   --no-use-temp-file	Ignored for compatibility with windres.\n"
-	"   --help		Synonym for -h.\n"
-	"   --version		Print version and exit.\n"
+	"   --debug=nn          Set debug level to 'nn'\n"
+	"   --define		Synonym for -D\n"
+	"   --endianess=e       Set output byte-order e={n[ative], l[ittle], b[ig]}\n"
+	"                       (win32 only; default is " ENDIAN "-endian)\n"
+	"   --help		Synonym for -h\n"
+	"   --include-dir	Synonym for -I\n"
+	"   --input		Synonym for -i\n"
+	"   --input-format	Synonym for -J\n"
+	"   --language		Synonym for -l\n"
+	"   --no-use-temp-file	Ignored for compatibility with windres\n"
+	"   --nostdinc		Disables searching the standard include path\n"
+	"   --output		Synonym for -o\n"
+	"   --output-format	Synonym for -O\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"
 	"Debug level 'n' is a bitmask with following meaning:\n"
 	"    * 0x01 Tell which resource is parsed (verbose mode)\n"
@@ -155,11 +157,6 @@
  */
 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 *input_name;		/* The name given on the command-line */
 char *temp_name;		/* Temporary file for preprocess pipe */
@@ -177,21 +174,25 @@
 static void segvhandler(int sig);
 
 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[] = {
+	{ "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-format", 1, 0, 'J' },
+	{ "language", 1, 0, 'l' },
+	{ "no-use-temp-file", 0, 0, 3 },
+	{ "nostdinc", 0, 0, 1 },
 	{ "output", 1, 0, 'o' },
 	{ "output-format", 1, 0, 'O' },
-	{ "target", 1, 0, 'F' },
+	{ "pendantic", 0, 0, 8 },
 	{ "preprocessor", 1, 0, 4 },
-	{ "include-dir", 1, 0, 'I' },
-	{ "define", 1, 0, 'D' },
-	{ "language", 1, 0, 'l' },
-	{ "nostdinc", 0, 0, 1 },
+	{ "target", 1, 0, 'F' },
+	{ "undefine", 1, 0, 'U' },
 	{ "use-temp-file", 0, 0, 2 },
-	{ "no-use-temp-file", 0, 0, 3 },
-	{ "help", 0, 0, 'h' },
 	{ "version", 0, 0, 5 },
 	{ 0, 0, 0, 0 }
 };
@@ -212,6 +213,16 @@
 
 	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 */
 	/* Could be done through env[], but not all OS-es support it */
 	cmdlen = 4; /* for "wrc " */
@@ -247,7 +258,10 @@
 			printf(version_string);
 			exit(0);
 			break;
-		case 'B':
+		case 6:
+			debuglevel = strtol(optarg, NULL, 0);
+			break;
+		case 7:
 			switch(optarg[0])
 			{
 			case 'n':
@@ -267,8 +281,9 @@
 				lose++;
 			}
 			break;
-		case 'd':
-			debuglevel = strtol(optarg, NULL, 0);
+		case 8:
+			pedantic = 1;
+			wpp_set_pedantic(1);
 			break;
 		case 'D':
 			wpp_add_cmdline_define(optarg);
@@ -302,24 +317,28 @@
 				currentlanguage = new_language(PRIMARYLANGID(lan), SUBLANGID(lan));
 			}
 			break;
-		case 'm':
-			remap = 0;
-			break;
 		case 'o':
 			if (!output_name) output_name = strdup(optarg);
 			else error("Too many output files.\n");
 			break;
 		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);
 			break;
+		case 'r':
+			/* ignored for compatibility with rc */
+			break;
+		case 'U':
+			wpp_del_define(optarg);
+			break;
 		case 'v':
 			debuglevel = DEBUGLEVEL_CHAT;
 			break;
-		case 'W':
-			pedantic = 1;
-			wpp_set_pedantic(1);
-			break;
 		default:
 			lose++;
 			break;
@@ -366,20 +385,6 @@
         wpp_set_debug( (debuglevel & DEBUGLEVEL_PPLEX) != 0,
                        (debuglevel & DEBUGLEVEL_PPTRACE) != 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 */
 	if(!currentlanguage)
Index: tools/wrc/wrc.h
===================================================================
RCS file: /var/cvs/wine/tools/wrc/wrc.h,v
retrieving revision 1.29
diff -u -r1.29 wrc.h
--- tools/wrc/wrc.h	27 Mar 2003 18:37:59 -0000	1.29
+++ tools/wrc/wrc.h	27 Mar 2003 20:44:34 -0000
@@ -56,7 +56,6 @@
 extern int byteorder;
 extern int preprocess_only;
 extern int no_preprocess;
-extern int remap;
 
 extern char *output_name;
 extern char *input_name;
Index: tools/wrc/wrc.man
===================================================================
RCS file: /var/cvs/wine/tools/wrc/wrc.man,v
retrieving revision 1.18
diff -u -r1.18 wrc.man
--- tools/wrc/wrc.man	27 Mar 2003 18:37:59 -0000	1.18
+++ tools/wrc/wrc.man	27 Mar 2003 21:50:18 -0000
@@ -20,17 +20,17 @@
 no inputfile was given.
 .SH OPTIONS
 .TP
-.I \fB\-B\fR \fIx\fR
-Win32 only; set output byte\-ordering, where \fIx\fR is one of n[ative],
+.I \fB\-\-debug\fR=\fInn\fR
+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
 ordering depends on the system on which \fBwrc\fR was built. You can see
 the native ordering by typing \fIwrc \-h\fR.
 .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
 Define preprocessor identifier \fIid\fR to (optionally) value \fIval\fR.
 See also
@@ -43,7 +43,7 @@
 generate.
 .TP
 .I \fB\-F\fR, \fB\-\-target\fR
-Ignored for compatibility with windres.
+Ignored for compatibility with \fIwindres\fR.
 .TP
 .I \fB\-h\fR, \fB\-\-help\fR
 Prints a summary message and exits.
@@ -72,23 +72,12 @@
 Set default language to \fIlan\fR. Default is the neutral language 0
 (i.e. "LANGUAGE 0, 0").
 .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
 Do not search the standard include path, look for include files only
 in the directories explicitly specified with the \fI\-I\fR option.
 .TP
 .I \fB\-\-no\-use\-temp\-file\fR
-Ignored for compatibility with windres.
+Ignored for compatibility with \fIwindres\fR.
 .TP
 .I \fB\-o\fR, \fB\-\-output\fR=\fIfile\fR
 Write output to \fIfile\fR. Default is \fBinputfile.res\fR
@@ -99,23 +88,34 @@
 Sets the output format. The supported formats are 'res' and 'res16'.
 If this option is not specified, format defaults to 'res'.
 .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
 This option may be used to specify the preprocessor to use, including any 
 leading arguments. If not specified, \fBwrc\fR uses its builtin processor.
 To disable preprocessing, use \fB--preprocessor=cat\fR.
 .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
-Ignored for compatibility with windres.
+Ignored for compatibility with \fIwindres\fR.
 .TP
 .I \fB\-v\fR
 Turns on verbose mode (equivalent to -d 1).
 .TP
 .I \fB\-\-version\fR
 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
 The preprocessor is ANSI\-C compatible with some of the extensions of 
 the gcc preprocessor. 


-- 
Dimi.




More information about the wine-patches mailing list