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
ea993255
Commit
ea993255
authored
Apr 20, 2008
by
Rob Shearman
Committed by
Alexandre Julliard
Apr 21, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widl: Add support for '%' operator in expressions.
parent
d27c7601
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
1 deletion
+15
-1
header.c
tools/widl/header.c
+2
-0
parser.y
tools/widl/parser.y
+9
-1
typegen.c
tools/widl/typegen.c
+3
-0
widltypes.h
tools/widl/widltypes.h
+1
-0
No files found.
tools/widl/header.c
View file @
ea993255
...
...
@@ -520,6 +520,7 @@ void write_expr(FILE *h, const expr_t *e, int brackets)
break
;
case
EXPR_SHL
:
case
EXPR_SHR
:
case
EXPR_MOD
:
case
EXPR_MUL
:
case
EXPR_DIV
:
case
EXPR_ADD
:
...
...
@@ -533,6 +534,7 @@ void write_expr(FILE *h, const expr_t *e, int brackets)
switch
(
e
->
type
)
{
case
EXPR_SHL
:
fprintf
(
h
,
" << "
);
break
;
case
EXPR_SHR
:
fprintf
(
h
,
" >> "
);
break
;
case
EXPR_MOD
:
fprintf
(
h
,
" %% "
);
break
;
case
EXPR_MUL
:
fprintf
(
h
,
" * "
);
break
;
case
EXPR_DIV
:
fprintf
(
h
,
" / "
);
break
;
case
EXPR_ADD
:
fprintf
(
h
,
" + "
);
break
;
...
...
tools/widl/parser.y
View file @
ea993255
...
...
@@ -293,7 +293,7 @@ static void add_explicit_handle_if_necessary(func_t *func);
%left '|'
%left '&'
%left '-' '+'
%left '*' '/'
%left '*' '/'
'%'
%left SHL SHR
%left '.' MEMBERPTR '[' ']'
%right '~'
...
...
@@ -632,6 +632,7 @@ expr: aNUM { $$ = make_exprl(EXPR_NUM, $1); }
| expr '&' expr { $$ = make_expr2(EXPR_AND, $1, $3); }
| expr '+' expr { $$ = make_expr2(EXPR_ADD, $1, $3); }
| expr '-' expr { $$ = make_expr2(EXPR_SUB, $1, $3); }
| expr '%' expr { $$ = make_expr2(EXPR_MOD, $1, $3); }
| expr '*' expr { $$ = make_expr2(EXPR_MUL, $1, $3); }
| expr '/' expr { $$ = make_expr2(EXPR_DIV, $1, $3); }
| expr SHL expr { $$ = make_expr2(EXPR_SHL, $1, $3); }
...
...
@@ -1238,6 +1239,13 @@ static expr_t *make_expr2(enum expr_type type, expr_t *expr1, expr_t *expr2)
case EXPR_SUB:
e->cval = expr1->cval - expr2->cval;
break;
case EXPR_MOD:
if (expr2->cval == 0) {
error_loc("divide by zero in expression\n");
e->cval = 0;
} else
e->cval = expr1->cval % expr2->cval;
break;
case EXPR_MUL:
e->cval = expr1->cval * expr2->cval;
break;
...
...
tools/widl/typegen.c
View file @
ea993255
...
...
@@ -352,6 +352,7 @@ static int compare_expr(const expr_t *a, const expr_t *b)
case
EXPR_AND
:
case
EXPR_ADD
:
case
EXPR_SUB
:
case
EXPR_MOD
:
case
EXPR_MUL
:
case
EXPR_DIV
:
case
EXPR_SHL
:
...
...
@@ -3148,6 +3149,7 @@ static void write_struct_expr(FILE *h, const expr_t *e, int brackets,
break
;
case
EXPR_SHL
:
case
EXPR_SHR
:
case
EXPR_MOD
:
case
EXPR_MUL
:
case
EXPR_DIV
:
case
EXPR_ADD
:
...
...
@@ -3161,6 +3163,7 @@ static void write_struct_expr(FILE *h, const expr_t *e, int brackets,
switch
(
e
->
type
)
{
case
EXPR_SHL
:
fprintf
(
h
,
" << "
);
break
;
case
EXPR_SHR
:
fprintf
(
h
,
" >> "
);
break
;
case
EXPR_MOD
:
fprintf
(
h
,
" %% "
);
break
;
case
EXPR_MUL
:
fprintf
(
h
,
" * "
);
break
;
case
EXPR_DIV
:
fprintf
(
h
,
" / "
);
break
;
case
EXPR_ADD
:
fprintf
(
h
,
" + "
);
break
;
...
...
tools/widl/widltypes.h
View file @
ea993255
...
...
@@ -164,6 +164,7 @@ enum expr_type
EXPR_MEMBERPTR
,
EXPR_MEMBER
,
EXPR_ARRAY
,
EXPR_MOD
,
};
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