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
7f0abaff
Commit
7f0abaff
authored
Apr 19, 2004
by
Robert Shearman
Committed by
Alexandre Julliard
Apr 19, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Handle "? :" conditionals.
- Allow [handle] attribute for types.
parent
a9805619
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
0 deletions
+42
-0
header.c
tools/widl/header.c
+9
-0
parser.l
tools/widl/parser.l
+1
-0
parser.y
tools/widl/parser.y
+29
-0
widltypes.h
tools/widl/widltypes.h
+3
-0
No files found.
tools/widl/header.c
View file @
7f0abaff
...
...
@@ -378,6 +378,15 @@ static void do_write_expr(FILE *h, expr_t *e, int p)
do_write_expr
(
h
,
e
->
u
.
ext
,
1
);
if
(
p
)
fprintf
(
h
,
")"
);
break
;
case
EXPR_COND
:
if
(
p
)
fprintf
(
h
,
"("
);
do_write_expr
(
h
,
e
->
ref
,
1
);
fprintf
(
h
,
" ? "
);
do_write_expr
(
h
,
e
->
u
.
ext
,
1
);
fprintf
(
h
,
" : "
);
do_write_expr
(
h
,
e
->
ext2
,
1
);
if
(
p
)
fprintf
(
h
,
")"
);
break
;
}
}
...
...
tools/widl/parser.l
View file @
7f0abaff
...
...
@@ -221,6 +221,7 @@ static struct keyword {
/* ... */
{"float", tFLOAT},
/* ... */
{"handle", tHANDLE},
{"handle_t", tHANDLET},
/* ... */
{"helpstring", tHELPSTRING},
...
...
tools/widl/parser.y
View file @
7f0abaff
...
...
@@ -72,6 +72,7 @@ static expr_t *make_exprs(enum expr_type type, char *val);
static expr_t *make_exprt(enum expr_type type, typeref_t *tref, expr_t *expr);
static expr_t *make_expr1(enum expr_type type, expr_t *expr);
static expr_t *make_expr2(enum expr_type type, expr_t *exp1, expr_t *exp2);
static expr_t *make_expr3(enum expr_type type, expr_t *exp1, expr_t *exp2, expr_t *exp3);
static type_t *make_type(BYTE type, type_t *ref);
static typeref_t *make_tref(char *name, type_t *ref);
static typeref_t *uniq_tref(typeref_t *ref);
...
...
@@ -134,6 +135,7 @@ static type_t std_uhyper = { "MIDL_uhyper" };
%token tENTRY tENUM tERRORSTATUST
%token tEXTERN
%token tFLOAT
%token tHANDLE
%token tHANDLET
%token tHELPSTRING
%token tHYPER tID tIDEMPOTENT
...
...
@@ -327,6 +329,7 @@ attribute:
| tDUAL { $$ = make_attr(ATTR_DUAL); }
| tENTRY '(' aSTRING ')' { $$ = make_attrp(ATTR_ENTRY_STRING, $3); }
| tENTRY '(' expr_const ')' { $$ = make_attrp(ATTR_ENTRY_ORDINAL, $3); }
| tHANDLE { $$ = make_attr(ATTR_HANDLE); }
| tHELPSTRING '(' aSTRING ')' { $$ = make_attrp(ATTR_HELPSTRING, $3); }
| tID '(' expr_const ')' { $$ = make_attrp(ATTR_ID, $3); }
| tIDEMPOTENT { $$ = make_attr(ATTR_IDEMPOTENT); }
...
...
@@ -430,6 +433,7 @@ m_expr: { $$ = make_expr(EXPR_VOID); }
expr: aNUM { $$ = make_exprl(EXPR_NUM, $1); }
| aHEXNUM { $$ = make_exprl(EXPR_HEXNUM, $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); }
| expr '&' expr { $$ = make_expr2(EXPR_AND, $1, $3); }
| expr '+' expr { $$ = make_expr2(EXPR_ADD, $1, $3); }
...
...
@@ -884,6 +888,31 @@ static expr_t *make_expr2(enum expr_type type, expr_t *expr1, expr_t *expr2)
return e;
}
static expr_t *make_expr3(enum expr_type type, expr_t *expr1, expr_t *expr2, expr_t *expr3)
{
expr_t *e;
e = xmalloc(sizeof(expr_t));
e->type = type;
e->ref = expr1;
e->u.ext = expr2;
e->ext2 = expr3;
e->is_const = FALSE;
INIT_LINK(e);
/* check for compile-time optimization */
if (expr1->is_const && expr2->is_const && expr3->is_const) {
e->is_const = TRUE;
switch (type) {
case EXPR_COND:
e->cval = expr1->cval ? expr2->cval : expr3->cval;
break;
default:
e->is_const = FALSE;
break;
}
}
return e;
}
static type_t *make_type(BYTE type, type_t *ref)
{
type_t *t = xmalloc(sizeof(type_t));
...
...
tools/widl/widltypes.h
View file @
7f0abaff
...
...
@@ -62,6 +62,7 @@ enum attr_type
ATTR_DUAL
,
ATTR_ENTRY_STRING
,
ATTR_ENTRY_ORDINAL
,
ATTR_HANDLE
,
ATTR_HELPSTRING
,
ATTR_ID
,
ATTR_IDEMPOTENT
,
...
...
@@ -109,6 +110,7 @@ enum expr_type
EXPR_SUB
,
EXPR_AND
,
EXPR_OR
,
EXPR_COND
,
};
struct
_attr_t
{
...
...
@@ -130,6 +132,7 @@ struct _expr_t {
expr_t
*
ext
;
typeref_t
*
tref
;
}
u
;
expr_t
*
ext2
;
int
is_const
;
long
cval
;
/* parser-internal */
...
...
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