Added support for HTML resource type.

This commit is contained in:
Alexandre Julliard 2005-06-30 20:58:52 +00:00
parent 9c80ef3d85
commit 52788d1f1c
6 changed files with 67 additions and 3 deletions

View File

@ -1339,6 +1339,35 @@ static res_t *fontdir2res(name_id_t *name, fontdir_t *fnd)
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
@ -1932,6 +1961,10 @@ void resources2res(resource_t *top)
if(!top->binres)
top->binres = menuex2res(top->name, top->res.menex);
break;
case res_html:
if(!top->binres)
top->binres = html2res(top->name, top->res.html);
break;
case res_rdt:
if(!top->binres)
top->binres = rcdata2res(top->name, top->res.rdt);

View File

@ -123,6 +123,20 @@ characts_t *dup_characts(characts_t *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 *rc = (rcdata_t *)xmalloc(sizeof(rcdata_t));

View File

@ -61,6 +61,7 @@ language_t *new_language(int id, int sub);
language_t *dup_language(language_t *l);
version_t *dup_version(version_t *v);
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);
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);
@ -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);
#endif

View File

@ -204,6 +204,7 @@ static struct keyword keywords[] = {
{ "GRAYED", tGRAYED, 0, 0, 0},
{ "GROUPBOX", tGROUPBOX, 0, 0, 0},
{ "HELP", tHELP, 0, 0, 0},
{ "HTML", tHTML, 0, 0, 0},
{ "ICON", tICON, 0, 0, 0},
{ "IMPURE", tIMPURE, 0, 0, 0},
{ "INACTIVE", tINACTIVE, 0, 0, 0},

View File

@ -251,6 +251,7 @@ static int rsrcid_to_token(int lookahead);
fontdir_t *fnd;
menu_t *men;
menuex_t *menex;
html_t *html;
rcdata_t *rdt;
stringtable_t *stt;
stt_entry_t *stte;
@ -285,7 +286,7 @@ static int rsrcid_to_token(int lookahead);
%token <str> tSTRING tIDENT tFILENAME
%token <raw> tRAWDATA
%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 tPUSHBUTTON tRADIOBUTTON tSTATE3 /* PUSHBOX */
%token tGROUPBOX tCOMBOBOX tLISTBOX tSCROLLBAR
@ -323,6 +324,7 @@ static int rsrcid_to_token(int lookahead);
%type <iptr> helpid
%type <dlgex> dialogex dlgex_attribs
%type <ctl> exctrls gen_exctrl lab_exctrl exctrl_desc
%type <html> html
%type <rdt> rcdata
%type <raw> raw_data raw_elements opt_data file_raw
%type <veri> versioninfo fix_version
@ -644,6 +646,7 @@ resource_definition
$$ = NULL;
}
| 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); }
| toolbar { $$ = new_resource(res_toolbar, $1, $1->memopt, $1->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 : tRCDATA loadmemopts file_raw { $$ = new_rcdata($3, $2); }
;
@ -3008,6 +3015,10 @@ static int rsrcid_to_token(int lookahead)
type = "TOOLBAR";
token = tTOOLBAR;
break;
case WRC_RT_HTML:
type = "HTML";
token = tHTML;
break;
case WRC_RT_STRING:
type = "STRINGTABLE";
@ -3023,7 +3034,6 @@ static int rsrcid_to_token(int lookahead)
case WRC_RT_DLGINCLUDE:
case WRC_RT_PLUGPLAY:
case WRC_RT_VXD:
case WRC_RT_HTML:
yywarning("Usertype uses reserved type ID %d, which is not supported by wrc yet", yylval.num);
default:
return lookahead;

View File

@ -441,6 +441,11 @@ typedef struct bitmap {
raw_data_t *data;
} bitmap_t;
typedef struct html {
DWORD memopt;
raw_data_t *data;
} html_t;
typedef struct rcdata {
DWORD memopt;
raw_data_t *data;
@ -615,6 +620,7 @@ typedef struct resource {
menu_t *men;
menuex_t *menex;
messagetable_t *msg;
html_t *html;
rcdata_t *rdt;
stringtable_t *stt;
toolbar_t *tbt;