diff --git a/reactos/media/doc/README.WINE b/reactos/media/doc/README.WINE index 86a7acfc6c7..b3d67264664 100644 --- a/reactos/media/doc/README.WINE +++ b/reactos/media/doc/README.WINE @@ -25,7 +25,7 @@ reactos/tools/unicode # Synced to Wine-20081105 (~Wine-1.1.7) reactos/tools/wpp # Synced to Wine-20081105 (~Wine-1.1.7) reactos/tools/winebuild # Synced to Wine-20081105 (~Wine-1.1.7) reactos/tools/wmc # Synced to Wine-20081105 (~Wine-1.1.7) -reactos/tools/wrc # Synced to Wine-0_9_53 +reactos/tools/wrc # Synced to Wine-20081105 (~Wine-1.1.7) reactos/tools/widl # Synced to Wine-0_9_59 The following libraries are shared with Wine. diff --git a/reactos/tools/wrc/genres.c b/reactos/tools/wrc/genres.c index 05b1dd533b7..5853ce3fcd6 100644 --- a/reactos/tools/wrc/genres.c +++ b/reactos/tools/wrc/genres.c @@ -51,7 +51,7 @@ typedef unsigned long HOST_DWORD; res_t *new_res(void) { res_t *r; - r = (res_t *)xmalloc(sizeof(res_t)); + r = xmalloc(sizeof(res_t)); r->allocsize = RES_BLOCKSIZE; r->size = 0; r->dataidx = 0; @@ -62,7 +62,7 @@ res_t *new_res(void) res_t *grow_res(res_t *r, unsigned int add) { r->allocsize += add; - r->data = (char *)xrealloc(r->data, r->allocsize); + r->data = xrealloc(r->data, r->allocsize); return r; } @@ -118,9 +118,7 @@ void put_word(res_t *res, unsigned w) void put_dword(res_t *res, unsigned d) { - assert(sizeof(HOST_DWORD) == 4); - - if(res->allocsize - res->size < sizeof(HOST_DWORD)) + if(res->allocsize - res->size < sizeof(DWORD)) grow_res(res, RES_BLOCKSIZE); switch(byteorder) { @@ -144,7 +142,7 @@ void put_dword(res_t *res, unsigned d) res->data[res->size+0] = LOBYTE(LOWORD(d)); break; } - res->size += sizeof(HOST_DWORD); + res->size += sizeof(DWORD); } static void put_pad(res_t *res) @@ -229,7 +227,7 @@ static void set_dword(res_t *res, int ofs, unsigned d) * Remarks : ***************************************************************************** */ -static HOST_DWORD get_dword(res_t *res, int ofs) +static DWORD get_dword(res_t *res, int ofs) { switch(byteorder) { @@ -423,7 +421,7 @@ static void put_raw_data(res_t *res, raw_data_t *raw, int offset) /* ***************************************************************************** * Function : put_res_header - * Syntax : intput_res_header(res_t *res, int type, name_id_t *ntype, + * Syntax : input_res_header(res_t *res, int type, name_id_t *ntype, * name_id_t *name, DWORD memopt, lvc_t *lvc) * * Input : @@ -440,7 +438,7 @@ static void put_raw_data(res_t *res, raw_data_t *raw, int offset) ***************************************************************************** */ static int put_res_header(res_t *res, int type, name_id_t *ntype, name_id_t *name, - HOST_DWORD memopt, lvc_t *lvc) + DWORD memopt, lvc_t *lvc) { if(win32) { @@ -458,8 +456,8 @@ static int put_res_header(res_t *res, int type, name_id_t *ntype, name_id_t *nam put_dword(res, 0); /* DataVersion */ put_word(res, memopt); /* Memory options */ put_lvc(res, lvc); /* Language, version and characts */ - set_dword(res, 0*sizeof(HOST_DWORD), res->size); /* Set preliminary resource */ - set_dword(res, 1*sizeof(HOST_DWORD), res->size); /* Set HeaderSize */ + set_dword(res, 0*sizeof(DWORD), res->size); /* Set preliminary resource */ + set_dword(res, 1*sizeof(DWORD), res->size); /* Set HeaderSize */ res->dataidx = res->size; return 0; } @@ -721,7 +719,7 @@ static res_t *dialogex2res(name_id_t *name, dialogex_t *dlgex) { restag = put_res_header(res, WRC_RT_DIALOG, NULL, name, dlgex->memopt, &(dlgex->lvc)); - /* FIXME: MS doc says thet the first word must contain 0xffff + /* FIXME: MS doc says that the first word must contain 0xffff * and the second 0x0001 to signal a DLGTEMPLATEEX. Borland's * compiler reverses the two words. * I don't know which one to choose, but I write it as Mr. B @@ -754,8 +752,8 @@ static res_t *dialogex2res(name_id_t *name, dialogex_t *dlgex) { put_word(res, dlgex->font->size); put_word(res, dlgex->font->weight); - /* FIXME: ? TRUE should be sufficient to say that its - * italic, but Borland's compiler says its 0x0101. + /* FIXME: ? TRUE should be sufficient to say that it's + * italic, but Borland's compiler says it's 0x0101. * I just copy it here, and hope for the best. */ put_word(res, dlgex->font->italic ? 0x0101 : 0); @@ -1025,7 +1023,7 @@ static res_t *cursorgroup2res(name_id_t *name, cursor_group_t *curg) put_word(res, cur->planes); put_word(res, cur->bits); /* FIXME: The +4 is the hotspot in the cursor resource. - * However, I cound not find this in the documentation. + * However, I could not find this in the documentation. * The hotspot bytes must either be included or MS * doesn't care. */ @@ -1062,7 +1060,7 @@ static res_t *cursorgroup2res(name_id_t *name, cursor_group_t *curg) put_word(res, cur->planes); put_word(res, cur->bits); /* FIXME: The +4 is the hotspot in the cursor resource. - * However, I cound not find this in the documentation. + * However, I could not find this in the documentation. * The hotspot bytes must either be included or MS * doesn't care. */ @@ -1450,7 +1448,7 @@ static res_t *stringtable2res(stringtable_t *stt) name_id_t name; int i; int restag; - HOST_DWORD lastsize = 0; + DWORD lastsize = 0; assert(stt != NULL); res = new_res(); @@ -1852,7 +1850,7 @@ char *make_c_name(const char *base, const name_id_t *nid, const language_t *lan) buf = prep_nid_for_label(nid); nlen = strlen(buf) + strlen(lanbuf); nlen += strlen(base) + 4; /* three time '_' and '\0' */ - ret = (char *)xmalloc(nlen); + ret = xmalloc(nlen); strcpy(ret, "_"); strcat(ret, base); strcat(ret, "_"); diff --git a/reactos/tools/wrc/lex.yy.c b/reactos/tools/wrc/lex.yy.c index 5e979fed17e..b72d0a651a3 100644 --- a/reactos/tools/wrc/lex.yy.c +++ b/reactos/tools/wrc/lex.yy.c @@ -19,7 +19,7 @@ /* A lexical scanner generated by flex */ /* Scanner skeleton version: - * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.85 95/04/24 10:48:47 vern Exp $ + * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $ */ #define FLEX_SCANNER @@ -144,6 +144,7 @@ extern FILE *yyin, *yyout; { \ /* Undo effects of setting up yytext. */ \ *yy_cp = yy_hold_char; \ + YY_RESTORE_YY_MORE_OFFSET \ yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ @@ -253,7 +254,7 @@ void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); -YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *str )); +YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); static void *yy_flex_alloc YY_PROTO(( yy_size_t )); @@ -586,6 +587,7 @@ static char *yy_last_accepting_cpos; #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET char *yytext; #line 1 "parser.l" #define INITIAL 0 @@ -681,6 +683,7 @@ char *yytext; #define pp_code_page 8 #define YY_STACK_USED 1 +#define YY_NO_INPUT 1 #define YY_NO_UNPUT 1 #define YY_NO_TOP_STATE 1 #define YY_NEVER_INTERACTIVE 1 @@ -689,11 +692,19 @@ char *yytext; /*#define LEX_DEBUG*/ +#include "config.h" + #include #include #include #include #include +#include +#include + +#ifndef HAVE_UNISTD_H +#define YY_NO_UNISTD_H +#endif #include "wine/unicode.h" #include "wrc.h" @@ -882,12 +893,25 @@ static struct keyword *iskeyword(char *kw) return kwp; } +/* converts an integer in string form to an unsigned long and prints an error + * on overflow */ +static unsigned long xstrtoul(const char *nptr, char **endptr, int base) +{ + unsigned long l; + + errno = 0; + l = strtoul(nptr, endptr, base); + if (l == ULONG_MAX && errno == ERANGE) + parser_error("integer constant %s is too large\n", nptr); + return l; +} + /* ************************************************************************** * The flexer starts here ************************************************************************** */ -#line 891 "lex.yy.c" +#line 915 "lex.yy.c" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -909,6 +933,10 @@ static void yyunput YY_PROTO(( int c, char *buf_ptr )); static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); #endif +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen YY_PROTO(( yyconst char * )); +#endif + #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput YY_PROTO(( void )); @@ -1037,7 +1065,7 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; -#line 299 "parser.l" +#line 320 "parser.l" /* * Catch the GCC-style line statements here and parse them. @@ -1057,7 +1085,7 @@ YY_DECL * because we only want to know the linenumber and * filename. */ -#line 1061 "lex.yy.c" +#line 1089 "lex.yy.c" if ( yy_init ) { @@ -1143,17 +1171,17 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 318 "parser.l" +#line 339 "parser.l" yy_push_state(pp_pragma); YY_BREAK case 2: YY_RULE_SETUP -#line 319 "parser.l" +#line 340 "parser.l" yy_push_state(pp_line); YY_BREAK case 3: YY_RULE_SETUP -#line 320 "parser.l" +#line 341 "parser.l" { int lineno, len; char *cptr; @@ -1161,10 +1189,10 @@ YY_RULE_SETUP yy_pop_state(); lineno = (int)strtol(yytext, &cptr, 10); if(!lineno) - parser_error("Malformed '#...' line-directive; invalid linenumber\n"); + parser_error("Malformed '#...' line-directive; invalid linenumber"); fname = strchr(cptr, '"'); if(!fname) - parser_error("Malformed '#...' line-directive; missing filename\n"); + parser_error("Malformed '#...' line-directive; missing filename"); fname++; cptr = strchr(fname, '"'); if(!cptr) @@ -1182,43 +1210,43 @@ YY_RULE_SETUP YY_BREAK case 4: YY_RULE_SETUP -#line 346 "parser.l" +#line 367 "parser.l" yyless(9); yy_pop_state(); yy_push_state(pp_code_page); YY_BREAK case 5: YY_RULE_SETUP -#line 347 "parser.l" +#line 368 "parser.l" yy_pop_state(); if (pedantic) parser_warning("Unrecognized #pragma directive '%s'\n",yytext); YY_BREAK case 6: YY_RULE_SETUP -#line 349 "parser.l" +#line 370 "parser.l" current_codepage = -1; yy_pop_state(); YY_BREAK case 7: YY_RULE_SETUP -#line 350 "parser.l" +#line 371 "parser.l" current_codepage = CP_UTF8; yy_pop_state(); YY_BREAK case 8: YY_RULE_SETUP -#line 351 "parser.l" +#line 372 "parser.l" { char *p = yytext; yy_pop_state(); while (*p < '0' || *p > '9') p++; current_codepage = strtol( p, NULL, 10 ); - if (current_codepage && current_codepage != CP_UTF8 && !wine_cp_get_table( current_codepage )) + if (current_codepage != CP_UTF8 && !wine_cp_get_table( current_codepage )) { - parser_error("Codepage %d not supported\n", current_codepage); + parser_error("Codepage %d not supported", current_codepage); current_codepage = 0; } } YY_BREAK case 9: YY_RULE_SETUP -#line 362 "parser.l" -yy_pop_state(); parser_error("Malformed #pragma code_page directive\n"); +#line 383 "parser.l" +yy_pop_state(); parser_error("Malformed #pragma code_page directive"); YY_BREAK /* * Strip everything until a ';' taking @@ -1227,38 +1255,38 @@ yy_pop_state(); parser_error("Malformed #pragma code_page directive\n"); */ case 10: YY_RULE_SETUP -#line 369 "parser.l" +#line 390 "parser.l" line_number++; char_number = 1; YY_BREAK case 11: YY_RULE_SETUP -#line 370 "parser.l" +#line 391 "parser.l" ; /* ignore */ YY_BREAK case 12: YY_RULE_SETUP -#line 372 "parser.l" +#line 393 "parser.l" return tBEGIN; YY_BREAK case 13: YY_RULE_SETUP -#line 373 "parser.l" +#line 394 "parser.l" return tEND; YY_BREAK case 14: YY_RULE_SETUP -#line 375 "parser.l" -{ parser_lval.num = strtoul(yytext, 0, 10); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; } +#line 396 "parser.l" +{ parser_lval.num = xstrtoul(yytext, 0, 10); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; } YY_BREAK case 15: YY_RULE_SETUP -#line 376 "parser.l" -{ parser_lval.num = strtoul(yytext, 0, 16); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; } +#line 397 "parser.l" +{ parser_lval.num = xstrtoul(yytext, 0, 16); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; } YY_BREAK case 16: YY_RULE_SETUP -#line 377 "parser.l" -{ parser_lval.num = strtoul(yytext+2, 0, 8); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; } +#line 398 "parser.l" +{ parser_lval.num = xstrtoul(yytext+2, 0, 8); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; } YY_BREAK /* * The next two rules scan identifiers and filenames. @@ -1269,7 +1297,7 @@ YY_RULE_SETUP */ case 17: YY_RULE_SETUP -#line 386 "parser.l" +#line 407 "parser.l" { struct keyword *tok = iskeyword(yytext); @@ -1292,7 +1320,7 @@ YY_RULE_SETUP YY_BREAK case 18: YY_RULE_SETUP -#line 405 "parser.l" +#line 426 "parser.l" parser_lval.str = make_string(yytext); return tFILENAME; YY_BREAK /* @@ -1300,7 +1328,7 @@ parser_lval.str = make_string(yytext); return tFILENAME; */ case 19: YY_RULE_SETUP -#line 410 "parser.l" +#line 431 "parser.l" { yy_push_state(tklstr); wbufidx = 0; @@ -1309,10 +1337,10 @@ YY_RULE_SETUP } YY_BREAK case 20: -#line 417 "parser.l" +#line 438 "parser.l" case 21: YY_RULE_SETUP -#line 417 "parser.l" +#line 438 "parser.l" { yy_pop_state(); parser_lval.str = get_buffered_wstring(); @@ -1321,18 +1349,18 @@ YY_RULE_SETUP YY_BREAK case 22: YY_RULE_SETUP -#line 422 "parser.l" +#line 443 "parser.l" { /* octal escape sequence */ unsigned int result; result = strtoul(yytext+1, 0, 8); if ( result > 0xffff ) - parser_error("Character constant out of range\n"); + parser_error("Character constant out of range"); addwchar((WCHAR)result); } YY_BREAK case 23: YY_RULE_SETUP -#line 429 "parser.l" +#line 450 "parser.l" { /* hex escape sequence */ unsigned int result; result = strtoul(yytext+2, 0, 16); @@ -1341,82 +1369,82 @@ YY_RULE_SETUP YY_BREAK case 24: YY_RULE_SETUP -#line 434 "parser.l" -{ parser_error("Invalid hex escape sequence '%s'\n", yytext); } +#line 455 "parser.l" +{ parser_error("Invalid hex escape sequence '%s'", yytext); } YY_BREAK case 25: YY_RULE_SETUP -#line 436 "parser.l" -parser_error("Bad escape sequence\n"); +#line 457 "parser.l" +parser_error("Bad escape sequence"); YY_BREAK case 26: YY_RULE_SETUP -#line 437 "parser.l" +#line 458 "parser.l" line_number++; char_number = 1; /* backslash at EOL continues string after leading whitespace on next line */ YY_BREAK case 27: YY_RULE_SETUP -#line 438 "parser.l" +#line 459 "parser.l" addwchar('\a'); YY_BREAK case 28: YY_RULE_SETUP -#line 439 "parser.l" +#line 460 "parser.l" addwchar('\b'); YY_BREAK case 29: YY_RULE_SETUP -#line 440 "parser.l" +#line 461 "parser.l" addwchar('\f'); YY_BREAK case 30: YY_RULE_SETUP -#line 441 "parser.l" +#line 462 "parser.l" addwchar('\n'); YY_BREAK case 31: YY_RULE_SETUP -#line 442 "parser.l" +#line 463 "parser.l" addwchar('\r'); YY_BREAK case 32: YY_RULE_SETUP -#line 443 "parser.l" +#line 464 "parser.l" addwchar('\t'); YY_BREAK case 33: YY_RULE_SETUP -#line 444 "parser.l" +#line 465 "parser.l" addwchar('\v'); YY_BREAK case 34: YY_RULE_SETUP -#line 445 "parser.l" +#line 466 "parser.l" addwchar(yytext[1]); YY_BREAK case 35: YY_RULE_SETUP -#line 446 "parser.l" +#line 467 "parser.l" addwchar(yytext[2]); line_number++; char_number = 1; YY_BREAK case 36: YY_RULE_SETUP -#line 447 "parser.l" +#line 468 "parser.l" addwchar('\"'); /* "bla""bla" -> "bla\"bla" */ YY_BREAK case 37: YY_RULE_SETUP -#line 448 "parser.l" +#line 469 "parser.l" addwchar('\"'); /* "bla\""bla" -> "bla\"bla" */ YY_BREAK case 38: YY_RULE_SETUP -#line 449 "parser.l" +#line 470 "parser.l" ; /* "bla" "bla" -> "blabla" */ YY_BREAK case 39: YY_RULE_SETUP -#line 450 "parser.l" +#line 471 "parser.l" { char *yptr = yytext; while(*yptr) /* FIXME: codepage translation */ @@ -1425,22 +1453,22 @@ YY_RULE_SETUP YY_BREAK case 40: YY_RULE_SETUP -#line 455 "parser.l" -parser_error("Unterminated string\n"); +#line 476 "parser.l" +parser_error("Unterminated string"); YY_BREAK /* * Normal string scanning */ case 41: YY_RULE_SETUP -#line 460 "parser.l" +#line 481 "parser.l" yy_push_state(tkstr); cbufidx = 0; YY_BREAK case 42: -#line 462 "parser.l" +#line 483 "parser.l" case 43: YY_RULE_SETUP -#line 462 "parser.l" +#line 483 "parser.l" { yy_pop_state(); parser_lval.str = get_buffered_cstring(); @@ -1449,18 +1477,18 @@ YY_RULE_SETUP YY_BREAK case 44: YY_RULE_SETUP -#line 467 "parser.l" +#line 488 "parser.l" { /* octal escape sequence */ int result; result = strtol(yytext+1, 0, 8); if ( result > 0xff ) - parser_error("Character constant out of range\n"); + parser_error("Character constant out of range"); addcchar((char)result); } YY_BREAK case 45: YY_RULE_SETUP -#line 474 "parser.l" +#line 495 "parser.l" { /* hex escape sequence */ int result; result = strtol(yytext+2, 0, 16); @@ -1469,67 +1497,67 @@ YY_RULE_SETUP YY_BREAK case 46: YY_RULE_SETUP -#line 479 "parser.l" -{ parser_error("Invalid hex escape sequence '%s'\n", yytext); } +#line 500 "parser.l" +{ parser_error("Invalid hex escape sequence '%s'", yytext); } YY_BREAK case 47: YY_RULE_SETUP -#line 481 "parser.l" -parser_error("Bad escape sequence\n"); +#line 502 "parser.l" +parser_error("Bad escape sequence"); YY_BREAK case 48: YY_RULE_SETUP -#line 482 "parser.l" +#line 503 "parser.l" line_number++; char_number = 1; /* backslash at EOL continues string after leading whitespace on next line */ YY_BREAK case 49: YY_RULE_SETUP -#line 483 "parser.l" +#line 504 "parser.l" addcchar('\a'); YY_BREAK case 50: YY_RULE_SETUP -#line 484 "parser.l" +#line 505 "parser.l" addcchar('\b'); YY_BREAK case 51: YY_RULE_SETUP -#line 485 "parser.l" +#line 506 "parser.l" addcchar('\f'); YY_BREAK case 52: YY_RULE_SETUP -#line 486 "parser.l" +#line 507 "parser.l" addcchar('\n'); YY_BREAK case 53: YY_RULE_SETUP -#line 487 "parser.l" +#line 508 "parser.l" addcchar('\r'); YY_BREAK case 54: YY_RULE_SETUP -#line 488 "parser.l" +#line 509 "parser.l" addcchar('\t'); YY_BREAK case 55: YY_RULE_SETUP -#line 489 "parser.l" +#line 510 "parser.l" addcchar('\v'); YY_BREAK case 56: YY_RULE_SETUP -#line 490 "parser.l" +#line 511 "parser.l" addcchar(yytext[1]); YY_BREAK case 57: YY_RULE_SETUP -#line 491 "parser.l" +#line 512 "parser.l" addcchar(yytext[2]); line_number++; char_number = 1; YY_BREAK case 58: YY_RULE_SETUP -#line 492 "parser.l" +#line 513 "parser.l" { char *yptr = yytext; while(*yptr) @@ -1538,35 +1566,35 @@ YY_RULE_SETUP YY_BREAK case 59: YY_RULE_SETUP -#line 497 "parser.l" +#line 518 "parser.l" addcchar('\"'); /* "bla""bla" -> "bla\"bla" */ YY_BREAK case 60: YY_RULE_SETUP -#line 498 "parser.l" +#line 519 "parser.l" addcchar('\"'); /* "bla\""bla" -> "bla\"bla" */ YY_BREAK case 61: YY_RULE_SETUP -#line 499 "parser.l" +#line 520 "parser.l" ; /* "bla" "bla" -> "blabla" */ YY_BREAK case 62: YY_RULE_SETUP -#line 500 "parser.l" -parser_error("Unterminated string\n"); +#line 521 "parser.l" +parser_error("Unterminated string"); YY_BREAK /* * Raw data scanning */ case 63: YY_RULE_SETUP -#line 505 "parser.l" +#line 526 "parser.l" yy_push_state(tkrcd); cbufidx = 0; YY_BREAK case 64: YY_RULE_SETUP -#line 506 "parser.l" +#line 527 "parser.l" { yy_pop_state(); parser_lval.raw = new_raw_data(); @@ -1578,7 +1606,7 @@ YY_RULE_SETUP YY_BREAK case 65: YY_RULE_SETUP -#line 514 "parser.l" +#line 535 "parser.l" { int result; result = strtol(yytext, 0, 16); @@ -1587,18 +1615,18 @@ YY_RULE_SETUP YY_BREAK case 66: YY_RULE_SETUP -#line 519 "parser.l" +#line 540 "parser.l" ; /* Ignore space */ YY_BREAK case 67: YY_RULE_SETUP -#line 520 "parser.l" +#line 541 "parser.l" line_number++; char_number = 1; YY_BREAK case 68: YY_RULE_SETUP -#line 521 "parser.l" -parser_error("Malformed data-line\n"); +#line 542 "parser.l" +parser_error("Malformed data-line"); YY_BREAK /* * Comment stripping @@ -1606,7 +1634,7 @@ parser_error("Malformed data-line\n"); */ case 69: YY_RULE_SETUP -#line 527 "parser.l" +#line 548 "parser.l" { yy_push_state(comment); save_wanted_id = wanted_id; @@ -1616,37 +1644,37 @@ YY_RULE_SETUP YY_BREAK case 70: YY_RULE_SETUP -#line 533 "parser.l" +#line 554 "parser.l" ; YY_BREAK case 71: YY_RULE_SETUP -#line 534 "parser.l" +#line 555 "parser.l" ; YY_BREAK case 72: YY_RULE_SETUP -#line 535 "parser.l" +#line 556 "parser.l" line_number++; char_number = 1; YY_BREAK case 73: YY_RULE_SETUP -#line 536 "parser.l" +#line 557 "parser.l" yy_pop_state(); want_id = save_wanted_id; YY_BREAK case 74: YY_RULE_SETUP -#line 538 "parser.l" +#line 559 "parser.l" want_id = wanted_id; /* not really comment, but left-over c-junk */ YY_BREAK case 75: YY_RULE_SETUP -#line 539 "parser.l" +#line 560 "parser.l" want_id = wanted_id; if(!no_preprocess) parser_warning("Found comments after preprocessing, please report\n"); YY_BREAK case 76: YY_RULE_SETUP -#line 541 "parser.l" +#line 562 "parser.l" { want_id = wanted_id; line_number++; @@ -1660,17 +1688,17 @@ YY_RULE_SETUP YY_BREAK case 77: YY_RULE_SETUP -#line 551 "parser.l" +#line 572 "parser.l" want_id = wanted_id; /* Eat whitespace */ YY_BREAK case 78: YY_RULE_SETUP -#line 553 "parser.l" +#line 574 "parser.l" return yytext[0]; YY_BREAK case 79: YY_RULE_SETUP -#line 555 "parser.l" +#line 576 "parser.l" { /* Catch all rule to find any unmatched text */ if(*yytext == '\n') @@ -1684,10 +1712,10 @@ YY_RULE_SETUP YY_BREAK case 80: YY_RULE_SETUP -#line 566 "parser.l" +#line 587 "parser.l" ECHO; YY_BREAK -#line 1691 "lex.yy.c" +#line 1719 "lex.yy.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(tkstr): case YY_STATE_EOF(tklstr): @@ -1706,6 +1734,7 @@ case YY_STATE_EOF(pp_code_page): /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = yy_hold_char; + YY_RESTORE_YY_MORE_OFFSET if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) { @@ -1851,7 +1880,7 @@ static int yy_get_next_buffer() { /* Don't try to fill the buffer, so this is an EOF. */ if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) { - /* We matched a singled characater, the EOB, so + /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; @@ -1878,7 +1907,7 @@ static int yy_get_next_buffer() /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ - yy_n_chars = 0; + yy_current_buffer->yy_n_chars = yy_n_chars = 0; else { @@ -1933,6 +1962,8 @@ static int yy_get_next_buffer() /* Read in more data. */ YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), yy_n_chars, num_to_read ); + + yy_current_buffer->yy_n_chars = yy_n_chars; } if ( yy_n_chars == 0 ) @@ -2058,7 +2089,8 @@ register char *yy_bp; yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); - yy_n_chars = yy_current_buffer->yy_buf_size; + yy_current_buffer->yy_n_chars = + yy_n_chars = yy_current_buffer->yy_buf_size; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); @@ -2096,19 +2128,31 @@ static int input() else { /* need more input */ - yytext_ptr = yy_c_buf_p; + int offset = yy_c_buf_p - yytext_ptr; ++yy_c_buf_p; switch ( yy_get_next_buffer() ) { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart( yyin ); + + /* fall through */ + case EOB_ACT_END_OF_FILE: { if ( yywrap() ) - { - yy_c_buf_p = - yytext_ptr + YY_MORE_ADJ; return EOF; - } if ( ! yy_did_buffer_switch_on_eof ) YY_NEW_FILE; @@ -2120,17 +2164,8 @@ static int input() } case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + yy_c_buf_p = yytext_ptr + offset; break; - - case EOB_ACT_LAST_MATCH: -#ifdef __cplusplus - YY_FATAL_ERROR( - "unexpected last match in yyinput()" ); -#else - YY_FATAL_ERROR( - "unexpected last match in input()" ); -#endif } } } @@ -2295,6 +2330,9 @@ YY_BUFFER_STATE b; #endif { + if ( ! b ) + return; + b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes @@ -2354,17 +2392,17 @@ yy_size_t size; #ifndef YY_NO_SCAN_STRING #ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_string( yyconst char *str ) +YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) #else -YY_BUFFER_STATE yy_scan_string( str ) -yyconst char *str; +YY_BUFFER_STATE yy_scan_string( yy_str ) +yyconst char *yy_str; #endif { int len; - for ( len = 0; str[len]; ++len ) + for ( len = 0; yy_str[len]; ++len ) ; - return yy_scan_bytes( str, len ); + return yy_scan_bytes( yy_str, len ); } #endif @@ -2485,7 +2523,7 @@ char msg[]; { \ /* Undo effects of setting up yytext. */ \ yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n - YY_MORE_ADJ; \ + yy_c_buf_p = yytext + n; \ yy_hold_char = *yy_c_buf_p; \ *yy_c_buf_p = '\0'; \ yyleng = n; \ @@ -2511,6 +2549,22 @@ int n; } #endif +#ifdef YY_NEED_STRLEN +#ifdef YY_USE_PROTOS +static int yy_flex_strlen( yyconst char *s ) +#else +static int yy_flex_strlen( s ) +yyconst char *s; +#endif + { + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; + } +#endif + #ifdef YY_USE_PROTOS static void *yy_flex_alloc( yy_size_t size ) @@ -2557,7 +2611,7 @@ int main() return 0; } #endif -#line 566 "parser.l" +#line 587 "parser.l" /* These dup functions copy the enclosed '\0' from @@ -2599,7 +2653,7 @@ static string_t *get_buffered_cstring(void) if (!current_codepage || current_codepage == -1 || !win32) /* store as ANSI string */ { - if (!current_codepage) parser_error("Codepage set to Unicode only, cannot use ASCII string here\n"); + if (!current_codepage) parser_error("Codepage set to Unicode only, cannot use ASCII string here"); return str; } else /* convert to Unicode before storing */ @@ -2607,7 +2661,7 @@ static string_t *get_buffered_cstring(void) string_t *str_w = convert_string( str, str_unicode, current_codepage ); if (!check_unicode_conversion( str, str_w, current_codepage )) parser_error("String %s does not convert identically to Unicode and back in codepage %d. " - "Try using a Unicode string instead\n", str->str.cstr, current_codepage ); + "Try using a Unicode string instead", str->str.cstr, current_codepage ); free_string( str ); return str_w; } diff --git a/reactos/tools/wrc/newstruc.c b/reactos/tools/wrc/newstruc.c index 88d1c7a1127..7df5d294ab3 100644 --- a/reactos/tools/wrc/newstruc.c +++ b/reactos/tools/wrc/newstruc.c @@ -792,7 +792,7 @@ static void handle_ani_list(riff_tag_t *lst, enum res_e type, int isswapped) } else if(!memcmp(rtp->tag, iart, sizeof(iart))) { - /* Ignore the author's name; its a string */ + /* Ignore the author's name; it's a string */ rtp = NEXT_TAG(rtp); } else if(!memcmp(rtp->tag, fram, sizeof(fram))) @@ -1154,6 +1154,7 @@ stringtable_t *new_stringtable(lvc_t *lvc) toolbar_t *new_toolbar(int button_width, int button_height, toolbar_item_t *items, int nitems) { toolbar_t *tb = (toolbar_t *)xmalloc(sizeof(toolbar_t)); + memset( tb, 0, sizeof(*tb) ); tb->button_width = button_width; tb->button_height = button_height; tb->nitems = nitems; diff --git a/reactos/tools/wrc/parser.h b/reactos/tools/wrc/parser.h index 8be2269dc12..b9e204589db 100644 --- a/reactos/tools/wrc/parser.h +++ b/reactos/tools/wrc/parser.h @@ -23,7 +23,7 @@ /* From parser.y */ extern int parser_debug; -extern int want_nl; /* Set when getting line-numers */ +extern int want_nl; /* Set when getting line-numbers */ extern int want_id; /* Set when getting the resource name */ int parser_parse(void); @@ -36,4 +36,3 @@ extern int yy_flex_debug; int parser_lex(void); #endif - diff --git a/reactos/tools/wrc/parser.l b/reactos/tools/wrc/parser.l index 98f9c85d778..2ed5f4b29ef 100644 --- a/reactos/tools/wrc/parser.l +++ b/reactos/tools/wrc/parser.l @@ -84,7 +84,7 @@ %x pp_code_page %option stack -%option nounput noyy_top_state noyywrap +%option noinput nounput noyy_top_state noyywrap %option 8bit never-interactive %option prefix="parser_" @@ -96,11 +96,19 @@ cident [a-zA-Z_][0-9a-zA-Z_]* /*#define LEX_DEBUG*/ +#include "config.h" + #include #include #include #include #include +#include +#include + +#ifndef HAVE_UNISTD_H +#define YY_NO_UNISTD_H +#endif #include "wine/unicode.h" #include "wrc.h" @@ -289,6 +297,19 @@ static struct keyword *iskeyword(char *kw) return kwp; } +/* converts an integer in string form to an unsigned long and prints an error + * on overflow */ +static unsigned long xstrtoul(const char *nptr, char **endptr, int base) +{ + unsigned long l; + + errno = 0; + l = strtoul(nptr, endptr, base); + if (l == ULONG_MAX && errno == ERANGE) + parser_error("integer constant %s is too large\n", nptr); + return l; +} + %} /* @@ -324,10 +345,10 @@ static struct keyword *iskeyword(char *kw) yy_pop_state(); lineno = (int)strtol(yytext, &cptr, 10); if(!lineno) - parser_error("Malformed '#...' line-directive; invalid linenumber\n"); + parser_error("Malformed '#...' line-directive; invalid linenumber"); fname = strchr(cptr, '"'); if(!fname) - parser_error("Malformed '#...' line-directive; missing filename\n"); + parser_error("Malformed '#...' line-directive; missing filename"); fname++; cptr = strchr(fname, '"'); if(!cptr) @@ -353,13 +374,13 @@ static struct keyword *iskeyword(char *kw) yy_pop_state(); while (*p < '0' || *p > '9') p++; current_codepage = strtol( p, NULL, 10 ); - if (current_codepage && current_codepage != CP_UTF8 && !wine_cp_get_table( current_codepage )) + if (current_codepage != CP_UTF8 && !wine_cp_get_table( current_codepage )) { - parser_error("Codepage %d not supported\n", current_codepage); + parser_error("Codepage %d not supported", current_codepage); current_codepage = 0; } } -[^\n]* yy_pop_state(); parser_error("Malformed #pragma code_page directive\n"); +[^\n]* yy_pop_state(); parser_error("Malformed #pragma code_page directive"); /* * Strip everything until a ';' taking @@ -372,9 +393,9 @@ static struct keyword *iskeyword(char *kw) \{ return tBEGIN; \} return tEND; -[0-9]+[lL]? { parser_lval.num = strtoul(yytext, 0, 10); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; } -0[xX][0-9A-Fa-f]+[lL]? { parser_lval.num = strtoul(yytext, 0, 16); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; } -0[oO][0-7]+[lL]? { parser_lval.num = strtoul(yytext+2, 0, 8); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; } +[0-9]+[lL]? { parser_lval.num = xstrtoul(yytext, 0, 10); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; } +0[xX][0-9A-Fa-f]+[lL]? { parser_lval.num = xstrtoul(yytext, 0, 16); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; } +0[oO][0-7]+[lL]? { parser_lval.num = xstrtoul(yytext+2, 0, 8); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; } /* * The next two rules scan identifiers and filenames. @@ -423,7 +444,7 @@ L\" { unsigned int result; result = strtoul(yytext+1, 0, 8); if ( result > 0xffff ) - parser_error("Character constant out of range\n"); + parser_error("Character constant out of range"); addwchar((WCHAR)result); } \\x[0-9a-fA-F]{4} { /* hex escape sequence */ @@ -431,9 +452,9 @@ L\" { result = strtoul(yytext+2, 0, 16); addwchar((WCHAR)result); } -\\x[0-9a-fA-F]{1,3} { parser_error("Invalid hex escape sequence '%s'\n", yytext); } +\\x[0-9a-fA-F]{1,3} { parser_error("Invalid hex escape sequence '%s'", yytext); } -\\[0-9]+ parser_error("Bad escape sequence\n"); +\\[0-9]+ parser_error("Bad escape sequence"); \\\n{ws}* line_number++; char_number = 1; /* backslash at EOL continues string after leading whitespace on next line */ \\a addwchar('\a'); \\b addwchar('\b'); @@ -452,7 +473,7 @@ L\" { while(*yptr) /* FIXME: codepage translation */ addwchar(*yptr++ & 0xff); } -\n parser_error("Unterminated string\n"); +\n parser_error("Unterminated string"); /* * Normal string scanning @@ -468,7 +489,7 @@ L\" { int result; result = strtol(yytext+1, 0, 8); if ( result > 0xff ) - parser_error("Character constant out of range\n"); + parser_error("Character constant out of range"); addcchar((char)result); } \\x[0-9a-fA-F]{2} { /* hex escape sequence */ @@ -476,9 +497,9 @@ L\" { result = strtol(yytext+2, 0, 16); addcchar((char)result); } -\\x[0-9a-fA-F] { parser_error("Invalid hex escape sequence '%s'\n", yytext); } +\\x[0-9a-fA-F] { parser_error("Invalid hex escape sequence '%s'", yytext); } -\\[0-9]+ parser_error("Bad escape sequence\n"); +\\[0-9]+ parser_error("Bad escape sequence"); \\\n{ws}* line_number++; char_number = 1; /* backslash at EOL continues string after leading whitespace on next line */ \\a addcchar('\a'); \\b addcchar('\b'); @@ -497,7 +518,7 @@ L\" { \"\" addcchar('\"'); /* "bla""bla" -> "bla\"bla" */ \\\"\" addcchar('\"'); /* "bla\""bla" -> "bla\"bla" */ \"{ws}+\" ; /* "bla" "bla" -> "blabla" */ -\n parser_error("Unterminated string\n"); +\n parser_error("Unterminated string"); /* * Raw data scanning @@ -518,7 +539,7 @@ L\" { } {ws}+ ; /* Ignore space */ \n line_number++; char_number = 1; -. parser_error("Malformed data-line\n"); +. parser_error("Malformed data-line"); /* * Comment stripping @@ -604,7 +625,7 @@ static string_t *get_buffered_cstring(void) if (!current_codepage || current_codepage == -1 || !win32) /* store as ANSI string */ { - if (!current_codepage) parser_error("Codepage set to Unicode only, cannot use ASCII string here\n"); + if (!current_codepage) parser_error("Codepage set to Unicode only, cannot use ASCII string here"); return str; } else /* convert to Unicode before storing */ @@ -612,7 +633,7 @@ static string_t *get_buffered_cstring(void) string_t *str_w = convert_string( str, str_unicode, current_codepage ); if (!check_unicode_conversion( str, str_w, current_codepage )) parser_error("String %s does not convert identically to Unicode and back in codepage %d. " - "Try using a Unicode string instead\n", str->str.cstr, current_codepage ); + "Try using a Unicode string instead", str->str.cstr, current_codepage ); free_string( str ); return str_w; } diff --git a/reactos/tools/wrc/parser.tab.c b/reactos/tools/wrc/parser.tab.c index 990cfbc1211..73805837b43 100644 --- a/reactos/tools/wrc/parser.tab.c +++ b/reactos/tools/wrc/parser.tab.c @@ -495,7 +495,7 @@ static int rsrcid_to_token(int lookahead); #endif #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 237 "parser.y" +#line 241 "parser.y" typedef union YYSTYPE { string_t *str; int num; @@ -540,7 +540,7 @@ typedef union YYSTYPE { ani_any_t *ani; } YYSTYPE; /* Line 196 of yacc.c. */ -#line 544 "parser.tab.c" +#line 548 "parser.tab.c" # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 @@ -552,7 +552,7 @@ typedef union YYSTYPE { /* Line 219 of yacc.c. */ -#line 556 "parser.tab.c" +#line 560 "parser.tab.c" #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) # define YYSIZE_T __SIZE_TYPE__ @@ -902,32 +902,32 @@ static const short int yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const unsigned short int yyrline[] = { - 0, 359, 359, 393, 394, 464, 470, 482, 492, 500, - 500, 543, 549, 556, 566, 567, 576, 577, 578, 602, - 603, 609, 610, 611, 612, 636, 637, 643, 644, 645, - 646, 647, 648, 652, 653, 654, 658, 662, 678, 700, - 710, 718, 726, 730, 734, 738, 749, 754, 763, 787, - 788, 789, 798, 799, 802, 803, 806, 807, 808, 809, - 810, 811, 816, 851, 852, 853, 854, 855, 856, 857, - 858, 859, 860, 863, 864, 865, 866, 867, 868, 869, - 870, 871, 872, 874, 875, 876, 877, 878, 879, 880, - 881, 883, 893, 916, 938, 940, 945, 952, 963, 977, - 992, 997, 998, 999, 1003, 1004, 1005, 1006, 1010, 1015, - 1023, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, - 1076, 1077, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, - 1088, 1089, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, - 1100, 1110, 1135, 1151, 1177, 1200, 1201, 1204, 1205, 1209, - 1216, 1217, 1221, 1244, 1248, 1249, 1258, 1264, 1283, 1284, - 1285, 1286, 1287, 1288, 1289, 1293, 1318, 1322, 1323, 1339, - 1345, 1365, 1366, 1370, 1378, 1389, 1390, 1394, 1400, 1408, - 1428, 1466, 1476, 1477, 1510, 1512, 1517, 1533, 1534, 1544, - 1554, 1561, 1568, 1575, 1582, 1592, 1593, 1602, 1610, 1611, - 1620, 1625, 1631, 1640, 1641, 1645, 1671, 1672, 1677, 1686, - 1687, 1697, 1712, 1713, 1714, 1715, 1718, 1719, 1720, 1724, - 1725, 1733, 1741, 1759, 1766, 1770, 1774, 1789, 1790, 1791, - 1792, 1793, 1794, 1795, 1796, 1797, 1798, 1799, 1800, 1804, - 1805, 1812, 1813, 1817, 1820, 1821, 1822, 1823, 1824, 1825, - 1826, 1827, 1828, 1829, 1830, 1831, 1832, 1835, 1836 + 0, 363, 363, 397, 398, 469, 475, 487, 497, 505, + 505, 548, 554, 561, 571, 572, 581, 582, 583, 607, + 608, 614, 615, 616, 617, 641, 642, 648, 649, 650, + 651, 652, 653, 657, 658, 659, 663, 667, 683, 705, + 715, 723, 731, 735, 739, 743, 754, 759, 768, 792, + 793, 794, 803, 804, 807, 808, 811, 812, 813, 814, + 815, 816, 821, 856, 857, 858, 859, 860, 861, 862, + 863, 864, 865, 868, 869, 870, 871, 872, 873, 874, + 875, 876, 877, 879, 880, 881, 882, 883, 884, 885, + 886, 888, 898, 921, 943, 945, 950, 957, 968, 982, + 997, 1002, 1003, 1004, 1008, 1009, 1010, 1011, 1015, 1020, + 1028, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, + 1081, 1082, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, + 1093, 1094, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, + 1105, 1115, 1140, 1156, 1182, 1205, 1206, 1209, 1210, 1214, + 1221, 1222, 1226, 1249, 1253, 1254, 1263, 1269, 1288, 1289, + 1290, 1291, 1292, 1293, 1294, 1298, 1323, 1327, 1328, 1344, + 1350, 1370, 1371, 1375, 1383, 1394, 1395, 1399, 1405, 1413, + 1433, 1471, 1481, 1482, 1515, 1517, 1522, 1538, 1539, 1549, + 1559, 1566, 1573, 1580, 1587, 1597, 1598, 1607, 1615, 1616, + 1625, 1630, 1636, 1645, 1646, 1650, 1676, 1677, 1682, 1691, + 1692, 1702, 1717, 1718, 1719, 1720, 1723, 1724, 1725, 1729, + 1730, 1738, 1746, 1764, 1771, 1775, 1779, 1794, 1795, 1796, + 1797, 1798, 1799, 1800, 1801, 1802, 1803, 1804, 1805, 1809, + 1810, 1817, 1818, 1822, 1825, 1826, 1827, 1828, 1829, 1830, + 1831, 1832, 1833, 1834, 1835, 1836, 1837, 1840, 1841 }; #endif @@ -2089,7 +2089,7 @@ yyreduce: switch (yyn) { case 2: -#line 359 "parser.y" +#line 363 "parser.y" { resource_t *rsc; /* First add stringtables to the resource-list */ @@ -2123,12 +2123,12 @@ yyreduce: break; case 3: -#line 393 "parser.y" +#line 397 "parser.y" { (yyval.res) = NULL; want_id = 1; ;} break; case 4: -#line 394 "parser.y" +#line 398 "parser.y" { if((yyvsp[0].res)) { @@ -2151,9 +2151,10 @@ yyreduce: if(rsc->type == head->type && rsc->lan->id == head->lan->id && rsc->lan->sub == head->lan->sub - && !compare_name_id(rsc->name, head->name)) + && !compare_name_id(rsc->name, head->name) + && (rsc->type != res_usr || !compare_name_id(rsc->res.usr->type,head->res.usr->type))) { - parser_error("Duplicate resource name '%s'\n", get_nameid_str(rsc->name)); + yyerror("Duplicate resource name '%s'", get_nameid_str(rsc->name)); } rsc = rsc->prev; } @@ -2177,13 +2178,13 @@ yyreduce: break; case 6: -#line 470 "parser.y" +#line 475 "parser.y" { (yyval.res) = (yyvsp[0].res); if((yyval.res)) { if((yyvsp[-2].num) > 65535 || (yyvsp[-2].num) < -32768) - parser_error("Resource's ID out of range (%d)\n", (yyvsp[-2].num)); + yyerror("Resource's ID out of range (%d)", (yyvsp[-2].num)); (yyval.res)->name = new_name_id(); (yyval.res)->name->type = name_ord; (yyval.res)->name->name.i_name = (yyvsp[-2].num); @@ -2193,7 +2194,7 @@ yyreduce: break; case 7: -#line 482 "parser.y" +#line 487 "parser.y" { (yyval.res) = (yyvsp[0].res); if((yyval.res)) @@ -2207,7 +2208,7 @@ yyreduce: break; case 8: -#line 492 "parser.y" +#line 497 "parser.y" { /* Don't do anything, stringtables are converted to * resource_t structures when we are finished parsing and @@ -2219,12 +2220,12 @@ yyreduce: break; case 9: -#line 500 "parser.y" +#line 505 "parser.y" {want_nl = 1; ;} break; case 10: -#line 500 "parser.y" +#line 505 "parser.y" { /* We *NEED* the newline to delimit the expression. * Otherwise, we would not be able to set the next @@ -2233,7 +2234,7 @@ yyreduce: * However, we can test the lookahead-token for * being "non-expression" type, in which case we * continue. Fortunately, tNL is the only token that - * will break expression parsing and is implicitely + * will break expression parsing and is implicitly * void, so we just remove it. This scheme makes it * possible to do some (not all) fancy preprocessor * stuff. @@ -2257,7 +2258,7 @@ yyreduce: parser_warning("LANGUAGE not supported in 16-bit mode\n"); free(currentlanguage); if (get_language_codepage((yyvsp[-2].num), (yyvsp[0].num)) == -1) - parser_error( "Language %04x is not supported\n", ((yyvsp[0].num)<<10) + (yyvsp[-2].num)); + yyerror( "Language %04x is not supported", ((yyvsp[0].num)<<10) + (yyvsp[-2].num)); currentlanguage = new_language((yyvsp[-2].num), (yyvsp[0].num)); (yyval.res) = NULL; chat("Got LANGUAGE %d,%d (0x%04x)\n", (yyvsp[-2].num), (yyvsp[0].num), ((yyvsp[0].num)<<10) + (yyvsp[-2].num)); @@ -2265,15 +2266,15 @@ yyreduce: break; case 11: -#line 543 "parser.y" +#line 548 "parser.y" { yychar = rsrcid_to_token(yychar); ;} break; case 12: -#line 549 "parser.y" +#line 554 "parser.y" { if((yyvsp[0].num) > 65535 || (yyvsp[0].num) < -32768) - parser_error("Resource's ID out of range (%d)\n", (yyvsp[0].num)); + yyerror("Resource's ID out of range (%d)", (yyvsp[0].num)); (yyval.nid) = new_name_id(); (yyval.nid)->type = name_ord; (yyval.nid)->name.i_name = (yyvsp[0].num); @@ -2281,7 +2282,7 @@ yyreduce: break; case 13: -#line 556 "parser.y" +#line 561 "parser.y" { (yyval.nid) = new_name_id(); (yyval.nid)->type = name_str; @@ -2290,12 +2291,12 @@ yyreduce: break; case 14: -#line 566 "parser.y" +#line 571 "parser.y" { (yyval.nid) = (yyvsp[0].nid); ;} break; case 15: -#line 567 "parser.y" +#line 572 "parser.y" { (yyval.nid) = new_name_id(); (yyval.nid)->type = name_str; @@ -2304,17 +2305,17 @@ yyreduce: break; case 16: -#line 576 "parser.y" +#line 581 "parser.y" { (yyval.res) = new_resource(res_acc, (yyvsp[0].acc), (yyvsp[0].acc)->memopt, (yyvsp[0].acc)->lvc.language); ;} break; case 17: -#line 577 "parser.y" +#line 582 "parser.y" { (yyval.res) = new_resource(res_bmp, (yyvsp[0].bmp), (yyvsp[0].bmp)->memopt, (yyvsp[0].bmp)->data->lvc.language); ;} break; case 18: -#line 578 "parser.y" +#line 583 "parser.y" { resource_t *rsc; if((yyvsp[0].ani)->type == res_anicur) @@ -2342,12 +2343,12 @@ yyreduce: break; case 19: -#line 602 "parser.y" +#line 607 "parser.y" { (yyval.res) = new_resource(res_dlg, (yyvsp[0].dlg), (yyvsp[0].dlg)->memopt, (yyvsp[0].dlg)->lvc.language); ;} break; case 20: -#line 603 "parser.y" +#line 608 "parser.y" { if(win32) (yyval.res) = new_resource(res_dlgex, (yyvsp[0].dlgex), (yyvsp[0].dlgex)->memopt, (yyvsp[0].dlgex)->lvc.language); @@ -2357,22 +2358,22 @@ yyreduce: break; case 21: -#line 609 "parser.y" +#line 614 "parser.y" { (yyval.res) = new_resource(res_dlginit, (yyvsp[0].dginit), (yyvsp[0].dginit)->memopt, (yyvsp[0].dginit)->data->lvc.language); ;} break; case 22: -#line 610 "parser.y" +#line 615 "parser.y" { (yyval.res) = new_resource(res_fnt, (yyvsp[0].fnt), (yyvsp[0].fnt)->memopt, (yyvsp[0].fnt)->data->lvc.language); ;} break; case 23: -#line 611 "parser.y" +#line 616 "parser.y" { (yyval.res) = new_resource(res_fntdir, (yyvsp[0].fnd), (yyvsp[0].fnd)->memopt, (yyvsp[0].fnd)->data->lvc.language); ;} break; case 24: -#line 612 "parser.y" +#line 617 "parser.y" { resource_t *rsc; if((yyvsp[0].ani)->type == res_aniico) @@ -2400,12 +2401,12 @@ yyreduce: break; case 25: -#line 636 "parser.y" +#line 641 "parser.y" { (yyval.res) = new_resource(res_men, (yyvsp[0].men), (yyvsp[0].men)->memopt, (yyvsp[0].men)->lvc.language); ;} break; case 26: -#line 637 "parser.y" +#line 642 "parser.y" { if(win32) (yyval.res) = new_resource(res_menex, (yyvsp[0].menex), (yyvsp[0].menex)->memopt, (yyvsp[0].menex)->lvc.language); @@ -2415,57 +2416,57 @@ yyreduce: break; case 27: -#line 643 "parser.y" +#line 648 "parser.y" { (yyval.res) = new_resource(res_msg, (yyvsp[0].msg), WRC_MO_MOVEABLE | WRC_MO_DISCARDABLE, (yyvsp[0].msg)->data->lvc.language); ;} break; case 28: -#line 644 "parser.y" +#line 649 "parser.y" { (yyval.res) = new_resource(res_html, (yyvsp[0].html), (yyvsp[0].html)->memopt, (yyvsp[0].html)->data->lvc.language); ;} break; case 29: -#line 645 "parser.y" +#line 650 "parser.y" { (yyval.res) = new_resource(res_rdt, (yyvsp[0].rdt), (yyvsp[0].rdt)->memopt, (yyvsp[0].rdt)->data->lvc.language); ;} break; case 30: -#line 646 "parser.y" +#line 651 "parser.y" { (yyval.res) = new_resource(res_toolbar, (yyvsp[0].tlbar), (yyvsp[0].tlbar)->memopt, (yyvsp[0].tlbar)->lvc.language); ;} break; case 31: -#line 647 "parser.y" +#line 652 "parser.y" { (yyval.res) = new_resource(res_usr, (yyvsp[0].usr), (yyvsp[0].usr)->memopt, (yyvsp[0].usr)->data->lvc.language); ;} break; case 32: -#line 648 "parser.y" +#line 653 "parser.y" { (yyval.res) = new_resource(res_ver, (yyvsp[0].veri), WRC_MO_MOVEABLE | WRC_MO_DISCARDABLE, (yyvsp[0].veri)->lvc.language); ;} break; case 33: -#line 652 "parser.y" +#line 657 "parser.y" { (yyval.str) = make_filename((yyvsp[0].str)); ;} break; case 34: -#line 653 "parser.y" +#line 658 "parser.y" { (yyval.str) = make_filename((yyvsp[0].str)); ;} break; case 35: -#line 654 "parser.y" +#line 659 "parser.y" { (yyval.str) = make_filename((yyvsp[0].str)); ;} break; case 36: -#line 658 "parser.y" +#line 663 "parser.y" { (yyval.bmp) = new_bitmap((yyvsp[0].raw), (yyvsp[-1].iptr)); ;} break; case 37: -#line 662 "parser.y" +#line 667 "parser.y" { (yyval.ani) = new_ani_any(); if((yyvsp[0].raw)->size > 4 && !memcmp((yyvsp[0].raw)->data, riff, sizeof(riff))) @@ -2482,7 +2483,7 @@ yyreduce: break; case 38: -#line 678 "parser.y" +#line 683 "parser.y" { (yyval.ani) = new_ani_any(); if((yyvsp[0].raw)->size > 4 && !memcmp((yyvsp[0].raw)->data, riff, sizeof(riff))) @@ -2499,17 +2500,17 @@ yyreduce: break; case 39: -#line 700 "parser.y" +#line 705 "parser.y" { (yyval.fnt) = new_font((yyvsp[0].raw), (yyvsp[-1].iptr)); ;} break; case 40: -#line 710 "parser.y" +#line 715 "parser.y" { (yyval.fnd) = new_fontdir((yyvsp[0].raw), (yyvsp[-1].iptr)); ;} break; case 41: -#line 718 "parser.y" +#line 723 "parser.y" { if(!win32) parser_warning("MESSAGETABLE not supported in 16-bit mode\n"); @@ -2518,22 +2519,22 @@ yyreduce: break; case 42: -#line 726 "parser.y" +#line 731 "parser.y" { (yyval.html) = new_html((yyvsp[0].raw), (yyvsp[-1].iptr)); ;} break; case 43: -#line 730 "parser.y" +#line 735 "parser.y" { (yyval.rdt) = new_rcdata((yyvsp[0].raw), (yyvsp[-1].iptr)); ;} break; case 44: -#line 734 "parser.y" +#line 739 "parser.y" { (yyval.dginit) = new_dlginit((yyvsp[0].raw), (yyvsp[-1].iptr)); ;} break; case 45: -#line 738 "parser.y" +#line 743 "parser.y" { #ifdef WORDS_BIGENDIAN if(pedantic && byteorder != WRC_BO_LITTLE) @@ -2546,7 +2547,7 @@ yyreduce: break; case 46: -#line 749 "parser.y" +#line 754 "parser.y" { (yyval.nid) = new_name_id(); (yyval.nid)->type = name_ord; @@ -2555,7 +2556,7 @@ yyreduce: break; case 47: -#line 754 "parser.y" +#line 759 "parser.y" { (yyval.nid) = new_name_id(); (yyval.nid)->type = name_str; @@ -2564,7 +2565,7 @@ yyreduce: break; case 48: -#line 763 "parser.y" +#line 768 "parser.y" { (yyval.acc) = new_accelerator(); if((yyvsp[-4].iptr)) @@ -2577,7 +2578,7 @@ yyreduce: (yyval.acc)->memopt = WRC_MO_MOVEABLE | WRC_MO_PURE; } if(!(yyvsp[-1].event)) - parser_error("Accelerator table must have at least one entry\n"); + yyerror("Accelerator table must have at least one entry"); (yyval.acc)->events = get_event_head((yyvsp[-1].event)); if((yyvsp[-3].lvc)) { @@ -2590,72 +2591,72 @@ yyreduce: break; case 49: -#line 787 "parser.y" +#line 792 "parser.y" { (yyval.event)=NULL; ;} break; case 50: -#line 788 "parser.y" +#line 793 "parser.y" { (yyval.event)=add_string_event((yyvsp[-3].str), (yyvsp[-1].num), (yyvsp[0].num), (yyvsp[-4].event)); ;} break; case 51: -#line 789 "parser.y" +#line 794 "parser.y" { (yyval.event)=add_event((yyvsp[-3].num), (yyvsp[-1].num), (yyvsp[0].num), (yyvsp[-4].event)); ;} break; case 52: -#line 798 "parser.y" +#line 803 "parser.y" { (yyval.num) = 0; ;} break; case 53: -#line 799 "parser.y" +#line 804 "parser.y" { (yyval.num) = (yyvsp[0].num); ;} break; case 54: -#line 802 "parser.y" +#line 807 "parser.y" { (yyval.num) = (yyvsp[0].num); ;} break; case 55: -#line 803 "parser.y" +#line 808 "parser.y" { (yyval.num) = (yyvsp[-2].num) | (yyvsp[0].num); ;} break; case 56: -#line 806 "parser.y" +#line 811 "parser.y" { (yyval.num) = WRC_AF_NOINVERT; ;} break; case 57: -#line 807 "parser.y" +#line 812 "parser.y" { (yyval.num) = WRC_AF_SHIFT; ;} break; case 58: -#line 808 "parser.y" +#line 813 "parser.y" { (yyval.num) = WRC_AF_CONTROL; ;} break; case 59: -#line 809 "parser.y" +#line 814 "parser.y" { (yyval.num) = WRC_AF_ALT; ;} break; case 60: -#line 810 "parser.y" +#line 815 "parser.y" { (yyval.num) = WRC_AF_ASCII; ;} break; case 61: -#line 811 "parser.y" +#line 816 "parser.y" { (yyval.num) = WRC_AF_VIRTKEY; ;} break; case 62: -#line 817 "parser.y" +#line 822 "parser.y" { if((yyvsp[-11].iptr)) { @@ -2690,147 +2691,147 @@ yyreduce: break; case 63: -#line 851 "parser.y" +#line 856 "parser.y" { (yyval.dlg)=new_dialog(); ;} break; case 64: -#line 852 "parser.y" +#line 857 "parser.y" { (yyval.dlg)=dialog_style((yyvsp[0].style),(yyvsp[-2].dlg)); ;} break; case 65: -#line 853 "parser.y" +#line 858 "parser.y" { (yyval.dlg)=dialog_exstyle((yyvsp[0].style),(yyvsp[-2].dlg)); ;} break; case 66: -#line 854 "parser.y" +#line 859 "parser.y" { (yyval.dlg)=dialog_caption((yyvsp[0].str),(yyvsp[-2].dlg)); ;} break; case 67: -#line 855 "parser.y" +#line 860 "parser.y" { (yyval.dlg)=dialog_font((yyvsp[0].fntid),(yyvsp[-1].dlg)); ;} break; case 68: -#line 856 "parser.y" +#line 861 "parser.y" { (yyval.dlg)=dialog_class((yyvsp[0].nid),(yyvsp[-2].dlg)); ;} break; case 69: -#line 857 "parser.y" +#line 862 "parser.y" { (yyval.dlg)=dialog_menu((yyvsp[0].nid),(yyvsp[-2].dlg)); ;} break; case 70: -#line 858 "parser.y" +#line 863 "parser.y" { (yyval.dlg)=dialog_language((yyvsp[0].lan),(yyvsp[-1].dlg)); ;} break; case 71: -#line 859 "parser.y" +#line 864 "parser.y" { (yyval.dlg)=dialog_characteristics((yyvsp[0].chars),(yyvsp[-1].dlg)); ;} break; case 72: -#line 860 "parser.y" +#line 865 "parser.y" { (yyval.dlg)=dialog_version((yyvsp[0].ver),(yyvsp[-1].dlg)); ;} break; case 73: -#line 863 "parser.y" +#line 868 "parser.y" { (yyval.ctl) = NULL; ;} break; case 74: -#line 864 "parser.y" +#line 869 "parser.y" { (yyval.ctl)=ins_ctrl(-1, 0, (yyvsp[0].ctl), (yyvsp[-2].ctl)); ;} break; case 75: -#line 865 "parser.y" +#line 870 "parser.y" { (yyval.ctl)=ins_ctrl(CT_EDIT, 0, (yyvsp[0].ctl), (yyvsp[-2].ctl)); ;} break; case 76: -#line 866 "parser.y" +#line 871 "parser.y" { (yyval.ctl)=ins_ctrl(CT_LISTBOX, 0, (yyvsp[0].ctl), (yyvsp[-2].ctl)); ;} break; case 77: -#line 867 "parser.y" +#line 872 "parser.y" { (yyval.ctl)=ins_ctrl(CT_COMBOBOX, 0, (yyvsp[0].ctl), (yyvsp[-2].ctl)); ;} break; case 78: -#line 868 "parser.y" +#line 873 "parser.y" { (yyval.ctl)=ins_ctrl(CT_SCROLLBAR, 0, (yyvsp[0].ctl), (yyvsp[-2].ctl)); ;} break; case 79: -#line 869 "parser.y" +#line 874 "parser.y" { (yyval.ctl)=ins_ctrl(CT_BUTTON, BS_CHECKBOX, (yyvsp[0].ctl), (yyvsp[-2].ctl)); ;} break; case 80: -#line 870 "parser.y" +#line 875 "parser.y" { (yyval.ctl)=ins_ctrl(CT_BUTTON, BS_DEFPUSHBUTTON, (yyvsp[0].ctl), (yyvsp[-2].ctl)); ;} break; case 81: -#line 871 "parser.y" +#line 876 "parser.y" { (yyval.ctl)=ins_ctrl(CT_BUTTON, BS_GROUPBOX, (yyvsp[0].ctl), (yyvsp[-2].ctl));;} break; case 82: -#line 872 "parser.y" +#line 877 "parser.y" { (yyval.ctl)=ins_ctrl(CT_BUTTON, BS_PUSHBUTTON, (yyvsp[0].ctl), (yyvsp[-2].ctl)); ;} break; case 83: -#line 874 "parser.y" +#line 879 "parser.y" { (yyval.ctl)=ins_ctrl(CT_BUTTON, BS_RADIOBUTTON, (yyvsp[0].ctl), (yyvsp[-2].ctl)); ;} break; case 84: -#line 875 "parser.y" +#line 880 "parser.y" { (yyval.ctl)=ins_ctrl(CT_BUTTON, BS_AUTO3STATE, (yyvsp[0].ctl), (yyvsp[-2].ctl)); ;} break; case 85: -#line 876 "parser.y" +#line 881 "parser.y" { (yyval.ctl)=ins_ctrl(CT_BUTTON, BS_3STATE, (yyvsp[0].ctl), (yyvsp[-2].ctl)); ;} break; case 86: -#line 877 "parser.y" +#line 882 "parser.y" { (yyval.ctl)=ins_ctrl(CT_BUTTON, BS_AUTOCHECKBOX, (yyvsp[0].ctl), (yyvsp[-2].ctl)); ;} break; case 87: -#line 878 "parser.y" +#line 883 "parser.y" { (yyval.ctl)=ins_ctrl(CT_BUTTON, BS_AUTORADIOBUTTON, (yyvsp[0].ctl), (yyvsp[-2].ctl)); ;} break; case 88: -#line 879 "parser.y" +#line 884 "parser.y" { (yyval.ctl)=ins_ctrl(CT_STATIC, SS_LEFT, (yyvsp[0].ctl), (yyvsp[-2].ctl)); ;} break; case 89: -#line 880 "parser.y" +#line 885 "parser.y" { (yyval.ctl)=ins_ctrl(CT_STATIC, SS_CENTER, (yyvsp[0].ctl), (yyvsp[-2].ctl)); ;} break; case 90: -#line 881 "parser.y" +#line 886 "parser.y" { (yyval.ctl)=ins_ctrl(CT_STATIC, SS_RIGHT, (yyvsp[0].ctl), (yyvsp[-2].ctl)); ;} break; case 91: -#line 883 "parser.y" +#line 888 "parser.y" { (yyvsp[0].ctl)->title = (yyvsp[-7].nid); (yyvsp[0].ctl)->id = (yyvsp[-5].num); @@ -2841,7 +2842,7 @@ yyreduce: break; case 92: -#line 893 "parser.y" +#line 898 "parser.y" { (yyval.ctl)=new_control(); (yyval.ctl)->title = (yyvsp[-11].nid); @@ -2865,7 +2866,7 @@ yyreduce: break; case 93: -#line 916 "parser.y" +#line 921 "parser.y" { (yyval.ctl) = new_control(); (yyval.ctl)->id = (yyvsp[-9].num); @@ -2888,12 +2889,12 @@ yyreduce: break; case 94: -#line 938 "parser.y" +#line 943 "parser.y" { (yyval.ctl) = new_control(); ;} break; case 95: -#line 940 "parser.y" +#line 945 "parser.y" { (yyval.ctl) = new_control(); (yyval.ctl)->width = (yyvsp[-2].num); @@ -2902,7 +2903,7 @@ yyreduce: break; case 96: -#line 945 "parser.y" +#line 950 "parser.y" { (yyval.ctl) = new_control(); (yyval.ctl)->width = (yyvsp[-4].num); @@ -2913,7 +2914,7 @@ yyreduce: break; case 97: -#line 952 "parser.y" +#line 957 "parser.y" { (yyval.ctl) = new_control(); (yyval.ctl)->width = (yyvsp[-6].num); @@ -2926,7 +2927,7 @@ yyreduce: break; case 98: -#line 963 "parser.y" +#line 968 "parser.y" { (yyval.ctl)=new_control(); (yyval.ctl)->title = (yyvsp[-16].nid); @@ -2944,7 +2945,7 @@ yyreduce: break; case 99: -#line 977 "parser.y" +#line 982 "parser.y" { (yyval.ctl)=new_control(); (yyval.ctl)->title = (yyvsp[-14].nid); @@ -2960,47 +2961,47 @@ yyreduce: break; case 100: -#line 992 "parser.y" +#line 997 "parser.y" { (yyval.fntid) = new_font_id((yyvsp[-2].num), (yyvsp[0].str), 0, 0); ;} break; case 101: -#line 997 "parser.y" +#line 1002 "parser.y" { (yyval.styles) = NULL; ;} break; case 102: -#line 998 "parser.y" +#line 1003 "parser.y" { (yyval.styles) = new_style_pair((yyvsp[0].style), 0); ;} break; case 103: -#line 999 "parser.y" +#line 1004 "parser.y" { (yyval.styles) = new_style_pair((yyvsp[-2].style), (yyvsp[0].style)); ;} break; case 104: -#line 1003 "parser.y" +#line 1008 "parser.y" { (yyval.style) = new_style((yyvsp[-2].style)->or_mask | (yyvsp[0].style)->or_mask, (yyvsp[-2].style)->and_mask | (yyvsp[0].style)->and_mask); free((yyvsp[-2].style)); free((yyvsp[0].style));;} break; case 105: -#line 1004 "parser.y" +#line 1009 "parser.y" { (yyval.style) = (yyvsp[-1].style); ;} break; case 106: -#line 1005 "parser.y" +#line 1010 "parser.y" { (yyval.style) = new_style((yyvsp[0].num), 0); ;} break; case 107: -#line 1006 "parser.y" +#line 1011 "parser.y" { (yyval.style) = new_style(0, (yyvsp[0].num)); ;} break; case 108: -#line 1010 "parser.y" +#line 1015 "parser.y" { (yyval.nid) = new_name_id(); (yyval.nid)->type = name_ord; @@ -3009,7 +3010,7 @@ yyreduce: break; case 109: -#line 1015 "parser.y" +#line 1020 "parser.y" { (yyval.nid) = new_name_id(); (yyval.nid)->type = name_str; @@ -3018,7 +3019,7 @@ yyreduce: break; case 110: -#line 1024 "parser.y" +#line 1029 "parser.y" { if(!win32) parser_warning("DIALOGEX not supported in 16-bit mode\n"); @@ -3062,152 +3063,152 @@ yyreduce: break; case 111: -#line 1067 "parser.y" +#line 1072 "parser.y" { (yyval.dlgex)=new_dialogex(); ;} break; case 112: -#line 1068 "parser.y" +#line 1073 "parser.y" { (yyval.dlgex)=dialogex_style((yyvsp[0].style),(yyvsp[-2].dlgex)); ;} break; case 113: -#line 1069 "parser.y" +#line 1074 "parser.y" { (yyval.dlgex)=dialogex_exstyle((yyvsp[0].style),(yyvsp[-2].dlgex)); ;} break; case 114: -#line 1070 "parser.y" +#line 1075 "parser.y" { (yyval.dlgex)=dialogex_caption((yyvsp[0].str),(yyvsp[-2].dlgex)); ;} break; case 115: -#line 1071 "parser.y" +#line 1076 "parser.y" { (yyval.dlgex)=dialogex_font((yyvsp[0].fntid),(yyvsp[-1].dlgex)); ;} break; case 116: -#line 1072 "parser.y" +#line 1077 "parser.y" { (yyval.dlgex)=dialogex_font((yyvsp[0].fntid),(yyvsp[-1].dlgex)); ;} break; case 117: -#line 1073 "parser.y" +#line 1078 "parser.y" { (yyval.dlgex)=dialogex_class((yyvsp[0].nid),(yyvsp[-2].dlgex)); ;} break; case 118: -#line 1074 "parser.y" +#line 1079 "parser.y" { (yyval.dlgex)=dialogex_menu((yyvsp[0].nid),(yyvsp[-2].dlgex)); ;} break; case 119: -#line 1075 "parser.y" +#line 1080 "parser.y" { (yyval.dlgex)=dialogex_language((yyvsp[0].lan),(yyvsp[-1].dlgex)); ;} break; case 120: -#line 1076 "parser.y" +#line 1081 "parser.y" { (yyval.dlgex)=dialogex_characteristics((yyvsp[0].chars),(yyvsp[-1].dlgex)); ;} break; case 121: -#line 1077 "parser.y" +#line 1082 "parser.y" { (yyval.dlgex)=dialogex_version((yyvsp[0].ver),(yyvsp[-1].dlgex)); ;} break; case 122: -#line 1080 "parser.y" +#line 1085 "parser.y" { (yyval.ctl) = NULL; ;} break; case 123: -#line 1081 "parser.y" +#line 1086 "parser.y" { (yyval.ctl)=ins_ctrl(-1, 0, (yyvsp[0].ctl), (yyvsp[-2].ctl)); ;} break; case 124: -#line 1082 "parser.y" +#line 1087 "parser.y" { (yyval.ctl)=ins_ctrl(CT_EDIT, 0, (yyvsp[0].ctl), (yyvsp[-2].ctl)); ;} break; case 125: -#line 1083 "parser.y" +#line 1088 "parser.y" { (yyval.ctl)=ins_ctrl(CT_LISTBOX, 0, (yyvsp[0].ctl), (yyvsp[-2].ctl)); ;} break; case 126: -#line 1084 "parser.y" +#line 1089 "parser.y" { (yyval.ctl)=ins_ctrl(CT_COMBOBOX, 0, (yyvsp[0].ctl), (yyvsp[-2].ctl)); ;} break; case 127: -#line 1085 "parser.y" +#line 1090 "parser.y" { (yyval.ctl)=ins_ctrl(CT_SCROLLBAR, 0, (yyvsp[0].ctl), (yyvsp[-2].ctl)); ;} break; case 128: -#line 1086 "parser.y" +#line 1091 "parser.y" { (yyval.ctl)=ins_ctrl(CT_BUTTON, BS_CHECKBOX, (yyvsp[0].ctl), (yyvsp[-2].ctl)); ;} break; case 129: -#line 1087 "parser.y" +#line 1092 "parser.y" { (yyval.ctl)=ins_ctrl(CT_BUTTON, BS_DEFPUSHBUTTON, (yyvsp[0].ctl), (yyvsp[-2].ctl)); ;} break; case 130: -#line 1088 "parser.y" +#line 1093 "parser.y" { (yyval.ctl)=ins_ctrl(CT_BUTTON, BS_GROUPBOX, (yyvsp[0].ctl), (yyvsp[-2].ctl));;} break; case 131: -#line 1089 "parser.y" +#line 1094 "parser.y" { (yyval.ctl)=ins_ctrl(CT_BUTTON, BS_PUSHBUTTON, (yyvsp[0].ctl), (yyvsp[-2].ctl)); ;} break; case 132: -#line 1091 "parser.y" +#line 1096 "parser.y" { (yyval.ctl)=ins_ctrl(CT_BUTTON, BS_RADIOBUTTON, (yyvsp[0].ctl), (yyvsp[-2].ctl)); ;} break; case 133: -#line 1092 "parser.y" +#line 1097 "parser.y" { (yyval.ctl)=ins_ctrl(CT_BUTTON, BS_AUTO3STATE, (yyvsp[0].ctl), (yyvsp[-2].ctl)); ;} break; case 134: -#line 1093 "parser.y" +#line 1098 "parser.y" { (yyval.ctl)=ins_ctrl(CT_BUTTON, BS_3STATE, (yyvsp[0].ctl), (yyvsp[-2].ctl)); ;} break; case 135: -#line 1094 "parser.y" +#line 1099 "parser.y" { (yyval.ctl)=ins_ctrl(CT_BUTTON, BS_AUTOCHECKBOX, (yyvsp[0].ctl), (yyvsp[-2].ctl)); ;} break; case 136: -#line 1095 "parser.y" +#line 1100 "parser.y" { (yyval.ctl)=ins_ctrl(CT_BUTTON, BS_AUTORADIOBUTTON, (yyvsp[0].ctl), (yyvsp[-2].ctl)); ;} break; case 137: -#line 1096 "parser.y" +#line 1101 "parser.y" { (yyval.ctl)=ins_ctrl(CT_STATIC, SS_LEFT, (yyvsp[0].ctl), (yyvsp[-2].ctl)); ;} break; case 138: -#line 1097 "parser.y" +#line 1102 "parser.y" { (yyval.ctl)=ins_ctrl(CT_STATIC, SS_CENTER, (yyvsp[0].ctl), (yyvsp[-2].ctl)); ;} break; case 139: -#line 1098 "parser.y" +#line 1103 "parser.y" { (yyval.ctl)=ins_ctrl(CT_STATIC, SS_RIGHT, (yyvsp[0].ctl), (yyvsp[-2].ctl)); ;} break; case 140: -#line 1100 "parser.y" +#line 1105 "parser.y" { (yyvsp[0].ctl)->title = (yyvsp[-7].nid); (yyvsp[0].ctl)->id = (yyvsp[-5].num); @@ -3218,7 +3219,7 @@ yyreduce: break; case 141: -#line 1111 "parser.y" +#line 1116 "parser.y" { (yyval.ctl)=new_control(); (yyval.ctl)->title = (yyvsp[-18].nid); @@ -3246,7 +3247,7 @@ yyreduce: break; case 142: -#line 1135 "parser.y" +#line 1140 "parser.y" { (yyval.ctl)=new_control(); (yyval.ctl)->title = (yyvsp[-15].nid); @@ -3263,7 +3264,7 @@ yyreduce: break; case 143: -#line 1151 "parser.y" +#line 1156 "parser.y" { (yyval.ctl)=new_control(); (yyval.ctl)->title = (yyvsp[-13].nid); @@ -3290,7 +3291,7 @@ yyreduce: break; case 144: -#line 1177 "parser.y" +#line 1182 "parser.y" { (yyval.ctl) = new_control(); (yyval.ctl)->id = (yyvsp[-11].num); @@ -3315,45 +3316,45 @@ yyreduce: break; case 145: -#line 1200 "parser.y" +#line 1205 "parser.y" { (yyval.raw) = NULL; ;} break; case 146: -#line 1201 "parser.y" +#line 1206 "parser.y" { (yyval.raw) = (yyvsp[0].raw); ;} break; case 147: -#line 1204 "parser.y" +#line 1209 "parser.y" { (yyval.iptr) = NULL; ;} break; case 148: -#line 1205 "parser.y" +#line 1210 "parser.y" { (yyval.iptr) = new_int((yyvsp[0].num)); ;} break; case 149: -#line 1209 "parser.y" +#line 1214 "parser.y" { (yyval.fntid) = new_font_id((yyvsp[-7].num), (yyvsp[-5].str), (yyvsp[-3].num), (yyvsp[-1].num)); ;} break; case 150: -#line 1216 "parser.y" +#line 1221 "parser.y" { (yyval.fntid) = NULL; ;} break; case 151: -#line 1217 "parser.y" +#line 1222 "parser.y" { (yyval.fntid) = NULL; ;} break; case 152: -#line 1221 "parser.y" +#line 1226 "parser.y" { if(!(yyvsp[0].menitm)) - parser_error("Menu must contain items\n"); + yyerror("Menu must contain items"); (yyval.men) = new_menu(); if((yyvsp[-2].iptr)) { @@ -3374,17 +3375,17 @@ yyreduce: break; case 153: -#line 1244 "parser.y" +#line 1249 "parser.y" { (yyval.menitm) = (yyvsp[-1].menitm); ;} break; case 154: -#line 1248 "parser.y" +#line 1253 "parser.y" {(yyval.menitm) = NULL;;} break; case 155: -#line 1249 "parser.y" +#line 1254 "parser.y" { (yyval.menitm)=new_menu_item(); (yyval.menitm)->prev = (yyvsp[-5].menitm); @@ -3397,7 +3398,7 @@ yyreduce: break; case 156: -#line 1258 "parser.y" +#line 1263 "parser.y" { (yyval.menitm)=new_menu_item(); (yyval.menitm)->prev = (yyvsp[-2].menitm); @@ -3407,7 +3408,7 @@ yyreduce: break; case 157: -#line 1264 "parser.y" +#line 1269 "parser.y" { (yyval.menitm) = new_menu_item(); (yyval.menitm)->prev = (yyvsp[-4].menitm); @@ -3419,47 +3420,47 @@ yyreduce: break; case 158: -#line 1283 "parser.y" +#line 1288 "parser.y" { (yyval.num) = 0; ;} break; case 159: -#line 1284 "parser.y" +#line 1289 "parser.y" { (yyval.num) = (yyvsp[0].num) | MF_CHECKED; ;} break; case 160: -#line 1285 "parser.y" +#line 1290 "parser.y" { (yyval.num) = (yyvsp[0].num) | MF_GRAYED; ;} break; case 161: -#line 1286 "parser.y" +#line 1291 "parser.y" { (yyval.num) = (yyvsp[0].num) | MF_HELP; ;} break; case 162: -#line 1287 "parser.y" +#line 1292 "parser.y" { (yyval.num) = (yyvsp[0].num) | MF_DISABLED; ;} break; case 163: -#line 1288 "parser.y" +#line 1293 "parser.y" { (yyval.num) = (yyvsp[0].num) | MF_MENUBARBREAK; ;} break; case 164: -#line 1289 "parser.y" +#line 1294 "parser.y" { (yyval.num) = (yyvsp[0].num) | MF_MENUBREAK; ;} break; case 165: -#line 1293 "parser.y" +#line 1298 "parser.y" { if(!win32) parser_warning("MENUEX not supported in 16-bit mode\n"); if(!(yyvsp[0].menexitm)) - parser_error("MenuEx must contain items\n"); + yyerror("MenuEx must contain items"); (yyval.menex) = new_menuex(); if((yyvsp[-2].iptr)) { @@ -3480,17 +3481,17 @@ yyreduce: break; case 166: -#line 1318 "parser.y" +#line 1323 "parser.y" { (yyval.menexitm) = (yyvsp[-1].menexitm); ;} break; case 167: -#line 1322 "parser.y" +#line 1327 "parser.y" {(yyval.menexitm) = NULL; ;} break; case 168: -#line 1323 "parser.y" +#line 1328 "parser.y" { (yyval.menexitm) = new_menuex_item(); (yyval.menexitm)->prev = (yyvsp[-3].menexitm); @@ -3510,7 +3511,7 @@ yyreduce: break; case 169: -#line 1339 "parser.y" +#line 1344 "parser.y" { (yyval.menexitm) = new_menuex_item(); (yyval.menexitm)->prev = (yyvsp[-2].menexitm); @@ -3520,7 +3521,7 @@ yyreduce: break; case 170: -#line 1345 "parser.y" +#line 1350 "parser.y" { (yyval.menexitm) = new_menuex_item(); (yyval.menexitm)->prev = (yyvsp[-4].menexitm); @@ -3541,12 +3542,12 @@ yyreduce: break; case 171: -#line 1365 "parser.y" +#line 1370 "parser.y" { (yyval.exopt) = new_itemex_opt(0, 0, 0, 0); ;} break; case 172: -#line 1366 "parser.y" +#line 1371 "parser.y" { (yyval.exopt) = new_itemex_opt((yyvsp[0].num), 0, 0, 0); (yyval.exopt)->gotid = TRUE; @@ -3554,7 +3555,7 @@ yyreduce: break; case 173: -#line 1370 "parser.y" +#line 1375 "parser.y" { (yyval.exopt) = new_itemex_opt((yyvsp[-3].iptr) ? *((yyvsp[-3].iptr)) : 0, (yyvsp[-1].iptr) ? *((yyvsp[-1].iptr)) : 0, (yyvsp[0].num), 0); (yyval.exopt)->gotid = TRUE; @@ -3566,7 +3567,7 @@ yyreduce: break; case 174: -#line 1378 "parser.y" +#line 1383 "parser.y" { (yyval.exopt) = new_itemex_opt((yyvsp[-4].iptr) ? *((yyvsp[-4].iptr)) : 0, (yyvsp[-2].iptr) ? *((yyvsp[-2].iptr)) : 0, (yyvsp[0].num), 0); (yyval.exopt)->gotid = TRUE; @@ -3578,12 +3579,12 @@ yyreduce: break; case 175: -#line 1389 "parser.y" +#line 1394 "parser.y" { (yyval.exopt) = new_itemex_opt(0, 0, 0, 0); ;} break; case 176: -#line 1390 "parser.y" +#line 1395 "parser.y" { (yyval.exopt) = new_itemex_opt((yyvsp[0].num), 0, 0, 0); (yyval.exopt)->gotid = TRUE; @@ -3591,7 +3592,7 @@ yyreduce: break; case 177: -#line 1394 "parser.y" +#line 1399 "parser.y" { (yyval.exopt) = new_itemex_opt((yyvsp[-2].iptr) ? *((yyvsp[-2].iptr)) : 0, (yyvsp[0].num), 0, 0); free((yyvsp[-2].iptr)); @@ -3601,7 +3602,7 @@ yyreduce: break; case 178: -#line 1400 "parser.y" +#line 1405 "parser.y" { (yyval.exopt) = new_itemex_opt((yyvsp[-4].iptr) ? *((yyvsp[-4].iptr)) : 0, (yyvsp[-2].iptr) ? *((yyvsp[-2].iptr)) : 0, (yyvsp[0].num), 0); free((yyvsp[-4].iptr)); @@ -3613,7 +3614,7 @@ yyreduce: break; case 179: -#line 1408 "parser.y" +#line 1413 "parser.y" { (yyval.exopt) = new_itemex_opt((yyvsp[-6].iptr) ? *((yyvsp[-6].iptr)) : 0, (yyvsp[-4].iptr) ? *((yyvsp[-4].iptr)) : 0, (yyvsp[-2].iptr) ? *((yyvsp[-2].iptr)) : 0, (yyvsp[0].num)); free((yyvsp[-6].iptr)); @@ -3627,11 +3628,11 @@ yyreduce: break; case 180: -#line 1428 "parser.y" +#line 1433 "parser.y" { if(!(yyvsp[-1].stt)) { - parser_error("Stringtable must have at least one entry\n"); + yyerror("Stringtable must have at least one entry"); } else { @@ -3666,7 +3667,7 @@ yyreduce: break; case 181: -#line 1466 "parser.y" +#line 1471 "parser.y" { if((tagstt = find_stringtable((yyvsp[0].lvc))) == NULL) tagstt = new_stringtable((yyvsp[0].lvc)); @@ -3678,22 +3679,22 @@ yyreduce: break; case 182: -#line 1476 "parser.y" +#line 1481 "parser.y" { (yyval.stt) = NULL; ;} break; case 183: -#line 1477 "parser.y" +#line 1482 "parser.y" { int i; assert(tagstt != NULL); if((yyvsp[-2].num) > 65535 || (yyvsp[-2].num) < -32768) - parser_error("Stringtable entry's ID out of range (%d)\n", (yyvsp[-2].num)); + yyerror("Stringtable entry's ID out of range (%d)", (yyvsp[-2].num)); /* Search for the ID */ for(i = 0; i < tagstt->nentries; i++) { if(tagstt->entries[i].id == (yyvsp[-2].num)) - parser_error("Stringtable ID %d already in use\n", (yyvsp[-2].num)); + yyerror("Stringtable ID %d already in use", (yyvsp[-2].num)); } /* If we get here, then we have a new unique entry */ tagstt->nentries++; @@ -3710,15 +3711,15 @@ yyreduce: if(pedantic && !(yyvsp[0].str)->size) parser_warning("Zero length strings make no sense\n"); if(!win32 && (yyvsp[0].str)->size > 254) - parser_error("Stringtable entry more than 254 characters\n"); + yyerror("Stringtable entry more than 254 characters"); if(win32 && (yyvsp[0].str)->size > 65534) /* Hmm..., does this happen? */ - parser_error("Stringtable entry more than 65534 characters (probably something else that went wrong)\n"); + yyerror("Stringtable entry more than 65534 characters (probably something else that went wrong)"); (yyval.stt) = tagstt; ;} break; case 186: -#line 1517 "parser.y" +#line 1522 "parser.y" { (yyval.veri) = (yyvsp[-3].veri); if((yyvsp[-4].iptr)) @@ -3735,15 +3736,15 @@ yyreduce: break; case 187: -#line 1533 "parser.y" +#line 1538 "parser.y" { (yyval.veri) = new_versioninfo(); ;} break; case 188: -#line 1534 "parser.y" +#line 1539 "parser.y" { if((yyvsp[-8].veri)->gotit.fv) - parser_error("FILEVERSION already defined\n"); + yyerror("FILEVERSION already defined"); (yyval.veri) = (yyvsp[-8].veri); (yyval.veri)->filever_maj1 = (yyvsp[-6].num); (yyval.veri)->filever_maj2 = (yyvsp[-4].num); @@ -3754,10 +3755,10 @@ yyreduce: break; case 189: -#line 1544 "parser.y" +#line 1549 "parser.y" { if((yyvsp[-8].veri)->gotit.pv) - parser_error("PRODUCTVERSION already defined\n"); + yyerror("PRODUCTVERSION already defined"); (yyval.veri) = (yyvsp[-8].veri); (yyval.veri)->prodver_maj1 = (yyvsp[-6].num); (yyval.veri)->prodver_maj2 = (yyvsp[-4].num); @@ -3768,10 +3769,10 @@ yyreduce: break; case 190: -#line 1554 "parser.y" +#line 1559 "parser.y" { if((yyvsp[-2].veri)->gotit.ff) - parser_error("FILEFLAGS already defined\n"); + yyerror("FILEFLAGS already defined"); (yyval.veri) = (yyvsp[-2].veri); (yyval.veri)->fileflags = (yyvsp[0].num); (yyval.veri)->gotit.ff = 1; @@ -3779,10 +3780,10 @@ yyreduce: break; case 191: -#line 1561 "parser.y" +#line 1566 "parser.y" { if((yyvsp[-2].veri)->gotit.ffm) - parser_error("FILEFLAGSMASK already defined\n"); + yyerror("FILEFLAGSMASK already defined"); (yyval.veri) = (yyvsp[-2].veri); (yyval.veri)->fileflagsmask = (yyvsp[0].num); (yyval.veri)->gotit.ffm = 1; @@ -3790,10 +3791,10 @@ yyreduce: break; case 192: -#line 1568 "parser.y" +#line 1573 "parser.y" { if((yyvsp[-2].veri)->gotit.fo) - parser_error("FILEOS already defined\n"); + yyerror("FILEOS already defined"); (yyval.veri) = (yyvsp[-2].veri); (yyval.veri)->fileos = (yyvsp[0].num); (yyval.veri)->gotit.fo = 1; @@ -3801,10 +3802,10 @@ yyreduce: break; case 193: -#line 1575 "parser.y" +#line 1580 "parser.y" { if((yyvsp[-2].veri)->gotit.ft) - parser_error("FILETYPE already defined\n"); + yyerror("FILETYPE already defined"); (yyval.veri) = (yyvsp[-2].veri); (yyval.veri)->filetype = (yyvsp[0].num); (yyval.veri)->gotit.ft = 1; @@ -3812,10 +3813,10 @@ yyreduce: break; case 194: -#line 1582 "parser.y" +#line 1587 "parser.y" { if((yyvsp[-2].veri)->gotit.fst) - parser_error("FILESUBTYPE already defined\n"); + yyerror("FILESUBTYPE already defined"); (yyval.veri) = (yyvsp[-2].veri); (yyval.veri)->filesubtype = (yyvsp[0].num); (yyval.veri)->gotit.fst = 1; @@ -3823,12 +3824,12 @@ yyreduce: break; case 195: -#line 1592 "parser.y" +#line 1597 "parser.y" { (yyval.blk) = NULL; ;} break; case 196: -#line 1593 "parser.y" +#line 1598 "parser.y" { (yyval.blk) = (yyvsp[0].blk); (yyval.blk)->prev = (yyvsp[-1].blk); @@ -3838,7 +3839,7 @@ yyreduce: break; case 197: -#line 1602 "parser.y" +#line 1607 "parser.y" { (yyval.blk) = new_ver_block(); (yyval.blk)->name = (yyvsp[-3].str); @@ -3847,12 +3848,12 @@ yyreduce: break; case 198: -#line 1610 "parser.y" +#line 1615 "parser.y" { (yyval.val) = NULL; ;} break; case 199: -#line 1611 "parser.y" +#line 1616 "parser.y" { (yyval.val) = (yyvsp[0].val); (yyval.val)->prev = (yyvsp[-1].val); @@ -3862,7 +3863,7 @@ yyreduce: break; case 200: -#line 1620 "parser.y" +#line 1625 "parser.y" { (yyval.val) = new_ver_value(); (yyval.val)->type = val_block; @@ -3871,7 +3872,7 @@ yyreduce: break; case 201: -#line 1625 "parser.y" +#line 1630 "parser.y" { (yyval.val) = new_ver_value(); (yyval.val)->type = val_str; @@ -3881,7 +3882,7 @@ yyreduce: break; case 202: -#line 1631 "parser.y" +#line 1636 "parser.y" { (yyval.val) = new_ver_value(); (yyval.val)->type = val_words; @@ -3891,17 +3892,17 @@ yyreduce: break; case 203: -#line 1640 "parser.y" +#line 1645 "parser.y" { (yyval.verw) = new_ver_words((yyvsp[0].num)); ;} break; case 204: -#line 1641 "parser.y" +#line 1646 "parser.y" { (yyval.verw) = add_ver_words((yyvsp[-2].verw), (yyvsp[0].num)); ;} break; case 205: -#line 1645 "parser.y" +#line 1650 "parser.y" { int nitems; toolbar_item_t *items = get_tlbr_buttons_head((yyvsp[-1].tlbarItems), &nitems); @@ -3928,12 +3929,12 @@ yyreduce: break; case 206: -#line 1671 "parser.y" +#line 1676 "parser.y" { (yyval.tlbarItems) = NULL; ;} break; case 207: -#line 1672 "parser.y" +#line 1677 "parser.y" { toolbar_item_t *idrec = new_toolbar_item(); idrec->id = (yyvsp[0].num); @@ -3942,7 +3943,7 @@ yyreduce: break; case 208: -#line 1677 "parser.y" +#line 1682 "parser.y" { toolbar_item_t *idrec = new_toolbar_item(); idrec->id = 0; @@ -3951,12 +3952,12 @@ yyreduce: break; case 209: -#line 1686 "parser.y" +#line 1691 "parser.y" { (yyval.iptr) = NULL; ;} break; case 210: -#line 1687 "parser.y" +#line 1692 "parser.y" { if((yyvsp[-1].iptr)) { @@ -3970,7 +3971,7 @@ yyreduce: break; case 211: -#line 1697 "parser.y" +#line 1702 "parser.y" { if((yyvsp[-1].iptr)) { @@ -3987,101 +3988,101 @@ yyreduce: break; case 212: -#line 1712 "parser.y" +#line 1717 "parser.y" { (yyval.iptr) = new_int(WRC_MO_PRELOAD); ;} break; case 213: -#line 1713 "parser.y" +#line 1718 "parser.y" { (yyval.iptr) = new_int(WRC_MO_MOVEABLE); ;} break; case 214: -#line 1714 "parser.y" +#line 1719 "parser.y" { (yyval.iptr) = new_int(WRC_MO_DISCARDABLE); ;} break; case 215: -#line 1715 "parser.y" +#line 1720 "parser.y" { (yyval.iptr) = new_int(WRC_MO_PURE); ;} break; case 216: -#line 1718 "parser.y" +#line 1723 "parser.y" { (yyval.iptr) = new_int(~WRC_MO_PRELOAD); ;} break; case 217: -#line 1719 "parser.y" +#line 1724 "parser.y" { (yyval.iptr) = new_int(~WRC_MO_MOVEABLE); ;} break; case 218: -#line 1720 "parser.y" +#line 1725 "parser.y" { (yyval.iptr) = new_int(~WRC_MO_PURE); ;} break; case 219: -#line 1724 "parser.y" +#line 1729 "parser.y" { (yyval.lvc) = new_lvc(); ;} break; case 220: -#line 1725 "parser.y" +#line 1730 "parser.y" { if(!win32) parser_warning("LANGUAGE not supported in 16-bit mode\n"); if((yyvsp[-1].lvc)->language) - parser_error("Language already defined\n"); + yyerror("Language already defined"); (yyval.lvc) = (yyvsp[-1].lvc); (yyvsp[-1].lvc)->language = (yyvsp[0].lan); ;} break; case 221: -#line 1733 "parser.y" +#line 1738 "parser.y" { if(!win32) parser_warning("CHARACTERISTICS not supported in 16-bit mode\n"); if((yyvsp[-1].lvc)->characts) - parser_error("Characteristics already defined\n"); + yyerror("Characteristics already defined"); (yyval.lvc) = (yyvsp[-1].lvc); (yyvsp[-1].lvc)->characts = (yyvsp[0].chars); ;} break; case 222: -#line 1741 "parser.y" +#line 1746 "parser.y" { if(!win32) parser_warning("VERSION not supported in 16-bit mode\n"); if((yyvsp[-1].lvc)->version) - parser_error("Version already defined\n"); + yyerror("Version already defined"); (yyval.lvc) = (yyvsp[-1].lvc); (yyvsp[-1].lvc)->version = (yyvsp[0].ver); ;} break; case 223: -#line 1759 "parser.y" +#line 1764 "parser.y" { (yyval.lan) = new_language((yyvsp[-2].num), (yyvsp[0].num)); if (get_language_codepage((yyvsp[-2].num), (yyvsp[0].num)) == -1) - parser_error( "Language %04x is not supported\n", ((yyvsp[0].num)<<10) + (yyvsp[-2].num)); + yyerror( "Language %04x is not supported", ((yyvsp[0].num)<<10) + (yyvsp[-2].num)); ;} break; case 224: -#line 1766 "parser.y" +#line 1771 "parser.y" { (yyval.chars) = new_characts((yyvsp[0].num)); ;} break; case 225: -#line 1770 "parser.y" +#line 1775 "parser.y" { (yyval.ver) = new_version((yyvsp[0].num)); ;} break; case 226: -#line 1774 "parser.y" +#line 1779 "parser.y" { if((yyvsp[-3].lvc)) { @@ -4097,162 +4098,162 @@ yyreduce: break; case 227: -#line 1789 "parser.y" +#line 1794 "parser.y" { (yyval.raw) = (yyvsp[0].raw); ;} break; case 228: -#line 1790 "parser.y" +#line 1795 "parser.y" { (yyval.raw) = int2raw_data((yyvsp[0].num)); ;} break; case 229: -#line 1791 "parser.y" +#line 1796 "parser.y" { (yyval.raw) = int2raw_data(-((yyvsp[0].num))); ;} break; case 230: -#line 1792 "parser.y" +#line 1797 "parser.y" { (yyval.raw) = long2raw_data((yyvsp[0].num)); ;} break; case 231: -#line 1793 "parser.y" +#line 1798 "parser.y" { (yyval.raw) = long2raw_data(-((yyvsp[0].num))); ;} break; case 232: -#line 1794 "parser.y" +#line 1799 "parser.y" { (yyval.raw) = str2raw_data((yyvsp[0].str)); ;} break; case 233: -#line 1795 "parser.y" +#line 1800 "parser.y" { (yyval.raw) = merge_raw_data((yyvsp[-2].raw), (yyvsp[0].raw)); free((yyvsp[0].raw)->data); free((yyvsp[0].raw)); ;} break; case 234: -#line 1796 "parser.y" +#line 1801 "parser.y" { (yyval.raw) = merge_raw_data_int((yyvsp[-2].raw), (yyvsp[0].num)); ;} break; case 235: -#line 1797 "parser.y" +#line 1802 "parser.y" { (yyval.raw) = merge_raw_data_int((yyvsp[-3].raw), -((yyvsp[0].num))); ;} break; case 236: -#line 1798 "parser.y" +#line 1803 "parser.y" { (yyval.raw) = merge_raw_data_long((yyvsp[-2].raw), (yyvsp[0].num)); ;} break; case 237: -#line 1799 "parser.y" +#line 1804 "parser.y" { (yyval.raw) = merge_raw_data_long((yyvsp[-3].raw), -((yyvsp[0].num))); ;} break; case 238: -#line 1800 "parser.y" +#line 1805 "parser.y" { (yyval.raw) = merge_raw_data_str((yyvsp[-2].raw), (yyvsp[0].str)); ;} break; case 239: -#line 1804 "parser.y" +#line 1809 "parser.y" { (yyval.raw) = load_file((yyvsp[0].str),dup_language(currentlanguage)); ;} break; case 240: -#line 1805 "parser.y" +#line 1810 "parser.y" { (yyval.raw) = (yyvsp[0].raw); ;} break; case 241: -#line 1812 "parser.y" +#line 1817 "parser.y" { (yyval.iptr) = 0; ;} break; case 242: -#line 1813 "parser.y" +#line 1818 "parser.y" { (yyval.iptr) = new_int((yyvsp[0].num)); ;} break; case 243: -#line 1817 "parser.y" +#line 1822 "parser.y" { (yyval.num) = ((yyvsp[0].num)); ;} break; case 244: -#line 1820 "parser.y" +#line 1825 "parser.y" { (yyval.num) = ((yyvsp[-2].num)) + ((yyvsp[0].num)); ;} break; case 245: -#line 1821 "parser.y" +#line 1826 "parser.y" { (yyval.num) = ((yyvsp[-2].num)) - ((yyvsp[0].num)); ;} break; case 246: -#line 1822 "parser.y" +#line 1827 "parser.y" { (yyval.num) = ((yyvsp[-2].num)) | ((yyvsp[0].num)); ;} break; case 247: -#line 1823 "parser.y" +#line 1828 "parser.y" { (yyval.num) = ((yyvsp[-2].num)) & ((yyvsp[0].num)); ;} break; case 248: -#line 1824 "parser.y" +#line 1829 "parser.y" { (yyval.num) = ((yyvsp[-2].num)) * ((yyvsp[0].num)); ;} break; case 249: -#line 1825 "parser.y" +#line 1830 "parser.y" { (yyval.num) = ((yyvsp[-2].num)) / ((yyvsp[0].num)); ;} break; case 250: -#line 1826 "parser.y" +#line 1831 "parser.y" { (yyval.num) = ((yyvsp[-2].num)) ^ ((yyvsp[0].num)); ;} break; case 251: -#line 1827 "parser.y" - { (yyval.num) = ~((yyvsp[0].num)); ;} - break; - - case 252: -#line 1828 "parser.y" - { (yyval.num) = -((yyvsp[0].num)); ;} - break; - - case 253: -#line 1829 "parser.y" - { (yyval.num) = (yyvsp[0].num); ;} - break; - - case 254: -#line 1830 "parser.y" - { (yyval.num) = (yyvsp[-1].num); ;} - break; - - case 255: -#line 1831 "parser.y" - { (yyval.num) = (yyvsp[0].num); ;} - break; - - case 256: #line 1832 "parser.y" { (yyval.num) = ~((yyvsp[0].num)); ;} break; - case 257: + case 252: +#line 1833 "parser.y" + { (yyval.num) = -((yyvsp[0].num)); ;} + break; + + case 253: +#line 1834 "parser.y" + { (yyval.num) = (yyvsp[0].num); ;} + break; + + case 254: #line 1835 "parser.y" + { (yyval.num) = (yyvsp[-1].num); ;} + break; + + case 255: +#line 1836 "parser.y" + { (yyval.num) = (yyvsp[0].num); ;} + break; + + case 256: +#line 1837 "parser.y" + { (yyval.num) = ~((yyvsp[0].num)); ;} + break; + + case 257: +#line 1840 "parser.y" { (yyval.num) = (yyvsp[0].num); ;} break; case 258: -#line 1836 "parser.y" +#line 1841 "parser.y" { (yyval.num) = (yyvsp[0].num); ;} break; @@ -4261,7 +4262,7 @@ yyreduce: } /* Line 1126 of yacc.c. */ -#line 4265 "parser.tab.c" +#line 4270 "parser.tab.c" yyvsp -= yylen; yyssp -= yylen; @@ -4529,7 +4530,7 @@ yyreturn: } -#line 1839 "parser.y" +#line 1844 "parser.y" /* Dialog specific functions */ static dialog_t *dialog_style(style_t * st, dialog_t *dlg) @@ -4584,7 +4585,7 @@ static dialog_t *dialog_caption(string_t *s, dialog_t *dlg) { assert(dlg != NULL); if(dlg->title) - parser_error("Caption already defined\n"); + yyerror("Caption already defined"); dlg->title = s; return dlg; } @@ -4593,7 +4594,7 @@ static dialog_t *dialog_font(font_id_t *f, dialog_t *dlg) { assert(dlg != NULL); if(dlg->font) - parser_error("Font already defined\n"); + yyerror("Font already defined"); dlg->font = f; return dlg; } @@ -4602,7 +4603,7 @@ static dialog_t *dialog_class(name_id_t *n, dialog_t *dlg) { assert(dlg != NULL); if(dlg->dlgclass) - parser_error("Class already defined\n"); + yyerror("Class already defined"); dlg->dlgclass = n; return dlg; } @@ -4769,34 +4770,63 @@ byebye: return ctrl; } +static int get_class_idW(const WCHAR *cc) +{ + static const WCHAR szBUTTON[] = {'B','U','T','T','O','N',0}; + static const WCHAR szCOMBOBOX[] = {'C','O','M','B','O','B','O','X',0}; + static const WCHAR szLISTBOX[] = {'L','I','S','T','B','O','X',0}; + static const WCHAR szEDIT[] = {'E','D','I','T',0}; + static const WCHAR szSTATIC[] = {'S','T','A','T','I','C',0}; + static const WCHAR szSCROLLBAR[] = {'S','C','R','O','L','L','B','A','R',0}; + + if(!strcmpiW(szBUTTON, cc)) + return CT_BUTTON; + if(!strcmpiW(szCOMBOBOX, cc)) + return CT_COMBOBOX; + if(!strcmpiW(szLISTBOX, cc)) + return CT_LISTBOX; + if(!strcmpiW(szEDIT, cc)) + return CT_EDIT; + if(!strcmpiW(szSTATIC, cc)) + return CT_STATIC; + if(!strcmpiW(szSCROLLBAR, cc)) + return CT_SCROLLBAR; + + return -1; +} + +static int get_class_idA(const char *cc) +{ + if(!strcasecmp("BUTTON", cc)) + return CT_BUTTON; + if(!strcasecmp("COMBOBOX", cc)) + return CT_COMBOBOX; + if(!strcasecmp("LISTBOX", cc)) + return CT_LISTBOX; + if(!strcasecmp("EDIT", cc)) + return CT_EDIT; + if(!strcasecmp("STATIC", cc)) + return CT_STATIC; + if(!strcasecmp("SCROLLBAR", cc)) + return CT_SCROLLBAR; + + return -1; +} + + static name_id_t *convert_ctlclass(name_id_t *cls) { - char *cc = NULL; int iclass; if(cls->type == name_ord) return cls; assert(cls->type == name_str); - if(cls->type == str_unicode) - { - yyerror("Don't yet support unicode class comparison"); - } - else - cc = cls->name.s_name->str.cstr; + if(cls->name.s_name->type == str_unicode) + iclass = get_class_idW(cls->name.s_name->str.wstr); + else + iclass = get_class_idA(cls->name.s_name->str.cstr); - if(!strcasecmp("BUTTON", cc)) - iclass = CT_BUTTON; - else if(!strcasecmp("COMBOBOX", cc)) - iclass = CT_COMBOBOX; - else if(!strcasecmp("LISTBOX", cc)) - iclass = CT_LISTBOX; - else if(!strcasecmp("EDIT", cc)) - iclass = CT_EDIT; - else if(!strcasecmp("STATIC", cc)) - iclass = CT_STATIC; - else if(!strcasecmp("SCROLLBAR", cc)) - iclass = CT_SCROLLBAR; - else + if (iclass == -1) return cls; /* No default, return user controlclass */ free(cls->name.s_name->str.cstr); @@ -4937,39 +4967,53 @@ static event_t *add_event(int key, int id, int flags, event_t *prev) static event_t *add_string_event(string_t *key, int id, int flags, event_t *prev) { - int keycode = 0, keysym = 0; - event_t *ev = new_event(); + int keycode = 0; + event_t *ev = new_event(); - if(key->type == str_char) - keysym = key->str.cstr[0]; - else - keysym = key->str.wstr[0]; - - if((flags & WRC_AF_VIRTKEY) && (!isupper(keysym & 0xff) && !isdigit(keysym & 0xff))) + if(key->type == str_char) + { + if((flags & WRC_AF_VIRTKEY) && (!isupper(key->str.cstr[0] & 0xff) && !isdigit(key->str.cstr[0] & 0xff))) yyerror("VIRTKEY code is not equal to ascii value"); - if(keysym == '^' && (flags & WRC_AF_CONTROL) != 0) + if(key->str.cstr[0] == '^' && (flags & WRC_AF_CONTROL) != 0) { yyerror("Cannot use both '^' and CONTROL modifier"); } - else if(keysym == '^') + else if(key->str.cstr[0] == '^') { - if(key->type == str_char) - keycode = toupper(key->str.cstr[1]) - '@'; - else - keycode = toupper(key->str.wstr[1]) - '@'; + keycode = toupper(key->str.cstr[1]) - '@'; if(keycode >= ' ') yyerror("Control-code out of range"); } else - keycode = keysym; - ev->key = keycode; - ev->id = id; - ev->flags = flags & ~WRC_AF_ASCII; - ev->prev = prev; - if(prev) - prev->next = ev; - return ev; + keycode = key->str.cstr[0]; + } + else + { + if((flags & WRC_AF_VIRTKEY) && !isupperW(key->str.wstr[0]) && !isdigitW(key->str.wstr[0])) + yyerror("VIRTKEY code is not equal to ascii value"); + + if(key->str.wstr[0] == '^' && (flags & WRC_AF_CONTROL) != 0) + { + yyerror("Cannot use both '^' and CONTROL modifier"); + } + else if(key->str.wstr[0] == '^') + { + keycode = toupperW(key->str.wstr[1]) - '@'; + if(keycode >= ' ') + yyerror("Control-code out of range"); + } + else + keycode = key->str.wstr[0]; + } + + ev->key = keycode; + ev->id = id; + ev->flags = flags & ~WRC_AF_ASCII; + ev->prev = prev; + if(prev) + prev->next = ev; + return ev; } /* MenuEx specific functions */ diff --git a/reactos/tools/wrc/parser.tab.h b/reactos/tools/wrc/parser.tab.h index 6eeddcc86bb..d5a98cd10a8 100644 --- a/reactos/tools/wrc/parser.tab.h +++ b/reactos/tools/wrc/parser.tab.h @@ -203,7 +203,7 @@ #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 237 "parser.y" +#line 241 "parser.y" typedef union YYSTYPE { string_t *str; int num; diff --git a/reactos/tools/wrc/parser.y b/reactos/tools/wrc/parser.y index 63c63a12a19..c0cc2ba5f0a 100644 --- a/reactos/tools/wrc/parser.y +++ b/reactos/tools/wrc/parser.y @@ -140,6 +140,10 @@ #include "wine/wpp.h" #include "wine/unicode.h" #include "parser.h" +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "winuser.h" #if defined(YYBYACC) /* Berkeley yacc (byacc) doesn't seem to know about these */ @@ -413,9 +417,10 @@ resources if(rsc->type == head->type && rsc->lan->id == head->lan->id && rsc->lan->sub == head->lan->sub - && !compare_name_id(rsc->name, head->name)) + && !compare_name_id(rsc->name, head->name) + && (rsc->type != res_usr || !compare_name_id(rsc->res.usr->type,head->res.usr->type))) { - parser_error("Duplicate resource name '%s'\n", get_nameid_str(rsc->name)); + yyerror("Duplicate resource name '%s'", get_nameid_str(rsc->name)); } rsc = rsc->prev; } @@ -438,7 +443,7 @@ resources } /* * The following newline rule will never get reduced because we never - * get the tNL token, unless we explicitely set the 'want_nl' + * get the tNL token, unless we explicitly set the 'want_nl' * flag, which we don't. * The *ONLY* reason for this to be here is because Berkeley * yacc (byacc), at least version 1.9, has a bug. @@ -472,7 +477,7 @@ resource if($$) { if($1 > 65535 || $1 < -32768) - parser_error("Resource's ID out of range (%d)\n", $1); + yyerror("Resource's ID out of range (%d)", $1); $$->name = new_name_id(); $$->name->type = name_ord; $$->name->name.i_name = $1; @@ -505,7 +510,7 @@ resource * However, we can test the lookahead-token for * being "non-expression" type, in which case we * continue. Fortunately, tNL is the only token that - * will break expression parsing and is implicitely + * will break expression parsing and is implicitly * void, so we just remove it. This scheme makes it * possible to do some (not all) fancy preprocessor * stuff. @@ -529,7 +534,7 @@ resource parser_warning("LANGUAGE not supported in 16-bit mode\n"); free(currentlanguage); if (get_language_codepage($3, $5) == -1) - parser_error( "Language %04x is not supported\n", ($5<<10) + $3); + yyerror( "Language %04x is not supported", ($5<<10) + $3); currentlanguage = new_language($3, $5); $$ = NULL; chat("Got LANGUAGE %d,%d (0x%04x)\n", $3, $5, ($5<<10) + $3); @@ -548,7 +553,7 @@ usrcvt : /* Empty */ { yychar = rsrcid_to_token(yychar); } */ nameid : expr { if($1 > 65535 || $1 < -32768) - parser_error("Resource's ID out of range (%d)\n", $1); + yyerror("Resource's ID out of range (%d)", $1); $$ = new_name_id(); $$->type = name_ord; $$->name.i_name = $1; @@ -772,7 +777,7 @@ accelerators $$->memopt = WRC_MO_MOVEABLE | WRC_MO_PURE; } if(!$5) - parser_error("Accelerator table must have at least one entry\n"); + yyerror("Accelerator table must have at least one entry"); $$->events = get_event_head($5); if($3) { @@ -1220,7 +1225,7 @@ opt_expr: /* Empty */ { $$ = NULL; } /* ------------------------------ Menu ------------------------------ */ menu : tMENU loadmemopts opt_lvc menu_body { if(!$4) - parser_error("Menu must contain items\n"); + yyerror("Menu must contain items"); $$ = new_menu(); if($2) { @@ -1294,7 +1299,7 @@ menuex : tMENUEX loadmemopts opt_lvc menuex_body { if(!win32) parser_warning("MENUEX not supported in 16-bit mode\n"); if(!$4) - parser_error("MenuEx must contain items\n"); + yyerror("MenuEx must contain items"); $$ = new_menuex(); if($2) { @@ -1428,7 +1433,7 @@ stringtable : stt_head tBEGIN strings tEND { if(!$3) { - parser_error("Stringtable must have at least one entry\n"); + yyerror("Stringtable must have at least one entry"); } else { @@ -1478,12 +1483,12 @@ strings : /* Empty */ { $$ = NULL; } int i; assert(tagstt != NULL); if($2 > 65535 || $2 < -32768) - parser_error("Stringtable entry's ID out of range (%d)\n", $2); + yyerror("Stringtable entry's ID out of range (%d)", $2); /* Search for the ID */ for(i = 0; i < tagstt->nentries; i++) { if(tagstt->entries[i].id == $2) - parser_error("Stringtable ID %d already in use\n", $2); + yyerror("Stringtable ID %d already in use", $2); } /* If we get here, then we have a new unique entry */ tagstt->nentries++; @@ -1500,9 +1505,9 @@ strings : /* Empty */ { $$ = NULL; } if(pedantic && !$4->size) parser_warning("Zero length strings make no sense\n"); if(!win32 && $4->size > 254) - parser_error("Stringtable entry more than 254 characters\n"); + yyerror("Stringtable entry more than 254 characters"); if(win32 && $4->size > 65534) /* Hmm..., does this happen? */ - parser_error("Stringtable entry more than 65534 characters (probably something else that went wrong)\n"); + yyerror("Stringtable entry more than 65534 characters (probably something else that went wrong)"); $$ = tagstt; } ; @@ -1533,7 +1538,7 @@ fix_version : /* Empty */ { $$ = new_versioninfo(); } | fix_version tFILEVERSION expr ',' expr ',' expr ',' expr { if($1->gotit.fv) - parser_error("FILEVERSION already defined\n"); + yyerror("FILEVERSION already defined"); $$ = $1; $$->filever_maj1 = $3; $$->filever_maj2 = $5; @@ -1543,7 +1548,7 @@ fix_version } | fix_version tPRODUCTVERSION expr ',' expr ',' expr ',' expr { if($1->gotit.pv) - parser_error("PRODUCTVERSION already defined\n"); + yyerror("PRODUCTVERSION already defined"); $$ = $1; $$->prodver_maj1 = $3; $$->prodver_maj2 = $5; @@ -1553,35 +1558,35 @@ fix_version } | fix_version tFILEFLAGS expr { if($1->gotit.ff) - parser_error("FILEFLAGS already defined\n"); + yyerror("FILEFLAGS already defined"); $$ = $1; $$->fileflags = $3; $$->gotit.ff = 1; } | fix_version tFILEFLAGSMASK expr { if($1->gotit.ffm) - parser_error("FILEFLAGSMASK already defined\n"); + yyerror("FILEFLAGSMASK already defined"); $$ = $1; $$->fileflagsmask = $3; $$->gotit.ffm = 1; } | fix_version tFILEOS expr { if($1->gotit.fo) - parser_error("FILEOS already defined\n"); + yyerror("FILEOS already defined"); $$ = $1; $$->fileos = $3; $$->gotit.fo = 1; } | fix_version tFILETYPE expr { if($1->gotit.ft) - parser_error("FILETYPE already defined\n"); + yyerror("FILETYPE already defined"); $$ = $1; $$->filetype = $3; $$->gotit.ft = 1; } | fix_version tFILESUBTYPE expr { if($1->gotit.fst) - parser_error("FILESUBTYPE already defined\n"); + yyerror("FILESUBTYPE already defined"); $$ = $1; $$->filesubtype = $3; $$->gotit.fst = 1; @@ -1726,7 +1731,7 @@ opt_lvc : /* Empty */ { $$ = new_lvc(); } if(!win32) parser_warning("LANGUAGE not supported in 16-bit mode\n"); if($1->language) - parser_error("Language already defined\n"); + yyerror("Language already defined"); $$ = $1; $1->language = $2; } @@ -1734,7 +1739,7 @@ opt_lvc : /* Empty */ { $$ = new_lvc(); } if(!win32) parser_warning("CHARACTERISTICS not supported in 16-bit mode\n"); if($1->characts) - parser_error("Characteristics already defined\n"); + yyerror("Characteristics already defined"); $$ = $1; $1->characts = $2; } @@ -1742,7 +1747,7 @@ opt_lvc : /* Empty */ { $$ = new_lvc(); } if(!win32) parser_warning("VERSION not supported in 16-bit mode\n"); if($1->version) - parser_error("Version already defined\n"); + yyerror("Version already defined"); $$ = $1; $1->version = $2; } @@ -1758,7 +1763,7 @@ opt_lvc : /* Empty */ { $$ = new_lvc(); } opt_language : tLANGUAGE expr ',' expr { $$ = new_language($2, $4); if (get_language_codepage($2, $4) == -1) - parser_error( "Language %04x is not supported\n", ($4<<10) + $2); + yyerror( "Language %04x is not supported", ($4<<10) + $2); } ; @@ -1890,7 +1895,7 @@ static dialog_t *dialog_caption(string_t *s, dialog_t *dlg) { assert(dlg != NULL); if(dlg->title) - parser_error("Caption already defined\n"); + yyerror("Caption already defined"); dlg->title = s; return dlg; } @@ -1899,7 +1904,7 @@ static dialog_t *dialog_font(font_id_t *f, dialog_t *dlg) { assert(dlg != NULL); if(dlg->font) - parser_error("Font already defined\n"); + yyerror("Font already defined"); dlg->font = f; return dlg; } @@ -1908,7 +1913,7 @@ static dialog_t *dialog_class(name_id_t *n, dialog_t *dlg) { assert(dlg != NULL); if(dlg->dlgclass) - parser_error("Class already defined\n"); + yyerror("Class already defined"); dlg->dlgclass = n; return dlg; } @@ -2075,34 +2080,63 @@ byebye: return ctrl; } +static int get_class_idW(const WCHAR *cc) +{ + static const WCHAR szBUTTON[] = {'B','U','T','T','O','N',0}; + static const WCHAR szCOMBOBOX[] = {'C','O','M','B','O','B','O','X',0}; + static const WCHAR szLISTBOX[] = {'L','I','S','T','B','O','X',0}; + static const WCHAR szEDIT[] = {'E','D','I','T',0}; + static const WCHAR szSTATIC[] = {'S','T','A','T','I','C',0}; + static const WCHAR szSCROLLBAR[] = {'S','C','R','O','L','L','B','A','R',0}; + + if(!strcmpiW(szBUTTON, cc)) + return CT_BUTTON; + if(!strcmpiW(szCOMBOBOX, cc)) + return CT_COMBOBOX; + if(!strcmpiW(szLISTBOX, cc)) + return CT_LISTBOX; + if(!strcmpiW(szEDIT, cc)) + return CT_EDIT; + if(!strcmpiW(szSTATIC, cc)) + return CT_STATIC; + if(!strcmpiW(szSCROLLBAR, cc)) + return CT_SCROLLBAR; + + return -1; +} + +static int get_class_idA(const char *cc) +{ + if(!strcasecmp("BUTTON", cc)) + return CT_BUTTON; + if(!strcasecmp("COMBOBOX", cc)) + return CT_COMBOBOX; + if(!strcasecmp("LISTBOX", cc)) + return CT_LISTBOX; + if(!strcasecmp("EDIT", cc)) + return CT_EDIT; + if(!strcasecmp("STATIC", cc)) + return CT_STATIC; + if(!strcasecmp("SCROLLBAR", cc)) + return CT_SCROLLBAR; + + return -1; +} + + static name_id_t *convert_ctlclass(name_id_t *cls) { - char *cc = NULL; int iclass; if(cls->type == name_ord) return cls; assert(cls->type == name_str); - if(cls->type == str_unicode) - { - yyerror("Don't yet support unicode class comparison"); - } - else - cc = cls->name.s_name->str.cstr; + if(cls->name.s_name->type == str_unicode) + iclass = get_class_idW(cls->name.s_name->str.wstr); + else + iclass = get_class_idA(cls->name.s_name->str.cstr); - if(!strcasecmp("BUTTON", cc)) - iclass = CT_BUTTON; - else if(!strcasecmp("COMBOBOX", cc)) - iclass = CT_COMBOBOX; - else if(!strcasecmp("LISTBOX", cc)) - iclass = CT_LISTBOX; - else if(!strcasecmp("EDIT", cc)) - iclass = CT_EDIT; - else if(!strcasecmp("STATIC", cc)) - iclass = CT_STATIC; - else if(!strcasecmp("SCROLLBAR", cc)) - iclass = CT_SCROLLBAR; - else + if (iclass == -1) return cls; /* No default, return user controlclass */ free(cls->name.s_name->str.cstr); @@ -2243,12 +2277,11 @@ static event_t *add_event(int key, int id, int flags, event_t *prev) static event_t *add_string_event(string_t *key, int id, int flags, event_t *prev) { - int keycode = 0; - event_t *ev = new_event(); - - if(key->type != str_char) - yyerror("Key code must be an ascii string"); + int keycode = 0; + event_t *ev = new_event(); + if(key->type == str_char) + { if((flags & WRC_AF_VIRTKEY) && (!isupper(key->str.cstr[0] & 0xff) && !isdigit(key->str.cstr[0] & 0xff))) yyerror("VIRTKEY code is not equal to ascii value"); @@ -2264,13 +2297,33 @@ static event_t *add_string_event(string_t *key, int id, int flags, event_t *prev } else keycode = key->str.cstr[0]; - ev->key = keycode; - ev->id = id; - ev->flags = flags & ~WRC_AF_ASCII; - ev->prev = prev; - if(prev) - prev->next = ev; - return ev; + } + else + { + if((flags & WRC_AF_VIRTKEY) && !isupperW(key->str.wstr[0]) && !isdigitW(key->str.wstr[0])) + yyerror("VIRTKEY code is not equal to ascii value"); + + if(key->str.wstr[0] == '^' && (flags & WRC_AF_CONTROL) != 0) + { + yyerror("Cannot use both '^' and CONTROL modifier"); + } + else if(key->str.wstr[0] == '^') + { + keycode = toupperW(key->str.wstr[1]) - '@'; + if(keycode >= ' ') + yyerror("Control-code out of range"); + } + else + keycode = key->str.wstr[0]; + } + + ev->key = keycode; + ev->id = id; + ev->flags = flags & ~WRC_AF_ASCII; + ev->prev = prev; + if(prev) + prev->next = ev; + return ev; } /* MenuEx specific functions */ diff --git a/reactos/tools/wrc/readres.c b/reactos/tools/wrc/readres.c index 35a01768fc1..e3a4db74d25 100644 --- a/reactos/tools/wrc/readres.c +++ b/reactos/tools/wrc/readres.c @@ -19,6 +19,7 @@ */ #include "config.h" +#include "wine/port.h" #include #include diff --git a/reactos/tools/wrc/translation.c b/reactos/tools/wrc/translation.c index 2721fa71b9d..7262a658476 100644 --- a/reactos/tools/wrc/translation.c +++ b/reactos/tools/wrc/translation.c @@ -1,5 +1,6 @@ /* - * Copyright 2003 Vincent Béron + * Copyright 2003 Vincent BĂ©ron + * Copyright 2007, 2008 Mikolaj Zalewski * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -18,6 +19,7 @@ #include #include +#include #include "dumpres.h" #include "utils.h" @@ -279,6 +281,7 @@ static int compare_cursor_group(cursor_group_t *cursor_group1, cursor_group_t *c static int compare_control(control_t *control1, control_t *control2) { int different = 0; char *nameid = NULL; + int ignore_style; if(!different && ((control1 && !control2) || (!control1 && control2))) @@ -289,13 +292,21 @@ static int compare_control(control_t *control1, control_t *control2) { if(!different && strcmp(nameid, get_nameid_str(control2->ctlclass))) different = 1; free(nameid); + if (different) + return different; + + /* allow the translators to set some styles */ + ignore_style = 0; + if (control1->ctlclass->type == name_ord && control1->ctlclass->name.i_name == CT_BUTTON) + ignore_style = 0x2000; /* BS_MULTILINE*/ + if(!different && (control1->id != control2->id)) different = 1; if(!different && control1->gotstyle && control2->gotstyle) { if((!control1->style || !control2->style) || (control1->style->and_mask || control2->style->and_mask) || - (control1->style->or_mask != control2->style->or_mask)) + ((control1->style->or_mask & ~ignore_style) != (control2->style->or_mask & ~ignore_style))) different = 1; } else if(!different && ((control1->gotstyle && !control2->gotstyle) || @@ -323,6 +334,7 @@ static int compare_control(control_t *control1, control_t *control2) { static int compare_dialog(dialog_t *dialog1, dialog_t *dialog2) { int different = 0; char *nameid = NULL; + control_t *ctrl1, *ctrl2; if(!different && ((dialog1->memopt != dialog2->memopt) || (dialog1->lvc.version != dialog2->lvc.version) || @@ -354,14 +366,22 @@ static int compare_dialog(dialog_t *dialog1, dialog_t *dialog2) { if(!different && strcmp(nameid, get_nameid_str(dialog2->dlgclass))) different = 1; free(nameid); - if(!different) - different = compare_control(dialog1->controls, dialog2->controls); + + ctrl1 = dialog1->controls; + ctrl2 = dialog2->controls; + while(!different && (ctrl1 || ctrl2)) + { + different = compare_control(ctrl1, ctrl2); + if (ctrl1) ctrl1 = ctrl1->next; + if (ctrl2) ctrl2 = ctrl2->next; + } return different; } static int compare_dialogex(dialogex_t *dialogex1, dialogex_t *dialogex2) { int different = 0; char *nameid = NULL; + control_t *ctrl1, *ctrl2; if(!different && ((dialogex1->memopt != dialogex2->memopt) || (dialogex1->lvc.version != dialogex2->lvc.version) || @@ -400,8 +420,15 @@ static int compare_dialogex(dialogex_t *dialogex1, dialogex_t *dialogex2) { if(!different && strcmp(nameid, get_nameid_str(dialogex2->dlgclass))) different = 1; free(nameid); - if(!different) - different = compare_control(dialogex1->controls, dialogex2->controls); + + ctrl1 = dialogex1->controls; + ctrl2 = dialogex2->controls; + while(!different && (ctrl1 || ctrl2)) + { + different = compare_control(ctrl1, ctrl2); + if (ctrl1) ctrl1 = ctrl1->next; + if (ctrl2) ctrl2 = ctrl2->next; + } return different; } @@ -938,49 +965,6 @@ static int compare(resource_t *resource1, resource_t *resource2) { } } -static void dump_stringtable(resource_t *res) -{ - stringtable_t *stt = res->res.stt; - int j; - - printf("DUMP "); - assert((stt->idbase%16) == 0); - assert(stt->nentries == 16); - for (j = 0; j < stt->nentries; j++) - { - stt_entry_t *entry = &stt->entries[j]; - language_t *lang = stt->lvc.language; - string_t *newstr; - WCHAR *wstr; - int k; - - if (entry->str) - { - newstr = convert_string(entry->str, str_unicode, get_language_codepage(lang->id, lang->sub)); - printf("%02x%02x", newstr->size & 0xff, (newstr->size >> 8) & 0xff); - wstr = newstr->str.wstr; - for (k = 0; k < newstr->size; k++) - printf("%02x%02x", wstr[k] & 0xff, wstr[k] >> 8); - free_string(newstr); - } - else - printf("0000"); - } - putchar('\n'); -} - -static void dump(resource_t *res) -{ - switch (res->type) - { - case res_stt: - dump_stringtable(res); - return; - default: - break; - } -} - typedef struct resource_lang_node { language_t lang; @@ -1141,7 +1125,6 @@ void verify_translations(resource_t *top) { for (langnode = idnode->langs; langnode; langnode = langnode->next) { printf("EXIST %03x:%02x\n", langnode->lang.id, langnode->lang.sub); - dump(langnode->res); if (compare(langnode->res, mainres)) { printf("DIFF %03x:%02x\n", langnode->lang.id, langnode->lang.sub); diff --git a/reactos/tools/wrc/utils.c b/reactos/tools/wrc/utils.c index 14373645314..0f9b31e2e67 100644 --- a/reactos/tools/wrc/utils.c +++ b/reactos/tools/wrc/utils.c @@ -19,13 +19,13 @@ */ #include "config.h" +#include "wine/port.h" #include #include #include #include #include -#include #include #include "wine/unicode.h" @@ -71,6 +71,7 @@ int parser_error(const char *s, ...) va_list ap; va_start(ap, s); generic_msg(s, "Error", parser_text, ap); + fputc( '\n', stderr ); va_end(ap); exit(1); return 1; @@ -241,7 +242,7 @@ string_t *convert_string(const string_t *str, enum str_e type, int codepage) int res; if (!codepage && str->type != type) - parser_error( "Current language is Unicode only, cannot convert string\n" ); + parser_error( "Current language is Unicode only, cannot convert string" ); if((str->type == str_char) && (type == str_unicode)) { @@ -256,7 +257,7 @@ string_t *convert_string(const string_t *str, enum str_e type, int codepage) res = wine_utf8_mbstowcs( MB_ERR_INVALID_CHARS, str->str.cstr, str->size, ret->str.wstr, ret->size ); if (res == -2) - parser_error( "Invalid character in string '%.*s' for codepage %u\n", + parser_error( "Invalid character in string '%.*s' for codepage %u", str->size, str->str.cstr, codepage ); ret->str.wstr[ret->size] = 0; } @@ -343,18 +344,18 @@ static const struct lang2cp lang2cps[] = { LANG_ALBANIAN, SUBLANG_NEUTRAL, 1250 }, { LANG_ARABIC, SUBLANG_NEUTRAL, 1256 }, { LANG_ARMENIAN, SUBLANG_NEUTRAL, 0 }, + { LANG_ASSAMESE, SUBLANG_NEUTRAL, 0 }, { LANG_AZERI, SUBLANG_NEUTRAL, 1254 }, { LANG_AZERI, SUBLANG_AZERI_CYRILLIC, 1251 }, { LANG_BASQUE, SUBLANG_NEUTRAL, 1252 }, { LANG_BELARUSIAN, SUBLANG_NEUTRAL, 1251 }, -#ifdef LANG_BRETON + { LANG_BENGALI, SUBLANG_NEUTRAL, 0 }, { LANG_BRETON, SUBLANG_NEUTRAL, 1252 }, -#endif /* LANG_BRETON */ { LANG_BULGARIAN, SUBLANG_NEUTRAL, 1251 }, { LANG_CATALAN, SUBLANG_NEUTRAL, 1252 }, { LANG_CHINESE, SUBLANG_NEUTRAL, 950 }, - { LANG_CHINESE, SUBLANG_CHINESE_SINGAPORE, 936 }, { LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED, 936 }, + { LANG_CHINESE, SUBLANG_CHINESE_SINGAPORE, 936 }, #ifdef LANG_CORNISH { LANG_CORNISH, SUBLANG_NEUTRAL, 1252 }, #endif /* LANG_CORNISH */ @@ -385,6 +386,7 @@ static const struct lang2cp lang2cps[] = { LANG_HUNGARIAN, SUBLANG_NEUTRAL, 1250 }, { LANG_ICELANDIC, SUBLANG_NEUTRAL, 1252 }, { LANG_INDONESIAN, SUBLANG_NEUTRAL, 1252 }, + { LANG_IRISH, SUBLANG_NEUTRAL, 1252 }, { LANG_ITALIAN, SUBLANG_NEUTRAL, 1252 }, { LANG_JAPANESE, SUBLANG_NEUTRAL, 932 }, { LANG_KANNADA, SUBLANG_NEUTRAL, 0 }, @@ -394,17 +396,24 @@ static const struct lang2cp lang2cps[] = { LANG_KYRGYZ, SUBLANG_NEUTRAL, 1251 }, { LANG_LATVIAN, SUBLANG_NEUTRAL, 1257 }, { LANG_LITHUANIAN, SUBLANG_NEUTRAL, 1257 }, + { LANG_LOWER_SORBIAN, SUBLANG_NEUTRAL, 1252 }, { LANG_MACEDONIAN, SUBLANG_NEUTRAL, 1251 }, { LANG_MALAY, SUBLANG_NEUTRAL, 1252 }, + { LANG_MALAYALAM, SUBLANG_NEUTRAL, 0 }, + { LANG_MALTESE, SUBLANG_NEUTRAL, 0 }, { LANG_MARATHI, SUBLANG_NEUTRAL, 0 }, { LANG_MONGOLIAN, SUBLANG_NEUTRAL, 1251 }, + { LANG_NEPALI, SUBLANG_NEUTRAL, 0 }, { LANG_NEUTRAL, SUBLANG_NEUTRAL, 1252 }, { LANG_NORWEGIAN, SUBLANG_NEUTRAL, 1252 }, + { LANG_ORIYA, SUBLANG_NEUTRAL, 0 }, { LANG_POLISH, SUBLANG_NEUTRAL, 1250 }, { LANG_PORTUGUESE, SUBLANG_NEUTRAL, 1252 }, { LANG_PUNJABI, SUBLANG_NEUTRAL, 0 }, { LANG_ROMANIAN, SUBLANG_NEUTRAL, 1250 }, + { LANG_ROMANSH, SUBLANG_NEUTRAL, 1252 }, { LANG_RUSSIAN, SUBLANG_NEUTRAL, 1251 }, + { LANG_SAMI, SUBLANG_NEUTRAL, 1252 }, { LANG_SANSKRIT, SUBLANG_NEUTRAL, 0 }, { LANG_SERBIAN, SUBLANG_NEUTRAL, 1250 }, { LANG_SERBIAN, SUBLANG_SERBIAN_CYRILLIC, 1251 }, @@ -414,22 +423,27 @@ static const struct lang2cp lang2cps[] = { LANG_SWAHILI, SUBLANG_NEUTRAL, 1252 }, { LANG_SWEDISH, SUBLANG_NEUTRAL, 1252 }, { LANG_SYRIAC, SUBLANG_NEUTRAL, 0 }, + { LANG_TAJIK, SUBLANG_NEUTRAL, 1251 }, { LANG_TAMIL, SUBLANG_NEUTRAL, 0 }, { LANG_TATAR, SUBLANG_NEUTRAL, 1251 }, { LANG_TELUGU, SUBLANG_NEUTRAL, 0 }, { LANG_THAI, SUBLANG_NEUTRAL, 874 }, + { LANG_TSWANA, SUBLANG_NEUTRAL, 1252 }, { LANG_TURKISH, SUBLANG_NEUTRAL, 1254 }, { LANG_UKRAINIAN, SUBLANG_NEUTRAL, 1251 }, + { LANG_UPPER_SORBIAN, SUBLANG_NEUTRAL, 1252 }, { LANG_URDU, SUBLANG_NEUTRAL, 1256 }, { LANG_UZBEK, SUBLANG_NEUTRAL, 1254 }, { LANG_UZBEK, SUBLANG_UZBEK_CYRILLIC, 1251 }, - { LANG_VIETNAMESE, SUBLANG_NEUTRAL, 1258 } + { LANG_VIETNAMESE, SUBLANG_NEUTRAL, 1258 }, #ifdef LANG_WALON - , { LANG_WALON, SUBLANG_NEUTRAL, 1252 } + { LANG_WALON, SUBLANG_NEUTRAL, 1252 }, #endif /* LANG_WALON */ #ifdef LANG_WELSH - , { LANG_WELSH, SUBLANG_NEUTRAL, 1252 } -#endif /* LANG_WELSH */ + { LANG_WELSH, SUBLANG_NEUTRAL, 1252 }, +#endif + { LANG_XHOSA, SUBLANG_NEUTRAL, 1252 }, + { LANG_ZULU, SUBLANG_NEUTRAL, 1252 } }; int get_language_codepage( unsigned short lang, unsigned short sublang ) diff --git a/reactos/tools/wrc/wrc.c b/reactos/tools/wrc/wrc.c index 6d6a1158fb1..b752499783c 100644 --- a/reactos/tools/wrc/wrc.c +++ b/reactos/tools/wrc/wrc.c @@ -1,6 +1,6 @@ /* * Copyright 1994 Martin von Loewis - * Copyrignt 1998 Bertho A. Stultiens (BS) + * Copyright 1998 Bertho A. Stultiens (BS) * Copyright 2003 Dimitrie O. Paun * * This library is free software; you can redistribute it and/or @@ -20,6 +20,7 @@ */ #include "config.h" +#include "wine/port.h" #include #include @@ -113,7 +114,7 @@ int win32 = 1; /* * debuglevel == DEBUGLEVEL_NONE Don't bother - * debuglevel & DEBUGLEVEL_CHAT Say whats done + * debuglevel & DEBUGLEVEL_CHAT Say what's done * debuglevel & DEBUGLEVEL_DUMP Dump internal structures * debuglevel & DEBUGLEVEL_TRACE Create parser trace * debuglevel & DEBUGLEVEL_PPMSG Preprocessor messages diff --git a/reactos/tools/wrc/writeres.c b/reactos/tools/wrc/writeres.c index 5771b8ea17e..e26a559e765 100644 --- a/reactos/tools/wrc/writeres.c +++ b/reactos/tools/wrc/writeres.c @@ -19,6 +19,7 @@ */ #include "config.h" +#include "wine/port.h" #include #include @@ -69,7 +70,7 @@ void write_resfile(char *outname, resource_t *top) put_word(res, 0); /* Memory options */ put_word(res, 0); /* Language */ put_dword(res, 0); /* Version */ - put_dword(res, 0); /* Charateristics */ + put_dword(res, 0); /* Characteristics */ ret = fwrite(res->data, 1, res->size, fo); if(ret != res->size) {