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
40dda77c
Commit
40dda77c
authored
Jul 17, 2007
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widl: Added support for floating-point constants.
parent
7e191785
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
0 deletions
+30
-0
header.c
tools/widl/header.c
+3
-0
parser.l
tools/widl/parser.l
+5
-0
parser.y
tools/widl/parser.y
+15
-0
typegen.c
tools/widl/typegen.c
+5
-0
widltypes.h
tools/widl/widltypes.h
+2
-0
No files found.
tools/widl/header.c
View file @
40dda77c
...
...
@@ -358,6 +358,9 @@ void write_expr(FILE *h, const expr_t *e, int brackets)
case
EXPR_HEXNUM
:
fprintf
(
h
,
"0x%lx"
,
e
->
u
.
lval
);
break
;
case
EXPR_DOUBLE
:
fprintf
(
h
,
"%#.15g"
,
e
->
u
.
dval
);
break
;
case
EXPR_TRUEFALSE
:
if
(
e
->
u
.
lval
==
0
)
fprintf
(
h
,
"FALSE"
);
...
...
tools/widl/parser.l
View file @
40dda77c
...
...
@@ -29,6 +29,7 @@ int [0-9]+
hexd [0-9a-fA-F]
hex 0x{hexd}+
uuid {hexd}{8}-{hexd}{4}-{hexd}{4}-{hexd}{4}-{hexd}{12}
double [0-9]+\.[0-9]+([eE][+-]?[0-9]+)*
%x QUOTE
%x ATTR
...
...
@@ -150,6 +151,10 @@ static UUID* parse_uuid(const char*u)
parser_lval.num = strtoul(yytext, NULL, 0);
return aNUM;
}
<INITIAL>{double} {
parser_lval.dbl = strtod(yytext, NULL);
return aDOUBLE;
}
SAFEARRAY{ws}*/\( return tSAFEARRAY;
{cident} return kw_token(yytext);
<INITIAL,ATTR>\n line_number++;
...
...
tools/widl/parser.y
View file @
40dda77c
...
...
@@ -83,6 +83,7 @@ static attr_t *make_attrv(enum attr_type type, unsigned long val);
static attr_t *make_attrp(enum attr_type type, void *val);
static expr_t *make_expr(enum expr_type type);
static expr_t *make_exprl(enum expr_type type, long val);
static expr_t *make_exprd(enum expr_type type, double val);
static expr_t *make_exprs(enum expr_type type, char *val);
static expr_t *make_exprt(enum expr_type type, type_t *tref, expr_t *expr);
static expr_t *make_expr1(enum expr_type type, expr_t *expr);
...
...
@@ -151,11 +152,13 @@ static void check_all_user_types(ifref_list_t *ifaces);
char *str;
UUID *uuid;
unsigned int num;
double dbl;
}
%token <str> aIDENTIFIER
%token <str> aKNOWNTYPE
%token <num> aNUM aHEXNUM
%token <dbl> aDOUBLE
%token <str> aSTRING
%token <uuid> aUUID
%token aEOF
...
...
@@ -581,6 +584,7 @@ m_expr: { $$ = make_expr(EXPR_VOID); }
expr: aNUM { $$ = make_exprl(EXPR_NUM, $1); }
| aHEXNUM { $$ = make_exprl(EXPR_HEXNUM, $1); }
| aDOUBLE { $$ = make_exprd(EXPR_DOUBLE, $1); }
| tFALSE { $$ = make_exprl(EXPR_TRUEFALSE, 0); }
| tTRUE { $$ = make_exprl(EXPR_TRUEFALSE, 1); }
| aIDENTIFIER { $$ = make_exprs(EXPR_IDENTIFIER, $1); }
...
...
@@ -1033,6 +1037,17 @@ static expr_t *make_exprl(enum expr_type type, long val)
return e;
}
static expr_t *make_exprd(enum expr_type type, double val)
{
expr_t *e = xmalloc(sizeof(expr_t));
e->type = type;
e->ref = NULL;
e->u.dval = val;
e->is_const = TRUE;
e->cval = val;
return e;
}
static expr_t *make_exprs(enum expr_type type, char *val)
{
expr_t *e;
...
...
tools/widl/typegen.c
View file @
40dda77c
...
...
@@ -227,6 +227,8 @@ static int compare_expr(const expr_t *a, const expr_t *b)
case
EXPR_HEXNUM
:
case
EXPR_TRUEFALSE
:
return
a
->
u
.
lval
-
b
->
u
.
lval
;
case
EXPR_DOUBLE
:
return
a
->
u
.
dval
-
b
->
u
.
dval
;
case
EXPR_IDENTIFIER
:
return
strcmp
(
a
->
u
.
sval
,
b
->
u
.
sval
);
case
EXPR_COND
:
...
...
@@ -2690,6 +2692,9 @@ 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_DOUBLE
:
fprintf
(
h
,
"%#.15g"
,
e
->
u
.
dval
);
break
;
case
EXPR_TRUEFALSE
:
if
(
e
->
u
.
lval
==
0
)
fprintf
(
h
,
"FALSE"
);
...
...
tools/widl/widltypes.h
View file @
40dda77c
...
...
@@ -135,6 +135,7 @@ enum expr_type
EXPR_VOID
,
EXPR_NUM
,
EXPR_HEXNUM
,
EXPR_DOUBLE
,
EXPR_IDENTIFIER
,
EXPR_NEG
,
EXPR_NOT
,
...
...
@@ -188,6 +189,7 @@ struct _expr_t {
const
expr_t
*
ref
;
union
{
long
lval
;
double
dval
;
const
char
*
sval
;
const
expr_t
*
ext
;
type_t
*
tref
;
...
...
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