blob: 26c4fd6bd708ae5c70611796865a45461cd9f360 [file] [log] [blame]
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +00001Release 1.0.2 of wrc (20-Jun-1998), the wine resource compiler.
2
3See the file CHANGES for differences between the version and what has been
4corrected in the current version.
5
6Wrc features:
Alexandre Julliarda845b881998-06-01 10:44:35 +00007
8- source preprocessing
9- 16 and 32 bit support
10- LANGUAGE support (32 bit only)
11- almost all resource types are supported
12- enhanced expression capabilities and resource naming
13- indirect loadable resources
14- NE/PE resource directory generation
15- binary .res file generation/reading
16
17Wrc generates an assembly file that can be assembled with GNU's gas, or
18passed to gcc. The assembly became necessary for two reasons. First, C does
19not ensure relative position of declared data. Secondly, C complaints about
20complex initialization schemes that became necessary with the NE/PE
21directory generation.
22
23
24Wrc command-line
25----------------
26You can get this message by typing 'wrc -?':
27
28Usage: wrc [options...] [infile[.rc|.res]]
29 -a n Alignment of resource (win16 only, default is 4)
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +000030 -A Auto register resources (only with gcc 2.7 and better)
Alexandre Julliarda845b881998-06-01 10:44:35 +000031 -b Create a C array from a binary .res file
32 -c Add 'const' prefix to C constants
33 -C cp Set the resource's codepage to cp (default is 0)
34 -d n Set debug level to 'n'
35 -D id[=val] Define preprocessor identifier id=val
36 -e Disable recognition of win32 keywords in 16bit compile
37 -g Add symbols to the global c namespace
38 -h Also generate a .h file
39 -H file Same as -h but written to file
40 -I path Set include search dir to path (multiple -I allowed)
41 -l lan Set default language to lan (default is neutral {0})
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +000042 -L Leave case of embedded filenames as is
Alexandre Julliarda845b881998-06-01 10:44:35 +000043 -n Do not generate .s file
44 -o file Output to file (default is infile.[res|s|h]
45 -p prefix Give a prefix for the generated names
46 -r Create binary .res file (compile only)
47 -s Add structure with win32/16 (PE/NE) resource directory
48 -t Generate indirect loadable resource tables
49 -T Generate only indirect loadable resources tables
50 -V Print version end exit
51 -w 16|32 Select win16 or win32 output (default is win32)
52 -W Enable pedantic warnings
53
54Input is taken from stdin if no sourcefile specified.
55
56Debug level 'n' is a bitmask with following meaning:
57 * 0x01 Tell which resource is parsed (verbose mode)
58 * 0x02 Dump internal structures
59 * 0x04 Create a parser trace (yydebug=1)
60
61The -o option only applies to the final destination file, which is
62in case of normal compile a .s file. You must use the '-H header.h'
63option to override the header-filename.
64If no input filename is given and the output name is not overridden
65with -o and/or -H, then the output is written to "wrc.tab.[sh]"
66
67
68Preprocessing
69-------------
70The build-in preprocessor is not a full implementation of the C counterpart.
71Wrc does not understand function-type macros. These are discarded as they
72are scanned. This will be a future project. Wrc does understand these:
73#define
74#if
75#ifdef
76#ifndef
77#elif
78#else
79#endif
80#error
81
82Also 'defined' is supported as operator (both with and without parenthesis).
83'#if' expressions can be anything valid that evaluates to an integer
84expression (where 0 is false and anything else is true). Others (#pragma,
85#line) are ignored. A special case '#' generates an error. This is due to
86the implementation to enable generation of errors on preprocessing and will
87be improved in the future.
88
89
9016 and 32 bit support
91---------------------
92All of wrc is layed out in such a way that it enables compilation of both 16
93and 32 bit resources. They mainly differ in code-generation and extra
94keywords. Win32 keywords are recognized by default in 16 bit compile. You
95can disable recognition of win32 reserved keywords by using the '-e' option,
96if you encounter .rc-files that use win32 reserved keywords (I strongly
97recommend that you just rename things in the source).
98
99
100Language support
101----------------
102Wrc also understands the LANGUAGE keyword (win32 only) for both global and
103local definitions of language. There are differences with respect to MS' and
104Borland's implementation. Wrc uses 0,0 as the default language if non is
105specified. Both MS and Borland use the language of the system that the
106compiler runs on.
107
108Not all resource-types can have local language keywords attached yet
109(notably: BITMAP, CURSOR, ICON and usertype). This is due to implementation
110of filename-scanning and the complexity that it poses. This will be changed
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +0000111in the next release. You can work arround this problem by putting a LANGUAGE
112statement before (and evt. after) the code in the resource file.
Alexandre Julliarda845b881998-06-01 10:44:35 +0000113
114
115Resource types supported
116------------------------
117All types are supported except for:
118- FONT
119- MESSAGETABLE
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +0000120- extensions like TOOLBAR and the like (is this a user-type?)
Alexandre Julliarda845b881998-06-01 10:44:35 +0000121
122These types will be implemented as soon as I get a proper specification of
123the layout.
124
125Note: Usertype resources with character strings as types have a different
126layout and do not accept expressions when a numerical type is specified. The
127must be enclosed in double quotes. These are examples of valid usertype
128resources:
129
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +0000130MyName "MyType" mydata.bin
131MyName 12345 mydata.bin
132MyName "MyType" "mydata.bin"
133MyName 12345 "mydata.bin"
Alexandre Julliarda845b881998-06-01 10:44:35 +0000134
135MyName "MyType"
136{
137 ..., data, ...
138}
139
140or
141
142MyName 12345
143{
144 ..., data, ...
145}
146
147
148Expression capabilities and resource names
149------------------------------------------
150You can use an expression in most places where the resource definition
151expects a number (except usertype type). Operators supported:
152() parenthesis
153* multiply
154/ divide
155+ add
156- minus/substract
157| binary or
158& binary and
159~ binary not (unary operator though)
160NOT ... (sigh)
161
162Minus (-) can both be unary and binary. The NOT operator is (primarily)
163used to disable window styles but I strongly suggest to refrain from using
164this operator.
165There is a shift/reduce conflict on the unary minus, but this is not
166problematic. I was too lazy to make a new expression parser (next version or
167so). Unary plus (+) would cause another confilct, so I let it out for now.
168
169Resource names can be both numerical (expressions) and character typed. Wrc
170does supports this insane (deep sigh) construct:
171
172MENU MENU
173{
174 ...
175}
176
177It is _ONLY_ supported for backwards compatibility so that old sources can
178be compiled with winelib. DO NOT USE IT IN NEW RESOURCES, PLEASE!
179
180
181Indirect loadable resources
182---------------------------
183
184Wrc can generate tables for indirect resource loading like winerc did. There
185are two new structures defined in 'wine-base-dir/include/wrc_rsc.h':
186
187typedef struct wrc_resource16
188{
189 INT32 resid; /* The resource id if resname == NULL */
190 LPSTR resname;
191 INT32 restype; /* The resource type-id if typename == NULL */
192 LPSTR typename;
193 LPBYTE data; /* Actual resource data */
194 UINT32 datasize; /* The size of the resource */
195} wrc_resource16_t;
196
197typedef struct wrc_resource32
198{
199 INT32 resid; /* The resource id if resname == NULL */
200 LPWSTR resname;
201 INT32 restype; /* The resource type-id if typename == NULL */
202 LPWSTR typename;
203 LPBYTE data; /* Actual resource data */
204 UINT32 datasize; /* The size of the resource */
205} wrc_resource32_t;
206
207The extension to winerc lies in the addition of the 'typename' field to
208support usertype resoursec with names for types.
209
210Note that _ALL_ names generated by wrc and to be used in interfacing with
211wine are PASCAL-style strings, unlike winerc. The first element contains the
212length and the strings are _not_ '\0'-terminated!
213
214You can also generate header files with wrc when specifying the '-h' or
215'-H<filename>' option.
216
217
218NE/PE resource directory generation
219-----------------------------------
220A windows executable has a table/directory of resources avalable in that
221module. Wrc will generate this directory with the '-s' option and place it
222in the assembly output (and header-file). This will enable the separation
223of different modules (dlls) in wine, which is the next project after wrc.
224
225The layout of the PE directory should be exactly like the executable file.
226The NE-directory layout _DIFFERS_ from the real NE-executable in such way
227that all offsets to actual resource-data is relative to the NE-directory and
228_NOT_ the beginning of the file.
229
230
231Binary .res file generation/reading
232-----------------------------------
233Wrc can both generate (32 and 16 bit) and read (32 bit only) .res-files.
234These can be used as intermediate files or binary files can be imported from
235other sources. The reading of 16 bit .res-files is on the list for the next
236release.
237
238You cannot convert 32 bit .res-files into 16 bit output or vice versa. I
239might implement 16 bit res into 32 bit output in the future, but I stronly
240oppose to the other way arround.
241
242
243Bugs
244----
245Inherent to programs you have bugs. These I know are there, plus a few
246things that I noted in the above text (more lack of implementation than bug
247though):
248- No codepage translation
249- UNICODE translations are not/not correct implemented
250- No documentation ('wrc -?' gives command-line options though)
251- grep for FIXME in the source
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +0000252- Memory options are wrong under some conditions. There seems to be a
253 different action for win32 and win16.
254- User-type resources have slightly different layout.
255- Filename scanning is still hopeless.
Alexandre Julliarda845b881998-06-01 10:44:35 +0000256
257Reporting bugs and patches
258--------------------------
259Send problems to the wine newsgroup or, preferrably, directly to me at:
260
261bertho@akhphd.au.dk
262
263Please send the problematic rc-source with the bug so I can reproduce it.
264Patches should _not_ be send to Alexandre but to me. I will then review the
265change and send a full patch to be included into the new wine release (I
266prefer 'diff -u' format). You can always upload suggestions to wine
267headquarters, but be sure to send me a copy.
268