Commit 997e0d78 authored by Bertho Stultiens's avatar Bertho Stultiens Committed by Alexandre Julliard

- Implemented animated cursors and icons resource types.

- Added partial support for font resources (user supplied fontdir is required). - All resources with inline data (a la RCDATA) now support language, version and characteristics data. - Implemented resource name duplicate checks. It is now an error if two resources of the same type have the same name. - Bugfix: Language propagation was not correct when .res files were generated. - Bugfix: VERSIONINFO now handles memory options. - Bugfix: resource names and the resource type may be equal (e.g. MENU MENU {...}). This support was mistakingly deleted in the upgrade to the builtin preprocessor. The standalone LANGUAGE setting became context sensitive as a consequence of this. Now it *must* end with a newline *after* both expressions and no newlines are allowed within the line (the statement must fit on one line). This is no practical problem though.
parent 6b4c3474
---------------------------------------------------------------------------
Version 1.1.3 (21-May-2000)
Bertho Stultiens <bertho@akhphd.au.dk>
- Implemented animated cursors and icons resource types.
- Added partial support for font resources (user supplied fontdir is
required).
- All resources with inline data (a la RCDATA) now support language,
version and characteristics data.
- Implemented resource name duplicate checks. It is now an error if
two resources of the same type have the same name.
- Bugfix: Language propagation was not correct when .res files were
generated.
- Bugfix: VERSIONINFO now handles memory options.
- Bugfix: resource names and the resource type may be equal (e.g. MENU
MENU {...}). This support was mistakingly deleted in the upgrade to
the builtin preprocessor.
The standalone LANGUAGE setting became context sensitive as a consequence
of this. Now it *must* end with a newline *after* both expressions and
no newlines are allowed within the line (the statement must fit on one
line). This is no practical problem though.
Patrik Stridvall <ps@leissner.se>
- Fixed byte order on Solaris and FreeBSD.
---------------------------------------------------------------------------
Version 1.1.2 (08-May-2000)
Bertho Stultiens <bertho@akhphd.au.dk>
......
Release 1.1.2 of wrc (08-May-2000), the wine resource compiler.
Release 1.1.3 of wrc (21-May-2000), the wine resource compiler.
See the file CHANGES for differences between the version and what has been
corrected in the current version.
......@@ -144,25 +144,39 @@ Borland's implementation. Wrc uses 0,0 as the default language if non is
specified. Both MS and Borland use the language of the system that the
compiler runs on.
Not all resource-types can have local language keywords attached yet
(notably: BITMAP, CURSOR, ICON and usertype). This is due to implementation
of filename-scanning and the complexity that it poses. This will be changed
in the next release. You can work arround this problem by putting a LANGUAGE
statement before (and evt. after) the code in the resource file.
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
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.
Example:
1 RCDATA DISCARDABLE
LANGUAGE 1, 0
VERSION 312
CHARACTERISTICS 876
{
1, 2, 3, 4, 5, "and whatever more data you want"
'00 01 02 03 04 05 06 07 08'
}
Resource types supported
------------------------
All types are supported except for:
- FONT (RT_FONT, RT_FONTDIR)
- MESSAGETABLE (RT_MESSAGETABLE)
- Animated cursors/icons (RT_ANIICON, RT_ANICURSOR)
- RT_VXD
- RT_PLUGPLAY
- RT_HTML
These types will be implemented as soon as I get a proper specification of
the layout.
Font type resources (RT_FONT, RT_FONTDIR) are partially supported and will
be enhanced when I have the complete spec. The font resources work only if
you supply the FONTDIR resource yourself.
Expression capabilities and resource names
------------------------------------------
......@@ -263,10 +277,12 @@ things that I noted in the above text (more lack of implementation than bug
though):
- No codepage translation
- UNICODE translations are not/not correct implemented
- No documentation ('wrc -?' gives command-line options though)
- No documentation ('wrc -?' gives command-line options and a manpage)
- grep for FIXME in the source
- Memory options are wrong under some conditions. There seems to be a
different action for win32 and win16
- PUSHBOX control is unsupported. The MS docs use it plenty, but neither
MS' nor Borland's compiler supports it.
Reporting bugs and patches
--------------------------
......
......@@ -46,6 +46,8 @@ char *get_typename(resource_t* r)
case res_ver: return "VERSIONINFO";
case res_dlginit: return "DLGINIT";
case res_toolbar: return "TOOLBAR";
case res_anicur: return "CURSOR (animated)";
case res_aniico: return "ICON (animated)";
default: return "Unknown";
}
}
......@@ -365,6 +367,24 @@ static void dump_icon_group(icon_group_t *icog)
/*
*****************************************************************************
* Function : dump_ani_curico
* Syntax : void dump_ani_curico(ani_curico_t *ani)
* Input :
* ani - Animated object resource descriptor
* Output : nop
* Description :
* Remarks :
*****************************************************************************
*/
static void dump_ani_curico(ani_curico_t *ani)
{
dump_memopt(ani->memopt);
dump_lvc(&ani->data->lvc);
dump_raw_data(ani->data);
}
/*
*****************************************************************************
* Function : dump_font
* Syntax : void dump_font(font_t *fnt)
* Input :
......@@ -377,6 +397,7 @@ static void dump_icon_group(icon_group_t *icog)
static void dump_font(font_t *fnt)
{
dump_memopt(fnt->memopt);
dump_lvc(&(fnt->data->lvc));
dump_raw_data(fnt->data);
}
......@@ -394,6 +415,7 @@ static void dump_font(font_t *fnt)
static void dump_bitmap(bitmap_t *bmp)
{
dump_memopt(bmp->memopt);
dump_lvc(&(bmp->data->lvc));
dump_raw_data(bmp->data);
}
......@@ -411,6 +433,7 @@ static void dump_bitmap(bitmap_t *bmp)
static void dump_rcdata(rcdata_t *rdt)
{
dump_memopt(rdt->memopt);
dump_lvc(&(rdt->data->lvc));
dump_raw_data(rdt->data);
}
......@@ -428,6 +451,7 @@ static void dump_rcdata(rcdata_t *rdt)
static void dump_user(user_t *usr)
{
dump_memopt(usr->memopt);
dump_lvc(&(usr->data->lvc));
printf("Class %s\n", get_nameid_str(usr->type));
dump_raw_data(usr->data);
}
......@@ -445,6 +469,7 @@ static void dump_user(user_t *usr)
*/
static void dump_messagetable(messagetable_t *msg)
{
dump_lvc(&(msg->data->lvc));
dump_raw_data(msg->data);
}
......@@ -821,6 +846,8 @@ static void dump_versioninfo(versioninfo_t *ver)
{
ver_block_t *blk = ver->blocks;
dump_lvc(&(ver->lvc));
if(ver->gotit.fv)
printf("FILEVERSION %04x, %04x, %04x, %04x\n",
ver->filever_maj1,
......@@ -907,7 +934,7 @@ static void dump_toolbar(toolbar_t *toolbar)
static void dump_dlginit(dlginit_t *dit)
{
dump_memopt(dit->memopt);
dump_lvc(&(dit->lvc));
dump_lvc(&(dit->data->lvc));
dump_raw_data(dit->data);
}
......@@ -997,6 +1024,10 @@ void dump_resources(resource_t *top)
case res_toolbar:
dump_toolbar(top->res.tbt);
break;
case res_anicur:
case res_aniico:
dump_ani_curico(top->res.ani);
break;
default:
printf("Report this: Unknown resource type parsed %08x\n", top->type);
}
......
......@@ -14,5 +14,6 @@
char *get_typename(resource_t* r);
void dump_resources(resource_t *top);
char *get_nameid_str(name_id_t *n);
#endif
......@@ -1192,6 +1192,40 @@ static res_t *icon2res(icon_t *ico)
/*
*****************************************************************************
* Function : anicurico2res
* Syntax : res_t *anicurico2res(name_id_t *name, ani_curico_t *ani)
* Input :
* name - Name/ordinal of the resource
* ani - The animated object descriptor
* Output : New .res format structure
* Description :
* Remarks : The endian of the object's structures have been converted
* by the loader.
* There are rumors that win311 could handle animated stuff.
* That is why they are generated for both win16 and win32
* compile.
*****************************************************************************
*/
static res_t *anicurico2res(name_id_t *name, ani_curico_t *ani, enum res_e type)
{
int restag;
res_t *res;
assert(name != NULL);
assert(ani != NULL);
res = new_res();
restag = put_res_header(res, type == res_anicur ? WRC_RT_ANICURSOR : WRC_RT_ANIICON,
NULL, name, ani->memopt, NULL);
put_raw_data(res, ani->data, 0);
/* Set ResourceSize */
SetResSize(res, restag);
if(win32)
put_pad(res);
return res;
}
/*
*****************************************************************************
* Function : bitmap2res
* Syntax : res_t *bitmap2res(name_id_t *name, bitmap_t *bmp)
* Input :
......@@ -1200,7 +1234,7 @@ static res_t *icon2res(icon_t *ico)
* Output : New .res format structure
* Description :
* Remarks : The endian of the bitmap structures have been converted
* to native by the loader.
* by the loader.
*****************************************************************************
*/
static res_t *bitmap2res(name_id_t *name, bitmap_t *bmp)
......@@ -1211,7 +1245,7 @@ static res_t *bitmap2res(name_id_t *name, bitmap_t *bmp)
assert(bmp != NULL);
res = new_res();
restag = put_res_header(res, WRC_RT_BITMAP, NULL, name, bmp->memopt, NULL);
restag = put_res_header(res, WRC_RT_BITMAP, NULL, name, bmp->memopt, &(bmp->data->lvc));
if(bmp->data->data[0] == 'B'
&& bmp->data->data[1] == 'M'
&& ((BITMAPFILEHEADER *)bmp->data->data)->bfSize == bmp->data->size
......@@ -1240,15 +1274,53 @@ static res_t *bitmap2res(name_id_t *name, bitmap_t *bmp)
* fnt - The font descriptor
* Output : New .res format structure
* Description :
* Remarks :
* Remarks : The data has been prepared just after parsing.
*****************************************************************************
*/
static res_t *font2res(name_id_t *name, font_t *fnt)
{
int restag;
res_t *res;
assert(name != NULL);
assert(fnt != NULL);
warning("Fonts not yet implemented");
return NULL;
res = new_res();
restag = put_res_header(res, WRC_RT_FONT, NULL, name, fnt->memopt, &(fnt->data->lvc));
put_raw_data(res, fnt->data, 0);
/* Set ResourceSize */
SetResSize(res, restag);
if(win32)
put_pad(res);
return res;
}
/*
*****************************************************************************
* Function : fontdir2res
* Syntax : res_t *fontdir2res(name_id_t *name, fontdir_t *fnd)
* Input :
* name - Name/ordinal of the resource
* fntdir - The fontdir descriptor
* Output : New .res format structure
* Description :
* Remarks : The data has been prepared just after parsing.
*****************************************************************************
*/
static res_t *fontdir2res(name_id_t *name, fontdir_t *fnd)
{
int restag;
res_t *res;
assert(name != NULL);
assert(fnd != NULL);
res = new_res();
restag = put_res_header(res, WRC_RT_FONTDIR, NULL, name, fnd->memopt, &(fnd->data->lvc));
put_raw_data(res, fnd->data, 0);
/* Set ResourceSize */
SetResSize(res, restag);
if(win32)
put_pad(res);
return res;
}
/*
......@@ -1271,7 +1343,7 @@ static res_t *rcdata2res(name_id_t *name, rcdata_t *rdt)
assert(rdt != NULL);
res = new_res();
restag = put_res_header(res, WRC_RT_RCDATA, NULL, name, rdt->memopt, NULL);
restag = put_res_header(res, WRC_RT_RCDATA, NULL, name, rdt->memopt, &(rdt->data->lvc));
put_raw_data(res, rdt->data, 0);
/* Set ResourceSize */
SetResSize(res, restag);
......@@ -1379,7 +1451,7 @@ static res_t *user2res(name_id_t *name, user_t *usr)
assert(usr != NULL);
res = new_res();
restag = put_res_header(res, 0, usr->type, name, usr->memopt, NULL);
restag = put_res_header(res, 0, usr->type, name, usr->memopt, &(usr->data->lvc));
put_raw_data(res, usr->data, 0);
/* Set ResourceSize */
SetResSize(res, restag);
......@@ -1504,7 +1576,7 @@ static res_t *versioninfo2res(name_id_t *name, versioninfo_t *ver)
vsvi.size = 15; /* Excl. termination */
res = new_res();
restag = put_res_header(res, WRC_RT_VERSION, NULL, name, WRC_MO_MOVEABLE | WRC_MO_PURE, NULL);
restag = put_res_header(res, WRC_RT_VERSION, NULL, name, ver->memopt, &(ver->lvc));
rootblocksizetag = res->size;
put_word(res, 0); /* BlockSize filled in later */
valsizetag = res->size;
......@@ -1629,7 +1701,7 @@ static res_t *dlginit2res(name_id_t *name, dlginit_t *dit)
assert(dit != NULL);
res = new_res();
restag = put_res_header(res, WRC_RT_DLGINIT, NULL, name, dit->memopt, &(dit->lvc));
restag = put_res_header(res, WRC_RT_DLGINIT, NULL, name, dit->memopt, &(dit->data->lvc));
put_raw_data(res, dit->data, 0);
/* Set ResourceSize */
SetResSize(res, restag);
......@@ -1746,12 +1818,15 @@ char *get_c_typename(enum res_e type)
switch(type)
{
case res_acc: return "Acc";
case res_anicur:return "AniCur";
case res_aniico:return "AniIco";
case res_bmp: return "Bmp";
case res_cur: return "Cur";
case res_curg: return "CurGrp";
case res_dlg:
case res_dlgex: return "Dlg";
case res_fnt: return "Fnt";
case res_fntdir:return "FntDir";
case res_ico: return "Ico";
case res_icog: return "IcoGrp";
case res_men:
......@@ -1812,6 +1887,10 @@ void resources2res(resource_t *top)
if(!top->binres)
top->binres = font2res(top->name, top->res.fnt);
break;
case res_fntdir:
if(!top->binres)
top->binres = fontdir2res(top->name, top->res.fnd);
break;
case res_ico:
if(!top->binres)
top->binres = icon2res(top->res.ico);
......@@ -1856,7 +1935,11 @@ void resources2res(resource_t *top)
if(!top->binres)
top->binres = dlginit2res(top->name, top->res.dlgi);
break;
case res_anicur:
case res_aniico:
if(!top->binres)
top->binres = anicurico2res(top->name, top->res.ani, top->type);
break;
default:
internal_error(__FILE__, __LINE__, "Unknown resource type encountered %d in binary res generation", top->type);
}
......
......@@ -41,6 +41,7 @@ __NEW_STRUCT_PROTO(lvc);
__NEW_STRUCT_PROTO(res_count);
__NEW_STRUCT_PROTO(string);
__NEW_STRUCT_PROTO(toolbar_item);
__NEW_STRUCT_PROTO(ani_any);
resource_t *new_resource(enum res_e t, void *res, int memopt, language_t *lan);
version_t *new_version(DWORD v);
......@@ -53,8 +54,10 @@ rcdata_t *new_rcdata(raw_data_t *rd, int *memopt);
font_id_t *new_font_id(int size, string_t *face, int weight, int italic);
user_t *new_user(name_id_t *type, raw_data_t *rd, int *memopt);
font_t *new_font(raw_data_t *rd, int *memopt);
fontdir_t *new_fontdir(raw_data_t *rd, int *memopt);
icon_group_t *new_icon_group(raw_data_t *rd, int *memopt);
cursor_group_t *new_cursor_group(raw_data_t *rd, int *memopt);
ani_curico_t *new_ani_curico(enum res_e type, raw_data_t *rd, int *memopt);
bitmap_t *new_bitmap(raw_data_t *rd, int *memopt);
ver_words_t *new_ver_words(int i);
ver_words_t *add_ver_words(ver_words_t *w, int i);
......
......@@ -10,6 +10,7 @@
/* From parser.y */
extern int yydebug;
extern int want_nl; /* Set when getting line-numers */
extern int want_id; /* Set when getting the resource name */
int yyparse(void);
......
......@@ -2,6 +2,8 @@
*
* Copyright 1998-2000 Bertho A. Stultiens (BS)
*
* 21-May-2000 BS - Fixed the ident requirement of resource names
* which can be keywords.
* 30-Apr-2000 BS - Reintegration into the wine-tree
* 11-Jan-2000 BS - Very drastic cleanup because we don't have a
* preprocessor in here anymore.
......@@ -96,7 +98,7 @@ cident [a-zA-Z_][0-9a-zA-Z_]*
#define YY_NO_TOP_STATE
/* Always update the current character position within a line */
#define YY_USER_ACTION char_number+=yyleng;
#define YY_USER_ACTION char_number+=yyleng; wanted_id = want_id; want_id = 0;
static void addcchar(char c);
static void addwchar(short s);
......@@ -114,95 +116,116 @@ static int stripslevel = 0; /* Count {} during pp_strips/pp_stripe mode */
static int stripplevel = 0; /* Count () during pp_strips mode */
static int cjunk_tagline; /* Where did we start stripping (helps error tracking) */
/*
* This one is a bit tricky.
* We set 'want_id' in the parser to get the first
* identifier we get across in the scanner, but we
* also want it to be reset at nearly any token we
* see. Exceptions are:
* - newlines
* - comments
* - whitespace
*
* The scanner will automatically reset 'want_id'
* after *each* scanner reduction and puts is value
* into the var below. In this way we can see the
* state after the YY_RULE_SETUP (i.e. the user action;
* see above) and don't have to worry too much when
* it needs to be reset.
*/
static int wanted_id = 0;
static int save_wanted_id; /* To save across comment reductions */
struct keyword {
char *keyword;
int token;
int isextension;
int needcase;
int alwayskw;
};
static struct keyword keywords[] = {
{ "ACCELERATORS", tACCELERATORS, 0, 0},
{ "ALT", tALT, 0, 0},
{ "ASCII", tASCII, 0, 0},
{ "AUTO3STATE", tAUTO3STATE, 1, 0},
{ "AUTOCHECKBOX", tAUTOCHECKBOX, 1, 0},
{ "AUTORADIOBUTTON", tAUTORADIOBUTTON, 1, 0},
{ "BEGIN", tBEGIN, 0, 0},
{ "BITMAP", tBITMAP, 0, 0},
{ "BLOCK", tBLOCK, 0, 0},
{ "BUTTON", tBUTTON, 1, 0},
{ "CAPTION", tCAPTION, 0, 0},
{ "CHARACTERISTICS", tCHARACTERISTICS, 1, 0},
{ "CHECKBOX", tCHECKBOX, 0, 0},
{ "CHECKED", tCHECKED, 0, 0},
{ "CLASS", tCLASS, 0, 0},
{ "COMBOBOX", tCOMBOBOX, 0, 0},
{ "CONTROL", tCONTROL, 0, 0},
{ "CTEXT", tCTEXT, 0, 0},
{ "CURSOR", tCURSOR, 0, 0},
{ "DEFPUSHBUTTON", tDEFPUSHBUTTON, 0, 0},
{ "DIALOG", tDIALOG, 0, 0},
{ "DIALOGEX", tDIALOGEX, 1, 0},
{ "DISCARDABLE", tDISCARDABLE, 0, 0},
{ "DLGINIT", tDLGINIT, 0, 0},
{ "EDITTEXT", tEDITTEXT, 0, 0},
{ "END", tEND, 0, 0},
{ "enum", tENUM, 0, 1},
{ "EXSTYLE", tEXSTYLE, 0, 0},
{ "extern", tEXTERN, 0, 1},
{ "FILEFLAGS", tFILEFLAGS, 0, 0},
{ "FILEFLAGSMASK", tFILEFLAGSMASK, 0, 0},
{ "FILEOS", tFILEOS, 0, 0},
{ "FILESUBTYPE", tFILESUBTYPE, 0, 0},
{ "FILETYPE", tFILETYPE, 0, 0},
{ "FILEVERSION", tFILEVERSION, 0, 0},
{ "FIXED", tFIXED, 0, 0},
{ "FONT", tFONT, 0, 0},
{ "GRAYED", tGRAYED, 0, 0},
{ "GROUPBOX", tGROUPBOX, 0, 0},
{ "HELP", tHELP, 0, 0},
{ "ICON", tICON, 0, 0},
{ "IMPURE", tIMPURE, 0, 0},
{ "INACTIVE", tINACTIVE, 0, 0},
{ "inline", tINLINE, 0, 1},
{ "LANGUAGE", tLANGUAGE, 1, 0},
{ "LISTBOX", tLISTBOX, 0, 0},
{ "LOADONCALL", tLOADONCALL, 0, 0},
{ "LTEXT", tLTEXT, 0, 0},
{ "MENU", tMENU, 0, 0},
{ "MENUBARBREAK", tMENUBARBREAK, 0, 0},
{ "MENUBREAK", tMENUBREAK, 0, 0},
{ "MENUEX", tMENUEX, 1, 0},
{ "MENUITEM", tMENUITEM, 0, 0},
{ "MESSAGETABLE", tMESSAGETABLE, 1, 0},
{ "MOVEABLE", tMOVEABLE, 0, 0},
{ "NOINVERT", tNOINVERT, 0, 0},
{ "NOT", tNOT, 0, 0},
{ "POPUP", tPOPUP, 0, 0},
{ "PRELOAD", tPRELOAD, 0, 0},
{ "PRODUCTVERSION", tPRODUCTVERSION, 0, 0},
{ "PURE", tPURE, 0, 0},
{ "PUSHBUTTON", tPUSHBUTTON, 0, 0},
{ "RADIOBUTTON", tRADIOBUTTON, 0, 0},
{ "RCDATA", tRCDATA, 0, 0},
{ "RTEXT", tRTEXT, 0, 0},
{ "SCROLLBAR", tSCROLLBAR, 0, 0},
{ "SEPARATOR", tSEPARATOR, 0, 0},
{ "SHIFT", tSHIFT, 0, 0},
{ "STATE3", tSTATE3, 1, 0},
{ "static", tSTATIC, 0, 1},
{ "STRING", tSTRING, 0, 0},
{ "STRINGTABLE", tSTRINGTABLE, 0, 0},
{ "struct", tSTRUCT, 0, 1},
{ "STYLE", tSTYLE, 0, 0},
{ "TOOLBAR", tTOOLBAR, 1, 0},
{ "typedef", tTYPEDEF, 0, 1},
{ "VALUE", tVALUE, 0, 0},
{ "VERSION", tVERSION, 1, 0},
{ "VERSIONINFO", tVERSIONINFO, 0, 0},
{ "VIRTKEY", tVIRTKEY, 0, 0}
{ "ACCELERATORS", tACCELERATORS, 0, 0, 0},
{ "ALT", tALT, 0, 0, 0},
{ "ASCII", tASCII, 0, 0, 0},
{ "AUTO3STATE", tAUTO3STATE, 1, 0, 0},
{ "AUTOCHECKBOX", tAUTOCHECKBOX, 1, 0, 0},
{ "AUTORADIOBUTTON", tAUTORADIOBUTTON, 1, 0, 0},
{ "BEGIN", tBEGIN, 0, 0, 0},
{ "BITMAP", tBITMAP, 0, 0, 0},
{ "BLOCK", tBLOCK, 0, 0, 0},
{ "BUTTON", tBUTTON, 1, 0, 0},
{ "CAPTION", tCAPTION, 0, 0, 0},
{ "CHARACTERISTICS", tCHARACTERISTICS, 1, 0, 0},
{ "CHECKBOX", tCHECKBOX, 0, 0, 0},
{ "CHECKED", tCHECKED, 0, 0, 0},
{ "CLASS", tCLASS, 0, 0, 0},
{ "COMBOBOX", tCOMBOBOX, 0, 0, 0},
{ "CONTROL", tCONTROL, 0, 0, 0},
{ "CTEXT", tCTEXT, 0, 0, 0},
{ "CURSOR", tCURSOR, 0, 0, 0},
{ "DEFPUSHBUTTON", tDEFPUSHBUTTON, 0, 0, 0},
{ "DIALOG", tDIALOG, 0, 0, 0},
{ "DIALOGEX", tDIALOGEX, 1, 0, 0},
{ "DISCARDABLE", tDISCARDABLE, 0, 0, 0},
{ "DLGINIT", tDLGINIT, 0, 0, 0},
{ "EDITTEXT", tEDITTEXT, 0, 0, 0},
{ "END", tEND, 0, 0, 0},
{ "enum", tENUM, 0, 1, 1},
{ "EXSTYLE", tEXSTYLE, 0, 0, 0},
{ "extern", tEXTERN, 0, 1, 1},
{ "FILEFLAGS", tFILEFLAGS, 0, 0, 0},
{ "FILEFLAGSMASK", tFILEFLAGSMASK, 0, 0, 0},
{ "FILEOS", tFILEOS, 0, 0, 0},
{ "FILESUBTYPE", tFILESUBTYPE, 0, 0, 0},
{ "FILETYPE", tFILETYPE, 0, 0, 0},
{ "FILEVERSION", tFILEVERSION, 0, 0, 0},
{ "FIXED", tFIXED, 0, 0, 0},
{ "FONT", tFONT, 0, 0, 0},
{ "FONTDIR", tFONTDIR, 0, 0, 0}, /* This is a Borland BRC extension */
{ "GRAYED", tGRAYED, 0, 0, 0},
{ "GROUPBOX", tGROUPBOX, 0, 0, 0},
{ "HELP", tHELP, 0, 0, 0},
{ "ICON", tICON, 0, 0, 0},
{ "IMPURE", tIMPURE, 0, 0, 0},
{ "INACTIVE", tINACTIVE, 0, 0, 0},
{ "inline", tINLINE, 0, 1, 1},
{ "LANGUAGE", tLANGUAGE, 1, 0, 1},
{ "LISTBOX", tLISTBOX, 0, 0, 0},
{ "LOADONCALL", tLOADONCALL, 0, 0, 0},
{ "LTEXT", tLTEXT, 0, 0, 0},
{ "MENU", tMENU, 0, 0, 0},
{ "MENUBARBREAK", tMENUBARBREAK, 0, 0, 0},
{ "MENUBREAK", tMENUBREAK, 0, 0, 0},
{ "MENUEX", tMENUEX, 1, 0, 0},
{ "MENUITEM", tMENUITEM, 0, 0, 0},
{ "MESSAGETABLE", tMESSAGETABLE, 1, 0, 0},
{ "MOVEABLE", tMOVEABLE, 0, 0, 0},
{ "NOINVERT", tNOINVERT, 0, 0, 0},
{ "NOT", tNOT, 0, 0, 0},
{ "POPUP", tPOPUP, 0, 0, 0},
{ "PRELOAD", tPRELOAD, 0, 0, 0},
{ "PRODUCTVERSION", tPRODUCTVERSION, 0, 0, 0},
{ "PURE", tPURE, 0, 0, 0},
{ "PUSHBUTTON", tPUSHBUTTON, 0, 0, 0},
{ "RADIOBUTTON", tRADIOBUTTON, 0, 0, 0},
{ "RCDATA", tRCDATA, 0, 0, 0},
{ "RTEXT", tRTEXT, 0, 0, 0},
{ "SCROLLBAR", tSCROLLBAR, 0, 0, 0},
{ "SEPARATOR", tSEPARATOR, 0, 0, 0},
{ "SHIFT", tSHIFT, 0, 0, 0},
{ "STATE3", tSTATE3, 1, 0, 0},
{ "static", tSTATIC, 0, 1, 1},
{ "STRING", tSTRING, 0, 0, 0},
{ "STRINGTABLE", tSTRINGTABLE, 0, 0, 1},
{ "struct", tSTRUCT, 0, 1, 1},
{ "STYLE", tSTYLE, 0, 0, 0},
{ "TOOLBAR", tTOOLBAR, 1, 0, 0},
{ "typedef", tTYPEDEF, 0, 1, 1},
{ "VALUE", tVALUE, 0, 0, 0},
{ "VERSION", tVERSION, 1, 0, 0},
{ "VERSIONINFO", tVERSIONINFO, 0, 0, 0},
{ "VIRTKEY", tVIRTKEY, 0, 0, 0}
};
#define NKEYWORDS (sizeof(keywords)/sizeof(keywords[0]))
......@@ -318,6 +341,11 @@ static struct keyword *iskeyword(char *kw)
{
if(tok->token == tCLASS && !strcmp(yytext, "class"))
return tCPPCLASS;
else if(wanted_id && !tok->alwayskw)
{
yylval.str = make_string(yytext);
return tIDENT;
}
else
return tok->token;
}
......@@ -446,17 +474,21 @@ L\" {
* Should never occur after preprocessing
*/
<INITIAL,pp_stripp,pp_strips>"/*" {
yy_push_state(comment); if(!no_preprocess) yywarning("Found comments after preprocessing, please report");
yy_push_state(comment);
save_wanted_id = wanted_id;
if(!no_preprocess)
yywarning("Found comments after preprocessing, please report");
}
<comment>[^*\n]* ;
<comment>"*"+[^*/\n]* ;
<comment>\n line_number++; char_number = 1;
<comment>"*"+"/" yy_pop_state();
<comment>"*"+"/" yy_pop_state(); want_id = save_wanted_id;
;[^\n]* ; /* not really comment, but left-over c-junk */
"//"[^\n]* if(!no_preprocess) yywarning("Found comments after preprocessing, please report");
;[^\n]* want_id = wanted_id; /* not really comment, but left-over c-junk */
"//"[^\n]* want_id = wanted_id; if(!no_preprocess) yywarning("Found comments after preprocessing, please report");
\n {
want_id = wanted_id;
line_number++;
char_number = 1;
if(want_nl)
......@@ -465,7 +497,7 @@ L\" {
return tNL;
}
}
{ws}+ ; /* Eat whitespace */
{ws}+ want_id = wanted_id; /* Eat whitespace */
<INITIAL>. return yytext[0];
......
......@@ -276,3 +276,47 @@ char *dupwstr2cstr(const short *str)
return cs;
}
/*
*****************************************************************************
* Function : compare_name_id
* Syntax : int compare_name_id(name_id_t *n1, name_id_t *n2)
* Input :
* Output :
* Description :
* Remarks :
*****************************************************************************
*/
int compare_name_id(name_id_t *n1, name_id_t *n2)
{
if(n1->type == name_ord && n2->type == name_ord)
{
return n1->name.i_name - n2->name.i_name;
}
else if(n1->type == name_str && n2->type == name_str)
{
if(n1->name.s_name->type == str_char
&& n2->name.s_name->type == str_char)
{
return strcasecmp(n1->name.s_name->str.cstr, n2->name.s_name->str.cstr);
}
else if(n1->name.s_name->type == str_unicode
&& n2->name.s_name->type == str_unicode)
{
return wstricmp(n1->name.s_name->str.wstr, n2->name.s_name->str.wstr);
}
else
{
internal_error(__FILE__, __LINE__, "Can't yet compare strings of mixed type");
}
}
else if(n1->type == name_ord && n2->type == name_str)
return 1;
else if(n1->type == name_str && n2->type == name_ord)
return -1;
else
internal_error(__FILE__, __LINE__, "Comparing name-ids with unknown types (%d, %d)",
n1->type, n2->type);
return 0; /* Keep the compiler happy */
}
......@@ -34,5 +34,6 @@ short *wstrcpy(short *dst, const short *src);
int wstricmp(const short *s1, const short *s2);
char *dupwstr2cstr(const short *str);
short *dupcstr2wstr(const char *str);
int compare_name_id(name_id_t *n1, name_id_t *n2);
#endif
......@@ -16,8 +16,8 @@
#define WRC_MAJOR_VERSION 1
#define WRC_MINOR_VERSION 1
#define WRC_MICRO_VERSION 2
#define WRC_RELEASEDATE "(08-May-2000)"
#define WRC_MICRO_VERSION 3
#define WRC_RELEASEDATE "(21-May-2000)"
#define WRC_STRINGIZE(a) #a
#define WRC_VERSIONIZE(a,b,c) WRC_STRINGIZE(a) "." WRC_STRINGIZE(b) "." WRC_STRINGIZE(c)
......
.TH WRC 1 "May 8, 2000" "Version 1.1.2" "Wine Resource Compiler"
.TH WRC 1 "May 21, 2000" "Version 1.1.3" "Wine Resource Compiler"
.SH NAME
wrc \- Wine Resource Compiler
.SH SYNOPSIS
......@@ -179,21 +179,26 @@ Additional resource\-types were contributed Ulrich Czekalla and Albert
den Haan. 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
\- Codepage/UNICODE translations are not/not correct implemented.
\- Codepage/UNICODE translations are not/not correct implemented
.br
\- Default memory options should differ between win16 and win32.
.PP
\- There is no support for:
There is no support for:
.br
\- MESSAGETABLE (parsed, but not generated).
\- MESSAGETABLE (parsed, but not generated)
.br
\- FONT (parsed, but not generated).
\- RT_VXD, RT_PLUGPLAY and RT_HTML (unknown format)
.br
\- RT_VXD and RT_PLUGPLAY (unknown format)
.br
\- Animated cursors and icons (RIFF format unknown).
\- PUSHBOX control is unsupported due to lack of original functionality.
.PP
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
......
......@@ -44,6 +44,7 @@
#define WRC_RT_VXD (20)
#define WRC_RT_ANICURSOR (21)
#define WRC_RT_ANIICON (22)
#define WRC_RT_HTML (23)
#define WRC_RT_DLGINIT (240)
#define WRC_RT_TOOLBAR (241)
......@@ -160,8 +161,9 @@ enum res_e {
res_18,
res_pnp, /* Not implemented, no layout available */
res_vxd, /* Not implemented, no layout available */
res_anicur, /* Not implemented, no layout available */
res_aniico, /* Not implemented, no layout available */
res_anicur,
res_aniico,
res_html, /* Not implemented, no layout available */
res_dlginit = WRC_RT_DLGINIT, /* 240 */
res_toolbar = WRC_RT_TOOLBAR, /* 241 */
......@@ -175,6 +177,7 @@ enum res_e {
typedef struct raw_data {
int size;
char *data;
lvc_t lvc; /* Localized data */
} raw_data_t;
/* Dialog structures */
......@@ -286,12 +289,19 @@ typedef struct itemex_opt
int gothelpid;
} itemex_opt_t;
/* RC structures for types read from file or supplied binary */
/*
* Font resources
*/
typedef struct font {
DWORD memopt;
raw_data_t *data;
} font_t;
typedef struct fontdir {
DWORD memopt;
raw_data_t *data;
} fontdir_t;
/*
* Icon resources
*/
......@@ -374,6 +384,43 @@ typedef struct cursor_group {
int ncursor;
} cursor_group_t;
/*
* Animated cursors and icons
*/
typedef struct aniheader {
DWORD structsize; /* Header size (36 bytes) */
DWORD frames; /* Number of unique icons in this cursor */
DWORD steps; /* Number of blits before the animation cycles */
DWORD cx; /* reserved, must be 0? */
DWORD cy; /* reserved, must be 0? */
DWORD bitcount; /* reserved, must be 0? */
DWORD planes; /* reserved, must be 0? */
DWORD rate; /* Default rate (1/60th of a second) if "rate" not present */
DWORD flags; /* Animation flag (1==AF_ICON, although both icons and cursors set this) */
} aniheader_t;
typedef struct riff_tag {
BYTE tag[4];
DWORD size;
} riff_tag_t;
typedef struct ani_curico {
DWORD memopt;
raw_data_t *data;
} ani_curico_t;
typedef struct ani_any {
enum res_e type;
union {
ani_curico_t *ani;
cursor_group_t *curg;
icon_group_t *icog;
} u;
} ani_any_t;
/*
* Bitmaps
*/
typedef struct bitmap {
DWORD memopt;
raw_data_t *data;
......@@ -381,7 +428,6 @@ typedef struct bitmap {
typedef struct rcdata {
DWORD memopt;
lvc_t lvc;
raw_data_t *data;
} rcdata_t;
......@@ -467,6 +513,8 @@ typedef struct versioninfo {
int fst:1;
} gotit;
ver_block_t *blocks;
lvc_t lvc;
DWORD memopt;
} versioninfo_t;
/* Accelerator structures */
......@@ -509,7 +557,6 @@ typedef struct toolbar {
typedef struct dlginit {
DWORD memopt;
lvc_t lvc;
raw_data_t *data;
} dlginit_t;
......@@ -523,6 +570,7 @@ typedef struct resource {
language_t *lan; /* Only used as a sorting key and c-name creation*/
union {
accelerator_t *acc;
ani_curico_t *ani;
bitmap_t *bmp;
cursor_t *cur;
cursor_group_t *curg;
......@@ -530,6 +578,7 @@ typedef struct resource {
dialogex_t *dlgex;
dlginit_t *dlgi;
font_t *fnt;
fontdir_t *fnd;
icon_t *ico;
icon_group_t *icog;
menu_t *men;
......
......@@ -284,50 +284,6 @@ static void write_name_str(FILE *fp, name_id_t *nid)
/*
*****************************************************************************
* Function : compare_name_id
* Syntax : int compare_name_id(name_id_t *n1, name_id_t *n2)
* Input :
* Output :
* Description :
* Remarks :
*****************************************************************************
*/
static int compare_name_id(name_id_t *n1, name_id_t *n2)
{
if(n1->type == name_ord && n2->type == name_ord)
{
return n1->name.i_name - n2->name.i_name;
}
else if(n1->type == name_str && n2->type == name_str)
{
if(n1->name.s_name->type == str_char
&& n2->name.s_name->type == str_char)
{
return strcasecmp(n1->name.s_name->str.cstr, n2->name.s_name->str.cstr);
}
else if(n1->name.s_name->type == str_unicode
&& n2->name.s_name->type == str_unicode)
{
return wstricmp(n1->name.s_name->str.wstr, n2->name.s_name->str.wstr);
}
else
{
internal_error(__FILE__, __LINE__, "Can't yet compare strings of mixed type");
}
}
else if(n1->type == name_ord && n2->type == name_str)
return 1;
else if(n1->type == name_str && n2->type == name_ord)
return -1;
else
internal_error(__FILE__, __LINE__, "Comparing name-ids with unknown types (%d, %d)",
n1->type, n2->type);
return 0; /* Keep the compiler happy */
}
/*
*****************************************************************************
* Function : find_counter
* Syntax : res_count_t *find_counter(name_id_t *type)
* Input :
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment