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
28a2c06c
Commit
28a2c06c
authored
Feb 23, 2009
by
Rob Shearman
Committed by
Alexandre Julliard
Feb 23, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widl: Use type_get_type to determine the types of types during typelib generation.
parent
0f7f7922
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
87 additions
and
106 deletions
+87
-106
typelib.c
tools/widl/typelib.c
+67
-62
write_msft.c
tools/widl/write_msft.c
+20
-44
No files found.
tools/widl/typelib.c
View file @
28a2c06c
...
@@ -109,17 +109,20 @@ static unsigned short builtin_vt(const type_t *t)
...
@@ -109,17 +109,20 @@ static unsigned short builtin_vt(const type_t *t)
}
}
if
(
is_string_type
(
t
->
attrs
,
t
))
if
(
is_string_type
(
t
->
attrs
,
t
))
{
{
unsigned
char
fc
;
const
type_t
*
elem_type
;
if
(
is_array
(
t
))
if
(
is_array
(
t
))
fc
=
type_array_get_element
(
t
)
->
type
;
elem_type
=
type_array_get_element
(
t
)
;
else
else
fc
=
type_pointer_get_ref
(
t
)
->
type
;
elem_type
=
type_pointer_get_ref
(
t
);
switch
(
fc
)
if
(
type_get_type
(
elem_type
)
==
TYPE_BASIC
)
{
switch
(
type_basic_get_fc
(
elem_type
))
{
{
case
RPC_FC_CHAR
:
return
VT_LPSTR
;
case
RPC_FC_CHAR
:
return
VT_LPSTR
;
case
RPC_FC_WCHAR
:
return
VT_LPWSTR
;
case
RPC_FC_WCHAR
:
return
VT_LPWSTR
;
default:
break
;
default:
break
;
}
}
}
}
}
return
0
;
return
0
;
}
}
...
@@ -143,74 +146,76 @@ unsigned short get_type_vt(type_t *t)
...
@@ -143,74 +146,76 @@ unsigned short get_type_vt(type_t *t)
if
(
type_is_alias
(
t
)
&&
is_attr
(
t
->
attrs
,
ATTR_PUBLIC
))
if
(
type_is_alias
(
t
)
&&
is_attr
(
t
->
attrs
,
ATTR_PUBLIC
))
return
VT_USERDEFINED
;
return
VT_USERDEFINED
;
switch
(
t
->
type
)
{
switch
(
type_get_type
(
t
))
{
case
RPC_FC_BYTE
:
case
TYPE_BASIC
:
case
RPC_FC_USMALL
:
switch
(
type_basic_get_fc
(
t
))
{
return
VT_UI1
;
case
RPC_FC_BYTE
:
case
RPC_FC_CHAR
:
case
RPC_FC_USMALL
:
case
RPC_FC_SMALL
:
return
VT_UI1
;
return
VT_I1
;
case
RPC_FC_CHAR
:
case
RPC_FC_WCHAR
:
case
RPC_FC_SMALL
:
return
VT_I2
;
/* mktyplib seems to parse wchar_t as short */
return
VT_I1
;
case
RPC_FC_SHORT
:
case
RPC_FC_WCHAR
:
return
VT_I2
;
return
VT_I2
;
/* mktyplib seems to parse wchar_t as short */
case
RPC_FC_USHORT
:
case
RPC_FC_SHORT
:
return
VT_UI2
;
return
VT_I2
;
case
RPC_FC_LONG
:
case
RPC_FC_USHORT
:
if
(
match
(
t
->
name
,
"int"
))
return
VT_INT
;
return
VT_UI2
;
return
VT_I4
;
case
RPC_FC_LONG
:
case
RPC_FC_ULONG
:
if
(
match
(
t
->
name
,
"int"
))
return
VT_INT
;
if
(
match
(
t
->
name
,
"int"
))
return
VT_UINT
;
return
VT_I4
;
return
VT_UI4
;
case
RPC_FC_ULONG
:
case
RPC_FC_HYPER
:
if
(
match
(
t
->
name
,
"int"
))
return
VT_UINT
;
if
(
t
->
sign
<
0
)
return
VT_UI8
;
return
VT_UI4
;
if
(
match
(
t
->
name
,
"MIDL_uhyper"
))
return
VT_UI8
;
case
RPC_FC_HYPER
:
return
VT_I8
;
if
(
t
->
sign
<
0
)
return
VT_UI8
;
case
RPC_FC_FLOAT
:
if
(
match
(
t
->
name
,
"MIDL_uhyper"
))
return
VT_UI8
;
return
VT_R4
;
return
VT_I8
;
case
RPC_FC_DOUBLE
:
case
RPC_FC_FLOAT
:
return
VT_R8
;
return
VT_R4
;
case
RPC_FC_RP
:
case
RPC_FC_DOUBLE
:
case
RPC_FC_UP
:
return
VT_R8
;
case
RPC_FC_OP
:
default:
case
RPC_FC_FP
:
error
(
"get_type_vt: unknown basic type: 0x%02x
\n
"
,
type_basic_get_fc
(
t
));
case
RPC_FC_SMFARRAY
:
case
RPC_FC_LGFARRAY
:
case
RPC_FC_SMVARRAY
:
case
RPC_FC_LGVARRAY
:
case
RPC_FC_CARRAY
:
case
RPC_FC_CVARRAY
:
case
RPC_FC_BOGUS_ARRAY
:
if
(
t
->
ref
)
{
if
(
match
(
t
->
ref
->
name
,
"SAFEARRAY"
))
return
VT_SAFEARRAY
;
return
VT_PTR
;
}
}
error
(
"get_type_vt: unknown-deref-type: %d
\n
"
,
t
->
ref
->
type
);
break
;
break
;
case
RPC_FC_IP
:
case
TYPE_POINTER
:
if
(
match
(
type_pointer_get_ref
(
t
)
->
name
,
"SAFEARRAY"
))
return
VT_SAFEARRAY
;
return
VT_PTR
;
case
TYPE_ARRAY
:
if
(
t
->
declarray
)
error
(
"get_type_vt: array types not supported
\n
"
);
return
VT_PTR
;
case
TYPE_INTERFACE
:
if
(
match
(
t
->
name
,
"IUnknown"
))
if
(
match
(
t
->
name
,
"IUnknown"
))
return
VT_UNKNOWN
;
return
VT_UNKNOWN
;
if
(
match
(
t
->
name
,
"IDispatch"
))
if
(
match
(
t
->
name
,
"IDispatch"
))
return
VT_DISPATCH
;
return
VT_DISPATCH
;
return
VT_USERDEFINED
;
return
VT_USERDEFINED
;
case
RPC_FC_ENUM16
:
case
TYPE_ENUM
:
case
RPC_FC_STRUCT
:
case
TYPE_STRUCT
:
case
RPC_FC_PSTRUCT
:
case
TYPE_COCLASS
:
case
RPC_FC_CSTRUCT
:
case
TYPE_MODULE
:
case
RPC_FC_CPSTRUCT
:
case
TYPE_UNION
:
case
RPC_FC_CVSTRUCT
:
case
TYPE_ENCAPSULATED_UNION
:
case
RPC_FC_BOGUS_STRUCT
:
case
RPC_FC_COCLASS
:
case
RPC_FC_MODULE
:
return
VT_USERDEFINED
;
return
VT_USERDEFINED
;
case
0
:
case
TYPE_VOID
:
return
VT_VOID
;
return
VT_VOID
;
default:
error
(
"get_type_vt: unknown type: 0x%02x
\n
"
,
t
->
type
);
case
TYPE_ALIAS
:
/* aliases should be filtered out by the type_get_type call above */
assert
(
0
);
break
;
case
TYPE_FUNCTION
:
error
(
"get_type_vt: functions not supported
\n
"
);
break
;
}
}
return
0
;
return
0
;
}
}
...
...
tools/widl/write_msft.c
View file @
28a2c06c
...
@@ -983,34 +983,27 @@ static int encode_type(
...
@@ -983,34 +983,27 @@ static int encode_type(
while
(
type
->
typelib_idx
<
0
&&
type_is_alias
(
type
)
&&
!
is_attr
(
type
->
attrs
,
ATTR_PUBLIC
))
while
(
type
->
typelib_idx
<
0
&&
type_is_alias
(
type
)
&&
!
is_attr
(
type
->
attrs
,
ATTR_PUBLIC
))
type
=
type_alias_get_aliasee
(
type
);
type
=
type_alias_get_aliasee
(
type
);
chat
(
"encode_type: VT_USERDEFINED - type %p name = %s
type->
type %d idx %d
\n
"
,
type
,
chat
(
"encode_type: VT_USERDEFINED - type %p name = %s
real
type %d idx %d
\n
"
,
type
,
type
->
name
,
type
->
type
,
type
->
typelib_idx
);
type
->
name
,
type
_get_type
(
type
)
,
type
->
typelib_idx
);
if
(
type
->
typelib_idx
==
-
1
)
{
if
(
type
->
typelib_idx
==
-
1
)
{
chat
(
"encode_type: trying to ref not added type
\n
"
);
chat
(
"encode_type: trying to ref not added type
\n
"
);
switch
(
type
->
type
)
{
switch
(
type_get_type
(
type
))
{
case
RPC_FC_STRUCT
:
case
TYPE_STRUCT
:
case
RPC_FC_PSTRUCT
:
case
RPC_FC_CSTRUCT
:
case
RPC_FC_CPSTRUCT
:
case
RPC_FC_CVSTRUCT
:
case
RPC_FC_BOGUS_STRUCT
:
add_structure_typeinfo
(
typelib
,
type
);
add_structure_typeinfo
(
typelib
,
type
);
break
;
break
;
case
RPC_FC_IP
:
case
TYPE_INTERFACE
:
add_interface_typeinfo
(
typelib
,
type
);
add_interface_typeinfo
(
typelib
,
type
);
break
;
break
;
case
RPC_FC_ENUM16
:
case
TYPE_ENUM
:
add_enum_typeinfo
(
typelib
,
type
);
add_enum_typeinfo
(
typelib
,
type
);
break
;
break
;
case
RPC_FC
_COCLASS
:
case
TYPE
_COCLASS
:
add_coclass_typeinfo
(
typelib
,
type
);
add_coclass_typeinfo
(
typelib
,
type
);
break
;
break
;
case
0
:
error
(
"encode_type: VT_USERDEFINED - can't yet add typedef's on the fly
\n
"
);
break
;
default:
default:
error
(
"encode_type: VT_USERDEFINED - unhandled type %d
\n
"
,
type
->
type
);
error
(
"encode_type: VT_USERDEFINED - unhandled type %d
\n
"
,
type_get_type
(
type
));
}
}
}
}
...
@@ -1047,7 +1040,7 @@ static int encode_type(
...
@@ -1047,7 +1040,7 @@ static int encode_type(
static
void
dump_type
(
type_t
*
t
)
static
void
dump_type
(
type_t
*
t
)
{
{
chat
(
"dump_type: %p name %s type %d ref %p attrs %p
\n
"
,
t
,
t
->
name
,
t
->
type
,
t
->
ref
,
t
->
attrs
);
chat
(
"dump_type: %p name %s type %d ref %p attrs %p
\n
"
,
t
,
t
->
name
,
t
ype_get_type
(
t
)
,
t
->
ref
,
t
->
attrs
);
if
(
t
->
ref
)
dump_type
(
t
->
ref
);
if
(
t
->
ref
)
dump_type
(
t
->
ref
);
}
}
...
@@ -1482,7 +1475,7 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, var_t *func, int index)
...
@@ -1482,7 +1475,7 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, var_t *func, int index)
{
{
int
vt
;
int
vt
;
expr_t
*
expr
=
(
expr_t
*
)
attr
->
u
.
pval
;
expr_t
*
expr
=
(
expr_t
*
)
attr
->
u
.
pval
;
if
(
arg
->
type
->
type
==
RPC_FC_ENUM16
)
if
(
type_get_type
(
arg
->
type
)
==
TYPE_ENUM
)
vt
=
VT_INT
;
vt
=
VT_INT
;
else
else
vt
=
get_type_vt
(
arg
->
type
);
vt
=
get_type_vt
(
arg
->
type
);
...
@@ -2211,42 +2204,25 @@ static void add_module_typeinfo(msft_typelib_t *typelib, type_t *module)
...
@@ -2211,42 +2204,25 @@ static void add_module_typeinfo(msft_typelib_t *typelib, type_t *module)
static
void
add_type_typeinfo
(
msft_typelib_t
*
typelib
,
type_t
*
type
)
static
void
add_type_typeinfo
(
msft_typelib_t
*
typelib
,
type_t
*
type
)
{
{
switch
(
type
->
type
)
{
switch
(
type
_get_type
(
type
)
)
{
case
RPC_FC_IP
:
case
TYPE_INTERFACE
:
add_interface_typeinfo
(
typelib
,
type
);
add_interface_typeinfo
(
typelib
,
type
);
break
;
break
;
case
RPC_FC
_STRUCT
:
case
TYPE
_STRUCT
:
add_structure_typeinfo
(
typelib
,
type
);
add_structure_typeinfo
(
typelib
,
type
);
break
;
break
;
case
RPC_FC_ENUM16
:
case
TYPE_ENUM
:
case
RPC_FC_ENUM32
:
add_enum_typeinfo
(
typelib
,
type
);
add_enum_typeinfo
(
typelib
,
type
);
break
;
break
;
case
RPC_FC
_COCLASS
:
case
TYPE
_COCLASS
:
add_coclass_typeinfo
(
typelib
,
type
);
add_coclass_typeinfo
(
typelib
,
type
);
break
;
break
;
case
RPC_FC_BYTE
:
case
TYPE_BASIC
:
case
RPC_FC_CHAR
:
case
TYPE_POINTER
:
case
RPC_FC_USMALL
:
case
RPC_FC_SMALL
:
case
RPC_FC_WCHAR
:
case
RPC_FC_USHORT
:
case
RPC_FC_SHORT
:
case
RPC_FC_ULONG
:
case
RPC_FC_LONG
:
case
RPC_FC_HYPER
:
case
RPC_FC_IGNORE
:
case
RPC_FC_FLOAT
:
case
RPC_FC_DOUBLE
:
case
RPC_FC_ERROR_STATUS_T
:
case
RPC_FC_BIND_PRIMITIVE
:
case
RPC_FC_RP
:
case
RPC_FC_UP
:
case
RPC_FC_OP
:
case
RPC_FC_FP
:
break
;
break
;
default:
default:
error
(
"add_entry: unhandled type 0x%x for %s
\n
"
,
type
->
type
,
type
->
name
);
error
(
"add_entry: unhandled type 0x%x for %s
\n
"
,
type_get_type
(
type
),
type
->
name
);
break
;
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