mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-04-13 14:42:51 -07:00
Rebase against 00198c4084a61f65f18574d16833d945e50c0614.
This commit is contained in:
parent
506d9500b8
commit
164a792cb2
@ -1,159 +0,0 @@
|
||||
From 8438b605a8c08605a05e60114a549f6e72cda435 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Timoshkov <dmitry@baikal.ru>
|
||||
Date: Thu, 14 Jan 2016 15:16:37 +0800
|
||||
Subject: [PATCH] widl: Add support for recursive type references to SLTG
|
||||
typelib generator.
|
||||
|
||||
---
|
||||
tools/widl/write_sltg.c | 66 ++++++++++++++++++++++++++++-------------
|
||||
1 file changed, 46 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/tools/widl/write_sltg.c b/tools/widl/write_sltg.c
|
||||
index bb3a6c003d0..b4fd8f38006 100644
|
||||
--- a/tools/widl/write_sltg.c
|
||||
+++ b/tools/widl/write_sltg.c
|
||||
@@ -203,6 +203,12 @@ struct sltg_hrefinfo
|
||||
|
||||
#include "poppack.h"
|
||||
|
||||
+static void add_structure_typeinfo(struct sltg_typelib *typelib, type_t *type);
|
||||
+static void add_interface_typeinfo(struct sltg_typelib *typelib, type_t *type);
|
||||
+static void add_enum_typeinfo(struct sltg_typelib *typelib, type_t *type);
|
||||
+static void add_union_typeinfo(struct sltg_typelib *typelib, type_t *type);
|
||||
+static void add_coclass_typeinfo(struct sltg_typelib *typelib, type_t *type);
|
||||
+
|
||||
static void init_sltg_data(struct sltg_data *data)
|
||||
{
|
||||
data->size = 0;
|
||||
@@ -461,11 +467,6 @@ static void append_data(struct sltg_data *block, const void *data, int size)
|
||||
block->size = new_size;
|
||||
}
|
||||
|
||||
-static void add_typedef_typeinfo(struct sltg_typelib *typelib, type_t *type)
|
||||
-{
|
||||
- error("add_typedef_typeinfo: %s not implemented\n", type->name);
|
||||
-}
|
||||
-
|
||||
static void add_module_typeinfo(struct sltg_typelib *typelib, type_t *type)
|
||||
{
|
||||
error("add_module_typeinfo: %s not implemented\n", type->name);
|
||||
@@ -747,8 +748,8 @@ static int local_href(struct sltg_hrefmap *hrefmap, int typelib_href)
|
||||
return href << 2;
|
||||
}
|
||||
|
||||
-static short write_var_desc(struct sltg_data *data, type_t *type, short flags, short base_offset,
|
||||
- int *size_instance, struct sltg_hrefmap *hrefmap)
|
||||
+static short write_var_desc(struct sltg_typelib *typelib, struct sltg_data *data, type_t *type, short flags,
|
||||
+ short base_offset, int *size_instance, struct sltg_hrefmap *hrefmap)
|
||||
{
|
||||
short vt, vt_flags, desc_offset;
|
||||
|
||||
@@ -840,10 +841,10 @@ static short write_var_desc(struct sltg_data *data, type_t *type, short flags, s
|
||||
chat("write_var_desc: vt VT_PTR | 0x0400\n");
|
||||
vt = VT_PTR | 0x0400;
|
||||
append_data(data, &vt, sizeof(vt));
|
||||
- write_var_desc(data, ref, 0, base_offset, size_instance, hrefmap);
|
||||
+ write_var_desc(typelib, data, ref, 0, base_offset, size_instance, hrefmap);
|
||||
}
|
||||
else
|
||||
- write_var_desc(data, ref, 0x0e00, base_offset, size_instance, hrefmap);
|
||||
+ write_var_desc(typelib, data, ref, 0x0e00, base_offset, size_instance, hrefmap);
|
||||
return desc_offset;
|
||||
}
|
||||
|
||||
@@ -862,6 +863,33 @@ static short write_var_desc(struct sltg_data *data, type_t *type, short flags, s
|
||||
chat("write_var_desc: VT_USERDEFINED, type %p, name %s, real type %d, href %d\n",
|
||||
type, type->name, type_get_type(type), type->typelib_idx);
|
||||
|
||||
+ if (type->typelib_idx == -1)
|
||||
+ {
|
||||
+ chat("write_var_desc: trying to ref not added type\n");
|
||||
+
|
||||
+ switch (type_get_type(type))
|
||||
+ {
|
||||
+ case TYPE_STRUCT:
|
||||
+ add_structure_typeinfo(typelib, type);
|
||||
+ break;
|
||||
+ case TYPE_INTERFACE:
|
||||
+ add_interface_typeinfo(typelib, type);
|
||||
+ break;
|
||||
+ case TYPE_ENUM:
|
||||
+ add_enum_typeinfo(typelib, type);
|
||||
+ break;
|
||||
+ case TYPE_UNION:
|
||||
+ add_union_typeinfo(typelib, type);
|
||||
+ break;
|
||||
+ case TYPE_COCLASS:
|
||||
+ add_coclass_typeinfo(typelib, type);
|
||||
+ break;
|
||||
+ default:
|
||||
+ error("write_var_desc: VT_USERDEFINED - unhandled type %d\n",
|
||||
+ type_get_type(type));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (type->typelib_idx == -1)
|
||||
error("write_var_desc: trying to ref not added type\n");
|
||||
|
||||
@@ -888,6 +916,8 @@ static void add_structure_typeinfo(struct sltg_typelib *typelib, type_t *type)
|
||||
int member_offset, var_count = 0, var_data_size = 0, size_instance = 0;
|
||||
short *type_desc_offset = NULL;
|
||||
|
||||
+ if (type->typelib_idx != -1) return;
|
||||
+
|
||||
chat("add_structure_typeinfo: type %p, type->name %s\n", type, type->name);
|
||||
|
||||
type->typelib_idx = typelib->n_file_blocks;
|
||||
@@ -897,8 +927,6 @@ static void add_structure_typeinfo(struct sltg_typelib *typelib, type_t *type)
|
||||
|
||||
init_sltg_data(&data);
|
||||
|
||||
- index_name = add_typeinfo_block(typelib, type, TKIND_RECORD);
|
||||
-
|
||||
if (type_struct_get_fields(type))
|
||||
{
|
||||
int i = 0;
|
||||
@@ -913,13 +941,13 @@ static void add_structure_typeinfo(struct sltg_typelib *typelib, type_t *type)
|
||||
{
|
||||
short base_offset;
|
||||
|
||||
- chat("add_structure_typeinfo: var %p, name %s, type %p\n",
|
||||
- var, var->name, var->declspec.type);
|
||||
+ chat("add_structure_typeinfo: var %p (%s), type %p (%s)\n",
|
||||
+ var, var->name, var->declspec.type, var->declspec.type->name);
|
||||
|
||||
init_sltg_data(&var_data[i]);
|
||||
|
||||
base_offset = var_data_size + (i + 1) * sizeof(struct sltg_variable);
|
||||
- type_desc_offset[i] = write_var_desc(&var_data[i], var->declspec.type, 0, base_offset, &size_instance, &hrefmap);
|
||||
+ type_desc_offset[i] = write_var_desc(typelib, &var_data[i], var->declspec.type, 0, base_offset, &size_instance, &hrefmap);
|
||||
dump_var_desc(var_data[i].data, var_data[i].size);
|
||||
|
||||
if (var_data[i].size > sizeof(short))
|
||||
@@ -928,6 +956,8 @@ static void add_structure_typeinfo(struct sltg_typelib *typelib, type_t *type)
|
||||
}
|
||||
}
|
||||
|
||||
+ index_name = add_typeinfo_block(typelib, type, TKIND_RECORD);
|
||||
+
|
||||
init_typeinfo(&ti, type, TKIND_RECORD, &hrefmap);
|
||||
append_data(&data, &ti, sizeof(ti));
|
||||
|
||||
@@ -1064,12 +1094,8 @@ static void add_statement(struct sltg_typelib *typelib, const statement_t *stmt)
|
||||
|
||||
LIST_FOR_EACH_ENTRY(ref, stmt->u.type_list, typeref_t, entry)
|
||||
{
|
||||
- /* if the type is public then add the typedef, otherwise attempt
|
||||
- * to add the aliased type */
|
||||
- if (is_attr(ref->type->attrs, ATTR_PUBLIC))
|
||||
- add_typedef_typeinfo(typelib, ref->type);
|
||||
- else
|
||||
- add_type_typeinfo(typelib, type_alias_get_aliasee_type(ref->type));
|
||||
+ /* in old style typelibs all types are public */
|
||||
+ add_type_typeinfo(typelib, ref->type);
|
||||
}
|
||||
break;
|
||||
}
|
||||
--
|
||||
2.20.1
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,185 +0,0 @@
|
||||
From 95266a585cb4c924250c900a3b8c3c63ebbf0699 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Timoshkov <dmitry@baikal.ru>
|
||||
Date: Tue, 19 Jan 2016 18:44:00 +0800
|
||||
Subject: widl: Add support for inherited interfaces to SLTG typelib generator.
|
||||
|
||||
---
|
||||
tools/widl/write_sltg.c | 90 +++++++++++++++++++++++++++++++++++++++----------
|
||||
1 file changed, 73 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/tools/widl/write_sltg.c b/tools/widl/write_sltg.c
|
||||
index 556816f..c8a8cfb 100644
|
||||
--- a/tools/widl/write_sltg.c
|
||||
+++ b/tools/widl/write_sltg.c
|
||||
@@ -225,6 +225,22 @@ struct sltg_function
|
||||
#endif
|
||||
};
|
||||
|
||||
+struct sltg_impl_info
|
||||
+{
|
||||
+ short res00;
|
||||
+ short next;
|
||||
+ short res04;
|
||||
+ char impltypeflags;
|
||||
+ char res07;
|
||||
+ short res08;
|
||||
+ short ref;
|
||||
+ short res0c;
|
||||
+ short res0e;
|
||||
+ short res10;
|
||||
+ short res12;
|
||||
+ short pos;
|
||||
+};
|
||||
+
|
||||
#include "poppack.h"
|
||||
|
||||
static void add_structure_typeinfo(struct sltg_typelib *typelib, type_t *type);
|
||||
@@ -1311,18 +1327,39 @@ static int add_func_desc(struct sltg_typelib *typelib, struct sltg_data *data, v
|
||||
return data->size - old_size;
|
||||
}
|
||||
|
||||
+static void write_impl_href(struct sltg_data *data, short href)
|
||||
+{
|
||||
+ struct sltg_impl_info impl_info;
|
||||
+
|
||||
+ impl_info.res00 = 0x004a;
|
||||
+ impl_info.next = -1;
|
||||
+ impl_info.res04 = -1;
|
||||
+ impl_info.impltypeflags = 0;
|
||||
+ impl_info.res07 = 0x80;
|
||||
+ impl_info.res08 = 0x0012;
|
||||
+ impl_info.ref = href;
|
||||
+ impl_info.res0c = 0x4001;
|
||||
+ impl_info.res0e = -2; /* 0xfffe */
|
||||
+ impl_info.res10 = -1;
|
||||
+ impl_info.res12 = 0x001d;
|
||||
+ impl_info.pos = 0;
|
||||
+
|
||||
+ append_data(data, &impl_info, sizeof(impl_info));
|
||||
+}
|
||||
+
|
||||
static void add_interface_typeinfo(struct sltg_typelib *typelib, type_t *iface)
|
||||
{
|
||||
const statement_t *stmt_func;
|
||||
importinfo_t *ref_importinfo = NULL;
|
||||
- type_t *inherit;
|
||||
+ short inherit_href = -1;
|
||||
struct sltg_data data;
|
||||
struct sltg_hrefmap hrefmap;
|
||||
const char *index_name;
|
||||
struct sltg_typeinfo_header ti;
|
||||
struct sltg_member_header member;
|
||||
struct sltg_tail tail;
|
||||
- int member_offset, base_offset, func_count, func_data_size, i;
|
||||
+ int member_offset, base_offset, func_data_size, i;
|
||||
+ int func_count, inherited_func_count = 0;
|
||||
|
||||
if (iface->typelib_idx != -1) return;
|
||||
|
||||
@@ -1340,13 +1377,16 @@ static void add_interface_typeinfo(struct sltg_typelib *typelib, type_t *iface)
|
||||
return;
|
||||
}
|
||||
|
||||
- inherit = type_iface_get_inherit(iface);
|
||||
+ hrefmap.href_count = 0;
|
||||
+ hrefmap.href = NULL;
|
||||
|
||||
- if (inherit)
|
||||
+ if (type_iface_get_inherit(iface))
|
||||
{
|
||||
- chat("add_interface_typeinfo: inheriting from base interface %s\n", inherit->name);
|
||||
+ type_t *inherit;
|
||||
|
||||
- warning("inheriting from base interface %s is not implemented\n", inherit->name);
|
||||
+ inherit = type_iface_get_inherit(iface);
|
||||
+
|
||||
+ chat("add_interface_typeinfo: inheriting from base interface %s\n", inherit->name);
|
||||
|
||||
ref_importinfo = find_importinfo(typelib->typelib, inherit->name);
|
||||
|
||||
@@ -1355,6 +1395,14 @@ static void add_interface_typeinfo(struct sltg_typelib *typelib, type_t *iface)
|
||||
|
||||
if (ref_importinfo)
|
||||
error("support for imported interfaces is not implemented\n");
|
||||
+
|
||||
+ inherit_href = local_href(&hrefmap, inherit->typelib_idx);
|
||||
+
|
||||
+ while (inherit)
|
||||
+ {
|
||||
+ inherited_func_count += list_count(type_iface_get_stmts(inherit));
|
||||
+ inherit = type_iface_get_inherit(inherit);
|
||||
+ }
|
||||
}
|
||||
|
||||
/* check typelib_idx again, it could have been added while resolving the parent interface */
|
||||
@@ -1363,9 +1411,6 @@ static void add_interface_typeinfo(struct sltg_typelib *typelib, type_t *iface)
|
||||
iface->typelib_idx = typelib->n_file_blocks;
|
||||
|
||||
/* pass 1: calculate function descriptions data size */
|
||||
- hrefmap.href_count = 0;
|
||||
- hrefmap.href = NULL;
|
||||
-
|
||||
init_sltg_data(&data);
|
||||
|
||||
STATEMENTS_FOR_EACH_FUNC(stmt_func, type_iface_get_stmts(iface))
|
||||
@@ -1388,19 +1433,21 @@ static void add_interface_typeinfo(struct sltg_typelib *typelib, type_t *iface)
|
||||
write_hrefmap(&data, &hrefmap);
|
||||
|
||||
member_offset = data.size;
|
||||
+ base_offset = 0;
|
||||
|
||||
member.res00 = 0x0001;
|
||||
member.res02 = 0xffff;
|
||||
member.res04 = 0x01;
|
||||
member.extra = func_data_size;
|
||||
+ if (inherit_href != -1)
|
||||
+ {
|
||||
+ member.extra += sizeof(struct sltg_impl_info);
|
||||
+ base_offset += sizeof(struct sltg_impl_info);
|
||||
+ }
|
||||
append_data(&data, &member, sizeof(member));
|
||||
|
||||
- base_offset = 0;
|
||||
-
|
||||
- /* inheriting from base interface is not implemented yet
|
||||
- if (type_iface_get_inherit(iface))
|
||||
- add_impl_type(typeinfo, type_iface_get_inherit(iface), ref_importinfo);
|
||||
- */
|
||||
+ if (inherit_href != -1)
|
||||
+ write_impl_href(&data, inherit_href);
|
||||
|
||||
i = 0;
|
||||
|
||||
@@ -1408,7 +1455,8 @@ static void add_interface_typeinfo(struct sltg_typelib *typelib, type_t *iface)
|
||||
{
|
||||
if (i == func_count - 1) i |= 0x80000000;
|
||||
|
||||
- base_offset += add_func_desc(typelib, &data, stmt_func->u.var, i, base_offset, &hrefmap);
|
||||
+ base_offset += add_func_desc(typelib, &data, stmt_func->u.var,
|
||||
+ inherited_func_count + i, base_offset, &hrefmap);
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -1419,10 +1467,18 @@ static void add_interface_typeinfo(struct sltg_typelib *typelib, type_t *iface)
|
||||
tail.funcs_bytes = func_data_size;
|
||||
tail.cbSizeInstance = pointer_size;
|
||||
tail.cbAlignment = pointer_size;
|
||||
- tail.cbSizeVft = func_count * pointer_size;
|
||||
+ tail.cbSizeVft = (inherited_func_count + func_count) * pointer_size;
|
||||
tail.type_bytes = data.size - member_offset - sizeof(member);
|
||||
tail.res24 = 0;
|
||||
tail.res26 = 0;
|
||||
+ if (inherit_href != -1)
|
||||
+ {
|
||||
+ tail.cImplTypes++;
|
||||
+ tail.impls_off = 0;
|
||||
+ tail.impls_bytes = 0;
|
||||
+
|
||||
+ tail.funcs_off += sizeof(struct sltg_impl_info);
|
||||
+ }
|
||||
append_data(&data, &tail, sizeof(tail));
|
||||
|
||||
add_block(typelib, data.data, data.size, index_name);
|
||||
--
|
||||
2.6.4
|
||||
|
@ -1 +1 @@
|
||||
8a3b0d7bc317aada750769af8f82762c7001acad
|
||||
00198c4084a61f65f18574d16833d945e50c0614
|
||||
|
Loading…
x
Reference in New Issue
Block a user