Added support for HTML resource type.
This commit is contained in:
parent
9c80ef3d85
commit
52788d1f1c
|
@ -1339,6 +1339,35 @@ static res_t *fontdir2res(name_id_t *name, fontdir_t *fnd)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
*****************************************************************************
|
||||||
|
* Function : html2res
|
||||||
|
* Syntax : res_t *html2res(name_id_t *name, html_t *html)
|
||||||
|
* Input :
|
||||||
|
* name - Name/ordinal of the resource
|
||||||
|
* rdt - The html descriptor
|
||||||
|
* Output : New .res format structure
|
||||||
|
* Description :
|
||||||
|
* Remarks :
|
||||||
|
*****************************************************************************
|
||||||
|
*/
|
||||||
|
static res_t *html2res(name_id_t *name, html_t *html)
|
||||||
|
{
|
||||||
|
int restag;
|
||||||
|
res_t *res;
|
||||||
|
assert(name != NULL);
|
||||||
|
assert(html != NULL);
|
||||||
|
|
||||||
|
res = new_res();
|
||||||
|
restag = put_res_header(res, WRC_RT_HTML, NULL, name, html->memopt, &(html->data->lvc));
|
||||||
|
put_raw_data(res, html->data, 0);
|
||||||
|
/* Set ResourceSize */
|
||||||
|
SetResSize(res, restag);
|
||||||
|
if(win32)
|
||||||
|
put_pad(res);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
* Function : rcdata2res
|
* Function : rcdata2res
|
||||||
|
@ -1932,6 +1961,10 @@ void resources2res(resource_t *top)
|
||||||
if(!top->binres)
|
if(!top->binres)
|
||||||
top->binres = menuex2res(top->name, top->res.menex);
|
top->binres = menuex2res(top->name, top->res.menex);
|
||||||
break;
|
break;
|
||||||
|
case res_html:
|
||||||
|
if(!top->binres)
|
||||||
|
top->binres = html2res(top->name, top->res.html);
|
||||||
|
break;
|
||||||
case res_rdt:
|
case res_rdt:
|
||||||
if(!top->binres)
|
if(!top->binres)
|
||||||
top->binres = rcdata2res(top->name, top->res.rdt);
|
top->binres = rcdata2res(top->name, top->res.rdt);
|
||||||
|
|
|
@ -123,6 +123,20 @@ characts_t *dup_characts(characts_t *c)
|
||||||
return new_characts(*c);
|
return new_characts(*c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
html_t *new_html(raw_data_t *rd, int *memopt)
|
||||||
|
{
|
||||||
|
html_t *html = xmalloc(sizeof(html_t));
|
||||||
|
html->data = rd;
|
||||||
|
if(memopt)
|
||||||
|
{
|
||||||
|
html->memopt = *memopt;
|
||||||
|
free(memopt);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
html->memopt = WRC_MO_MOVEABLE | WRC_MO_PURE;
|
||||||
|
return html;
|
||||||
|
}
|
||||||
|
|
||||||
rcdata_t *new_rcdata(raw_data_t *rd, int *memopt)
|
rcdata_t *new_rcdata(raw_data_t *rd, int *memopt)
|
||||||
{
|
{
|
||||||
rcdata_t *rc = (rcdata_t *)xmalloc(sizeof(rcdata_t));
|
rcdata_t *rc = (rcdata_t *)xmalloc(sizeof(rcdata_t));
|
||||||
|
|
|
@ -61,6 +61,7 @@ language_t *new_language(int id, int sub);
|
||||||
language_t *dup_language(language_t *l);
|
language_t *dup_language(language_t *l);
|
||||||
version_t *dup_version(version_t *v);
|
version_t *dup_version(version_t *v);
|
||||||
characts_t *dup_characts(characts_t *c);
|
characts_t *dup_characts(characts_t *c);
|
||||||
|
html_t *new_html(raw_data_t *rd, int *memopt);
|
||||||
rcdata_t *new_rcdata(raw_data_t *rd, int *memopt);
|
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);
|
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);
|
user_t *new_user(name_id_t *type, raw_data_t *rd, int *memopt);
|
||||||
|
@ -82,4 +83,3 @@ style_pair_t *new_style_pair(style_t *style, style_t *exstyle);
|
||||||
style_t *new_style(DWORD or_mask, DWORD and_mask);
|
style_t *new_style(DWORD or_mask, DWORD and_mask);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -204,6 +204,7 @@ static struct keyword keywords[] = {
|
||||||
{ "GRAYED", tGRAYED, 0, 0, 0},
|
{ "GRAYED", tGRAYED, 0, 0, 0},
|
||||||
{ "GROUPBOX", tGROUPBOX, 0, 0, 0},
|
{ "GROUPBOX", tGROUPBOX, 0, 0, 0},
|
||||||
{ "HELP", tHELP, 0, 0, 0},
|
{ "HELP", tHELP, 0, 0, 0},
|
||||||
|
{ "HTML", tHTML, 0, 0, 0},
|
||||||
{ "ICON", tICON, 0, 0, 0},
|
{ "ICON", tICON, 0, 0, 0},
|
||||||
{ "IMPURE", tIMPURE, 0, 0, 0},
|
{ "IMPURE", tIMPURE, 0, 0, 0},
|
||||||
{ "INACTIVE", tINACTIVE, 0, 0, 0},
|
{ "INACTIVE", tINACTIVE, 0, 0, 0},
|
||||||
|
|
|
@ -251,6 +251,7 @@ static int rsrcid_to_token(int lookahead);
|
||||||
fontdir_t *fnd;
|
fontdir_t *fnd;
|
||||||
menu_t *men;
|
menu_t *men;
|
||||||
menuex_t *menex;
|
menuex_t *menex;
|
||||||
|
html_t *html;
|
||||||
rcdata_t *rdt;
|
rcdata_t *rdt;
|
||||||
stringtable_t *stt;
|
stringtable_t *stt;
|
||||||
stt_entry_t *stte;
|
stt_entry_t *stte;
|
||||||
|
@ -285,7 +286,7 @@ static int rsrcid_to_token(int lookahead);
|
||||||
%token <str> tSTRING tIDENT tFILENAME
|
%token <str> tSTRING tIDENT tFILENAME
|
||||||
%token <raw> tRAWDATA
|
%token <raw> tRAWDATA
|
||||||
%token tACCELERATORS tBITMAP tCURSOR tDIALOG tDIALOGEX tMENU tMENUEX tMESSAGETABLE
|
%token tACCELERATORS tBITMAP tCURSOR tDIALOG tDIALOGEX tMENU tMENUEX tMESSAGETABLE
|
||||||
%token tRCDATA tVERSIONINFO tSTRINGTABLE tFONT tFONTDIR tICON
|
%token tRCDATA tVERSIONINFO tSTRINGTABLE tFONT tFONTDIR tICON tHTML
|
||||||
%token tAUTO3STATE tAUTOCHECKBOX tAUTORADIOBUTTON tCHECKBOX tDEFPUSHBUTTON
|
%token tAUTO3STATE tAUTOCHECKBOX tAUTORADIOBUTTON tCHECKBOX tDEFPUSHBUTTON
|
||||||
%token tPUSHBUTTON tRADIOBUTTON tSTATE3 /* PUSHBOX */
|
%token tPUSHBUTTON tRADIOBUTTON tSTATE3 /* PUSHBOX */
|
||||||
%token tGROUPBOX tCOMBOBOX tLISTBOX tSCROLLBAR
|
%token tGROUPBOX tCOMBOBOX tLISTBOX tSCROLLBAR
|
||||||
|
@ -323,6 +324,7 @@ static int rsrcid_to_token(int lookahead);
|
||||||
%type <iptr> helpid
|
%type <iptr> helpid
|
||||||
%type <dlgex> dialogex dlgex_attribs
|
%type <dlgex> dialogex dlgex_attribs
|
||||||
%type <ctl> exctrls gen_exctrl lab_exctrl exctrl_desc
|
%type <ctl> exctrls gen_exctrl lab_exctrl exctrl_desc
|
||||||
|
%type <html> html
|
||||||
%type <rdt> rcdata
|
%type <rdt> rcdata
|
||||||
%type <raw> raw_data raw_elements opt_data file_raw
|
%type <raw> raw_data raw_elements opt_data file_raw
|
||||||
%type <veri> versioninfo fix_version
|
%type <veri> versioninfo fix_version
|
||||||
|
@ -644,6 +646,7 @@ resource_definition
|
||||||
$$ = NULL;
|
$$ = NULL;
|
||||||
}
|
}
|
||||||
| messagetable { $$ = new_resource(res_msg, $1, WRC_MO_MOVEABLE | WRC_MO_DISCARDABLE, $1->data->lvc.language); }
|
| messagetable { $$ = new_resource(res_msg, $1, WRC_MO_MOVEABLE | WRC_MO_DISCARDABLE, $1->data->lvc.language); }
|
||||||
|
| html { $$ = new_resource(res_html, $1, $1->memopt, $1->data->lvc.language); }
|
||||||
| rcdata { $$ = new_resource(res_rdt, $1, $1->memopt, $1->data->lvc.language); }
|
| rcdata { $$ = new_resource(res_rdt, $1, $1->memopt, $1->data->lvc.language); }
|
||||||
| toolbar { $$ = new_resource(res_toolbar, $1, $1->memopt, $1->lvc.language); }
|
| toolbar { $$ = new_resource(res_toolbar, $1, $1->memopt, $1->lvc.language); }
|
||||||
| userres { $$ = new_resource(res_usr, $1, $1->memopt, $1->data->lvc.language); }
|
| userres { $$ = new_resource(res_usr, $1, $1->memopt, $1->data->lvc.language); }
|
||||||
|
@ -724,6 +727,10 @@ messagetable
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
/* ------------------------------ HTML ------------------------------ */
|
||||||
|
html : tHTML loadmemopts file_raw { $$ = new_html($3, $2); }
|
||||||
|
;
|
||||||
|
|
||||||
/* ------------------------------ RCData ------------------------------ */
|
/* ------------------------------ RCData ------------------------------ */
|
||||||
rcdata : tRCDATA loadmemopts file_raw { $$ = new_rcdata($3, $2); }
|
rcdata : tRCDATA loadmemopts file_raw { $$ = new_rcdata($3, $2); }
|
||||||
;
|
;
|
||||||
|
@ -3008,6 +3015,10 @@ static int rsrcid_to_token(int lookahead)
|
||||||
type = "TOOLBAR";
|
type = "TOOLBAR";
|
||||||
token = tTOOLBAR;
|
token = tTOOLBAR;
|
||||||
break;
|
break;
|
||||||
|
case WRC_RT_HTML:
|
||||||
|
type = "HTML";
|
||||||
|
token = tHTML;
|
||||||
|
break;
|
||||||
|
|
||||||
case WRC_RT_STRING:
|
case WRC_RT_STRING:
|
||||||
type = "STRINGTABLE";
|
type = "STRINGTABLE";
|
||||||
|
@ -3023,7 +3034,6 @@ static int rsrcid_to_token(int lookahead)
|
||||||
case WRC_RT_DLGINCLUDE:
|
case WRC_RT_DLGINCLUDE:
|
||||||
case WRC_RT_PLUGPLAY:
|
case WRC_RT_PLUGPLAY:
|
||||||
case WRC_RT_VXD:
|
case WRC_RT_VXD:
|
||||||
case WRC_RT_HTML:
|
|
||||||
yywarning("Usertype uses reserved type ID %d, which is not supported by wrc yet", yylval.num);
|
yywarning("Usertype uses reserved type ID %d, which is not supported by wrc yet", yylval.num);
|
||||||
default:
|
default:
|
||||||
return lookahead;
|
return lookahead;
|
||||||
|
|
|
@ -441,6 +441,11 @@ typedef struct bitmap {
|
||||||
raw_data_t *data;
|
raw_data_t *data;
|
||||||
} bitmap_t;
|
} bitmap_t;
|
||||||
|
|
||||||
|
typedef struct html {
|
||||||
|
DWORD memopt;
|
||||||
|
raw_data_t *data;
|
||||||
|
} html_t;
|
||||||
|
|
||||||
typedef struct rcdata {
|
typedef struct rcdata {
|
||||||
DWORD memopt;
|
DWORD memopt;
|
||||||
raw_data_t *data;
|
raw_data_t *data;
|
||||||
|
@ -615,6 +620,7 @@ typedef struct resource {
|
||||||
menu_t *men;
|
menu_t *men;
|
||||||
menuex_t *menex;
|
menuex_t *menex;
|
||||||
messagetable_t *msg;
|
messagetable_t *msg;
|
||||||
|
html_t *html;
|
||||||
rcdata_t *rdt;
|
rcdata_t *rdt;
|
||||||
stringtable_t *stt;
|
stringtable_t *stt;
|
||||||
toolbar_t *tbt;
|
toolbar_t *tbt;
|
||||||
|
|
Loading…
Reference in New Issue