mirror of
https://github.com/reactos/reactos.git
synced 2025-04-26 16:40:27 +00:00
- Sync WRC to Wine-20081105 (a few nice bugfixes).
svn path=/trunk/; revision=37211
This commit is contained in:
parent
e1f82ec004
commit
04b0bb8994
14 changed files with 841 additions and 671 deletions
|
@ -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.
|
||||
|
|
|
@ -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, "_");
|
||||
|
|
|
@ -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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
|
||||
#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,6 +2089,7 @@ register char *yy_bp;
|
|||
|
||||
yy_cp += (int) (dest - source);
|
||||
yy_bp += (int) (dest - source);
|
||||
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 )
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
}
|
||||
<pp_code_page>[^\n]* yy_pop_state(); parser_error("Malformed #pragma code_page directive\n");
|
||||
<pp_code_page>[^\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);
|
||||
}
|
||||
<tklstr>\\x[0-9a-fA-F]{4} { /* hex escape sequence */
|
||||
|
@ -431,9 +452,9 @@ L\" {
|
|||
result = strtoul(yytext+2, 0, 16);
|
||||
addwchar((WCHAR)result);
|
||||
}
|
||||
<tklstr>\\x[0-9a-fA-F]{1,3} { parser_error("Invalid hex escape sequence '%s'\n", yytext); }
|
||||
<tklstr>\\x[0-9a-fA-F]{1,3} { parser_error("Invalid hex escape sequence '%s'", yytext); }
|
||||
|
||||
<tklstr>\\[0-9]+ parser_error("Bad escape sequence\n");
|
||||
<tklstr>\\[0-9]+ parser_error("Bad escape sequence");
|
||||
<tklstr>\\\n{ws}* line_number++; char_number = 1; /* backslash at EOL continues string after leading whitespace on next line */
|
||||
<tklstr>\\a addwchar('\a');
|
||||
<tklstr>\\b addwchar('\b');
|
||||
|
@ -452,7 +473,7 @@ L\" {
|
|||
while(*yptr) /* FIXME: codepage translation */
|
||||
addwchar(*yptr++ & 0xff);
|
||||
}
|
||||
<tklstr>\n parser_error("Unterminated string\n");
|
||||
<tklstr>\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);
|
||||
}
|
||||
<tkstr>\\x[0-9a-fA-F]{2} { /* hex escape sequence */
|
||||
|
@ -476,9 +497,9 @@ L\" {
|
|||
result = strtol(yytext+2, 0, 16);
|
||||
addcchar((char)result);
|
||||
}
|
||||
<tkstr>\\x[0-9a-fA-F] { parser_error("Invalid hex escape sequence '%s'\n", yytext); }
|
||||
<tkstr>\\x[0-9a-fA-F] { parser_error("Invalid hex escape sequence '%s'", yytext); }
|
||||
|
||||
<tkstr>\\[0-9]+ parser_error("Bad escape sequence\n");
|
||||
<tkstr>\\[0-9]+ parser_error("Bad escape sequence");
|
||||
<tkstr>\\\n{ws}* line_number++; char_number = 1; /* backslash at EOL continues string after leading whitespace on next line */
|
||||
<tkstr>\\a addcchar('\a');
|
||||
<tkstr>\\b addcchar('\b');
|
||||
|
@ -497,7 +518,7 @@ L\" {
|
|||
<tkstr>\"\" addcchar('\"'); /* "bla""bla" -> "bla\"bla" */
|
||||
<tkstr>\\\"\" addcchar('\"'); /* "bla\""bla" -> "bla\"bla" */
|
||||
<tkstr>\"{ws}+\" ; /* "bla" "bla" -> "blabla" */
|
||||
<tkstr>\n parser_error("Unterminated string\n");
|
||||
<tkstr>\n parser_error("Unterminated string");
|
||||
|
||||
/*
|
||||
* Raw data scanning
|
||||
|
@ -518,7 +539,7 @@ L\" {
|
|||
}
|
||||
<tkrcd>{ws}+ ; /* Ignore space */
|
||||
<tkrcd>\n line_number++; char_number = 1;
|
||||
<tkrcd>. parser_error("Malformed data-line\n");
|
||||
<tkrcd>. 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;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
if(cls->name.s_name->type == str_unicode)
|
||||
iclass = get_class_idW(cls->name.s_name->str.wstr);
|
||||
else
|
||||
cc = cls->name.s_name->str.cstr;
|
||||
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);
|
||||
|
@ -2246,9 +2280,8 @@ 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");
|
||||
|
||||
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,6 +2297,26 @@ static event_t *add_string_event(string_t *key, int id, int flags, event_t *prev
|
|||
}
|
||||
else
|
||||
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;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#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);
|
||||
|
|
|
@ -19,13 +19,13 @@
|
|||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#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 )
|
||||
|
|
|
@ -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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -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
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue