Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
f6278456
Commit
f6278456
authored
Jul 06, 2006
by
Robert Shearman
Committed by
Alexandre Julliard
Jul 07, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widl: Add support for the builtin constants "TRUE" and "FALSE".
parent
5f453db5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
2 deletions
+24
-2
header.c
tools/widl/header.c
+6
-0
parser.l
tools/widl/parser.l
+3
-1
parser.y
tools/widl/parser.y
+7
-1
typegen.c
tools/widl/typegen.c
+7
-0
widltypes.h
tools/widl/widltypes.h
+1
-0
No files found.
tools/widl/header.c
View file @
f6278456
...
...
@@ -410,6 +410,12 @@ void write_expr(FILE *h, const expr_t *e, int brackets)
case
EXPR_HEXNUM
:
fprintf
(
h
,
"0x%lx"
,
e
->
u
.
lval
);
break
;
case
EXPR_TRUEFALSE
:
if
(
e
->
u
.
lval
==
0
)
fprintf
(
h
,
"FALSE"
);
else
fprintf
(
h
,
"TRUE"
);
break
;
case
EXPR_IDENTIFIER
:
fprintf
(
h
,
"%s"
,
e
->
u
.
sval
);
break
;
...
...
tools/widl/parser.l
View file @
f6278456
...
...
@@ -172,6 +172,8 @@ static struct keyword {
int token;
int val;
} keywords[] = {
{"FALSE", tFALSE},
{"TRUE", tTRUE},
{"__cdecl", tCDECL},
{"__int64", tINT64},
{"__stdcall", tSTDCALL},
...
...
@@ -307,7 +309,7 @@ static struct keyword {
{"version", tVERSION},
{"void", tVOID},
{"wchar_t", tWCHAR},
{"wire_marshal", tWIREMARSHAL}
{"wire_marshal", tWIREMARSHAL}
,
};
#define NKEYWORDS (sizeof(keywords)/sizeof(keywords[0]))
#define KWP(p) ((const struct keyword *)(p))
...
...
tools/widl/parser.y
View file @
f6278456
...
...
@@ -141,6 +141,7 @@ static type_t std_uhyper = { "MIDL_uhyper" };
%token tENDPOINT
%token tENTRY tENUM tERRORSTATUST
%token tEXPLICITHANDLE tEXTERN
%token tFALSE
%token tFLOAT
%token tHANDLE
%token tHANDLET
...
...
@@ -188,6 +189,7 @@ static type_t std_uhyper = { "MIDL_uhyper" };
%token tSTRING tSTRUCT
%token tSWITCH tSWITCHIS tSWITCHTYPE
%token tTRANSMITAS
%token tTRUE
%token tTYPEDEF
%token tUNION
%token tUNIQUE
...
...
@@ -496,6 +498,8 @@ m_expr: { $$ = make_expr(EXPR_VOID); }
expr: aNUM { $$ = make_exprl(EXPR_NUM, $1); }
| aHEXNUM { $$ = make_exprl(EXPR_HEXNUM, $1); }
| tFALSE { $$ = make_exprl(EXPR_TRUEFALSE, 0); }
| tTRUE { $$ = make_exprl(EXPR_TRUEFALSE, 1); }
| aIDENTIFIER { $$ = make_exprs(EXPR_IDENTIFIER, $1); }
| expr '?' expr ':' expr { $$ = make_expr3(EXPR_COND, $1, $3, $5); }
| expr '|' expr { $$ = make_expr2(EXPR_OR , $1, $3); }
...
...
@@ -859,7 +863,9 @@ static expr_t *make_exprl(enum expr_type type, long val)
e->is_const = FALSE;
INIT_LINK(e);
/* check for numeric constant */
if (type == EXPR_NUM || type == EXPR_HEXNUM) {
if (type == EXPR_NUM || type == EXPR_HEXNUM || type == EXPR_TRUEFALSE) {
/* make sure true/false value is valid */
assert(type != EXPR_TRUEFALSE || val == 0 || val == 1);
e->is_const = TRUE;
e->cval = val;
}
...
...
tools/widl/typegen.c
View file @
f6278456
...
...
@@ -73,6 +73,7 @@ static int compare_expr(const expr_t *a, const expr_t *b)
{
case
EXPR_NUM
:
case
EXPR_HEXNUM
:
case
EXPR_TRUEFALSE
:
return
a
->
u
.
lval
-
b
->
u
.
lval
;
case
EXPR_IDENTIFIER
:
return
strcmp
(
a
->
u
.
sval
,
b
->
u
.
sval
);
...
...
@@ -1957,6 +1958,12 @@ static void write_struct_expr(FILE *h, const expr_t *e, int brackets,
case
EXPR_HEXNUM
:
fprintf
(
h
,
"0x%lx"
,
e
->
u
.
lval
);
break
;
case
EXPR_TRUEFALSE
:
if
(
e
->
u
.
lval
==
0
)
fprintf
(
h
,
"FALSE"
);
else
fprintf
(
h
,
"TRUE"
);
break
;
case
EXPR_IDENTIFIER
:
{
const
var_t
*
field
;
...
...
tools/widl/widltypes.h
View file @
f6278456
...
...
@@ -156,6 +156,7 @@ enum expr_type
EXPR_AND
,
EXPR_OR
,
EXPR_COND
,
EXPR_TRUEFALSE
,
};
enum
type_kind
...
...
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