source: trunk/tools/wrc/README.wrc@ 10367

Last change on this file since 10367 was 5522, checked in by sandervl, 24 years ago

updates

File size: 10.8 KB
Line 
1Release 1.1.8 of wrc (24-Aug-2000), 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:
7
8- full source preprocessing
9- 16 and 32 bit support
10- LANGUAGE support (32 bit only)
11- most 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- byte-order conversions
17
18Wrc generates an assembly file that can be assembled with GNU's gas, or
19passed to gcc. The assembly became necessary for two reasons. First, C does
20not ensure relative position of declared data. Secondly, C complaints about
21complex initialization schemes that became necessary with the NE/PE
22directory generation.
23
24
25Wrc command-line
26----------------
27You can get this message by typing 'wrc -?':
28
29Usage: wrc [options...] [infile[.rc|.res]]
30 -a n Alignment of resource (win16 only, default is 4)
31 -A Auto register resources (only with gcc 2.7 and better)
32 -b Create a C array from a binary .res file
33 -c Add 'const' prefix to C constants
34 -C cp Set the resource's codepage to cp (default is 0)
35 -d n Set debug level to 'n'
36 -D id[=val] Define preprocessor identifier id=val
37 -e Disable recognition of win32 keywords in 16bit compile
38 -E Preprocess only
39 -g Add symbols to the global c namespace
40 -h Also generate a .h file
41 -H file Same as -h but written to file
42 -I path Set include search dir to path (multiple -I allowed)
43 -l lan Set default language to lan (default is neutral {0, 0})
44 -L Leave case of embedded filenames as is
45 -m Do not remap numerical resource IDs
46 -n Do not generate .s file
47 -N Do not preprocess input
48 -o file Output to file (default is infile.[res|s|h]
49 -p prefix Give a prefix for the generated names
50 -r Create binary .res file (compile only)
51 -s Add structure with win32/16 (PE/NE) resource directory
52 -t Generate indirect loadable resource tables
53 -T Generate only indirect loadable resources tables
54 -V Print version end exit
55 -w 16|32 Select win16 or win32 output (default is win32)
56 -W Enable pedantic warnings
57
58Input is taken from stdin if no sourcefile specified.
59
60Debug level 'n' is a bitmask with following meaning:
61 * 0x01 Tell which resource is parsed (verbose mode)
62 * 0x02 Dump internal structures
63 * 0x04 Create a parser trace (yydebug=1)
64 * 0x08 Preprocessor messages
65 * 0x10 Preprocessor lex messages
66 * 0x20 Preprocessor yacc trace
67
68The -o option only applies to the final destination file, which is
69in case of normal compile a .s file. You must use the '-H header.h'
70option to override the header-filename.
71If no input filename is given and the output name is not overridden
72with -o and/or -H, then the output is written to "wrc.tab.[sh]"
73
74For more info see the wrc manpage.
75
76
77Preprocessing
78-------------
79The preprocessor is a fully operational C preprocessor. It handles all
80directives supported by ANSI-C. It also includes some additions from
81gcc/egcs.
82Wrc understands these directives:
83#define (both simple and macro)
84#undef
85#if
86#ifdef
87#ifndef
88#elif
89#else
90#endif
91#error
92#warning
93#line
94#
95#pragma (ignored)
96#ident (ignored)
97
98The extensions include '#'-line directives.
99Not handled at the moment are variable argument macros. They are parsed,
100but not expanded properly. This will be corrected in the future.
101
102The preprocessor handles the special defines and aditionally defines an
103extra set of defines:
104 Define | Value | Comment
105---------------+---------------+---------------
106RC_INVOKED | 1 | Always defined
107__FLAT__ | 1 | Only defined if win32 compile
108__WIN32__ | 1 | Only defined if win32 compile
109__FILE__ | "..." | Current filename as string
110__LINE__ | nnn | Current linenumber as integer
111__TIME__ | "23:59:59" | Timestring of compilation
112__DATE__ | "May 1 2000" | Datestring of compilation
113__WRC__ | 1 | Wrc's major version
114__WRC_MINOR__ | 1 | Wrc's minor version
115__WRC_MICRO__ | 7 | Wrc's minor version
116__WRC_PATCH__ | 8 | Alias of __WRC_MICRO__
117
118Include-files are not read twice if they are protected with this scheme:
119#ifndef SOME_DEFINE
120#define SOME_DEFINE
121...
122#endif
123This strategy has been borrowed from gcc/egcs and results in significantly
124reduced preprocessing times (20..30%). There must not be any junk before
125the first #ifndef and not after the last #endif; comments and whitespace
126excepted. Wrc will check the existance of the define prior to inclusion to
127detect "#undef SOME_DEFINE" (notably poppack.h) and act accordingly.
128
129
13016 and 32 bit support
131---------------------
132All of wrc is layed out in such a way that it enables compilation of both 16
133and 32 bit resources. They mainly differ in code-generation and extra
134keywords. Win32 keywords are recognized by default in 16 bit compile. You
135can disable recognition of win32 reserved keywords by using the '-e' option,
136if you encounter .rc-files that use win32 reserved keywords (I strongly
137recommend that you just rename things in the source).
138
139
140Language support
141----------------
142Wrc also understands the LANGUAGE keyword (win32 only) for both global and
143local definitions of language. There are differences with respect to MS' and
144Borland's implementation. Wrc uses 0,0 as the default language if non is
145specified. Both MS and Borland use the language of the system that the
146compiler runs on.
147
148Language, version and characteristics can be bound to all resource types that
149have inline data, such as RCDATA. This is an extension to MS' resource
150compiler, which lacks this support completely. Only VERSIONINFO cannot have
151version and characteristics attached, but languages are propagated properly if
152you declare it correctly before the VERSIONINFO resource starts.
153
154Example:
155
1561 RCDATA DISCARDABLE
157LANGUAGE 1, 0
158VERSION 312
159CHARACTERISTICS 876
160{
161 1, 2, 3, 4, 5, "and whatever more data you want"
162 '00 01 02 03 04 05 06 07 08'
163}
164
165
166Resource types supported
167------------------------
168All types are supported except for:
169- RT_VXD
170- RT_PLUGPLAY
171- RT_HTML
172- RT_DLGINCLUDE
173
174These types will be implemented as soon as I get a proper specification of
175the layout.
176
177Font type resources (RT_FONT, RT_FONTDIR) are partially supported and will
178be enhanced when I have the complete spec. The font resources work only if
179you supply the FONTDIR resource yourself.
180
181
182Expression capabilities and resource names
183------------------------------------------
184You can use an expression in most places where the resource definition
185expects a number (except usertype type). Operators supported:
186() parenthesis
187* multiply
188/ divide
189+ plus/add
190- minus/substract
191| binary or
192& binary and
193~ binary not (unary operator though)
194NOT ... (sigh)
195
196Plus (+) and minus (-) can both be unary and binary. The NOT operator is
197(primarily) used to disable window styles but I strongly suggest to refrain
198from using this operator.
199
200Resource names can be both numerical (expressions) and character typed. Wrc
201does support this insane (deep sigh) construct:
202
203MENU MENU
204{
205 ...
206}
207
208It is _ONLY_ supported for backwards compatibility so that old sources can
209be compiled with winelib. DO NOT USE IT IN NEW RESOURCES, PLEASE!
210
211
212Indirect loadable resources
213---------------------------
214
215Wrc can generate tables for indirect resource loading like winerc did. There
216are two new structures defined in 'wine-base-dir/include/wrc_rsc.h':
217
218typedef struct wrc_resource16
219{
220 INT32 resid; /* The resource id if resname == NULL */
221 LPSTR resname;
222 INT32 restype; /* The resource type-id if typename == NULL */
223 LPSTR typename;
224 LPBYTE data; /* Actual resource data */
225 UINT32 datasize; /* The size of the resource */
226} wrc_resource16_t;
227
228typedef struct wrc_resource32
229{
230 INT32 resid; /* The resource id if resname == NULL */
231 LPWSTR resname;
232 INT32 restype; /* The resource type-id if typename == NULL */
233 LPWSTR typename;
234 LPBYTE data; /* Actual resource data */
235 UINT32 datasize; /* The size of the resource */
236} wrc_resource32_t;
237
238The extension to winerc lies in the addition of the 'typename' field to
239support usertype resoursec with names for types.
240
241Note that _ALL_ names generated by wrc and to be used in interfacing with
242wine are PASCAL-style strings, unlike winerc. The first element contains the
243length and the strings are _not_ '\0'-terminated!
244
245You can also generate header files with wrc when specifying the '-h' or
246'-H<filename>' option.
247
248
249NE/PE resource directory generation
250-----------------------------------
251A windows executable has a table/directory of resources avalable in that
252module. Wrc will generate this directory with the '-s' option and place it
253in the assembly output (and header-file). This will enable the separation
254of different modules (dlls) in wine, which is the next project after wrc.
255
256The layout of the PE directory should be exactly like the executable file.
257The NE-directory layout _DIFFERS_ from the real NE-executable in such way
258that all offsets to actual resource-data is relative to the NE-directory and
259_NOT_ the beginning of the file.
260
261
262Binary .res file generation/reading
263-----------------------------------
264Wrc can both generate (32 and 16 bit) and read (32 bit only) .res-files.
265These can be used as intermediate files or binary files can be imported from
266other sources. The reading of 16 bit .res-files is on the list for the next
267release.
268
269You cannot convert 32 bit .res-files into 16 bit output or vice versa. I
270might implement 16 bit res into 32 bit output in the future, but I stronly
271oppose to the other way arround.
272
273
274Bugs
275----
276Inherent to programs you have bugs. These I know are there, plus a few
277things that I noted in the above text (more lack of implementation than bug
278though):
279- No codepage translation
280- UNICODE translations are not/not correct implemented
281- No documentation ('wrc -?' gives command-line options and a manpage)
282- grep for FIXME in the source
283- Memory options are wrong under some conditions. There seems to be a
284 different action for win32 and win16
285- PUSHBOX control is unsupported. The MS docs use it plenty, but neither
286 MS' nor Borland's compiler supports it.
287
288Reporting bugs and patches
289--------------------------
290Send problems to the wine newsgroup or, preferrably, directly to me at:
291
292bertho@akhphd.au.dk
293
294Please send the problematic rc-source with the bug so I can reproduce it.
295Patches should _not_ be send to Alexandre but to me. I will then review the
296change and send a full patch to be included into the new wine release (I
297prefer 'diff -u' format). You can always upload suggestions to wine
298headquarters, but be sure to send me a copy.
299
Note: See TracBrowser for help on using the repository browser.