forked from Mirrors/wine-wine
widl: Use type_get_type to determine the types of types during typelib generation.
parent
0f7f7922ba
commit
28a2c06cf7
|
@ -109,18 +109,21 @@ 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,7 +146,9 @@ 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 TYPE_BASIC:
|
||||||
|
switch (type_basic_get_fc(t)) {
|
||||||
case RPC_FC_BYTE:
|
case RPC_FC_BYTE:
|
||||||
case RPC_FC_USMALL:
|
case RPC_FC_USMALL:
|
||||||
return VT_UI1;
|
return VT_UI1;
|
||||||
|
@ -170,47 +175,47 @@ unsigned short get_type_vt(type_t *t)
|
||||||
return VT_R4;
|
return VT_R4;
|
||||||
case RPC_FC_DOUBLE:
|
case RPC_FC_DOUBLE:
|
||||||
return VT_R8;
|
return VT_R8;
|
||||||
case RPC_FC_RP:
|
default:
|
||||||
case RPC_FC_UP:
|
error("get_type_vt: unknown basic type: 0x%02x\n", type_basic_get_fc(t));
|
||||||
case RPC_FC_OP:
|
}
|
||||||
case RPC_FC_FP:
|
break;
|
||||||
case RPC_FC_SMFARRAY:
|
|
||||||
case RPC_FC_LGFARRAY:
|
case TYPE_POINTER:
|
||||||
case RPC_FC_SMVARRAY:
|
if (match(type_pointer_get_ref(t)->name, "SAFEARRAY"))
|
||||||
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_SAFEARRAY;
|
||||||
return VT_PTR;
|
return VT_PTR;
|
||||||
}
|
|
||||||
|
|
||||||
error("get_type_vt: unknown-deref-type: %d\n", t->ref->type);
|
case TYPE_ARRAY:
|
||||||
break;
|
if (t->declarray)
|
||||||
case RPC_FC_IP:
|
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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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(
|
||||||
|
|
||||||
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, type_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)
|
||||||
{
|
{
|
||||||
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)
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue