- Generalized the distinction between 2 and 4 byte integers slightly through
a new parser state. The is now a warning when a 2 byte integer is larger than 16 bit (and is truncated). - Fixed a couple of cosmetic things in the DLGINIT stuff so that dumping of this type will work as expected. - Added generalized language/version/characteristics support to the DLGINIT resource type. Ulrich Czekalla <ulrichc@corel.ca> - Added support for DLGINIT resource-type. - Added string continuation and embedded quoting. - Added numeric IDs for icons in controls. Eric Pouech <Eric.Pouech@wanadoo.fr> - Bugfix: Distinguish between 2 and 4 byte integers in RCDATA.
This commit is contained in:
parent
3dc0421938
commit
62451da52c
|
@ -1,3 +1,23 @@
|
|||
---------------------------------------------------------------------------
|
||||
Version 1.0.12 (18-Jul-1999)
|
||||
|
||||
Bertho Stultiens <bertho@akhphd.au.dk>
|
||||
- Generalized the distinction between 2 and 4 byte integers slightly through
|
||||
a new parser state. The is now a warning when a 2 byte integer is larger
|
||||
than 16 bit (and is truncated).
|
||||
- Fixed a couple of cosmetic things in the DLGINIT stuff so that dumping of
|
||||
this type will work as expected.
|
||||
- Added generalized language/version/characteristics support to the DLGINIT
|
||||
resource type.
|
||||
|
||||
Ulrich Czekalla <ulrichc@corel.ca>
|
||||
- Added support for DLGINIT resource-type.
|
||||
- Added string continuation and embedded quoting.
|
||||
- Added numeric IDs for icons in controls.
|
||||
|
||||
Eric Pouech <Eric.Pouech@wanadoo.fr>
|
||||
- Bugfix: Distinguish between 2 and 4 byte integers in RCDATA.
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
Version 1.0.11 (22-Apr-1999)
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ char *get_typename(resource_t* r)
|
|||
case res_usr: return "UserResource";
|
||||
case res_msg: return "MESSAGETABLE";
|
||||
case res_ver: return "VERSIONINFO";
|
||||
case res_dlginit: return "DLGINIT";
|
||||
case res_toolbar: return "TOOLBAR";
|
||||
default: return "Unknown";
|
||||
}
|
||||
|
@ -492,7 +493,7 @@ void dump_stringtable(stringtable_t *stt)
|
|||
void dump_control(control_t *ctrl)
|
||||
{
|
||||
printf("Control {\n\tClass: %s\n", get_nameid_str(ctrl->ctlclass));
|
||||
printf("\tText: "); print_string(ctrl->title); printf("\n");
|
||||
printf("\tText: "); get_nameid_str(ctrl->title); printf("\n");
|
||||
printf("\tId: %d\n", ctrl->id);
|
||||
printf("\tx, y, w, h: %d, %d, %d, %d\n", ctrl->x, ctrl->y, ctrl->width, ctrl->height);
|
||||
if(ctrl->gotstyle)
|
||||
|
@ -850,7 +851,7 @@ void dump_toolbar_items(toolbar_item_t *items)
|
|||
/*
|
||||
*****************************************************************************
|
||||
* Function : dump_toolbar
|
||||
* Syntax : void dump_toolbar(dialogex_t *toolbar)
|
||||
* Syntax : void dump_toolbar(toolbar_t *toolbar)
|
||||
* Input :
|
||||
* toolbar - Toolbar resource descriptor
|
||||
* Output :
|
||||
|
@ -865,6 +866,24 @@ void dump_toolbar(toolbar_t *toolbar)
|
|||
dump_toolbar_items(toolbar->items);
|
||||
}
|
||||
|
||||
/*
|
||||
*****************************************************************************
|
||||
* Function : dump_dlginit
|
||||
* Syntax : void dump_dlginit(dlginit_t *dit)
|
||||
* Input :
|
||||
* dit - DlgInit resource descriptor
|
||||
* Output :
|
||||
* Description :
|
||||
* Remarks :
|
||||
*****************************************************************************
|
||||
*/
|
||||
void dump_dlginit(dlginit_t *dit)
|
||||
{
|
||||
dump_memopt(dit->memopt);
|
||||
dump_lvc(&(dit->lvc));
|
||||
dump_raw_data(dit->data);
|
||||
}
|
||||
|
||||
/*
|
||||
*****************************************************************************
|
||||
* Function :
|
||||
|
@ -945,6 +964,9 @@ void dump_resources(resource_t *top)
|
|||
case res_ver:
|
||||
dump_versioninfo(top->res.ver);
|
||||
break;
|
||||
case res_dlginit:
|
||||
dump_dlginit(top->res.dlgi);
|
||||
break;
|
||||
case res_toolbar:
|
||||
dump_toolbar(top->res.tbt);
|
||||
break;
|
||||
|
|
|
@ -457,7 +457,7 @@ res_t *dialog2res(name_id_t *name, dialog_t *dlg)
|
|||
else
|
||||
internal_error(__FILE__, __LINE__, "Control has no control-class");
|
||||
if(ctrl->title)
|
||||
put_string(res, ctrl->title, str_unicode, TRUE);
|
||||
put_name_id(res, ctrl->title, TRUE);
|
||||
else
|
||||
put_word(res, 0);
|
||||
if(ctrl->extra)
|
||||
|
@ -528,7 +528,7 @@ res_t *dialog2res(name_id_t *name, dialog_t *dlg)
|
|||
else
|
||||
internal_error(__FILE__, __LINE__, "Control has no control-class");
|
||||
if(ctrl->title)
|
||||
put_string(res, ctrl->title, str_char, TRUE);
|
||||
put_name_id(res, ctrl->title, FALSE);
|
||||
else
|
||||
put_byte(res, 0);
|
||||
|
||||
|
@ -634,7 +634,7 @@ res_t *dialogex2res(name_id_t *name, dialogex_t *dlgex)
|
|||
else
|
||||
internal_error(__FILE__, __LINE__, "Control has no control-class");
|
||||
if(ctrl->title)
|
||||
put_string(res, ctrl->title, str_unicode, TRUE);
|
||||
put_name_id(res, ctrl->title, TRUE);
|
||||
else
|
||||
put_word(res, 0);
|
||||
if(ctrl->extra)
|
||||
|
@ -1491,6 +1491,35 @@ res_t *toolbar2res(name_id_t *name, toolbar_t *toolbar)
|
|||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
*****************************************************************************
|
||||
* Function : dlginit2res
|
||||
* Syntax : res_t *dlginit2res(name_id_t *name, dlginit_t *dit)
|
||||
* Input :
|
||||
* name - Name/ordinal of the resource
|
||||
* rdt - The dlginit descriptor
|
||||
* Output : New .res format structure
|
||||
* Description :
|
||||
* Remarks :
|
||||
*****************************************************************************
|
||||
*/
|
||||
res_t *dlginit2res(name_id_t *name, dlginit_t *dit)
|
||||
{
|
||||
int restag;
|
||||
res_t *res;
|
||||
assert(name != NULL);
|
||||
assert(dit != NULL);
|
||||
|
||||
res = new_res();
|
||||
restag = put_res_header(res, WRC_RT_DLGINIT, NULL, name, dit->memopt, &(dit->lvc));
|
||||
put_raw_data(res, dit->data, 0);
|
||||
/* Set ResourceSize */
|
||||
SetResSize(res, restag);
|
||||
if(win32)
|
||||
put_pad(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
*****************************************************************************
|
||||
* Function : prep_nid_for_label
|
||||
|
@ -1615,6 +1644,7 @@ char *get_c_typename(enum res_e type)
|
|||
case res_msg: return "MsgTab";
|
||||
case res_ver: return "VerInf";
|
||||
case res_toolbar: return "TlBr";
|
||||
case res_dlginit: return "DlgInit";
|
||||
default: return "Oops";
|
||||
}
|
||||
}
|
||||
|
@ -1704,6 +1734,11 @@ void resources2res(resource_t *top)
|
|||
if(!top->binres)
|
||||
top->binres = toolbar2res(top->name, top->res.tbt);
|
||||
break;
|
||||
case res_dlginit:
|
||||
if(!top->binres)
|
||||
top->binres = dlginit2res(top->name, top->res.dlgi);
|
||||
break;
|
||||
|
||||
default:
|
||||
internal_error(__FILE__, __LINE__, "Unknown resource type encountered %d in binary res generation", top->type);
|
||||
}
|
||||
|
|
|
@ -263,3 +263,26 @@ toolbar_t *new_toolbar(int button_width, int button_height, toolbar_item_t *item
|
|||
tb->items = items;
|
||||
return tb;
|
||||
}
|
||||
|
||||
dlginit_t *new_dlginit(raw_data_t *rd, int *memopt)
|
||||
{
|
||||
dlginit_t *di = (dlginit_t *)xmalloc(sizeof(dlginit_t));
|
||||
di->data = rd;
|
||||
if(memopt)
|
||||
{
|
||||
di->memopt = *memopt;
|
||||
free(memopt);
|
||||
}
|
||||
else
|
||||
di->memopt = WRC_MO_MOVEABLE | WRC_MO_PURE | WRC_MO_DISCARDABLE;
|
||||
|
||||
return di;
|
||||
}
|
||||
|
||||
style_pair_t *new_style_pair(int style, int exstyle)
|
||||
{
|
||||
style_pair_t *sp = (style_pair_t *)xmalloc(sizeof(style_pair_t));
|
||||
sp->style = style;
|
||||
sp->exstyle = exstyle;
|
||||
return sp;
|
||||
}
|
||||
|
|
|
@ -59,10 +59,12 @@ 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);
|
||||
messagetable_t *new_messagetable(raw_data_t *rd);
|
||||
dlginit_t *new_dlginit(raw_data_t *rd, int *memopt);
|
||||
void copy_raw_data(raw_data_t *dst, raw_data_t *src, int offs, int len);
|
||||
int *new_int(int i);
|
||||
stringtable_t *new_stringtable(lvc_t *lvc);
|
||||
toolbar_t *new_toolbar(int button_width, int button_Height, toolbar_item_t *items, int nitems);
|
||||
style_pair_t *new_style_pair(int style, int exstyle);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -277,6 +277,7 @@ static struct keyword keywords[] = {
|
|||
{ "DIALOG", DIALOG, 0, 0, 0},
|
||||
{ "DIALOGEX", DIALOGEX, 1, 0, 0},
|
||||
{ "DISCARDABLE", DISCARDABLE, 0, 0, 0},
|
||||
{ "DLGINIT", DLGINIT, 0, 0, 0},
|
||||
{ "EDITTEXT", EDITTEXT, 0, 0, 0},
|
||||
{ "END", tEND, 0, 0, 1},
|
||||
{ "EXSTYLE", EXSTYLE, 0, 0, 0},
|
||||
|
@ -584,9 +585,9 @@ void add_to_substtext(char *text, int len)
|
|||
\{ return tBEGIN;
|
||||
\} return tEND;
|
||||
|
||||
[0-9]+[lL]? { yylval.num = atoi(yytext); return NUMBER; }
|
||||
0[xX][0-9A-Fa-f]+[lL]? { yylval.num = strtoul(yytext,0,16); return NUMBER; }
|
||||
0[oO][0-7]+ { yylval.num = strtoul(yytext+2,0,8); return NUMBER; }
|
||||
[0-9]+[lL]? { yylval.num = strtoul(yytext, 0, 10); return toupper(yytext[yyleng-1]) == 'L' ? LNUMBER : NUMBER; }
|
||||
0[xX][0-9A-Fa-f]+[lL]? { yylval.num = strtoul(yytext, 0, 16); return toupper(yytext[yyleng-1]) == 'L' ? LNUMBER : NUMBER; }
|
||||
0[oO][0-7]+[lL]? { yylval.num = strtoul(yytext+2, 0, 8); return toupper(yytext[yyleng-1]) == 'L' ? LNUMBER : NUMBER; }
|
||||
[A-Za-z_0-9]+ {
|
||||
struct keyword *token;
|
||||
struct pp_entry *ppp;
|
||||
|
@ -630,6 +631,7 @@ void add_to_substtext(char *text, int len)
|
|||
case CURSOR:
|
||||
case tBITMAP:
|
||||
case MESSAGETABLE:
|
||||
case DLGINIT:
|
||||
push_to(yywf);
|
||||
break;
|
||||
case FONT:
|
||||
|
@ -703,6 +705,9 @@ L\" {
|
|||
<yylstr>\\t addwchar('\t');
|
||||
<yylstr>\\v addwchar('\v');
|
||||
<yylstr>\\(.|\n) addwchar(yytext[1]);
|
||||
<yylstr>\"\" addcchar('\"'); /* "bla""bla" -> "bla\"bla" */
|
||||
<yylstr>\\\"\" addcchar('\"'); /* "bla\""bla" -> "bla\"bla" */
|
||||
<yylstr>\"{ws}+\" ; /* "bla" "bla" -> "blabla" */
|
||||
<yylstr>[^\\\n\"]+ {
|
||||
char *yptr = yytext;
|
||||
while(*yptr) /* FIXME: codepage translation */
|
||||
|
@ -745,6 +750,9 @@ L\" {
|
|||
while(*yptr)
|
||||
addcchar(*yptr++);
|
||||
}
|
||||
<yystr>\"\" addcchar('\"'); /* "bla""bla" -> "bla\"bla" */
|
||||
<yystr>\\\"\" addcchar('\"'); /* "bla\""bla" -> "bla\"bla" */
|
||||
<yystr>\"{ws}+\" ; /* "bla" "bla" -> "blabla" */
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -141,9 +141,11 @@ menuex_item_t *get_itemex_head(menuex_item_t *p);
|
|||
menu_item_t *get_item_head(menu_item_t *p);
|
||||
raw_data_t *merge_raw_data_str(raw_data_t *r1, string_t *str);
|
||||
raw_data_t *merge_raw_data_int(raw_data_t *r1, int i);
|
||||
raw_data_t *merge_raw_data_long(raw_data_t *r1, int i);
|
||||
raw_data_t *merge_raw_data(raw_data_t *r1, raw_data_t *r2);
|
||||
raw_data_t *str2raw_data(string_t *str);
|
||||
raw_data_t *int2raw_data(int i);
|
||||
raw_data_t *long2raw_data(int i);
|
||||
raw_data_t *load_file(string_t *name);
|
||||
itemex_opt_t *new_itemex_opt(int id, int type, int state, int helpid);
|
||||
event_t *add_string_event(string_t *key, int id, int flags, event_t *prev);
|
||||
|
@ -213,11 +215,13 @@ toolbar_item_t *get_tlbr_buttons_head(toolbar_item_t *p, int *nitems);
|
|||
ver_words_t *verw;
|
||||
toolbar_t *tlbar;
|
||||
toolbar_item_t *tlbarItems;
|
||||
dlginit_t *dginit;
|
||||
style_pair_t *styles;
|
||||
}
|
||||
|
||||
%token tIF tIFDEF tIFNDEF tELSE tELIF tENDIF tDEFINED tNL
|
||||
%token tTYPEDEF tEXTERN
|
||||
%token <num> NUMBER
|
||||
%token <num> NUMBER LNUMBER
|
||||
%token <str> tSTRING IDENT FILENAME
|
||||
%token <raw> RAWDATA
|
||||
%token ACCELERATORS tBITMAP CURSOR DIALOG DIALOGEX MENU MENUEX MESSAGETABLE
|
||||
|
@ -237,6 +241,7 @@ toolbar_item_t *get_tlbr_buttons_head(toolbar_item_t *p, int *nitems);
|
|||
%token tSTRING IDENT RAWDATA
|
||||
%token TOOLBAR BUTTON
|
||||
%token tBEGIN tEND
|
||||
%token DLGINIT
|
||||
%left LOGOR
|
||||
%left LOGAND
|
||||
%left '|'
|
||||
|
@ -278,7 +283,7 @@ toolbar_item_t *get_tlbr_buttons_head(toolbar_item_t *p, int *nitems);
|
|||
%type <nid> nameid nameid_s ctlclass usertype
|
||||
%type <num> acc_opt
|
||||
%type <iptr> loadmemopts lamo lama
|
||||
%type <fntid> opt_font opt_exfont
|
||||
%type <fntid> opt_font opt_exfont opt_expr
|
||||
%type <lvc> opt_lvc
|
||||
%type <lan> opt_language
|
||||
%type <chars> opt_characts
|
||||
|
@ -288,6 +293,9 @@ toolbar_item_t *get_tlbr_buttons_head(toolbar_item_t *p, int *nitems);
|
|||
%type <iptr> pp_expr pp_constant
|
||||
%type <tlbar> toolbar
|
||||
%type <tlbarItems> toolbar_items
|
||||
%type <dginit> dlginit
|
||||
%type <styles> optional_style_pair
|
||||
%type <num> any_num
|
||||
|
||||
%%
|
||||
|
||||
|
@ -372,7 +380,7 @@ pp_expr : pp_constant { $$ = $1; }
|
|||
;
|
||||
|
||||
pp_constant
|
||||
: NUMBER { $$ = new_int($1); }
|
||||
: any_num { $$ = new_int($1); }
|
||||
| IDENT { $$ = NULL; }
|
||||
| tDEFINED IDENT { $$ = new_int(pp_lookup($2->str.cstr) != NULL); }
|
||||
| tDEFINED '(' IDENT ')' { $$ = new_int(pp_lookup($3->str.cstr) != NULL); }
|
||||
|
@ -475,7 +483,8 @@ resource_definition
|
|||
else
|
||||
$$ = NULL;
|
||||
}
|
||||
| font { $$=new_resource(res_fnt, $1, $1->memopt, dup_language(currentlanguage)); }
|
||||
| dlginit { $$ = new_resource(res_dlginit, $1, $1->memopt, $1->lvc.language); }
|
||||
| font { $$ = new_resource(res_fnt, $1, $1->memopt, dup_language(currentlanguage)); }
|
||||
| icon {
|
||||
resource_t *rsc;
|
||||
icon_t *ico;
|
||||
|
@ -549,6 +558,19 @@ rcdata : RCDATA loadmemopts opt_lvc raw_data {
|
|||
}
|
||||
;
|
||||
|
||||
/* ------------------------------ DLGINIT ------------------------------ */
|
||||
dlginit : DLGINIT loadmemopts opt_lvc raw_data {
|
||||
$$ = new_dlginit($4, $2);
|
||||
if($3)
|
||||
{
|
||||
$$->lvc = *($3);
|
||||
free($3);
|
||||
}
|
||||
if(!$$->lvc.language)
|
||||
$$->lvc.language = dup_language(currentlanguage);
|
||||
}
|
||||
;
|
||||
|
||||
/* ------------------------------ UserType ------------------------------ */
|
||||
userres : usertype loadmemopts FILENAME { $$ = new_user($1, load_file($3), $2); }
|
||||
| usertype loadmemopts raw_data { $$ = new_user($1, $3, $2); }
|
||||
|
@ -696,14 +718,7 @@ ctrls : /* Empty */ { $$ = NULL; }
|
|||
| ctrls RTEXT lab_ctrl { $$=ins_ctrl(CT_STATIC, SS_RIGHT, $3, $1); }
|
||||
/* special treatment for icons, as the extent is optional */
|
||||
| ctrls ICON nameid_s ',' expr ',' expr ',' expr iconinfo {
|
||||
if($3->type == name_str)
|
||||
{
|
||||
$10->title = $3->name.s_name;
|
||||
}
|
||||
else
|
||||
{
|
||||
$10->title = NULL;
|
||||
}
|
||||
$10->title = $3;
|
||||
$10->id = $5;
|
||||
$10->x = $7;
|
||||
$10->y = $9;
|
||||
|
@ -714,7 +729,9 @@ ctrls : /* Empty */ { $$ = NULL; }
|
|||
lab_ctrl
|
||||
: tSTRING ',' expr ',' expr ',' expr ',' expr ',' expr optional_style {
|
||||
$$=new_control();
|
||||
$$->title = $1;
|
||||
$$->title = new_name_id();
|
||||
$$->title->type = name_str;
|
||||
$$->title->name.s_name = $1;
|
||||
$$->id = $3;
|
||||
$$->x = $5;
|
||||
$$->y = $7;
|
||||
|
@ -772,7 +789,7 @@ iconinfo: /* Empty */
|
|||
}
|
||||
;
|
||||
|
||||
gen_ctrl: tSTRING ',' expr ',' ctlclass ',' expr ',' expr ',' expr ',' expr ',' expr ',' expr {
|
||||
gen_ctrl: nameid_s ',' expr ',' ctlclass ',' expr ',' expr ',' expr ',' expr ',' expr ',' expr {
|
||||
$$=new_control();
|
||||
$$->title = $1;
|
||||
$$->id = $3;
|
||||
|
@ -786,7 +803,7 @@ gen_ctrl: tSTRING ',' expr ',' ctlclass ',' expr ',' expr ',' expr ',' expr ','
|
|||
$$->exstyle = $17;
|
||||
$$->gotexstyle = TRUE;
|
||||
}
|
||||
| tSTRING ',' expr ',' ctlclass ',' expr ',' expr ',' expr ',' expr ',' expr {
|
||||
| nameid_s ',' expr ',' ctlclass ',' expr ',' expr ',' expr ',' expr ',' expr {
|
||||
$$=new_control();
|
||||
$$->title = $1;
|
||||
$$->id = $3;
|
||||
|
@ -809,6 +826,12 @@ optional_style /* Abbused once to get optional ExStyle */
|
|||
| ',' expr { $$ = new_int($2); }
|
||||
;
|
||||
|
||||
optional_style_pair
|
||||
: /* Enpty */ { $$ = NULL; }
|
||||
| ',' expr { $$ = new_style_pair($2, 0); }
|
||||
| ',' expr ',' expr { $$ = new_style_pair($2, $4); }
|
||||
;
|
||||
|
||||
ctlclass
|
||||
: expr {
|
||||
$$ = new_name_id();
|
||||
|
@ -866,6 +889,7 @@ dlgex_attribs
|
|||
| dlgex_attribs STYLE expr { $$=dialogex_style($3,$1); }
|
||||
| dlgex_attribs EXSTYLE expr { $$=dialogex_exstyle($3,$1); }
|
||||
| dlgex_attribs CAPTION tSTRING { $$=dialogex_caption($3,$1); }
|
||||
| dlgex_attribs opt_font { $$=dialogex_font($2,$1); }
|
||||
| dlgex_attribs opt_exfont { $$=dialogex_font($2,$1); }
|
||||
| dlgex_attribs CLASS nameid_s { $$=dialogex_class($3,$1); }
|
||||
| dlgex_attribs MENU nameid { $$=dialogex_menu($3,$1); }
|
||||
|
@ -894,7 +918,7 @@ exctrls : /* Empty */ { $$ = NULL; }
|
|||
| exctrls CTEXT lab_exctrl { $$=ins_ctrl(CT_STATIC, SS_CENTER, $3, $1); }
|
||||
| exctrls RTEXT lab_exctrl { $$=ins_ctrl(CT_STATIC, SS_RIGHT, $3, $1); }
|
||||
/* special treatment for icons, as the extent is optional */
|
||||
| exctrls ICON tSTRING ',' expr ',' expr ',' expr iconinfo {
|
||||
| exctrls ICON nameid_s ',' expr ',' expr ',' expr iconinfo {
|
||||
$10->title = $3;
|
||||
$10->id = $5;
|
||||
$10->x = $7;
|
||||
|
@ -904,7 +928,7 @@ exctrls : /* Empty */ { $$ = NULL; }
|
|||
;
|
||||
|
||||
gen_exctrl
|
||||
: tSTRING ',' expr ',' ctlclass ',' expr ',' expr ',' expr ',' expr ','
|
||||
: nameid_s ',' expr ',' ctlclass ',' expr ',' expr ',' expr ',' expr ','
|
||||
expr ',' e_expr helpid opt_data {
|
||||
$$=new_control();
|
||||
$$->title = $1;
|
||||
|
@ -930,7 +954,7 @@ gen_exctrl
|
|||
}
|
||||
$$->extra = $19;
|
||||
}
|
||||
| tSTRING ',' expr ',' ctlclass ',' expr ',' expr ',' expr ',' expr ',' expr opt_data {
|
||||
| nameid_s ',' expr ',' ctlclass ',' expr ',' expr ',' expr ',' expr ',' expr opt_data {
|
||||
$$=new_control();
|
||||
$$->title = $1;
|
||||
$$->id = $3;
|
||||
|
@ -946,9 +970,11 @@ gen_exctrl
|
|||
;
|
||||
|
||||
lab_exctrl
|
||||
: tSTRING ',' expr ',' expr ',' expr ',' expr ',' expr optional_style opt_data {
|
||||
: tSTRING ',' expr ',' expr ',' expr ',' expr ',' expr optional_style_pair opt_data {
|
||||
$$=new_control();
|
||||
$$->title = $1;
|
||||
$$->title = new_name_id();
|
||||
$$->title->type = name_str;
|
||||
$$->title->name.s_name = $1;
|
||||
$$->id = $3;
|
||||
$$->x = $5;
|
||||
$$->y = $7;
|
||||
|
@ -956,16 +982,23 @@ lab_exctrl
|
|||
$$->height = $11;
|
||||
if($12)
|
||||
{
|
||||
$$->style = *($12);
|
||||
$$->style = $12->style;
|
||||
$$->gotstyle = TRUE;
|
||||
|
||||
if ($12->exstyle)
|
||||
{
|
||||
$$->exstyle = $12->exstyle;
|
||||
$$->gotexstyle = TRUE;
|
||||
}
|
||||
free($12);
|
||||
}
|
||||
|
||||
$$->extra = $13;
|
||||
}
|
||||
;
|
||||
|
||||
exctrl_desc
|
||||
: expr ',' expr ',' expr ',' expr ',' expr optional_style opt_data {
|
||||
: expr ',' expr ',' expr ',' expr ',' expr optional_style_pair opt_data {
|
||||
$$ = new_control();
|
||||
$$->id = $1;
|
||||
$$->x = $3;
|
||||
|
@ -974,8 +1007,14 @@ exctrl_desc
|
|||
$$->height = $9;
|
||||
if($10)
|
||||
{
|
||||
$$->style = *($10);
|
||||
$$->style = $10->style;
|
||||
$$->gotstyle = TRUE;
|
||||
|
||||
if ($10->exstyle)
|
||||
{
|
||||
$$->exstyle = $10->exstyle;
|
||||
$$->gotexstyle = TRUE;
|
||||
}
|
||||
free($10);
|
||||
}
|
||||
$$->extra = $11;
|
||||
|
@ -991,7 +1030,15 @@ helpid : /* Empty */ { $$ = NULL; }
|
|||
;
|
||||
|
||||
opt_exfont
|
||||
: FONT expr ',' tSTRING ',' expr ',' expr { $$ = new_font_id($2, $4, $6, $8); }
|
||||
: FONT expr ',' tSTRING ',' expr ',' expr opt_expr { $$ = new_font_id($2, $4, $6, $8); }
|
||||
;
|
||||
|
||||
/*
|
||||
* FIXME: This odd expression is here to nullify an extra token found
|
||||
* in some appstudio produced resources which appear to do nothing.
|
||||
*/
|
||||
opt_expr: /* Empty */ { $$ = NULL; }
|
||||
| ',' expr { $$ = NULL; }
|
||||
;
|
||||
|
||||
/* ------------------------------ Menu ------------------------------ */
|
||||
|
@ -1535,9 +1582,11 @@ raw_data: tBEGIN raw_elements tEND { $$ = $2; }
|
|||
raw_elements
|
||||
: RAWDATA { $$ = $1; }
|
||||
| NUMBER { $$ = int2raw_data($1); }
|
||||
| LNUMBER { $$ = long2raw_data($1); }
|
||||
| tSTRING { $$ = str2raw_data($1); }
|
||||
| raw_elements opt_comma RAWDATA { $$ = merge_raw_data($1, $3); free($3->data); free($3); }
|
||||
| raw_elements opt_comma NUMBER { $$ = merge_raw_data_int($1, $3); }
|
||||
| raw_elements opt_comma NUMBER { $$ = merge_raw_data_int($1, $3); }
|
||||
| raw_elements opt_comma LNUMBER { $$ = merge_raw_data_long($1, $3); }
|
||||
| raw_elements opt_comma tSTRING { $$ = merge_raw_data_str($1, $3); }
|
||||
;
|
||||
|
||||
|
@ -1564,9 +1613,14 @@ xpr : xpr '+' xpr { $$ = ($1) + ($3); }
|
|||
| '-' xpr { $$ = -($2); } /* FIXME: shift/reduce conflict */
|
||||
/* | '+' xpr { $$ = $2; } */
|
||||
| '(' xpr ')' { $$ = $2; }
|
||||
| NUMBER { $$ = $1; want_rscname = 0; }
|
||||
| NOT NUMBER { $$ = 0; andmask &= ~($2); }
|
||||
| any_num { $$ = $1; want_rscname = 0; }
|
||||
| NOT any_num { $$ = 0; andmask &= ~($2); }
|
||||
;
|
||||
|
||||
any_num : NUMBER { $$ = $1; }
|
||||
| LNUMBER { $$ = $1; }
|
||||
;
|
||||
|
||||
%%
|
||||
/* Dialog specific functions */
|
||||
dialog_t *dialog_style(int st, dialog_t *dlg)
|
||||
|
@ -1982,6 +2036,10 @@ raw_data_t *load_file(string_t *name)
|
|||
raw_data_t *int2raw_data(int i)
|
||||
{
|
||||
raw_data_t *rd;
|
||||
|
||||
if((int)((short)i) != i)
|
||||
yywarning("Integer constant out of 16bit range (%d), truncated to %d\n", i, (short)i);
|
||||
|
||||
rd = new_raw_data();
|
||||
rd->size = sizeof(short);
|
||||
rd->data = (char *)xmalloc(rd->size);
|
||||
|
@ -1989,6 +2047,16 @@ raw_data_t *int2raw_data(int i)
|
|||
return rd;
|
||||
}
|
||||
|
||||
raw_data_t *long2raw_data(int i)
|
||||
{
|
||||
raw_data_t *rd;
|
||||
rd = new_raw_data();
|
||||
rd->size = sizeof(int);
|
||||
rd->data = (char *)xmalloc(rd->size);
|
||||
*(int *)(rd->data) = i;
|
||||
return rd;
|
||||
}
|
||||
|
||||
raw_data_t *str2raw_data(string_t *str)
|
||||
{
|
||||
raw_data_t *rd;
|
||||
|
@ -2016,6 +2084,15 @@ raw_data_t *merge_raw_data_int(raw_data_t *r1, int i)
|
|||
return r1;
|
||||
}
|
||||
|
||||
raw_data_t *merge_raw_data_long(raw_data_t *r1, int i)
|
||||
{
|
||||
raw_data_t *t = long2raw_data(i);
|
||||
merge_raw_data(r1, t);
|
||||
free(t->data);
|
||||
free(t);
|
||||
return r1;
|
||||
}
|
||||
|
||||
raw_data_t *merge_raw_data_str(raw_data_t *r1, string_t *str)
|
||||
{
|
||||
raw_data_t *t = str2raw_data(str);
|
||||
|
|
|
@ -90,7 +90,7 @@ char usage[] = "Usage: wrc [options...] [infile[.rc|.res]]\n"
|
|||
;
|
||||
|
||||
char version_string[] = "Wine Resource Compiler Version " WRC_FULLVERSION "\n"
|
||||
"Copyright 1998 Bertho A. Stultiens\n"
|
||||
"Copyright 1998,1999 Bertho A. Stultiens\n"
|
||||
" 1994 Martin von Loewis\n";
|
||||
|
||||
/*
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
#include "wrctypes.h"
|
||||
#endif
|
||||
|
||||
#define WRC_VERSION "1.0.11"
|
||||
#define WRC_RELEASEDATE "(22-Apr-1999)"
|
||||
#define WRC_VERSION "1.0.12"
|
||||
#define WRC_RELEASEDATE "(18-Jul-1999)"
|
||||
#define WRC_FULLVERSION WRC_VERSION " " WRC_RELEASEDATE
|
||||
|
||||
/* Only used in heavy debugging sessions */
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#define WRC_RT_VXD (20)
|
||||
#define WRC_RT_ANICURSOR (21)
|
||||
#define WRC_RT_ANIICON (22)
|
||||
#define WRC_RT_DLGINIT (240)
|
||||
#define WRC_RT_TOOLBAR (241)
|
||||
|
||||
/* Default class type IDs */
|
||||
|
@ -145,6 +146,7 @@ enum res_e {
|
|||
res_anicur, /* Not implemented, no layout available */
|
||||
res_aniico, /* Not implemented, no layout available */
|
||||
|
||||
res_dlginit = WRC_RT_DLGINIT, /* 240 */
|
||||
res_toolbar = WRC_RT_TOOLBAR, /* 241 */
|
||||
|
||||
res_menex = 256 + 4,
|
||||
|
@ -163,7 +165,7 @@ typedef struct control {
|
|||
struct control *next; /* List of controls */
|
||||
struct control *prev;
|
||||
name_id_t *ctlclass; /* ControlClass */
|
||||
string_t *title; /* Title of control */
|
||||
name_id_t *title; /* Title of control */
|
||||
int id;
|
||||
int x; /* Position */
|
||||
int y;
|
||||
|
@ -470,6 +472,13 @@ typedef struct toolbar {
|
|||
toolbar_item_t *items;
|
||||
} toolbar_t;
|
||||
|
||||
typedef struct dlginit {
|
||||
DWORD memopt;
|
||||
lvc_t lvc;
|
||||
raw_data_t *data;
|
||||
} dlginit_t;
|
||||
|
||||
|
||||
/* A top-level resource node */
|
||||
typedef struct resource {
|
||||
struct resource *next;
|
||||
|
@ -484,6 +493,7 @@ typedef struct resource {
|
|||
cursor_group_t *curg;
|
||||
dialog_t *dlg;
|
||||
dialogex_t *dlgex;
|
||||
dlginit_t *dlgi;
|
||||
font_t *fnt;
|
||||
icon_t *ico;
|
||||
icon_group_t *icog;
|
||||
|
@ -518,6 +528,11 @@ typedef struct res_count {
|
|||
int n_name_entries;
|
||||
} res_count_t;
|
||||
|
||||
typedef struct style_pair {
|
||||
int style;
|
||||
int exstyle;
|
||||
} style_pair_t;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue