On January 29, 2003 07:51 pm, Alexandre Julliard wrote: > I think we should keep the -g option though, otherwise > in asm mode you are forced to parse the resource descriptor which > isn't much fun. Which raises the question why we need the asm mode in the first place... But this is a different can of worms I guess, so here is another try that keeps -g: ChangeLog Remove header file generation, and related options. Index: tools/wrc/wrc.c =================================================================== RCS file: /var/cvs/wine/tools/wrc/wrc.c,v retrieving revision 1.26 diff -u -r1.26 wrc.c --- tools/wrc/wrc.c 23 Jan 2003 21:21:50 -0000 1.26 +++ tools/wrc/wrc.c 30 Jan 2003 02:38:46 -0000 @@ -89,7 +89,6 @@ " -b Create an assembly array from a binary .res file\n" " -B x Set output byte-order x={n[ative], l[ittle], b[ig]}\n" " (win32 only; default is " ENDIAN "-endian)\n" - " -c Add 'const' prefix to C constants\n" " -C cp Set the resource's codepage to cp (default is 0)\n" " -d n Set debug level to 'n'\n" " -D id[=val] Define preprocessor identifier id=val\n" @@ -104,8 +103,8 @@ " -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|h]\n" - " -O format The output format: one of `res', 'asm', 'hdr'.\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" " -s Add structure with win32/16 (PE/NE) resource directory\n" " -v Enable verbose mode.\n" @@ -137,7 +136,7 @@ " * 0x10 Preprocessor lex messages\n" " * 0x20 Preprocessor yacc trace\n" "If no input filename is given and the output name is not overridden\n" - "with -o, then the output is written to \"wrc.tab.[sh]\"\n" + "with -o, then the output is written to \"wrc.tab.{s,res}\"\n" ; char version_string[] = "Wine Resource Compiler Version " WRC_FULLVERSION "\n" @@ -156,14 +155,9 @@ int win32 = 1; /* - * Set when generated C variables should be prefixed with 'const' - */ -int constant = 0; - -/* * Output type (default res) */ -enum output_t { output_def, output_res, output_asm, output_hdr } output_type = output_def; +enum output_t { output_def, output_res, output_asm } output_type = output_def; /* * debuglevel == DEBUGLEVEL_NONE Don't bother @@ -352,9 +346,6 @@ lose++; } break; - case 'c': - constant = 1; - break; case 'C': codepage = strtol(optarg, NULL, 0); break; @@ -411,7 +402,6 @@ case 'O': 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': @@ -481,7 +471,6 @@ if (dotstr) { if (strcmp(dotstr+1, "s") == 0) output_type = output_asm; - else if(strcmp(dotstr+1, "h") == 0) output_type = output_hdr; } } @@ -498,12 +487,6 @@ if(output_type == output_res) { - if(constant) - { - warning("Option -c ignored with compile to .res\n"); - constant = 0; - } - if(global) { warning("Option -g ignored with compile to .res\n"); @@ -529,12 +512,6 @@ if(preprocess_only) { - if(constant) - { - warning("Option -c ignored with preprocess only\n"); - constant = 0; - } - if(global) { warning("Option -g ignored with preprocess only\n"); @@ -616,7 +593,6 @@ output_name = dup_basename(input_name, binary ? ".res" : ".rc"); 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 */ @@ -692,11 +668,6 @@ 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); - } } else @@ -708,11 +679,6 @@ { 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); } } Index: tools/wrc/wrc.h =================================================================== RCS file: /var/cvs/wine/tools/wrc/wrc.h,v retrieving revision 1.26 diff -u -r1.26 wrc.h --- tools/wrc/wrc.h 20 Jan 2003 23:29:27 -0000 1.26 +++ tools/wrc/wrc.h 30 Jan 2003 02:43:46 -0000 @@ -49,11 +49,9 @@ #define DEBUGLEVEL_PPTRACE 0x0020 extern int win32; -extern int constant; extern int create_res; extern int extensions; extern int binary; -extern int create_header; extern int create_dir; extern int global; extern int alignment; @@ -69,7 +67,6 @@ extern char *prefix; extern char *output_name; extern char *input_name; -extern char *header_name; extern char *cmdline; extern time_t now; Index: tools/wrc/wrc.man =================================================================== RCS file: /var/cvs/wine/tools/wrc/wrc.man,v retrieving revision 1.11 diff -u -r1.11 wrc.man --- tools/wrc/wrc.man 20 Jan 2003 23:29:27 -0000 1.11 +++ tools/wrc/wrc.man 30 Jan 2003 02:40:24 -0000 @@ -25,9 +25,9 @@ extension \fB.rc\fR for resources in source form and \fB.res\fR for binary resources. The resources are read from standard input if no inputfile is given. If the outputfile is not specified with \fI-o\fR, -then \fBwrc\fR will write the output to \fBinputfile.{s,h,res}\fR +then \fBwrc\fR will write the output to \fBinputfile.{s,res}\fR with \fB.rc\fR stripped, depending on the mode of compilation. -The outputfile is named \fBwrc.tab.{s,h,res}\fR if no inputfile was +The outputfile is named \fBwrc.tab.{s,res}\fR if no inputfile was given. .SH OPTIONS .TP @@ -44,9 +44,6 @@ ordering depends on the system on which \fBwrc\fR was built. You can see the native ordering by typing \fIwrc \-?\fR. .TP -.I \-c -Add 'const' prefix to C constants when writing header files. -.TP .I \-C cp Set the resource's codepage to \fIcp\fR. Default codepage is 0. .TP @@ -119,8 +116,8 @@ 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. +Sets the output format. \fformat\fR can one either 'res' or 'asm' +to generate a \fB.res\fR or \fB.s\fR file respectively. If not specified, \fBwrc\fR assumes 'res'. .TP .I \-p prefix Index: tools/wrc/writeres.c =================================================================== RCS file: /var/cvs/wine/tools/wrc/writeres.c,v retrieving revision 1.25 diff -u -r1.25 writeres.c --- tools/wrc/writeres.c 20 Jan 2003 23:29:27 -0000 1.25 +++ tools/wrc/writeres.c 30 Jan 2003 02:45:37 -0000 @@ -48,26 +48,6 @@ "\n" ; -static char h_file_head_str[] = - "/*\n" - " * This file is generated with wrc version " WRC_FULLVERSION ". Do not edit!\n" - " * Source : %s\n" - " * Cmdline: %s\n" - " * Date : %s" - " */\n" - "\n" - "#ifndef __%08lx_H\n" /* This becomes the date of compile */ - "#define __%08lx_H\n" - "\n" - "#include <wrc_rsc.h>\n" - "\n" - ; - -static char h_file_tail_str[] = - "#endif\n" - "/* <eof> */\n\n" - ; - char _NEResTab[] = "_NEResTab"; char _PEResTab[] = "_PEResTab"; char _ResTable[] = "_ResTable"; @@ -950,56 +930,5 @@ } fprintf(fo, s_file_tail_str); - fclose(fo); -} - -/* - ***************************************************************************** - * Function : write_h_file - * Syntax : void write_h_file(char *outname, resource_t *top) - * Input : - * outname - Filename to write to - * top - The resource-tree to convert - * Output : - * Description : - * Remarks : - ***************************************************************************** -*/ -void write_h_file(char *outname, resource_t *top) -{ - FILE *fo; - resource_t *rsc; - - fo = fopen(outname, "wt"); - if(!fo) - { - error("Could not open %s\n", outname); - } - - fprintf(fo, h_file_head_str, input_name ? input_name : "stdin", - cmdline, ctime(&now), (long)now, (long)now); - - /* First write the segment tables reference */ - if(create_dir) - { - fprintf(fo, "extern %schar %s%s[];\n\n", - constant ? "const " : "", - prefix, - win32 ? _PEResTab : _NEResTab); - } - - /* Write the resource data */ - for(rsc = top; global && rsc; rsc = rsc->next) - { - if(!rsc->binres) - continue; - - fprintf(fo, "extern %schar %s%s_data[];\n", - constant ? "const " : "", - prefix, - rsc->c_name); - } - - fprintf(fo, h_file_tail_str); fclose(fo); } Index: tools/wrc/writeres.h =================================================================== RCS file: /var/cvs/wine/tools/wrc/writeres.h,v retrieving revision 1.2 diff -u -r1.2 writeres.h --- tools/wrc/writeres.h 10 Mar 2002 00:24:24 -0000 1.2 +++ tools/wrc/writeres.h 27 Jan 2003 20:34:11 -0000 @@ -27,6 +27,5 @@ void write_resfile(char *outname, resource_t *top); void write_s_file(char *outname, resource_t *top); -void write_h_file(char *outname, resource_t *top); #endif -- Dimi.