wrc: set preprocessor option

Dimitrie O. Paun dpaun at rogers.com
Fri Jan 31 18:10:36 CST 2003


Some apps to use the --preprocessor thingy for windres,
so we will have to support it sooner or later. So we
might as well decide the interface now, to avoid interface
changes in the future. This allows us to get rid of -N,
which now becomes -P cat.

ChangeLog
  Add option to set preprocessor (not yet implemented).
  Remove the -N option, which is equivalent to '-P cat'.

Index: tools/wrc/wrc.c
===================================================================
RCS file: /var/cvs/wine/tools/wrc/wrc.c,v
retrieving revision 1.27
diff -u -r1.27 wrc.c
--- tools/wrc/wrc.c	31 Jan 2003 03:20:49 -0000	1.27
+++ tools/wrc/wrc.c	31 Jan 2003 17:47:59 -0000
@@ -102,10 +102,10 @@
 	"   -J		Do not search the standard include path\n"
 	"   -l lan      Set default language to lan (default is neutral {0, 0})\n"
 	"   -m          Do not remap numerical resource IDs\n"
-	"   -N          Do not preprocess input\n"
 	"   -o file     Output to file (default is infile.[res|s]\n"
 	"   -O format	The output format: one of `res', 'asm'.\n"
 	"   -p prefix   Give a prefix for the generated names\n"
+	"   -P program	Specifies the preprocessor to use, including arguments.\n"
 	"   -s          Add structure with win32/16 (PE/NE) resource directory\n"
 	"   -v          Enable verbose mode.\n"
 	"   -V          Print version and exit\n"
@@ -123,7 +123,7 @@
 	"   --language		Synonym for -l.\n"
 	"   --use-temp-file	Ignored for compatibility with windres.\n"
 	"   --no-use-temp-file	Ignored for compatibility with windres.\n"
-	"   --preprocessor	Specify the preprocessor to use, including arguments.\n"
+	"   --preprocessor	Synonym for -P.\n"
 	"   --help		Synonym for -h.\n"
 	"   --version		Synonym for -V.\n"
 #endif
@@ -224,7 +224,7 @@
 int preprocess_only = 0;
 
 /*
- * Set when _not_ to run the preprocessor (-N option)
+ * Set when _not_ to run the preprocessor (-P cat option)
  */
 int no_preprocess = 0;
 
@@ -250,7 +250,7 @@
 static void segvhandler(int sig);
 
 static const char* short_options = 
-	"a:AbB:cC:d:D:eEF:ghH:i:I:Jl:LmnNo:O:p:rstTvVw:W";
+	"a:AbB:cC:d:D:eEF:ghH:i:I:Jl:LmnNo:O:p:P:rstTvVw:W";
 #ifdef HAVE_GETOPT_LONG
 static struct option long_options[] = {
 	{ "input", 1, 0, 'i' },
@@ -263,7 +263,7 @@
 	{ "language", 1, 0, 'l' },
 	{ "version", 0, 0, 'V' },
 	{ "help", 0, 0, 'h' },
-	{ "preprocessor", 1, 0, 1 },
+	{ "preprocessor", 1, 0, 'P' },
 	{ "use-temp-file", 0, 0, 2 },
 	{ "no-use-temp-file", 0, 0, 3 },
 	{ 0, 0, 0, 0 }
@@ -311,9 +311,6 @@
 	{
 		switch(optc)
 		{
-		case 1:
-			fprintf(stderr, "--preprocessor option not yet supported, ignored.\n");
-			break;
 		case 2:
 			fprintf(stderr, "--use-temp-file option not yet supported, ignored.\n");
 			break;
@@ -392,9 +389,6 @@
 		case 'm':
 			remap = 0;
 			break;
-		case 'N':
-			no_preprocess = 1;
-			break;
 		case 'o':
 			if (!output_name) output_name = strdup(optarg);
 			else error("Too many output files.\n");
@@ -407,6 +401,10 @@
 		case 'p':
 			prefix = xstrdup(optarg);
 			break;
+		case 'P':
+			if (strcmp(optarg, "cat") == 0) no_preprocess = 1;
+			else fprintf(stderr, "-P option not yet supported, ignored.\n");
+			break;
 		case 's':
 			create_dir = 1;
 			break;
@@ -527,11 +525,6 @@
 		if(binary)
 		{
 			error("Option -E and -b cannot be used together\n");
-		}
-
-		if(no_preprocess)
-		{
-			error("Option -E and -N cannot be used together\n");
 		}
 	}
 
Index: tools/wrc/wrc.man
===================================================================
RCS file: /var/cvs/wine/tools/wrc/wrc.man,v
retrieving revision 1.13
diff -u -r1.13 wrc.man
--- tools/wrc/wrc.man	1 Feb 2003 00:36:59 -0000	1.13
+++ tools/wrc/wrc.man	1 Feb 2003 00:04:03 -0000
@@ -105,11 +105,6 @@
 source\-files that contain overlapping type\-IDs, or when the format of the
 resource is not 100% compliant.
 .TP
-.I \-N
-Do not preprocess the input. This will most certainly result in
-compilation failure, unless you have preprocessed the source with
-another preprocessor before passing it to \fBwrc\fR.
-.TP
 .I \-o file
 Write output to \fIfile\fR. Default is \fBinputfile.{res,s,h}\fR
 with \fB.rc\fR stripped or \fBwrc.tab.{s,h,res}\fR, depending on the
@@ -124,6 +119,11 @@
 Prefix all generated names with \fIprefix\fR. This is only relevant for
 names in the assembly code and header file. Resource names are not
 affected.
+.TP
+.I \-P program
+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-P cat\fR.
 .TP
 .I \-s
 Add structure with win32/16 (PE/NE) resource directory to outputfile.


-- 
Dimi.




More information about the wine-patches mailing list