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
67ac03ae
Commit
67ac03ae
authored
Jan 05, 2009
by
Rob Shearman
Committed by
Alexandre Julliard
Jan 06, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widl: Add a new function, type_pointer_get_ref.
Use it for retrieving the type that a pointer refers to.
parent
2b87d269
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
99 additions
and
60 deletions
+99
-60
expr.c
tools/widl/expr.c
+1
-1
header.c
tools/widl/header.c
+20
-10
header.h
tools/widl/header.h
+2
-2
parser.y
tools/widl/parser.y
+7
-7
proxy.c
tools/widl/proxy.c
+4
-4
typegen.c
tools/widl/typegen.c
+43
-31
typelib.c
tools/widl/typelib.c
+8
-1
typetree.h
tools/widl/typetree.h
+6
-0
write_msft.c
tools/widl/write_msft.c
+8
-4
No files found.
tools/widl/expr.c
View file @
67ac03ae
...
...
@@ -469,7 +469,7 @@ static struct expression_type resolve_expression(const struct expr_loc *expr_loc
case
EXPR_PPTR
:
result
=
resolve_expression
(
expr_loc
,
cont_type
,
e
->
ref
);
if
(
result
.
type
&&
is_ptr
(
result
.
type
))
result
.
type
=
result
.
type
->
ref
;
result
.
type
=
type_pointer_get_ref
(
result
.
type
)
;
else
error_loc_info
(
&
expr_loc
->
v
->
loc_info
,
"dereference operator applied to non-pointer type in expression%s%s
\n
"
,
expr_loc
->
attr
?
" for attribute "
:
""
,
...
...
tools/widl/header.c
View file @
67ac03ae
...
...
@@ -65,7 +65,7 @@ int is_ptrchain_attr(const var_t *var, enum attr_type t)
else
if
(
type_is_alias
(
type
))
type
=
type
->
orig
;
else
if
(
is_ptr
(
type
))
type
=
type
->
ref
;
type
=
type
_pointer_get_ref
(
type
)
;
else
return
0
;
}
}
...
...
@@ -253,9 +253,9 @@ void write_type_left(FILE *h, type_t *t, int declonly)
case
RPC_FC_UP
:
case
RPC_FC_FP
:
case
RPC_FC_OP
:
write_type_left
(
h
,
t
->
ref
,
declonly
);
fprintf
(
h
,
"%s*"
,
needs_space_after
(
t
->
ref
)
?
" "
:
""
);
if
(
is_
ptr
(
t
)
&&
is_
attr
(
t
->
attrs
,
ATTR_CONST
))
fprintf
(
h
,
"const "
);
write_type_left
(
h
,
t
ype_pointer_get_ref
(
t
)
,
declonly
);
fprintf
(
h
,
"%s*"
,
needs_space_after
(
t
ype_pointer_get_ref
(
t
)
)
?
" "
:
""
);
if
(
is_attr
(
t
->
attrs
,
ATTR_CONST
))
fprintf
(
h
,
"const "
);
break
;
case
RPC_FC_CARRAY
:
case
RPC_FC_CVARRAY
:
...
...
@@ -291,7 +291,7 @@ void write_type_v(FILE *h, type_t *t, int is_field, int declonly,
if
(
!
h
)
return
;
for
(
pt
=
t
;
is_ptr
(
pt
);
pt
=
pt
->
ref
,
ptr_level
++
)
for
(
pt
=
t
;
is_ptr
(
pt
);
pt
=
type_pointer_get_ref
(
pt
)
,
ptr_level
++
)
;
if
(
pt
->
type
==
RPC_FC_FUNCTION
)
{
...
...
@@ -378,10 +378,11 @@ void check_for_additional_prototype_types(const var_list_t *list)
if
(
!
list
)
return
;
LIST_FOR_EACH_ENTRY
(
v
,
list
,
const
var_t
,
entry
)
{
type_t
*
type
;
for
(
type
=
v
->
type
;
type
;
type
=
type_is_alias
(
type
)
?
type
->
orig
:
type
->
ref
)
{
type_t
*
type
=
v
->
type
;
if
(
!
type
)
continue
;
for
(;;)
{
const
char
*
name
=
type
->
name
;
if
(
type
->
user_types_registered
)
continue
;
if
(
type
->
user_types_registered
)
break
;
type
->
user_types_registered
=
1
;
if
(
is_attr
(
type
->
attrs
,
ATTR_CONTEXTHANDLE
))
{
if
(
!
context_handle_registered
(
name
))
...
...
@@ -425,6 +426,15 @@ void check_for_additional_prototype_types(const var_list_t *list)
vars
=
type_union_get_cases
(
type
);
check_for_additional_prototype_types
(
vars
);
}
if
(
type_is_alias
(
type
))
type
=
type
->
orig
;
else
if
(
is_ptr
(
type
))
type
=
type_pointer_get_ref
(
type
);
else
if
(
is_array
(
type
))
type
=
type_array_get_element
(
type
);
else
break
;
}
}
}
...
...
@@ -482,7 +492,7 @@ int is_const_decl(const var_t *var)
if
(
is_attr
(
t
->
attrs
,
ATTR_CONST
))
return
TRUE
;
else
if
(
is_ptr
(
t
))
t
=
t
->
ref
;
t
=
t
ype_pointer_get_ref
(
t
)
;
else
break
;
}
return
FALSE
;
...
...
@@ -541,7 +551,7 @@ const var_t* get_explicit_handle_var(const var_t *func)
const
type_t
*
get_explicit_generic_handle_type
(
const
var_t
*
var
)
{
const
type_t
*
t
;
for
(
t
=
var
->
type
;
is_ptr
(
t
);
t
=
t
->
ref
)
for
(
t
=
var
->
type
;
is_ptr
(
t
);
t
=
t
ype_pointer_get_ref
(
t
)
)
if
(
t
->
type
!=
RPC_FC_BIND_PRIMITIVE
&&
is_attr
(
t
->
attrs
,
ATTR_HANDLE
))
return
t
;
return
NULL
;
...
...
tools/widl/header.h
View file @
67ac03ae
...
...
@@ -58,7 +58,7 @@ extern int is_const_decl(const var_t *var);
static
inline
int
last_ptr
(
const
type_t
*
type
)
{
return
is_ptr
(
type
)
&&
!
is_declptr
(
type
->
ref
);
return
is_ptr
(
type
)
&&
!
is_declptr
(
type
_pointer_get_ref
(
type
)
);
}
static
inline
int
last_array
(
const
type_t
*
type
)
...
...
@@ -75,7 +75,7 @@ static inline int is_string_type(const attr_list_t *attrs, const type_t *type)
static
inline
int
is_context_handle
(
const
type_t
*
type
)
{
const
type_t
*
t
;
for
(
t
=
type
;
is_ptr
(
t
);
t
=
t
->
ref
)
for
(
t
=
type
;
is_ptr
(
t
);
t
=
t
ype_pointer_get_ref
(
t
)
)
if
(
is_attr
(
t
->
attrs
,
ATTR_CONTEXTHANDLE
))
return
1
;
return
0
;
...
...
tools/widl/parser.y
View file @
67ac03ae
...
...
@@ -1419,7 +1419,7 @@ static void set_type(var_t *v, decl_spec_t *decl_spec, const declarator_t *decl,
{
type_t *t;
/* move inline attribute from return type node to function node */
for (t = func_type; is_ptr(t); t = t
->ref
)
for (t = func_type; is_ptr(t); t = t
ype_pointer_get_ref(t)
)
;
t->attrs = move_attr(t->attrs, type->attrs, ATTR_INLINE);
}
...
...
@@ -1556,13 +1556,13 @@ static void set_type(var_t *v, decl_spec_t *decl_spec, const declarator_t *decl,
type_t *ft, *t;
type_t *return_type = v->type;
v->type = func_type;
for (ft = v->type; is_ptr(ft); ft =
ft->ref
)
for (ft = v->type; is_ptr(ft); ft =
type_pointer_get_ref(ft)
)
;
assert(ft->type == RPC_FC_FUNCTION);
ft->ref = return_type;
/* move calling convention attribute, if present, from pointer nodes to
* function node */
for (t = v->type; is_ptr(t); t = t
->ref
)
for (t = v->type; is_ptr(t); t = t
ype_pointer_get_ref(t)
)
ft->attrs = move_attr(ft->attrs, t->attrs, ATTR_CALLCONV);
if (is_object_interface && !is_attr(ft->attrs, ATTR_CALLCONV))
{
...
...
@@ -1574,7 +1574,7 @@ static void set_type(var_t *v, decl_spec_t *decl_spec, const declarator_t *decl,
else
{
type_t *t;
for (t = v->type; is_ptr(t); t = t
->ref
)
for (t = v->type; is_ptr(t); t = t
ype_pointer_get_ref(t)
)
if (is_attr(t->attrs, ATTR_CALLCONV))
error_loc("calling convention applied to non-function-pointer type\n");
}
...
...
@@ -1826,7 +1826,7 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at
unsigned char c;
while (is_ptr(t))
t = t
->ref
;
t = t
ype_pointer_get_ref(t)
;
c = t->type;
if (c != RPC_FC_CHAR && c != RPC_FC_BYTE && c != RPC_FC_WCHAR)
...
...
@@ -2281,7 +2281,7 @@ static int is_ptr_guid_type(const type_t *type)
/* second, make sure it is a pointer to something of size sizeof(GUID),
* i.e. 16 bytes */
return (type_memsize(type
->ref
, &align) == 16);
return (type_memsize(type
_pointer_get_ref(type)
, &align) == 16);
}
static void check_conformance_expr_list(const char *attr_name, const var_t *arg, const type_t *container_type, expr_list_t *expr_list)
...
...
@@ -2446,7 +2446,7 @@ static void check_remoting_args(const var_t *func)
else if (is_ptr(type))
{
ptr_level++;
type = type
->ref
;
type = type
_pointer_get_ref(type)
;
}
else
break;
...
...
tools/widl/proxy.c
View file @
67ac03ae
...
...
@@ -164,10 +164,10 @@ int cant_be_null(const var_t *v)
if
(
is_user_type
(
type
))
return
0
;
if
(
!
attrs
&&
type
)
if
(
!
attrs
&&
is_ptr
(
type
)
)
{
attrs
=
type
->
attrs
;
type
=
type
->
ref
;
type
=
type
_pointer_get_ref
(
type
)
;
}
while
(
attrs
)
...
...
@@ -180,10 +180,10 @@ int cant_be_null(const var_t *v)
if
(
t
==
RPC_FC_RP
)
return
1
;
if
(
type
)
if
(
is_ptr
(
type
)
)
{
attrs
=
type
->
attrs
;
type
=
type
->
ref
;
type
=
type
_pointer_get_ref
(
type
)
;
}
else
attrs
=
NULL
;
...
...
tools/widl/typegen.c
View file @
67ac03ae
This diff is collapsed.
Click to expand it.
tools/widl/typelib.c
View file @
67ac03ae
...
...
@@ -124,12 +124,19 @@ static unsigned short builtin_vt(const type_t *t)
return
kwp
->
vt
;
}
if
(
is_string_type
(
t
->
attrs
,
t
))
switch
(
t
->
ref
->
type
)
{
unsigned
char
fc
;
if
(
is_array
(
t
))
fc
=
type_array_get_element
(
t
)
->
type
;
else
fc
=
type_pointer_get_ref
(
t
)
->
type
;
switch
(
fc
)
{
case
RPC_FC_CHAR
:
return
VT_LPSTR
;
case
RPC_FC_WCHAR
:
return
VT_LPWSTR
;
default:
break
;
}
}
return
0
;
}
...
...
tools/widl/typetree.h
View file @
67ac03ae
...
...
@@ -166,4 +166,10 @@ static inline ifref_list_t *type_coclass_get_ifaces(const type_t *type)
return
type
->
details
.
coclass
.
ifaces
;
}
static
inline
type_t
*
type_pointer_get_ref
(
const
type_t
*
type
)
{
assert
(
is_ptr
(
type
));
return
type
->
ref
;
}
#endif
/* WIDL_TYPE_TREE_H */
tools/widl/write_msft.c
View file @
67ac03ae
...
...
@@ -876,8 +876,8 @@ static int encode_type(
case
VT_PTR
:
{
int
next_vt
;
for
(
next_vt
=
0
;
type
->
ref
;
type
=
type
->
ref
)
{
next_vt
=
get_type_vt
(
type
->
ref
);
for
(
next_vt
=
0
;
is_ptr
(
type
);
type
=
type_pointer_get_ref
(
type
)
)
{
next_vt
=
get_type_vt
(
type
_pointer_get_ref
(
type
)
);
if
(
next_vt
!=
0
)
break
;
}
...
...
@@ -885,7 +885,8 @@ static int encode_type(
if
(
next_vt
==
0
)
next_vt
=
VT_VOID
;
encode_type
(
typelib
,
next_vt
,
type
->
ref
,
&
target_type
,
NULL
,
NULL
,
&
child_size
);
encode_type
(
typelib
,
next_vt
,
type_pointer_get_ref
(
type
),
&
target_type
,
NULL
,
NULL
,
&
child_size
);
/* these types already have an implicit pointer, so we don't need to
* add another */
if
(
next_vt
==
VT_DISPATCH
||
next_vt
==
VT_UNKNOWN
)
{
...
...
@@ -1115,7 +1116,10 @@ static int encode_var(
vt
=
get_type_vt
(
type
);
if
(
vt
==
VT_PTR
)
{
int
skip_ptr
=
encode_var
(
typelib
,
type
->
ref
,
var
,
&
target_type
,
NULL
,
NULL
,
&
child_size
);
type_t
*
ref
=
is_ptr
(
type
)
?
type_pointer_get_ref
(
type
)
:
type_array_get_element
(
type
);
int
skip_ptr
=
encode_var
(
typelib
,
ref
,
var
,
&
target_type
,
NULL
,
NULL
,
&
child_size
);
if
(
skip_ptr
==
2
)
{
chat
(
"encode_var: skipping ptr
\n
"
);
...
...
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