wrc -hHrs (take 2)
Dimitrie O. Paun
dpaun at rogers.com
Sun Jan 5 10:42:02 CST 2003
Now that we have the windres compatible -O option, we can use
it to cleanup a bit some of wrc's options. Code got cleaner,
options are simpler to use and understand.
ChangeLog
Collapse the -hHrs options into the -O option.
Generate .res files by default.
Index: Make.rules.in
===================================================================
RCS file: /var/cvs/wine/Make.rules.in,v
retrieving revision 1.138
diff -u -r1.138 Make.rules.in
--- Make.rules.in 4 Jan 2003 00:52:21 -0000 1.138
+++ Make.rules.in 5 Jan 2003 16:26:37 -0000
@@ -123,7 +123,7 @@
$(LDPATH) $(WMC) -i -U -H /dev/null -o $@ $<
.rc.res:
- $(LDPATH) $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ -r $<
+ $(LDPATH) $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ $<
.res.res.o:
$(WINDRES) -i $< -o $@
Index: dlls/gdi/Makefile.in
===================================================================
RCS file: /var/cvs/wine/dlls/gdi/Makefile.in,v
retrieving revision 1.41
diff -u -r1.41 Makefile.in
--- dlls/gdi/Makefile.in 11 Dec 2002 01:34:52 -0000 1.41
+++ dlls/gdi/Makefile.in 5 Jan 2003 16:26:55 -0000
@@ -87,6 +87,6 @@
$(LDPATH) $(WINEBUILD) $(DEFS) -H 65520 -o $@ -M $(MODULE) -r version16.res --spec $(SRCDIR)/gdi.exe.spec
version16.res: version16.rc
- $(LDPATH) $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ -w16 -r $(SRCDIR)/version16.rc
+ $(LDPATH) $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ -w16 $(SRCDIR)/version16.rc
### Dependencies:
Index: dlls/kernel/Makefile.in
===================================================================
RCS file: /var/cvs/wine/dlls/kernel/Makefile.in,v
retrieving revision 1.52
diff -u -r1.52 Makefile.in
--- dlls/kernel/Makefile.in 11 Dec 2002 01:34:52 -0000 1.52
+++ dlls/kernel/Makefile.in 5 Jan 2003 16:27:06 -0000
@@ -56,6 +56,6 @@
$(LDPATH) $(WINEBUILD) $(DEFS) -N kernel -o $@ -M $(MODULE) -r version16.res --spec $(SRCDIR)/krnl386.exe.spec
version16.res: version16.rc
- $(LDPATH) $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ -w16 -r $(SRCDIR)/version16.rc
+ $(LDPATH) $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ -w16 $(SRCDIR)/version16.rc
### Dependencies:
Index: dlls/shell32/Makefile.in
===================================================================
RCS file: /var/cvs/wine/dlls/shell32/Makefile.in,v
retrieving revision 1.58
diff -u -r1.58 Makefile.in
--- dlls/shell32/Makefile.in 3 Jan 2003 19:12:56 -0000 1.58
+++ dlls/shell32/Makefile.in 5 Jan 2003 16:27:17 -0000
@@ -65,7 +65,7 @@
# Special rules for 16-bit resource files
version16.res: version16.rc
- $(LDPATH) $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ -w16 -r $(SRCDIR)/version16.rc
+ $(LDPATH) $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ -w16 $(SRCDIR)/version16.rc
shell.spec.c: shell.spec version16.res
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ -M $(MODULE) -r version16.res --spec $(SRCDIR)/shell.spec
Index: dlls/user/Makefile.in
===================================================================
RCS file: /var/cvs/wine/dlls/user/Makefile.in,v
retrieving revision 1.60
diff -u -r1.60 Makefile.in
--- dlls/user/Makefile.in 11 Dec 2002 01:34:52 -0000 1.60
+++ dlls/user/Makefile.in 5 Jan 2003 16:27:33 -0000
@@ -114,12 +114,12 @@
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ -M $(MODULE) -r resources/mouse.res --spec $(SRCDIR)/mouse.spec
resources/display.res: resources/display.rc
- $(LDPATH) $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ -w16 -r $(SRCDIR)/resources/display.rc
+ $(LDPATH) $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ -w16 $(SRCDIR)/resources/display.rc
resources/mouse.res: resources/mouse.rc
- $(LDPATH) $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ -w16 -r $(SRCDIR)/resources/mouse.rc
+ $(LDPATH) $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ -w16 $(SRCDIR)/resources/mouse.rc
resources/version16.res: resources/version16.rc
- $(LDPATH) $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ -w16 -r $(SRCDIR)/resources/version16.rc
+ $(LDPATH) $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ -w16 $(SRCDIR)/resources/version16.rc
### Dependencies:
Index: tools/wrc/wrc.c
===================================================================
RCS file: /var/cvs/wine/tools/wrc/wrc.c,v
retrieving revision 1.22
diff -u -r1.22 wrc.c
--- tools/wrc/wrc.c 19 Dec 2002 04:14:38 -0000 1.22
+++ tools/wrc/wrc.c 5 Jan 2003 16:28:18 -0000
@@ -98,19 +98,15 @@
" -E Preprocess only\n"
" -F target Ignored for compatibility with windres\n"
" -g Add symbols to the global c namespace\n"
- " -h Also generate a .h file\n"
- " -H file Same as -h but written to file\n"
" -i file The name of the input file.\n"
" -I path Set include search dir to path (multiple -I allowed)\n"
" -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 generate .s file\n"
" -N Do not preprocess input\n"
" -o file Output to file (default is infile.[res|s|h]\n"
- " -O format The output format to generate. format may be `res' only.\n"
+ " -O format The output format: one of `res', 'asm', 'hdr'.\n"
" -p prefix Give a prefix for the generated names\n"
- " -r Create binary .res file (compile only)\n"
" -s Add structure with win32/16 (PE/NE) resource directory\n"
" -t Generate indirect loadable resource tables\n"
" -T Generate only indirect loadable resources tables\n"
@@ -167,9 +163,9 @@
int constant = 0;
/*
- * Create a .res file from the source and exit (-r option).
+ * Output type (default res)
*/
-int create_res = 0;
+enum output_t { output_def, output_res, output_asm, output_hdr } output_type = output_def;
/*
* debuglevel == DEBUGLEVEL_NONE Don't bother
@@ -194,11 +190,6 @@
int binary = 0;
/*
- * Set when an additional C-header is to be created in compile (-h option).
- */
-int create_header = 0;
-
-/*
* Set when the NE/PE resource directory should be dumped into
* the output file.
*/
@@ -226,11 +217,6 @@
int alignment_pwr;
/*
- * Cleared when the assembly file must be suppressed (-n option)
- */
-int create_s = 1;
-
-/*
* Language setting for resources (-l option)
*/
language_t *currentlanguage = NULL;
@@ -272,7 +258,6 @@
char *output_name; /* The name given by the -o option */
char *input_name; /* The name given on the command-line */
-char *header_name; /* The name given by the -H option */
char *temp_name; /* Temporary file for preprocess pipe */
int line_number = 1; /* The current line */
@@ -402,12 +387,6 @@
case 'g':
global = 1;
break;
- case 'H':
- header_name = strdup(optarg);
- /* Fall through */
- case 'h':
- create_header = 1;
- break;
case 'i':
if (!input_name) input_name = strdup(optarg);
else error("Too many input files.\n");
@@ -430,9 +409,6 @@
case 'm':
remap = 0;
break;
- case 'n':
- create_s = 0;
- break;
case 'N':
no_preprocess = 1;
break;
@@ -441,15 +417,14 @@
else error("Too many output files.\n");
break;
case 'O':
- if (strcmp(optarg, "res"))
- error("Output format %s not supported.", optarg);
+ if (strcmp(optarg, "res") == 0) output_type = output_res;
+ else if (strcmp(optarg, "asm") == 0) output_type = output_asm;
+ else if (strcmp(optarg, "hdr") == 0) output_type = output_hdr;
+ else error("Output format %s not supported.", optarg);
break;
case 'p':
prefix = xstrdup(optarg);
break;
- case 'r':
- create_res = 1;
- break;
case 's':
create_dir = 1;
break;
@@ -509,12 +484,16 @@
}
/* Try to guess the output format based on output name */
- if (output_name)
+ if (output_type == output_def)
{
- char *dotstr = strrchr(output_name, '.');
- if (dotstr && (strcmp(dotstr+1, "res") == 0 ||
- strcmp(dotstr+1, "o") == 0))
- create_res = 1;
+ char *dotstr = output_name ? strrchr(output_name, '.') : 0;
+
+ output_type = output_res; /* by default generate .res files */
+ if (dotstr)
+ {
+ if (strcmp(dotstr+1, "s") == 0) output_type = output_asm;
+ else if(strcmp(dotstr+1, "h") == 0) output_type = output_hdr;
+ }
}
@@ -528,7 +507,7 @@
}
}
- if(create_res)
+ if(output_type == output_res)
{
if(constant)
{
@@ -536,12 +515,6 @@
constant = 0;
}
- if(create_header)
- {
- warning("Option -[h|H] ignored with compile to .res\n");
- create_header = 0;
- }
-
if(indirect)
{
warning("Option -t ignored with compile to .res\n");
@@ -585,12 +558,6 @@
constant = 0;
}
- if(create_header)
- {
- warning("Option -[h|H] ignored with preprocess only\n");
- create_header = 0;
- }
-
if(indirect)
{
warning("Option -t ignored with preprocess only\n");
@@ -689,13 +656,9 @@
if(!output_name && !preprocess_only)
{
output_name = dup_basename(input_name, binary ? ".res" : ".rc");
- strcat(output_name, create_res ? ".res" : ".s");
- }
-
- if(!header_name && !create_res)
- {
- header_name = dup_basename(input_name, binary ? ".res" : ".rc");
- strcat(header_name, ".h");
+ if (output_type == output_res) strcat(output_name, ".res");
+ else if (output_type == output_asm) strcat(output_name, ".s");
+ else if (output_type == output_hdr) strcat(output_name, ".h");
}
/* Run the preprocessor on the input */
@@ -761,23 +724,20 @@
/* Convert the internal lists to binary data */
resources2res(resource_top);
- if(create_res)
+ if(output_type == output_res)
{
chat("Writing .res-file");
write_resfile(output_name, resource_top);
}
- else
+ else if(output_type == output_asm)
{
- if(create_s)
- {
- chat("Writing .s-file");
- write_s_file(output_name, resource_top);
- }
- if(create_header)
- {
- chat("Writing .h-file");
- write_h_file(header_name, resource_top);
- }
+ chat("Writing .s-file");
+ write_s_file(output_name, resource_top);
+ }
+ else if(output_type == output_hdr)
+ {
+ chat("Writing .h-file");
+ write_h_file(output_name, resource_top);
}
}
@@ -786,15 +746,15 @@
/* Go from .res to .s */
chat("Reading .res-file");
resource_top = read_resfile(input_name);
- if(create_s)
+ if(output_type == output_asm)
{
chat("Writing .s-file");
write_s_file(output_name, resource_top);
}
- if(create_header)
+ else if(output_type == output_hdr)
{
chat("Writing .h-file");
- write_h_file(header_name, resource_top);
+ write_h_file(output_name, resource_top);
}
}
Index: tools/wrc/wrc.man
===================================================================
RCS file: /var/cvs/wine/tools/wrc/wrc.man,v
retrieving revision 1.8
diff -u -r1.8 wrc.man
--- tools/wrc/wrc.man 2 Jan 2003 19:30:17 -0000 1.8
+++ tools/wrc/wrc.man 5 Jan 2003 16:25:20 -0000
@@ -79,13 +79,6 @@
Add symbols to the global C namespace. This makes all symbols available
for linking by other modules.
.TP
-.I \-h
-Generate a \fB.h\fR header-file. The resource tables are described by
-extern declarations.
-.TP
-.I \-H file
-Same as \fI\-h\fR but written to \fIfile\fR.
-.TP
.I \-I path
Add \fIpath\fR to include search directories. \fIPath\fR may contain
multiple directories, separated with ':'. It is allowed to specify
@@ -116,10 +109,6 @@
source\-files that contain overlapping type\-IDs, or when the format of the
resource is not 100% compliant.
.TP
-.I \-n
-Do not generate an assembly outputfile (suppress generation of \fB.s\fR
-file). Usefull if you are interested in a header file only.
-.TP
.I \-N
Do not preprocess the input. This will most certainly result in
compilation failure, unless you have preprocessed the source with
@@ -130,13 +119,14 @@
with \fB.rc\fR stripped or \fBwrc.tab.{s,h,res}\fR, depending on the
compilation mode.
.TP
+.I \-O format
+Sets the output format. \fformat\fR can one of 'res', 'asm', and 'hdr'
+to generate a \fB.res\fR, \fB.s\fR, or \fB.h\fR file respectively.
+If not specified, \fBwrc\fR assumes 'res'.
+.TP
.I \-p prefix
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 \-r
-Create binary \fB.res\fR file (compile only).
.TP
.I \-s
Add structure with win32/16 (PE/NE) resource directory to outputfile.
--
Dimi.
More information about the wine-patches
mailing list