Alexandre Julliard <julliard@winehq.org>

- Added support for HTML resource type.
Mike McCormack <mike@codeweavers.com>
- gcc 4.0 -Wpointer-sign fixes.
Stefan Huehner <stefan@huehner.org>
- Fix some -Wsign-compare warnings.
Jacek Caban <jack@itma.pwr.wroc.pl>
- '.' is a valid char of tIDENT.
Marcus Meissner <marcus@jet.franken.de>
- Fixed signedness warnings.

svn path=/trunk/; revision=17286
This commit is contained in:
Gé van Geldorp 2005-08-11 15:10:01 +00:00
parent f5a7132861
commit 9664020ca4
13 changed files with 1864 additions and 1785 deletions

View file

@ -78,13 +78,13 @@ const char *get_typename(const resource_t* r)
* Remarks : No codepage translation is done.
*****************************************************************************
*/
static char *strncpyWtoA(char *cs, WCHAR *ws, int maxlen)
static char *strncpyWtoA(char *cs, const WCHAR *ws, int maxlen)
{
char *cptr = cs;
WCHAR *wsMax = ws + maxlen - 1;
const WCHAR *wsMax = ws + maxlen - 1;
while(*ws && ws < wsMax)
{
if((short)*ws < -128 || (short)*ws > 127)
if(*ws > 255)
fprintf(stderr, "***Warning: Unicode string contains non-printable chars***\n");
*cptr++ = (char)*ws++;
}

View file

@ -62,7 +62,7 @@ res_t *new_res(void)
return r;
}
res_t *grow_res(res_t *r, int add)
res_t *grow_res(res_t *r, unsigned int add)
{
r->allocsize += add;
r->data = (char *)xrealloc(r->data, r->allocsize);
@ -416,7 +416,7 @@ static void put_lvc(res_t *res, lvc_t *lvc)
*/
static void put_raw_data(res_t *res, raw_data_t *raw, int offset)
{
int wsize = raw->size - offset;
unsigned int wsize = raw->size - offset;
if(res->allocsize - res->size < wsize)
grow_res(res, wsize);
memcpy(&(res->data[res->size]), raw->data + offset, wsize);
@ -1348,6 +1348,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
@ -1941,6 +1970,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

@ -24,7 +24,7 @@
#include "wrctypes.h"
res_t *new_res(void);
res_t *grow_res(res_t *r, int add);
res_t *grow_res(res_t *r, unsigned int add);
void put_byte(res_t *res, unsigned c);
void put_word(res_t *res, unsigned w);
void put_dword(res_t *res, unsigned d);

File diff suppressed because it is too large Load diff

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},
@ -405,7 +406,7 @@ static struct keyword *iskeyword(char *kw)
* and *only* in a filename. In this case, the second
* rule will be reduced because it is longer.
*/
[A-Za-z_0-9]+ {
[A-Za-z_0-9.]+ {
struct keyword *tok = iskeyword(yytext);
if(tok)

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); }
;
@ -3017,6 +3024,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";
@ -3032,7 +3043,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

@ -232,7 +232,7 @@ static resource_t *read_res32(FILE *fp)
str = new_string();
str->type = str_unicode;
str->size = (idx - tag) / 2;
str->str.wstr = (WCHAR *)xmalloc(idx-tag+2);
str->str.wstr = xmalloc(idx-tag+2);
memcpy(str->str.wstr, &res->data[tag], idx-tag);
str->str.wstr[str->size] = 0;
type = new_name_id();
@ -266,7 +266,7 @@ static resource_t *read_res32(FILE *fp)
str = new_string();
str->type = str_unicode;
str->size = (idx - tag) / 2;
str->str.wstr = (WCHAR *)xmalloc(idx-tag+2);
str->str.wstr = xmalloc(idx-tag+2);
memcpy(str->str.wstr, &res->data[tag], idx-tag);
str->str.wstr[str->size] = 0;
name = new_name_id();

View file

@ -87,10 +87,10 @@
#define RES_BLOCKSIZE 512
typedef struct res {
int allocsize; /* Allocated datablock size */
int size; /* Actual size of data */
int dataidx; /* Tag behind the resource-header */
char *data;
unsigned int allocsize; /* Allocated datablock size */
unsigned int size; /* Actual size of data */
unsigned int dataidx; /* Tag behind the resource-header */
char *data;
} res_t;
/* Resource strings are slightly more complex because they include '\0' */
@ -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;

View file

@ -46,7 +46,7 @@
void write_resfile(char *outname, resource_t *top)
{
FILE *fo;
int ret;
unsigned int ret;
char zeros[3] = {0, 0, 0};
fo = fopen(outname, "wb");

File diff suppressed because it is too large Load diff

View file

@ -50,67 +50,68 @@
tFONT = 276,
tFONTDIR = 277,
tICON = 278,
tAUTO3STATE = 279,
tAUTOCHECKBOX = 280,
tAUTORADIOBUTTON = 281,
tCHECKBOX = 282,
tDEFPUSHBUTTON = 283,
tPUSHBUTTON = 284,
tRADIOBUTTON = 285,
tSTATE3 = 286,
tGROUPBOX = 287,
tCOMBOBOX = 288,
tLISTBOX = 289,
tSCROLLBAR = 290,
tCONTROL = 291,
tEDITTEXT = 292,
tRTEXT = 293,
tCTEXT = 294,
tLTEXT = 295,
tBLOCK = 296,
tVALUE = 297,
tSHIFT = 298,
tALT = 299,
tASCII = 300,
tVIRTKEY = 301,
tGRAYED = 302,
tCHECKED = 303,
tINACTIVE = 304,
tNOINVERT = 305,
tPURE = 306,
tIMPURE = 307,
tDISCARDABLE = 308,
tLOADONCALL = 309,
tPRELOAD = 310,
tFIXED = 311,
tMOVEABLE = 312,
tCLASS = 313,
tCAPTION = 314,
tCHARACTERISTICS = 315,
tEXSTYLE = 316,
tSTYLE = 317,
tVERSION = 318,
tLANGUAGE = 319,
tFILEVERSION = 320,
tPRODUCTVERSION = 321,
tFILEFLAGSMASK = 322,
tFILEOS = 323,
tFILETYPE = 324,
tFILEFLAGS = 325,
tFILESUBTYPE = 326,
tMENUBARBREAK = 327,
tMENUBREAK = 328,
tMENUITEM = 329,
tPOPUP = 330,
tSEPARATOR = 331,
tHELP = 332,
tTOOLBAR = 333,
tBUTTON = 334,
tBEGIN = 335,
tEND = 336,
tDLGINIT = 337,
tNOT = 338,
pUPM = 339
tHTML = 279,
tAUTO3STATE = 280,
tAUTOCHECKBOX = 281,
tAUTORADIOBUTTON = 282,
tCHECKBOX = 283,
tDEFPUSHBUTTON = 284,
tPUSHBUTTON = 285,
tRADIOBUTTON = 286,
tSTATE3 = 287,
tGROUPBOX = 288,
tCOMBOBOX = 289,
tLISTBOX = 290,
tSCROLLBAR = 291,
tCONTROL = 292,
tEDITTEXT = 293,
tRTEXT = 294,
tCTEXT = 295,
tLTEXT = 296,
tBLOCK = 297,
tVALUE = 298,
tSHIFT = 299,
tALT = 300,
tASCII = 301,
tVIRTKEY = 302,
tGRAYED = 303,
tCHECKED = 304,
tINACTIVE = 305,
tNOINVERT = 306,
tPURE = 307,
tIMPURE = 308,
tDISCARDABLE = 309,
tLOADONCALL = 310,
tPRELOAD = 311,
tFIXED = 312,
tMOVEABLE = 313,
tCLASS = 314,
tCAPTION = 315,
tCHARACTERISTICS = 316,
tEXSTYLE = 317,
tSTYLE = 318,
tVERSION = 319,
tLANGUAGE = 320,
tFILEVERSION = 321,
tPRODUCTVERSION = 322,
tFILEFLAGSMASK = 323,
tFILEOS = 324,
tFILETYPE = 325,
tFILEFLAGS = 326,
tFILESUBTYPE = 327,
tMENUBARBREAK = 328,
tMENUBREAK = 329,
tMENUITEM = 330,
tPOPUP = 331,
tSEPARATOR = 332,
tHELP = 333,
tTOOLBAR = 334,
tBUTTON = 335,
tBEGIN = 336,
tEND = 337,
tDLGINIT = 338,
tNOT = 339,
pUPM = 340
};
#endif
#define tNL 258
@ -134,73 +135,74 @@
#define tFONT 276
#define tFONTDIR 277
#define tICON 278
#define tAUTO3STATE 279
#define tAUTOCHECKBOX 280
#define tAUTORADIOBUTTON 281
#define tCHECKBOX 282
#define tDEFPUSHBUTTON 283
#define tPUSHBUTTON 284
#define tRADIOBUTTON 285
#define tSTATE3 286
#define tGROUPBOX 287
#define tCOMBOBOX 288
#define tLISTBOX 289
#define tSCROLLBAR 290
#define tCONTROL 291
#define tEDITTEXT 292
#define tRTEXT 293
#define tCTEXT 294
#define tLTEXT 295
#define tBLOCK 296
#define tVALUE 297
#define tSHIFT 298
#define tALT 299
#define tASCII 300
#define tVIRTKEY 301
#define tGRAYED 302
#define tCHECKED 303
#define tINACTIVE 304
#define tNOINVERT 305
#define tPURE 306
#define tIMPURE 307
#define tDISCARDABLE 308
#define tLOADONCALL 309
#define tPRELOAD 310
#define tFIXED 311
#define tMOVEABLE 312
#define tCLASS 313
#define tCAPTION 314
#define tCHARACTERISTICS 315
#define tEXSTYLE 316
#define tSTYLE 317
#define tVERSION 318
#define tLANGUAGE 319
#define tFILEVERSION 320
#define tPRODUCTVERSION 321
#define tFILEFLAGSMASK 322
#define tFILEOS 323
#define tFILETYPE 324
#define tFILEFLAGS 325
#define tFILESUBTYPE 326
#define tMENUBARBREAK 327
#define tMENUBREAK 328
#define tMENUITEM 329
#define tPOPUP 330
#define tSEPARATOR 331
#define tHELP 332
#define tTOOLBAR 333
#define tBUTTON 334
#define tBEGIN 335
#define tEND 336
#define tDLGINIT 337
#define tNOT 338
#define pUPM 339
#define tHTML 279
#define tAUTO3STATE 280
#define tAUTOCHECKBOX 281
#define tAUTORADIOBUTTON 282
#define tCHECKBOX 283
#define tDEFPUSHBUTTON 284
#define tPUSHBUTTON 285
#define tRADIOBUTTON 286
#define tSTATE3 287
#define tGROUPBOX 288
#define tCOMBOBOX 289
#define tLISTBOX 290
#define tSCROLLBAR 291
#define tCONTROL 292
#define tEDITTEXT 293
#define tRTEXT 294
#define tCTEXT 295
#define tLTEXT 296
#define tBLOCK 297
#define tVALUE 298
#define tSHIFT 299
#define tALT 300
#define tASCII 301
#define tVIRTKEY 302
#define tGRAYED 303
#define tCHECKED 304
#define tINACTIVE 305
#define tNOINVERT 306
#define tPURE 307
#define tIMPURE 308
#define tDISCARDABLE 309
#define tLOADONCALL 310
#define tPRELOAD 311
#define tFIXED 312
#define tMOVEABLE 313
#define tCLASS 314
#define tCAPTION 315
#define tCHARACTERISTICS 316
#define tEXSTYLE 317
#define tSTYLE 318
#define tVERSION 319
#define tLANGUAGE 320
#define tFILEVERSION 321
#define tPRODUCTVERSION 322
#define tFILEFLAGSMASK 323
#define tFILEOS 324
#define tFILETYPE 325
#define tFILEFLAGS 326
#define tFILESUBTYPE 327
#define tMENUBARBREAK 328
#define tMENUBREAK 329
#define tMENUITEM 330
#define tPOPUP 331
#define tSEPARATOR 332
#define tHELP 333
#define tTOOLBAR 334
#define tBUTTON 335
#define tBEGIN 336
#define tEND 337
#define tDLGINIT 338
#define tNOT 339
#define pUPM 340
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
#line 240 "parser.y"
#line 240 "./parser.y"
typedef union YYSTYPE {
string_t *str;
int num;
@ -215,6 +217,7 @@ typedef union YYSTYPE {
fontdir_t *fnd;
menu_t *men;
menuex_t *menex;
html_t *html;
rcdata_t *rdt;
stringtable_t *stt;
stt_entry_t *stte;
@ -244,7 +247,7 @@ typedef union YYSTYPE {
ani_any_t *ani;
} YYSTYPE;
/* Line 1275 of yacc.c. */
#line 248 "parser.tab.h"
#line 251 "y.tab.h"
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1