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
6f971037
Commit
6f971037
authored
Oct 05, 2018
by
Zebediah Figura
Committed by
Alexandre Julliard
Oct 09, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widl: Correctly generate headers for nested arrays and pointers.
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
f12cc887
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
10 deletions
+33
-10
header.c
tools/widl/header.c
+33
-10
No files found.
tools/widl/header.c
View file @
6f971037
...
...
@@ -285,6 +285,15 @@ int needs_space_after(type_t *t)
(
!
is_ptr
(
t
)
&&
(
!
is_array
(
t
)
||
!
type_array_is_decl_as_ptr
(
t
)
||
t
->
name
)));
}
static
void
write_pointer_left
(
FILE
*
h
,
type_t
*
ref
)
{
if
(
needs_space_after
(
ref
))
fprintf
(
h
,
" "
);
if
(
!
type_is_alias
(
ref
)
&&
is_array
(
ref
)
&&
!
type_array_is_decl_as_ptr
(
ref
))
fprintf
(
h
,
"("
);
fprintf
(
h
,
"*"
);
}
void
write_type_left
(
FILE
*
h
,
type_t
*
t
,
enum
name_type
name_type
,
int
declonly
)
{
const
char
*
name
;
...
...
@@ -341,10 +350,12 @@ void write_type_left(FILE *h, type_t *t, enum name_type name_type, int declonly)
else
fprintf
(
h
,
"union %s"
,
t
->
name
?
t
->
name
:
""
);
break
;
case
TYPE_POINTER
:
{
write_type_left
(
h
,
type_pointer_get_ref
(
t
),
name_type
,
declonly
);
fprintf
(
h
,
"%s*"
,
needs_space_after
(
type_pointer_get_ref
(
t
))
?
" "
:
""
);
write_pointer_left
(
h
,
type_pointer_get_ref
(
t
)
);
if
(
is_attr
(
t
->
attrs
,
ATTR_CONST
))
fprintf
(
h
,
"const "
);
break
;
}
case
TYPE_ARRAY
:
if
(
t
->
name
&&
type_array_is_decl_as_ptr
(
t
))
fprintf
(
h
,
"%s"
,
t
->
name
);
...
...
@@ -352,7 +363,7 @@ void write_type_left(FILE *h, type_t *t, enum name_type name_type, int declonly)
{
write_type_left
(
h
,
type_array_get_element
(
t
),
name_type
,
declonly
);
if
(
type_array_is_decl_as_ptr
(
t
))
fprintf
(
h
,
"%s*"
,
needs_space_after
(
type_array_get_element
(
t
))
?
" "
:
""
);
write_pointer_left
(
h
,
type_array_get_element
(
t
)
);
}
break
;
case
TYPE_BASIC
:
...
...
@@ -419,23 +430,36 @@ void write_type_left(FILE *h, type_t *t, enum name_type name_type, int declonly)
void
write_type_right
(
FILE
*
h
,
type_t
*
t
,
int
is_field
)
{
if
(
!
h
)
return
;
if
(
type_is_alias
(
t
))
return
;
switch
(
type_get_type
(
t
))
{
case
TYPE_ARRAY
:
if
(
!
type_array_is_decl_as_ptr
(
t
))
{
if
(
is_conformant_array
(
t
))
type_t
*
elem
=
type_array_get_element
(
t
);
if
(
type_array_is_decl_as_ptr
(
t
))
{
fprintf
(
h
,
"[%s]"
,
is_field
?
"1"
:
""
);
t
=
type_array_get_element
(
t
);
if
(
!
type_is_alias
(
elem
)
&&
is_array
(
elem
)
&&
!
type_array_is_decl_as_ptr
(
elem
))
fprintf
(
h
,
")"
);
}
for
(
;
type_get_type
(
t
)
==
TYPE_ARRAY
&&
!
type_array_is_decl_as_ptr
(
t
);
t
=
type_array_get_element
(
t
))
else
{
if
(
is_conformant_array
(
t
))
fprintf
(
h
,
"[%s]"
,
is_field
?
"1"
:
""
);
else
fprintf
(
h
,
"[%u]"
,
type_array_get_dim
(
t
));
}
write_type_right
(
h
,
elem
,
FALSE
);
break
;
}
case
TYPE_POINTER
:
{
type_t
*
ref
=
type_pointer_get_ref
(
t
);
if
(
!
type_is_alias
(
ref
)
&&
is_array
(
ref
)
&&
!
type_array_is_decl_as_ptr
(
ref
))
fprintf
(
h
,
")"
);
write_type_right
(
h
,
ref
,
FALSE
);
break
;
}
case
TYPE_BITFIELD
:
fprintf
(
h
,
" : %u"
,
type_bitfield_get_bits
(
t
)
->
cval
);
break
;
...
...
@@ -450,7 +474,6 @@ void write_type_right(FILE *h, type_t *t, int is_field)
case
TYPE_COCLASS
:
case
TYPE_FUNCTION
:
case
TYPE_INTERFACE
:
case
TYPE_POINTER
:
break
;
}
}
...
...
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