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
46222aee
Commit
46222aee
authored
Jun 25, 2007
by
Dan Hipschman
Committed by
Alexandre Julliard
Jun 26, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widl: Allow enums as union switch types.
parent
ea7b1694
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
5 deletions
+49
-5
server.c
dlls/rpcrt4/tests/server.c
+21
-0
server.idl
dlls/rpcrt4/tests/server.idl
+7
-0
typegen.c
tools/widl/typegen.c
+21
-5
No files found.
dlls/rpcrt4/tests/server.c
View file @
46222aee
...
...
@@ -286,6 +286,18 @@ s_enum_ord(e_t e)
}
}
double
s_square_encue
(
encue_t
*
eue
)
{
switch
(
eue
->
t
)
{
case
E1
:
return
eue
->
tagged_union
.
i1
*
eue
->
tagged_union
.
i1
;
case
E2
:
return
eue
->
tagged_union
.
f2
*
eue
->
tagged_union
.
f2
;
default:
return
0
.
0
;
}
}
void
s_stop
(
void
)
{
...
...
@@ -409,6 +421,7 @@ basic_tests(void)
static
void
union_tests
(
void
)
{
encue_t
eue
;
encu_t
eu
;
sun_t
su
;
int
i
;
...
...
@@ -437,6 +450,14 @@ union_tests(void)
eu
.
t
=
ENCU_F
;
eu
.
tagged_union
.
f
=
3
.
0
;
ok
(
square_encu
(
&
eu
)
==
9
.
0
,
"RPC square_encu
\n
"
);
eue
.
t
=
E1
;
eue
.
tagged_union
.
i1
=
8
;
ok
(
square_encue
(
&
eue
)
==
64
.
0
,
"RPC square_encue
\n
"
);
eue
.
t
=
E2
;
eue
.
tagged_union
.
f2
=
10
.
0
;
ok
(
square_encue
(
&
eue
)
==
100
.
0
,
"RPC square_encue
\n
"
);
}
static
test_list_t
*
...
...
dlls/rpcrt4/tests/server.idl
View file @
46222aee
...
...
@@ -165,9 +165,16 @@ interface IServer
E4 = 64
} e_t;
typedef union encue switch (e_t t)
{
case E1: int i1;
case E2: float f2;
} encue_t;
double square_encu(encu_t *eu);
int sum_parr(int *a[3]);
int sum_pcarr([size_is(n)] int *a[], int n);
int enum_ord(e_t e);
double square_encue(encue_t *eue);
void stop(void);
}
tools/widl/typegen.c
View file @
46222aee
...
...
@@ -626,6 +626,7 @@ static size_t write_conf_or_var_desc(FILE *file, const func_t *func, const type_
break
;
case
RPC_FC_WCHAR
:
case
RPC_FC_SHORT
:
case
RPC_FC_ENUM16
:
param_type
=
RPC_FC_SHORT
;
param_type_string
=
"FC_SHORT"
;
break
;
...
...
@@ -634,6 +635,7 @@ static size_t write_conf_or_var_desc(FILE *file, const func_t *func, const type_
param_type_string
=
"FC_USHORT"
;
break
;
case
RPC_FC_LONG
:
case
RPC_FC_ENUM32
:
param_type
=
RPC_FC_LONG
;
param_type_string
=
"FC_LONG"
;
break
;
...
...
@@ -1734,12 +1736,26 @@ static size_t write_union_tfs(FILE *file, type_t *type, unsigned int *tfsoff)
{
const
var_t
*
sv
=
LIST_ENTRY
(
list_head
(
type
->
fields
),
const
var_t
,
entry
);
const
type_t
*
st
=
sv
->
type
;
size_t
ss
=
type_memsize
(
st
,
&
align
);
print_file
(
file
,
2
,
"0x%x,
\t
/* %s */
\n
"
,
type
->
type
,
string_of_type
(
type
->
type
));
print_file
(
file
,
2
,
"0x%x,
\t
/* Switch type= %s */
\n
"
,
(
ss
<<
4
)
|
st
->
type
,
string_of_type
(
st
->
type
));
*
tfsoff
+=
2
;
switch
(
st
->
type
)
{
case
RPC_FC_CHAR
:
case
RPC_FC_SMALL
:
case
RPC_FC_USMALL
:
case
RPC_FC_SHORT
:
case
RPC_FC_USHORT
:
case
RPC_FC_LONG
:
case
RPC_FC_ULONG
:
case
RPC_FC_ENUM16
:
case
RPC_FC_ENUM32
:
print_file
(
file
,
2
,
"0x%x,
\t
/* %s */
\n
"
,
type
->
type
,
string_of_type
(
type
->
type
));
print_file
(
file
,
2
,
"0x%x,
\t
/* Switch type= %s */
\n
"
,
0x40
|
st
->
type
,
string_of_type
(
st
->
type
));
*
tfsoff
+=
2
;
break
;
default:
error
(
"union switch type must be an integer, char, or enum
\n
"
);
}
}
print_file
(
file
,
2
,
"NdrFcShort(0x%x),
\t
/* %d */
\n
"
,
size
,
size
);
print_file
(
file
,
2
,
"NdrFcShort(0x%x),
\t
/* %d */
\n
"
,
nbranch
,
nbranch
);
...
...
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