Many cleanups, lots of updates to the man page. I was about to argue that we should drop the -a and -C options (I tried before, but didn't go well :(), when I noticed they are not actually used! :) The -w options wanted to be merged into the -O option. It makes sense: we want to control the input and output format independently, and what better way than through already existing -J and -O option? ChangeLog Remove unused options -a and -C. Collapse the -w into -O, for symmetry with -J. Update the man page to the latest options. Index: tools/wrc/wrc.c =================================================================== RCS file: /var/cvs/wine/tools/wrc/wrc.c,v retrieving revision 1.31 diff -u -r1.31 wrc.c --- tools/wrc/wrc.c 20 Mar 2003 19:23:08 -0000 1.31 +++ tools/wrc/wrc.c 26 Mar 2003 04:18:33 -0000 @@ -56,10 +56,8 @@ static char usage[] = "Usage: wrc [options...] [infile[.rc|.res]] [outfile]\n" - " -a n Alignment of resource (win16 only, default is 4)\n" " -B x Set output byte-order x={n[ative], l[ittle], b[ig]}\n" " (win32 only; default is " ENDIAN "-endian)\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" " -E Preprocess only\n" @@ -71,9 +69,8 @@ " -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 (must be `res').\n" + " -O format The output format (either `res' or `res16`).\n" " -v Enable verbose mode.\n" - " -w 16|32 Select win16 or win32 output (default is win32)\n" " -W Enable pedantic warnings\n" "The following long options are supported:\n" " --input Synonym for -i.\n" @@ -134,22 +131,11 @@ int extensions = 1; /* - * NE segment resource aligment (-a option) - */ -int alignment = 4; -int alignment_pwr; - -/* * Language setting for resources (-l option) */ language_t *currentlanguage = NULL; /* - * The codepage to write in win32 PE resource segment (-C option) - */ -DWORD codepage = 0; - -/* * Set when extra warnings should be generated (-W option) */ int pedantic = 0; @@ -191,7 +177,7 @@ static void segvhandler(int sig); static const char* short_options = - "a:AB:cC:d:D:eEF:hH:i:I:l:LmnNo:O:P:rtTvVw:W"; + "B:d:D:EF:hi:I:J:l:mo:O:vW"; static struct option long_options[] = { { "input", 1, 0, 'i' }, { "input-format", 1, 0, 'J' }, @@ -219,7 +205,6 @@ int stdinc = 1; int lose = 0; int ret; - int a; int i; int cmdlen; @@ -262,9 +247,6 @@ printf(version_string); exit(0); break; - case 'a': - alignment = atoi(optarg); - break; case 'B': switch(optarg[0]) { @@ -285,9 +267,6 @@ lose++; } break; - case 'C': - codepage = strtol(optarg, NULL, 0); - break; case 'd': debuglevel = strtol(optarg, NULL, 0); break; @@ -331,20 +310,12 @@ else error("Too many output files.\n"); break; case 'O': - if (strcmp(optarg, "res")) - warning("Output format %s not supported.", optarg); + if (strcmp(optarg, "res16") == 0) win32 = 0; + else if (strcmp(optarg, "res")) warning("Output format %s not supported.", optarg); break; case 'v': debuglevel = DEBUGLEVEL_CHAT; break; - case 'w': - if(!strcmp(optarg, "16")) - win32 = 0; - else if(!strcmp(optarg, "32")) - win32 = 1; - else - lose++; - break; case 'W': pedantic = 1; wpp_set_pedantic(1); @@ -380,31 +351,6 @@ { if (!output_name) output_name = argv[optind++]; else error("Too many output files.\n"); - } - - /* Check the command line options for invalid combinations */ - if(win32) - { - if(!extensions) - { - warning("Option -e ignored with 32bit compile\n"); - extensions = 1; - } - } - - /* Set alignment power */ - a = alignment; - for(alignment_pwr = 0; alignment_pwr < 10 && a > 1; alignment_pwr++) - { - a >>= 1; - } - if(a != 1) - { - error("Alignment must be between 1 and 1024"); - } - if((1 << alignment_pwr) != alignment) - { - error("Alignment must be a power of 2"); } /* Kill io buffering when some kind of debuglevel is enabled */ Index: tools/wrc/wrc.h =================================================================== RCS file: /var/cvs/wine/tools/wrc/wrc.h,v retrieving revision 1.28 diff -u -r1.28 wrc.h --- tools/wrc/wrc.h 26 Feb 2003 05:04:12 -0000 1.28 +++ tools/wrc/wrc.h 26 Mar 2003 04:18:55 -0000 @@ -51,10 +51,7 @@ extern int win32; extern int create_res; extern int extensions; -extern int alignment; -extern int alignment_pwr; extern int create_s; -extern DWORD codepage; extern int pedantic; extern int byteorder; extern int preprocess_only; Index: tools/wrc/wrc.man =================================================================== RCS file: /var/cvs/wine/tools/wrc/wrc.man,v retrieving revision 1.17 diff -u -r1.17 wrc.man --- tools/wrc/wrc.man 20 Mar 2003 19:23:08 -0000 1.17 +++ tools/wrc/wrc.man 26 Mar 2003 04:55:22 -0000 @@ -20,39 +20,40 @@ no inputfile was given. .SH OPTIONS .TP -.I \-a n -Win16 only; set the alignment between resources n. The alignment must -be a power of 2. The default is 4. -.TP -.I \-B x +.I \fB\-B\fR \fIx\fR Win32 only; set output byte\-ordering, where \fIx\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 \-?\fR. -.TP -.I \-C cp -Set the resource's codepage to \fIcp\fR. Default codepage is 0. +the native ordering by typing \fIwrc \-h\fR. .TP -.I \-d n +.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 \-D id[=val] +.I \fB\-D\fR, \fB\-\-define\fR=\fIid[=val]\fR Define preprocessor identifier \fIid\fR to (optionally) value \fIval\fR. See also .B PREPROCESSOR below. .TP -.I \-E +.I \fB\-E\fR Preprocess only. The output is written to standard output if no outputfile was selected. The output is compatible with what gcc would generate. .TP -.I \-h +.I \fB\-F\fR, \fB\-\-target\fR +Ignored for compatibility with windres. +.TP +.I \fB\-h\fR, \fB\-\-help\fR Prints a summary message and exits. .TP -.I \-I path +.I \fB\-i\fR, \fB\-\-input\fR=\fIfile\fR +The name of the input file. If this option is not used, then \fBwrc\fR +will use the first non-option argument as the input file name. If there +are no non-option arguments, then \fBwrc\fR will read from standard input. +.TP +.I \fB\-I\fR, \fB\-\-include\-dir\fR=\fIfile\fR Add \fIpath\fR to include search directories. \fIPath\fR may contain multiple directories, separated with ':'. It is allowed to specify \fI\-I\fR multiple times. Include files are searched in the order in @@ -67,11 +68,11 @@ Sets the input format. Valid options are 'rc' or 'rc16'. Setting the input to 'rc16' disables the recognition of win32 keywords. .TP -.I \-l lan +.I \fB\-l\fR, \fB\-\-language\fR=\fIlan\fR Set default language to \fIlan\fR. Default is the neutral language 0 (i.e. "LANGUAGE 0, 0"). .TP -.I \-m +.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 @@ -82,47 +83,49 @@ source\-files that contain overlapping type\-IDs, or when the format of the resource is not 100% compliant. .TP -.I \--nostdinc +.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 \-o file +.I \fB\-\-no\-use\-temp\-file\fR +Ignored for compatibility with windres. +.TP +.I \fB\-o\fR, \fB\-\-output\fR=\fIfile\fR Write output to \fIfile\fR. Default is \fBinputfile.res\fR with \fB.rc\fR stripped or \fBwrc.tab.res\fR if input is read from standard input. .TP -.I \-O format -Sets the output format. The only supported \fformat\fR is 'res', which -is also the default format if this option is not specified. The option -exists mainly for compatibility with \fBwindres\fR. +.I \fB\-O\fR, \fB\-\-output\-format\fR=\fIformat\fR +Sets the output format. The supported formats are 'res' and 'res16'. +If this option is not specified, format defaults to 'res'. .TP -.I \--preprocessor program +.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-P cat\fR. +To disable preprocessing, use \fB--preprocessor=cat\fR. .TP -.I \-v +.I \fB\-\-use\-temp\-file\fR +Ignored for compatibility with windres. +.TP +.I \fB\-v\fR Turns on verbose mode (equivalent to -d 1). .TP -.I \--version +.I \fB\-\-version\fR Print version end exit. .TP -.I \-w 16|32 -Select win16 or win32 output. Default is win32. -.TP -.I \-W +.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 extensions of the gcc -preprocessor. +The preprocessor is ANSI\-C compatible with some of the extensions of +the gcc preprocessor. .PP The preprocessor recognizes these directives: #include, #define (both simple and macro), #undef, #if, #ifdef, #ifndef, #elif, #else, #endif, #error, #warning, #line, # (both null\- and line\-directive), #pragma (ignored), #ident (ignored). .PP -The preprocessor default sets several defines: +The preprocessor sets by default several defines: .br RC_INVOKED set to 1 .br @@ -140,7 +143,7 @@ recognized and expand to their respective equivalent. .SH "LANGUAGE SUPPORT" Language, version and characteristics can be bound to all resource types that -have inline data, such as RCDATA. This is an extension to MS' resource +have inline data, such as RCDATA. This is an extension to Microsoft's resource compiler, which lacks this support completely. Only VERSIONINFO cannot have version and characteristics attached, but languages are propagated properly if you declare it correctly before the VERSIONINFO resource starts. @@ -162,41 +165,24 @@ '00 01 02 03 04 05 06 07 08' .br } -.SH NE/PE RESOURCE DIRECTORY GENERATION -A windows executable has a table/directory of resources available in that -module. Wrc will generate this directory with the '-s' option and place it -in the assembly output. -.PP -The layout of the PE directory should be exactly like the executable file. -The NE directory layout _DIFFERS_ from the real NE executable in such way -that all offsets to actual resource data are relative to the NE directory and -_NOT_ the beginning of the file. -.SH "ERROR REPORTING" -All errors and warnings are written to standard error and report: -.br -\fIfilename\fR:\fIline\-number\fR:\fIcharacter\-pos\fR:\fI{Error,Warning}\fR:\fI<message>\fR -.br -The character\-position is always at the next token. I.e. the error -or warning happened before. The line\-number suffers from the same -problem if the error occurred at the last token of the previous line. -The line\-number will be several lines off when the error was followed -by several empry lines. See also \fBBUGS\fR. .SH AUTHORS .B wrc was written by Bertho A. Stultiens and is a nearly complete rewrite of the first wine resource compiler (1994) by Martin von Loewis. Additional resource\-types were contributed Ulrich Czekalla and Albert -den Haan. Bugfixes have been contributed by many wine developpers. +den Haan. Many cleanups by Dimitrie O. Paun in 2002-2003. +Bugfixes have been contributed by many Wine developpers. .SH BUGS \- The preprocessor recognizes variable argument macros, but does not -expanded them correctly +expanded them correctly. .br -\- Error reporting should be more to the point (and verbose) +\- Error reporting should be more precise, as currently the column and +line number reported are those of the next token. .br -\- Codepage/UNICODE translations are not/not correct implemented +\- Codepage/Unicode translations are not/not correctly implemented. .br \- Default memory options should differ between win16 and win32. -.PP +.PP` There is no support for: .br \- RT_DLGINCLUDE, RT_VXD, RT_PLUGPLAY and RT_HTML (unknown format) @@ -206,14 +192,11 @@ Fonts are parsed and generated, but there is no support for the generation of the FONTDIR yet. The user must supply the FONTDIR resource in the source to match the FONT resources. -.PP -See the CHANGES and README.wrc files in the distribution for more -comments on bugs and fixes across the versions. .SH AVAILABILITY .B wrc is part of the wine distribution, which is available through WineHQ, the -.B wine +.B Wine development headquarters, at .I http://www.winehq.com/. .SH "SEE ALSO" -- Dimi.