From: Ian Lance Taylor Date: Thu, 26 Jun 1997 19:27:42 +0000 (+0000) Subject: More tweaks. Add windres documentation. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=217947b23db936fdc814a757d51aa161be3040d0;p=binutils-gdb.git More tweaks. Add windres documentation. --- diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 5e8513fb77f..f1e425079d5 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,10 +1,15 @@ Thu Jun 26 13:53:17 1997 Ian Lance Taylor * windres.c (main): Quit if we didn't get any resources. + (usage): Fix --yydebug usage message. * rescoff.c (write_coff_file): Don't free the relocation array until after we've closed the BFD. + (read_coff_rsrc): Quit rather than try to read standard input. + (write_coff_file): Quit rather than try to write to standard + output. * rcparse.y: Add a couple of missing semicolons (accepted by bison but not byacc). + * binutils.texi: Document windres. Wed Jun 25 20:57:06 1997 Ian Lance Taylor diff --git a/binutils/binutils.texi b/binutils/binutils.texi index c2891195b53..78d3fa0a60b 100644 --- a/binutils/binutils.texi +++ b/binutils/binutils.texi @@ -122,6 +122,9 @@ Convert addresses into file names and line numbers @item nlmconv Convert object code into a Netware Loadable Module + +@item windres +Manipulate Windows resources @end table @end iftex @@ -137,6 +140,7 @@ Convert object code into a Netware Loadable Module * c++filt:: Filter to demangle encoded C++ symbols * addr2line:: Convert addresses to file and line * nlmconv:: Converts object code into an NLM +* windres:: Manipulate Windows resources * Selecting The Target System:: How these utilities determine the target. * Reporting Bugs:: Reporting Bugs * Index:: Index @@ -1849,6 +1853,131 @@ Prints a usage summary. Prints the version number for @code{nlmconv}. @end table +@node windres +@chapter windres + +@code{windres} may be used to manipulate Windows resources. + +@quotation +@emph{Warning:} @code{windres} is not always built as part of the binary +utilities, since it is only useful for Windows targets. +@end quotation + +@smallexample +windres [options] [input-file] [output-file] +@end smallexample + +@code{windres} reads resources from an input file and copies them into +an output file. Either file may be in one of three formats: + +@table @code +@item rc +A text format read by the Resource Compiler. + +@item res +A binary format generated by the Resource Compiler. + +@item coff +A COFF object or executable. +@end table + +The exact description of these different formats is available in +documentation from Microsoft. + +When @code{windres} converts from the @code{rc} format to the @code{res} +format, it is acting like the Windows Resource Compiler. When +@code{windres} converts from the @code{res} format to the @code{coff} +format, it is acting like the Windows @code{CVTRES} program. + +When @code{windres} generates an @code{rc} file, the output is similar +but not identical to the format expected for the input. When an input +@code{rc} file refers to an external filename, an output @code{rc} file +will instead include the file contents. + +If the input or output format is not specified, @code{windres} will +guess based on the file name, or, for the input file, the file contents. +A file with an extension of @file{.rc} will be treated as an @code{rc} +file, a file with an extension of @file{.res} will be treated as a +@code{res} file, and a file with an extension of @file{.o} or +@file{.exe} will be treated as a @code{coff} file. + +If no output file is specified, @code{windres} will print the resources +in @code{rc} format to standard output. + +The normal use is for you to write an @code{rc} file, use @code{windres} +to convert it to a COFF object file, and then link the COFF file into +your application. This will make the resources described in the +@code{rc} file available to Windows. + +@table @code +@item -i @var{filename} +@itemx --input @var{filename} +The name of the input file. If this option is not used, then +@code{windres} will use the first non-option argument as the input file +name. If there are no non-option arguments, then @code{windres} will +read from standard input. @code{windres} can not read a COFF file from +standard input. + +@item -o @var{filename} +@itemx --output @var{filename} +The name of the output file. If this option is not used, then +@code{windres} will use the first non-option argument, after any used +for the input file name, as the output file name. If there is no +non-option argument, then @code{windres} will write to standard output. +@code{windres} can not write a COFF file to standard output. + +@item -I @var{format} +@itemx --input-format @var{format} +The input format to read. @var{format} may be @samp{res}, @samp{rc}, or +@samp{coff}. If no input format is specified, @code{windres} will +guess, as described above. + +@item -O @var{format} +@itemx --output-format @var{format} +The output format to generate. @var{format} may be @samp{res}, +@samp{rc}, or @samp{coff}. If no output format is specified, +@code{windres} will guess, as described above. + +@item -F @var{target} +@itemx --target @var{target} +Specify the BFD format to use for a COFF file as input or output. This +is a BFD target name; you can use the @code{--help} option to see a list +of supported targets. Normally @code{windres} will use the default +format, which is the first one listed by the @code{--help} option. +@ref{Target Selection}. + +@item --preprocessor @var{program} +When @code{windres} reads an @code{rc} file, it runs it through the C +preprocessor first. This option may be used to specify the preprocessor +to use, including any leading arguments. The default preprocessor +argument is @code{gcc -E -xc-header -DRC_INVOKED}. + +@item --include-dir @var{directory} +Specify an include directory to use when reading an @code{rc} file. +@code{windres} will pass this to the preprocessor as an @code{-I} +option. @code{windres} will also search this directory when looking for +files named in the @code{rc} file. + +@item --define @var{sym[=val]} +Specify a @code{-D} option to pass to the preprocessor when reading an +@code{rc} file. + +@item --language @var{val} +Specify the default language to use when reading an @code{rc} file. +@var{val} should be a hexadecimal language code. The low eight bits are +the language, and the high eight bits are the sublanguage. + +@item --help +Prints a usage summary. + +@item --version +Prints the version number for @code{windres}. + +@item --yydebug +If @code{windres} is compiled with @code{YYDEBUG} defined as @code{1}, +this will turn on parser debugging. +@end table + @node Selecting The Target System @chapter Selecting the target system diff --git a/binutils/windres.c b/binutils/windres.c index f12d32ecc92..359026bf4f6 100644 --- a/binutils/windres.c +++ b/binutils/windres.c @@ -760,10 +760,12 @@ Options:\n\ --preprocessor PROGRAM Program to use to preprocess rc file\n\ --include-dir DIR Include directory when preprocessing rc file\n\ --define SYM[=VAL] Define SYM when preprocessing rc file\n\ - --language VAL Set language when reading rc file\n\ + --language VAL Set language when reading rc file\n"); #ifdef YYDEBUG - --yydebug Turn on parser debugging\n\ + fprintf (stream, "\ + --yydebug Turn on parser debugging\n"); #endif + fprintf (stream, "\ --help Print this help message\n\ --version Print version information\n"); fprintf (stream, "\