Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
42418fbb
Commit
42418fbb
authored
Sep 12, 2006
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wrc: Change the prefix on bison-generated names to avoid the name-prefix directive.
parent
4f0fa260
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
124 additions
and
125 deletions
+124
-125
newstruc.c
tools/wrc/newstruc.c
+22
-22
parser.h
tools/wrc/parser.h
+5
-5
parser.l
tools/wrc/parser.l
+39
-38
parser.y
tools/wrc/parser.y
+47
-49
utils.c
tools/wrc/utils.c
+4
-4
utils.h
tools/wrc/utils.h
+2
-2
wrc.c
tools/wrc/wrc.c
+5
-5
No files found.
tools/wrc/newstruc.c
View file @
42418fbb
...
...
@@ -327,7 +327,7 @@ static int convert_bitmap(char *data, int size)
type
|=
FL_SIZEBE
|
FL_OS2
;
}
else
yy
error
(
"Invalid bitmap format, bih->biSize = %ld"
,
bih
->
biSize
);
parser_
error
(
"Invalid bitmap format, bih->biSize = %ld"
,
bih
->
biSize
);
switch
(
type
)
{
...
...
@@ -336,12 +336,12 @@ static int convert_bitmap(char *data, int size)
case
FL_SIZEBE
:
case
FL_SIZEBE
|
FL_V4
:
case
FL_SIZEBE
|
FL_OS2
:
yy
warning
(
"Bitmap v%c signature little-endian, but size big-endian"
,
type
&
FL_V4
?
'4'
:
'3'
);
parser_
warning
(
"Bitmap v%c signature little-endian, but size big-endian"
,
type
&
FL_V4
?
'4'
:
'3'
);
break
;
case
FL_SIGBE
:
case
FL_SIGBE
|
FL_V4
:
case
FL_SIGBE
|
FL_OS2
:
yy
warning
(
"Bitmap v%c signature big-endian, but size little-endian"
,
type
&
FL_V4
?
'4'
:
'3'
);
parser_
warning
(
"Bitmap v%c signature big-endian, but size little-endian"
,
type
&
FL_V4
?
'4'
:
'3'
);
break
;
}
...
...
@@ -461,7 +461,7 @@ static void split_icons(raw_data_t *rd, icon_group_t *icog, int *nico)
else
if
(
BYTESWAP_WORD
(
ih
->
type
)
==
1
)
swap
=
1
;
else
yy
error
(
"Icon resource data has invalid type id %d"
,
ih
->
type
);
parser_
error
(
"Icon resource data has invalid type id %d"
,
ih
->
type
);
cnt
=
swap
?
BYTESWAP_WORD
(
ih
->
count
)
:
ih
->
count
;
for
(
i
=
0
;
i
<
cnt
;
i
++
)
...
...
@@ -481,7 +481,7 @@ static void split_icons(raw_data_t *rd, icon_group_t *icog, int *nico)
}
if
(
ide
.
offset
>
rd
->
size
||
ide
.
offset
+
ide
.
ressize
>
rd
->
size
)
yy
error
(
"Icon resource data corrupt"
);
parser_
error
(
"Icon resource data corrupt"
);
ico
->
width
=
ide
.
width
;
ico
->
height
=
ide
.
height
;
ico
->
nclr
=
ide
.
nclr
;
...
...
@@ -556,7 +556,7 @@ static void split_cursors(raw_data_t *rd, cursor_group_t *curg, int *ncur)
else
if
(
BYTESWAP_WORD
(
ch
->
type
)
==
2
)
swap
=
1
;
else
yy
error
(
"Cursor resource data has invalid type id %d"
,
ch
->
type
);
parser_
error
(
"Cursor resource data has invalid type id %d"
,
ch
->
type
);
cnt
=
swap
?
BYTESWAP_WORD
(
ch
->
count
)
:
ch
->
count
;
for
(
i
=
0
;
i
<
cnt
;
i
++
)
{
...
...
@@ -575,7 +575,7 @@ static void split_cursors(raw_data_t *rd, cursor_group_t *curg, int *ncur)
}
if
(
cde
.
offset
>
rd
->
size
||
cde
.
offset
+
cde
.
ressize
>
rd
->
size
)
yy
error
(
"Cursor resource data corrupt"
);
parser_
error
(
"Cursor resource data corrupt"
);
cur
->
width
=
cde
.
width
;
cur
->
height
=
cde
.
height
;
cur
->
nclr
=
cde
.
nclr
;
...
...
@@ -598,7 +598,7 @@ static void split_cursors(raw_data_t *rd, cursor_group_t *curg, int *ncur)
cur
->
bits
=
info
.
biBitCount
;
}
if
(
!
win32
&&
(
cur
->
planes
!=
1
||
cur
->
bits
!=
1
))
yy
warning
(
"Win16 cursor contains colors"
);
parser_
warning
(
"Win16 cursor contains colors"
);
cur
->
xhot
=
swap
?
BYTESWAP_WORD
(
cde
.
xhot
)
:
cde
.
xhot
;
cur
->
yhot
=
swap
?
BYTESWAP_WORD
(
cde
.
yhot
)
:
cde
.
yhot
;
cur
->
data
=
new_raw_data
();
...
...
@@ -745,21 +745,21 @@ static void handle_ani_icon(riff_tag_t *rtp, enum res_e type, int isswapped)
if
(
type
==
res_anicur
&&
ctype
!=
2
&&
!
once
)
{
yy
warning
(
"Animated cursor contains invalid
\"
icon
\"
tag cursor-file (%d->%s)"
,
parser_
warning
(
"Animated cursor contains invalid
\"
icon
\"
tag cursor-file (%d->%s)"
,
ctype
,
ctype
==
1
?
"icontype"
:
"?"
);
once
++
;
}
else
if
(
type
==
res_aniico
&&
ctype
!=
1
&&
!
once
)
{
yy
warning
(
"Animated icon contains invalid
\"
icon
\"
tag icon-file (%d->%s)"
,
parser_
warning
(
"Animated icon contains invalid
\"
icon
\"
tag icon-file (%d->%s)"
,
ctype
,
ctype
==
2
?
"cursortype"
:
"?"
);
once
++
;
}
else
if
(
ctype
!=
1
&&
ctype
!=
2
&&
!
once
)
{
yy
warning
(
"Animated %s contains invalid
\"
icon
\"
tag file-type (%d; neither icon nor cursor)"
,
anistr
,
ctype
);
parser_
warning
(
"Animated %s contains invalid
\"
icon
\"
tag file-type (%d; neither icon nor cursor)"
,
anistr
,
ctype
);
once
++
;
}
...
...
@@ -768,7 +768,7 @@ static void handle_ani_icon(riff_tag_t *rtp, enum res_e type, int isswapped)
DWORD
ofs
=
isswapped
?
BYTESWAP_DWORD
(
cdp
[
i
].
offset
)
:
cdp
[
i
].
offset
;
DWORD
sze
=
isswapped
?
BYTESWAP_DWORD
(
cdp
[
i
].
ressize
)
:
cdp
[
i
].
ressize
;
if
(
ofs
>
rtp
->
size
||
ofs
+
sze
>
rtp
->
size
)
yy
error
(
"Animated %s's data corrupt"
,
anistr
);
parser_
error
(
"Animated %s's data corrupt"
,
anistr
);
convert_bitmap
((
char
*
)
chp
+
ofs
,
0
);
cdp
[
i
].
xhot
=
BYTESWAP_WORD
(
cdp
->
xhot
);
cdp
[
i
].
yhot
=
BYTESWAP_WORD
(
cdp
->
yhot
);
...
...
@@ -840,7 +840,7 @@ ani_curico_t *new_ani_curico(enum res_e type, raw_data_t *rd, int *memopt)
else
if
(
rtp
->
size
+
2
*
sizeof
(
DWORD
)
==
rd
->
size
)
isswapped
=
0
;
else
yy
error
(
"Animated %s has an invalid RIFF length"
,
anistr
);
parser_
error
(
"Animated %s has an invalid RIFF length"
,
anistr
);
switch
(
byteorder
)
{
...
...
@@ -933,7 +933,7 @@ ani_curico_t *new_ani_curico(enum res_e type, raw_data_t *rd, int *memopt)
/* We must end correctly here */
if
((
char
*
)
rtp
!=
(
char
*
)
rd
->
data
+
rd
->
size
)
yy
error
(
"Animated %s contains invalid field size(s)"
,
anistr
);
parser_
error
(
"Animated %s contains invalid field size(s)"
,
anistr
);
}
ani
->
data
=
rd
;
...
...
@@ -1002,7 +1002,7 @@ messagetable_t *new_messagetable(raw_data_t *rd, int *memopt)
msg
->
memopt
=
WRC_MO_MOVEABLE
|
WRC_MO_PURE
;
if
(
rd
->
size
<
sizeof
(
DWORD
))
yy
error
(
"Invalid messagetable, size too small"
);
parser_
error
(
"Invalid messagetable, size too small"
);
nblk
=
*
(
DWORD
*
)
rd
->
data
;
lo
=
WRC_LOWORD
(
nblk
);
...
...
@@ -1019,7 +1019,7 @@ messagetable_t *new_messagetable(raw_data_t *rd, int *memopt)
if
(
hi
&&
lo
)
internal_error
(
__FILE__
,
__LINE__
,
"Messagetable contains more than 65535 blocks; cannot determine endian"
);
if
(
!
hi
&&
!
lo
)
yy
error
(
"Invalid messagetable block count 0"
);
parser_
error
(
"Invalid messagetable block count 0"
);
if
(
!
hi
&&
lo
)
/* Messagetable byteorder == native byteorder */
{
...
...
@@ -1032,7 +1032,7 @@ messagetable_t *new_messagetable(raw_data_t *rd, int *memopt)
mbp
=
(
msgtab_block_t
*
)
&
(((
DWORD
*
)
rd
->
data
)[
1
]);
if
(
MSGTAB_BAD_PTR
(
mbp
,
rd
->
data
,
rd
->
size
,
nblk
*
sizeof
(
*
mbp
)))
yy
error
(
"Messagetable's blocks are outside of defined data"
);
parser_
error
(
"Messagetable's blocks are outside of defined data"
);
for
(
i
=
0
;
i
<
nblk
;
i
++
)
{
msgtab_entry_t
*
mep
,
*
next_mep
;
...
...
@@ -1043,7 +1043,7 @@ messagetable_t *new_messagetable(raw_data_t *rd, int *memopt)
for
(
id
=
mbp
[
i
].
idlo
;
id
<=
mbp
[
i
].
idhi
;
id
++
)
{
if
(
MSGTAB_BAD_PTR
(
mep
,
rd
->
data
,
rd
->
size
,
mep
->
length
))
yy
error
(
"Messagetable's data for block %d, ID 0x%08lx is outside of defined data"
,
(
int
)
i
,
id
);
parser_
error
(
"Messagetable's data for block %d, ID 0x%08lx is outside of defined data"
,
(
int
)
i
,
id
);
if
(
mep
->
flags
==
1
)
/* Docu says 'flags == 0x0001' for unicode */
{
WORD
*
wp
=
(
WORD
*
)
&
mep
[
1
];
...
...
@@ -1051,7 +1051,7 @@ messagetable_t *new_messagetable(raw_data_t *rd, int *memopt)
int
n
;
if
(
mep
->
length
&
1
)
yy
error
(
"Message 0x%08lx is unicode (block %d), but has odd length (%d)"
,
id
,
(
int
)
i
,
mep
->
length
);
parser_
error
(
"Message 0x%08lx is unicode (block %d), but has odd length (%d)"
,
id
,
(
int
)
i
,
mep
->
length
);
for
(
n
=
0
;
n
<
l
;
n
++
)
wp
[
n
]
=
BYTESWAP_WORD
(
wp
[
n
]);
...
...
@@ -1079,7 +1079,7 @@ messagetable_t *new_messagetable(raw_data_t *rd, int *memopt)
mbp
=
(
msgtab_block_t
*
)
&
(((
DWORD
*
)
rd
->
data
)[
1
]);
nblk
=
BYTESWAP_DWORD
(
nblk
);
if
(
MSGTAB_BAD_PTR
(
mbp
,
rd
->
data
,
rd
->
size
,
nblk
*
sizeof
(
*
mbp
)))
yy
error
(
"Messagetable's blocks are outside of defined data"
);
parser_
error
(
"Messagetable's blocks are outside of defined data"
);
for
(
i
=
0
;
i
<
nblk
;
i
++
)
{
msgtab_entry_t
*
mep
;
...
...
@@ -1096,7 +1096,7 @@ messagetable_t *new_messagetable(raw_data_t *rd, int *memopt)
mep
->
flags
=
BYTESWAP_WORD
(
mep
->
flags
);
if
(
MSGTAB_BAD_PTR
(
mep
,
rd
->
data
,
rd
->
size
,
mep
->
length
))
yy
error
(
"Messagetable's data for block %d, ID 0x%08lx is outside of defined data"
,
(
int
)
i
,
id
);
parser_
error
(
"Messagetable's data for block %d, ID 0x%08lx is outside of defined data"
,
(
int
)
i
,
id
);
if
(
mep
->
flags
==
1
)
/* Docu says 'flags == 0x0001' for unicode */
{
WORD
*
wp
=
(
WORD
*
)
&
mep
[
1
];
...
...
@@ -1104,7 +1104,7 @@ messagetable_t *new_messagetable(raw_data_t *rd, int *memopt)
int
n
;
if
(
mep
->
length
&
1
)
yy
error
(
"Message 0x%08lx is unicode (block %d), but has odd length (%d)"
,
id
,
(
int
)
i
,
mep
->
length
);
parser_
error
(
"Message 0x%08lx is unicode (block %d), but has odd length (%d)"
,
id
,
(
int
)
i
,
mep
->
length
);
for
(
n
=
0
;
n
<
l
;
n
++
)
wp
[
n
]
=
BYTESWAP_WORD
(
wp
[
n
]);
...
...
tools/wrc/parser.h
View file @
42418fbb
...
...
@@ -22,18 +22,18 @@
#define __WRC_PARSER_H
/* From parser.y */
extern
int
yy
debug
;
extern
int
parser_
debug
;
extern
int
want_nl
;
/* Set when getting line-numers */
extern
int
want_id
;
/* Set when getting the resource name */
int
yy
parse
(
void
);
int
parser_
parse
(
void
);
/* From parser.l */
extern
FILE
*
yy
in
;
extern
char
*
yy
text
;
extern
FILE
*
parser_
in
;
extern
char
*
parser_
text
;
extern
int
yy_flex_debug
;
int
yy
lex
(
void
);
int
parser_
lex
(
void
);
#endif
tools/wrc/parser.l
View file @
42418fbb
...
...
@@ -89,6 +89,7 @@
%option stack
%option nounput noyy_top_state
%option 8bit never-interactive
%option prefix="parser_"
/* Some shortcut definitions */
ws [ \f\t\r]
...
...
@@ -329,21 +330,21 @@ static struct keyword *iskeyword(char *kw)
yy_pop_state();
lineno = (int)strtol(yytext, &cptr, 10);
if(!lineno)
yy
error("Malformed '#...' line-directive; invalid linenumber");
parser_
error("Malformed '#...' line-directive; invalid linenumber");
fname = strchr(cptr, '"');
if(!fname)
yy
error("Malformed '#...' line-directive; missing filename");
parser_
error("Malformed '#...' line-directive; missing filename");
fname++;
cptr = strchr(fname, '"');
if(!cptr)
yy
error("Malformed '#...' line-directive; missing terminating \"");
parser_
error("Malformed '#...' line-directive; missing terminating \"");
*cptr = '\0';
line_number = lineno - 1; /* We didn't read the newline */
input_name = xstrdup(fname);
}
<pp_pragma>code_page[^\n]* yyless(9); yy_pop_state(); yy_push_state(pp_code_page);
<pp_pragma>[^\n]* yy_pop_state(); if (pedantic)
yy
warning("Unrecognized #pragma directive '%s'",yytext);
<pp_pragma>[^\n]* yy_pop_state(); if (pedantic)
parser_
warning("Unrecognized #pragma directive '%s'",yytext);
<pp_code_page>\({ws}*default{ws}*\)[^\n]* current_codepage = -1; yy_pop_state();
<pp_code_page>\({ws}*[0-9]+{ws}*\)[^\n]* {
...
...
@@ -353,11 +354,11 @@ static struct keyword *iskeyword(char *kw)
current_codepage = strtol( p, NULL, 10 );
if (current_codepage && !wine_cp_get_table( current_codepage ))
{
yy
error("Codepage %d not supported", current_codepage);
parser_
error("Codepage %d not supported", current_codepage);
current_codepage = 0;
}
}
<pp_code_page>[^\n]* yy_pop_state();
yy
error("Malformed #pragma code_page directive");
<pp_code_page>[^\n]* yy_pop_state();
parser_
error("Malformed #pragma code_page directive");
/*
* Strip everything until a ';' taking
...
...
@@ -392,9 +393,9 @@ static struct keyword *iskeyword(char *kw)
\{ return tBEGIN;
\} return tEND;
[0-9]+[lL]? {
yy
lval.num = strtoul(yytext, 0, 10); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; }
0[xX][0-9A-Fa-f]+[lL]? {
yy
lval.num = strtoul(yytext, 0, 16); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; }
0[oO][0-7]+[lL]? {
yy
lval.num = strtoul(yytext+2, 0, 8); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; }
[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; }
/*
* The next two rules scan identifiers and filenames.
...
...
@@ -410,7 +411,7 @@ static struct keyword *iskeyword(char *kw)
{
if(wanted_id && !tok->alwayskw)
{
yy
lval.str = make_string(yytext);
parser_
lval.str = make_string(yytext);
return tIDENT;
}
else
...
...
@@ -418,11 +419,11 @@ static struct keyword *iskeyword(char *kw)
}
else
{
yy
lval.str = make_string(yytext);
parser_
lval.str = make_string(yytext);
return tIDENT;
}
}
[A-Za-z_0-9./\\]+
yy
lval.str = make_string(yytext); return tFILENAME;
[A-Za-z_0-9./\\]+
parser_
lval.str = make_string(yytext); return tFILENAME;
/*
* Wide string scanning
...
...
@@ -431,19 +432,19 @@ L\" {
yy_push_state(tklstr);
wbufidx = 0;
if(!win32)
yy
warning("16bit resource contains unicode strings\n");
parser_
warning("16bit resource contains unicode strings\n");
}
<tklstr>\"{ws}+ |
<tklstr>\" {
yy_pop_state();
yy
lval.str = get_buffered_wstring();
parser_
lval.str = get_buffered_wstring();
return tSTRING;
}
<tklstr>\\[0-7]{1,6} { /* octal escape sequence */
unsigned int result;
result = strtoul(yytext+1, 0, 8);
if ( result > 0xffff )
yy
error("Character constant out of range");
parser_
error("Character constant out of range");
addwchar((WCHAR)result);
}
<tklstr>\\x[0-9a-fA-F]{4} { /* hex escape sequence */
...
...
@@ -451,9 +452,9 @@ L\" {
result = strtoul(yytext+2, 0, 16);
addwchar((WCHAR)result);
}
<tklstr>\\x[0-9a-fA-F]{1,3} {
yy
error("Invalid hex escape sequence '%s'", yytext); }
<tklstr>\\x[0-9a-fA-F]{1,3} {
parser_
error("Invalid hex escape sequence '%s'", yytext); }
<tklstr>\\[0-9]+
yy
error("Bad escape sequence");
<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');
...
...
@@ -472,7 +473,7 @@ L\" {
while(*yptr) /* FIXME: codepage translation */
addwchar(*yptr++ & 0xff);
}
<tklstr>\n
yy
error("Unterminated string");
<tklstr>\n
parser_
error("Unterminated string");
/*
* Normal string scanning
...
...
@@ -481,14 +482,14 @@ L\" {
<tkstr>\"{ws}+ |
<tkstr>\" {
yy_pop_state();
yy
lval.str = get_buffered_cstring();
parser_
lval.str = get_buffered_cstring();
return tSTRING;
}
<tkstr>\\[0-7]{1,3} { /* octal escape sequence */
int result;
result = strtol(yytext+1, 0, 8);
if ( result > 0xff )
yy
error("Character constant out of range");
parser_
error("Character constant out of range");
addcchar((char)result);
}
<tkstr>\\x[0-9a-fA-F]{2} { /* hex escape sequence */
...
...
@@ -496,9 +497,9 @@ L\" {
result = strtol(yytext+2, 0, 16);
addcchar((char)result);
}
<tkstr>\\x[0-9a-fA-F] {
yy
error("Invalid hex escape sequence '%s'", yytext); }
<tkstr>\\x[0-9a-fA-F] {
parser_
error("Invalid hex escape sequence '%s'", yytext); }
<tkstr>\\[0-9]+
yy
error("Bad escape sequence");
<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');
...
...
@@ -517,7 +518,7 @@ L\" {
<tkstr>\"\" addcchar('\"'); /* "bla""bla" -> "bla\"bla" */
<tkstr>\\\"\" addcchar('\"'); /* "bla\""bla" -> "bla\"bla" */
<tkstr>\"{ws}+\" ; /* "bla" "bla" -> "blabla" */
<tkstr>\n
yy
error("Unterminated string");
<tkstr>\n
parser_
error("Unterminated string");
/*
* Raw data scanning
...
...
@@ -525,10 +526,10 @@ L\" {
\' yy_push_state(tkrcd); cbufidx = 0;
<tkrcd>\' {
yy_pop_state();
yy
lval.raw = new_raw_data();
yy
lval.raw->size = cbufidx;
yylval.raw->data = xmalloc(yy
lval.raw->size);
memcpy(
yylval.raw->data, cbuffer, yy
lval.raw->size);
parser_
lval.raw = new_raw_data();
parser_
lval.raw->size = cbufidx;
parser_lval.raw->data = xmalloc(parser_
lval.raw->size);
memcpy(
parser_lval.raw->data, cbuffer, parser_
lval.raw->size);
return tRAWDATA;
}
<tkrcd>[0-9a-fA-F]{2} {
...
...
@@ -538,7 +539,7 @@ L\" {
}
<tkrcd>{ws}+ ; /* Ignore space */
<tkrcd>\n line_number++; char_number = 1;
<tkrcd>.
yy
error("Malformed data-line");
<tkrcd>.
parser_
error("Malformed data-line");
/*
* Comment stripping
...
...
@@ -548,7 +549,7 @@ L\" {
yy_push_state(comment);
save_wanted_id = wanted_id;
if(!no_preprocess)
yy
warning("Found comments after preprocessing, please report");
parser_
warning("Found comments after preprocessing, please report");
}
<comment>[^*\n]* ;
<comment>"*"+[^*/\n]* ;
...
...
@@ -556,7 +557,7 @@ L\" {
<comment>"*"+"/" yy_pop_state(); want_id = save_wanted_id;
;[^\n]* want_id = wanted_id; /* not really comment, but left-over c-junk */
"//"[^\n]* want_id = wanted_id; if(!no_preprocess)
yy
warning("Found comments after preprocessing, please report");
"//"[^\n]* want_id = wanted_id; if(!no_preprocess)
parser_
warning("Found comments after preprocessing, please report");
\n {
want_id = wanted_id;
...
...
@@ -574,7 +575,7 @@ L\" {
<<EOF>> {
if(YY_START == pp_strips || YY_START == pp_stripe || YY_START == pp_stripp || YY_START == pp_stripp_final)
yy
error("Unexpected end of file during c-junk scanning (started at %d)", cjunk_tagline);
parser_
error("Unexpected end of file during c-junk scanning (started at %d)", cjunk_tagline);
else
yyterminate();
}
...
...
@@ -586,14 +587,14 @@ L\" {
line_number++;
char_number = 1;
}
yy
warning("Unmatched text '%c' (0x%02x) YY_START=%d stripslevel=%d",
parser_
warning("Unmatched text '%c' (0x%02x) YY_START=%d stripslevel=%d",
isprint(*yytext & 0xff) ? *yytext : '.', *yytext, YY_START,stripslevel);
}
%%
#ifndef
yy
wrap
int
yy
wrap(void)
#ifndef
parser_
wrap
int
parser_
wrap(void)
{
#if 0
if(bufferstackidx > 0)
...
...
@@ -615,7 +616,7 @@ static void addcchar(char c)
cbufalloc += 1024;
cbuffer = xrealloc(cbuffer, cbufalloc * sizeof(cbuffer[0]));
if(cbufalloc > 65536)
yy
warning("Reallocating string buffer larger than 64kB");
parser_
warning("Reallocating string buffer larger than 64kB");
}
cbuffer[cbufidx++] = c;
}
...
...
@@ -627,7 +628,7 @@ static void addwchar(WCHAR s)
wbufalloc += 1024;
wbuffer = xrealloc(wbuffer, wbufalloc * sizeof(wbuffer[0]));
if(wbufalloc > 65536)
yy
warning("Reallocating wide string buffer larger than 64kB");
parser_
warning("Reallocating wide string buffer larger than 64kB");
}
wbuffer[wbufidx++] = s;
}
...
...
@@ -644,14 +645,14 @@ static string_t *get_buffered_cstring(void)
if (!current_codepage || current_codepage == -1 || !win32) /* store as ANSI string */
{
if (!current_codepage)
yy
error("Codepage set to Unicode only, cannot use ASCII string here");
if (!current_codepage)
parser_
error("Codepage set to Unicode only, cannot use ASCII string here");
return str;
}
else /* convert to Unicode before storing */
{
string_t *str_w = convert_string( str, str_unicode, current_codepage );
if (!check_unicode_conversion( str, str_w, current_codepage ))
yy
error("String %s does not convert identically to Unicode and back in codepage %d. "
parser_
error("String %s does not convert identically to Unicode and back in codepage %d. "
"Try using a Unicode string instead.", str->str.cstr, current_codepage );
free_string( str );
return str_w;
...
...
tools/wrc/parser.y
View file @
42418fbb
...
...
@@ -282,8 +282,6 @@ static int rsrcid_to_token(int lookahead);
ani_any_t *ani;
}
%name-prefix="yy"
%token tNL
%token
<num>
tNUMBER tLNUMBER
%token
<str>
tSTRING tIDENT tFILENAME
...
...
@@ -421,7 +419,7 @@ resources
&&
rsc->lan->sub
==
head->lan->sub
&&
!compare_name_id(rsc->name,
head->name))
{
yy
error("Duplicate
resource
name
'%s'",
get_nameid_str(rsc->name));
parser_
error("Duplicate
resource
name
'%s'",
get_nameid_str(rsc->name));
}
rsc
=
rsc-
>
prev
;
}
...
...
@@ -478,7 +476,7 @@ resource
if($$)
{
if($1
>
65535
||
$1
<
-32768)
yy
error("Resource's
ID
out
of
range
(%d)",
$1);
parser_
error("Resource's
ID
out
of
range
(%d)",
$1);
$$->name
=
new_name_id();
$$->name->type
=
name_ord;
$$->name->name.i_name
=
$1;
...
...
@@ -527,16 +525,16 @@ resource
yychar
=
YYEMPTY;
/* Could use 'yyclearin', but we already need the*/
/* direct access to yychar in rule 'usrcvt' below. */
else
if(yychar
==
tIDENT)
yy
warning("LANGUAGE
statement
not
delimited
with
newline;
next
identifier
might
be
wrong");
parser_
warning("LANGUAGE
statement
not
delimited
with
newline;
next
identifier
might
be
wrong");
want_nl
=
0;
/* We don't want it anymore if we didn't get it */
if(!win32)
yy
warning("LANGUAGE
not
supported
in
16-bit
mode");
parser_
warning("LANGUAGE
not
supported
in
16-bit
mode");
if(currentlanguage)
free(currentlanguage);
if
(get_language_codepage($3,
$5)
==
-1)
yy
error(
"Language
%04x
is
not
supported",
($5<<10)
+
$3);
parser_
error(
"Language
%04x
is
not
supported",
($5<<10)
+
$3);
currentlanguage
=
new_language($3,
$5);
$$
=
NULL;
chat("Got
LANGUAGE
%d,%d
(0x%04x)",
$3,
$5,
($5<<10)
+
$3);
...
...
@@ -555,7 +553,7 @@ usrcvt : /* Empty */ { yychar = rsrcid_to_token(yychar); }
*/
nameid
:
expr
{
if($1
>
65535
||
$1
<
-32768)
yy
error("Resource's
ID
out
of
range
(%d)",
$1);
parser_
error("Resource's
ID
out
of
range
(%d)",
$1);
$$
=
new_name_id();
$$->type
=
name_ord;
$$->name.i_name
=
$1;
...
...
@@ -724,7 +722,7 @@ fontdir : tFONTDIR loadmemopts file_raw { $$ = new_fontdir($3, $2); }
messagetable
:
tMESSAGETABLE
loadmemopts
file_raw
{
if(!win32)
yy
warning("MESSAGETABLE
not
supported
in
16-bit
mode");
parser_
warning("MESSAGETABLE
not
supported
in
16-bit
mode");
$$
=
new_messagetable($3,
$2);
}
;
...
...
@@ -748,7 +746,7 @@ userres : usertype loadmemopts file_raw {
#else
if(pedantic
&&
byteorder
==
WRC_BO_BIG)
#endif
yy
warning("Byteordering
is
not
little-endian
and
type
cannot
be
interpreted");
parser_
warning("Byteordering
is
not
little-endian
and
type
cannot
be
interpreted");
$$
=
new_user($1,
$3,
$2);
}
;
...
...
@@ -779,7 +777,7 @@ accelerators
$$->memopt
=
WRC_MO_MOVEABLE
|
WRC_MO_PURE;
}
if
(!
$
5
)
yy
error
(
"Accelerator table must have at least one entry"
);
parser_
error
(
"Accelerator table must have at least one entry"
);
$$
-
>
events
=
get_event_head
(
$
5
);
if
(
$
3
)
{
...
...
@@ -1030,7 +1028,7 @@ ctlclass
dialogex
:
tDIALOGEX
loadmemopts
expr
','
expr
','
expr
','
expr
helpid
dlgex_attribs
tBEGIN
exctrls
tEND
{
if(!win32)
yy
warning("DIALOGEX
not
supported
in
16-bit
mode");
parser_
warning("DIALOGEX
not
supported
in
16-bit
mode");
if($2)
{
$11->memopt
=
*($2);
...
...
@@ -1227,7 +1225,7 @@ opt_expr: /* Empty */ { $$ = NULL; }
/* ------------------------------ Menu ------------------------------ */
menu
:
tMENU
loadmemopts
opt_lvc
menu_body
{
if(!$4)
yy
error("Menu
must
contain
items");
parser_
error("Menu
must
contain
items");
$$
=
new_menu();
if($2)
{
...
...
@@ -1299,9 +1297,9 @@ item_options
/* ------------------------------ MenuEx ------------------------------ */
menuex
:
tMENUEX
loadmemopts
opt_lvc
menuex_body
{
if(!win32)
yy
warning("MENUEX
not
supported
in
16-bit
mode");
parser_
warning("MENUEX
not
supported
in
16-bit
mode");
if(!$4)
yy
error("MenuEx
must
contain
items");
parser_
error("MenuEx
must
contain
items");
$$
=
new_menuex();
if($2)
{
...
...
@@ -1435,7 +1433,7 @@ stringtable
:
stt_head
tBEGIN
strings
tEND
{
if(!$3)
{
yy
error("Stringtable
must
have
at
least
one
entry");
parser_
error("Stringtable
must
have
at
least
one
entry");
}
else
{
...
...
@@ -1489,12 +1487,12 @@ strings : /* Empty */ { $$ = NULL; }
int
i;
assert(tagstt
!=
NULL);
if($2
>
65535
||
$2
<
-32768)
yy
error("Stringtable
entry's
ID
out
of
range
(%d)",
$2);
parser_
error("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)
yy
error("Stringtable
ID
%d
already
in
use",
$2);
parser_
error("Stringtable
ID
%d
already
in
use",
$2);
}
/* If we get here, then we have a new unique entry */
tagstt-
>
nentries
++;
...
...
@@ -1509,11 +1507,11 @@ strings : /* Empty */ { $$ = NULL; }
tagstt-
>
entries
[
tagstt-
>
nentries-1
]
.characts
=
tagstt_characts
;
if
(
pedantic
&&
!
$
4-
>
size
)
yy
warning
(
"Zero length strings make no sense"
);
parser_
warning
(
"Zero length strings make no sense"
);
if
(!
win32
&&
$
4-
>
size
>
254
)
yy
error
(
"Stringtable entry more than 254 characters"
);
parser_
error
(
"Stringtable entry more than 254 characters"
);
if
(
win32
&&
$
4-
>
size
>
65534
)
/* Hmm..., does this happen? */
yy
error
(
"Stringtable entry more than 65534 characters (probably something else that went wrong)"
);
parser_
error
(
"Stringtable entry more than 65534 characters (probably something else that went wrong)"
);
$$
=
tagstt
;
}
;
...
...
@@ -1544,7 +1542,7 @@ fix_version
:
/* Empty */
{
$$
=
new_versioninfo();
}
|
fix_version
tFILEVERSION
expr
','
expr
','
expr
','
expr
{
if($1->gotit.fv)
yy
error("FILEVERSION
already
defined");
parser_
error("FILEVERSION
already
defined");
$$
=
$1;
$$->filever_maj1
=
$3;
$$->filever_maj2
=
$5;
...
...
@@ -1554,7 +1552,7 @@ fix_version
}
|
fix_version
tPRODUCTVERSION
expr
','
expr
','
expr
','
expr
{
if($1->gotit.pv)
yy
error("PRODUCTVERSION
already
defined");
parser_
error("PRODUCTVERSION
already
defined");
$$
=
$1;
$$->prodver_maj1
=
$3;
$$->prodver_maj2
=
$5;
...
...
@@ -1564,35 +1562,35 @@ fix_version
}
|
fix_version
tFILEFLAGS
expr
{
if($1->gotit.ff)
yy
error("FILEFLAGS
already
defined");
parser_
error("FILEFLAGS
already
defined");
$$
=
$1;
$$->fileflags
=
$3;
$$->gotit.ff
=
1;
}
|
fix_version
tFILEFLAGSMASK
expr
{
if($1->gotit.ffm)
yy
error("FILEFLAGSMASK
already
defined");
parser_
error("FILEFLAGSMASK
already
defined");
$$
=
$1;
$$->fileflagsmask
=
$3;
$$->gotit.ffm
=
1;
}
|
fix_version
tFILEOS
expr
{
if($1->gotit.fo)
yy
error("FILEOS
already
defined");
parser_
error("FILEOS
already
defined");
$$
=
$1;
$$->fileos
=
$3;
$$->gotit.fo
=
1;
}
|
fix_version
tFILETYPE
expr
{
if($1->gotit.ft)
yy
error("FILETYPE
already
defined");
parser_
error("FILETYPE
already
defined");
$$
=
$1;
$$->filetype
=
$3;
$$->gotit.ft
=
1;
}
|
fix_version
tFILESUBTYPE
expr
{
if($1->gotit.fst)
yy
error("FILESUBTYPE
already
defined");
parser_
error("FILESUBTYPE
already
defined");
$$
=
$1;
$$->filesubtype
=
$3;
$$->gotit.fst
=
1;
...
...
@@ -1735,25 +1733,25 @@ lama : tLOADONCALL { $$ = new_int(~WRC_MO_PRELOAD); }
opt_lvc
:
/* Empty */
{
$$
=
new_lvc();
}
|
opt_lvc
opt_language
{
if(!win32)
yy
warning("LANGUAGE
not
supported
in
16-bit
mode");
parser_
warning("LANGUAGE
not
supported
in
16-bit
mode");
if($1->language)
yy
error("Language
already
defined");
parser_
error("Language
already
defined");
$$
=
$1;
$1->language
=
$2;
}
|
opt_lvc
opt_characts
{
if(!win32)
yy
warning("CHARACTERISTICS
not
supported
in
16-bit
mode");
parser_
warning("CHARACTERISTICS
not
supported
in
16-bit
mode");
if($1->characts)
yy
error("Characteristics
already
defined");
parser_
error("Characteristics
already
defined");
$$
=
$1;
$1->characts
=
$2;
}
|
opt_lvc
opt_version
{
if(!win32)
yy
warning("VERSION
not
supported
in
16-bit
mode");
parser_
warning("VERSION
not
supported
in
16-bit
mode");
if($1->version)
yy
error("Version
already
defined");
parser_
error("Version
already
defined");
$$
=
$1;
$1->version
=
$2;
}
...
...
@@ -1769,7 +1767,7 @@ opt_lvc : /* Empty */ { $$ = new_lvc(); }
opt_language
:
tLANGUAGE
expr
','
expr
{
$$
=
new_language($2,
$4);
if
(get_language_codepage($2,
$4)
==
-1)
yy
error(
"Language
%04x
is
not
supported",
($4<<10)
+
$2);
parser_
error(
"Language
%04x
is
not
supported",
($4<<10)
+
$2);
}
;
...
...
@@ -1859,7 +1857,7 @@ static dialog_t *dialog_style(style_t * st, dialog_t *dlg)
if
(
dlg-
>
gotstyle
)
{
yy
warning("Style
already
defined,
or-ing
together");
parser_
warning("Style
already
defined,
or-ing
together");
}
else
{
...
...
@@ -1883,7 +1881,7 @@ static dialog_t *dialog_exstyle(style_t *st, dialog_t *dlg)
if
(
dlg-
>
gotexstyle
)
{
yy
warning("ExStyle
already
defined,
or-ing
together");
parser_
warning("ExStyle
already
defined,
or-ing
together");
}
else
{
...
...
@@ -1901,7 +1899,7 @@ static dialog_t *dialog_caption(string_t *s, dialog_t *dlg)
{
assert(dlg
!=
NULL);
if(dlg->title)
yy
error("Caption
already
defined");
parser_
error("Caption
already
defined");
dlg->title
=
s;
return
dlg;
}
...
...
@@ -1910,7 +1908,7 @@ static dialog_t *dialog_font(font_id_t *f, dialog_t *dlg)
{
assert(dlg
!=
NULL);
if(dlg->font)
yy
error("Font
already
defined");
parser_
error("Font
already
defined");
dlg->font
=
f;
return
dlg;
}
...
...
@@ -1919,7 +1917,7 @@ static dialog_t *dialog_class(name_id_t *n, dialog_t *dlg)
{
assert(dlg
!=
NULL);
if(dlg->dlgclass)
yy
error("Class
already
defined");
parser_
error("Class
already
defined");
dlg->dlgclass
=
n;
return
dlg;
}
...
...
@@ -2031,7 +2029,7 @@ static control_t *ins_ctrl(int type, int special_style, control_t *ctrl, control
defaultstyle
|=
WS_TABSTOP
;
break;
default
:
yy
warning
(
"Unknown default button control-style 0x%08x"
,
special_style
);
parser_
warning
(
"Unknown default button control-style 0x%08x"
,
special_style
);
case
BS_GROUPBOX
:
case
BS_RADIOBUTTON
:
break
;
...
...
@@ -2049,7 +2047,7 @@ static control_t *ins_ctrl(int type, int special_style, control_t *ctrl, control
case
SS_ICON
:
/* Special case */
break
;
default
:
yy
warning
(
"Unknown default static control-style 0x%08x"
,
special_style
);
parser_
warning
(
"Unknown default static control-style 0x%08x"
,
special_style
);
break;
}
break
;
...
...
@@ -2134,7 +2132,7 @@ static dialogex_t *dialogex_style(style_t * st, dialogex_t *dlg)
if
(
dlg-
>
gotstyle
)
{
yy
warning("Style
already
defined,
or-ing
together");
parser_
warning("Style
already
defined,
or-ing
together");
}
else
{
...
...
@@ -2158,7 +2156,7 @@ static dialogex_t *dialogex_exstyle(style_t * st, dialogex_t *dlg)
if
(
dlg-
>
gotexstyle
)
{
yy
warning("ExStyle
already
defined,
or-ing
together");
parser_
warning("ExStyle
already
defined,
or-ing
together");
}
else
{
...
...
@@ -2336,7 +2334,7 @@ static raw_data_t *int2raw_data(int i)
if(
(
i
>=
0
&&
(int)((unsigned
short)i)
!=
i)
||
(
i
<
0
&&
(int)((short)i)
!=
i)
)
yy
warning("Integer
constant
out
of
16bit
range
(%d),
truncated
to
%d\n",
i,
(short)i);
parser_
warning("Integer
constant
out
of
16bit
range
(%d),
truncated
to
%d\n",
i,
(short)i);
rd
=
new_raw_data();
rd->size
=
sizeof(short);
...
...
@@ -2554,12 +2552,12 @@ static stringtable_t *find_stringtable(lvc_t *lvc)
if((stt->lvc.version && lvc->version && *(stt->lvc.version) != *(lvc->version))
|| (!stt->lvc.version && lvc->version)
|| (stt->lvc.version && !lvc->version))
yy
warning("Stringtable's versions are not the same, using first definition");
parser_
warning("Stringtable's versions are not the same, using first definition");
if((stt->lvc.characts && lvc->characts && *(stt->lvc.characts) != *(lvc->characts))
|| (!stt->lvc.characts && lvc->characts)
|| (stt->lvc.characts && !lvc->characts))
yy
warning("Stringtable's characteristics are not the same, using first definition");
parser_
warning("Stringtable's characteristics are not the same, using first definition");
*/
return
stt;
}
...
...
@@ -3029,13 +3027,13 @@ static int rsrcid_to_token(int lookahead)
case
WRC_RT_ANIICON
:
case
WRC_RT_GROUP_CURSOR
:
case
WRC_RT_GROUP_ICON
:
yy
warning
(
"Usertype uses reserved type ID %d, which is auto-generated"
,
yylval
.
num
);
parser_
warning
(
"Usertype uses reserved type ID %d, which is auto-generated"
,
yylval
.
num
);
return
lookahead;
case
WRC_RT_DLGINCLUDE
:
case
WRC_RT_PLUGPLAY
:
case
WRC_RT_VXD
:
yy
warning
(
"Usertype uses reserved type ID %d, which is not supported by wrc yet"
,
yylval
.
num
);
parser_
warning
(
"Usertype uses reserved type ID %d, which is not supported by wrc yet"
,
yylval
.
num
);
default
:
return
lookahead
;
}
...
...
tools/wrc/utils.c
View file @
42418fbb
...
...
@@ -68,21 +68,21 @@ static void generic_msg(const char *s, const char *t, const char *n, va_list ap)
}
int
yy
error
(
const
char
*
s
,
...)
int
parser_
error
(
const
char
*
s
,
...)
{
va_list
ap
;
va_start
(
ap
,
s
);
generic_msg
(
s
,
"Error"
,
yy
text
,
ap
);
generic_msg
(
s
,
"Error"
,
parser_
text
,
ap
);
va_end
(
ap
);
exit
(
1
);
return
1
;
}
int
yy
warning
(
const
char
*
s
,
...)
int
parser_
warning
(
const
char
*
s
,
...)
{
va_list
ap
;
va_start
(
ap
,
s
);
generic_msg
(
s
,
"Warning"
,
yy
text
,
ap
);
generic_msg
(
s
,
"Warning"
,
parser_
text
,
ap
);
va_end
(
ap
);
return
0
;
}
...
...
tools/wrc/utils.h
View file @
42418fbb
...
...
@@ -33,8 +33,8 @@ char *xstrdup(const char *str);
#define __attribute__(X)
#endif
int
yy
error
(
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
int
yy
warning
(
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
int
parser_
error
(
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
int
parser_
warning
(
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
void
internal_error
(
const
char
*
file
,
int
line
,
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
3
,
4
),
noreturn
));
void
error
(
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
void
warning
(
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
...
...
tools/wrc/wrc.c
View file @
42418fbb
...
...
@@ -166,7 +166,7 @@ int char_number = 1; /* The current char pos within the line */
char
*
cmdline
;
/* The entire commandline */
time_t
now
;
/* The time of start of wrc */
int
yy
debug
,
yy_flex_debug
;
int
parser_
debug
,
yy_flex_debug
;
resource_t
*
resource_top
;
/* The top of the parsed resources */
...
...
@@ -424,7 +424,7 @@ int main(int argc,char *argv[])
setbuf
(
stderr
,
0
);
}
yy
debug
=
debuglevel
&
DEBUGLEVEL_TRACE
?
1
:
0
;
parser_
debug
=
debuglevel
&
DEBUGLEVEL_TRACE
?
1
:
0
;
yy_flex_debug
=
debuglevel
&
DEBUGLEVEL_TRACE
?
1
:
0
;
wpp_set_debug
(
(
debuglevel
&
DEBUGLEVEL_PPLEX
)
!=
0
,
...
...
@@ -486,12 +486,12 @@ int main(int argc,char *argv[])
/* Go from .rc to .res */
chat
(
"Starting parse"
);
if
(
!
(
yy
in
=
fopen
(
input_name
,
"rb"
)))
if
(
!
(
parser_
in
=
fopen
(
input_name
,
"rb"
)))
error
(
"Could not open %s for input
\n
"
,
input_name
);
ret
=
yy
parse
();
ret
=
parser_
parse
();
if
(
input_name
)
fclose
(
yy
in
);
if
(
input_name
)
fclose
(
parser_
in
);
if
(
ret
)
exit
(
1
);
/* Error during parse */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment