widl: Introduce type_iface_get_async_iface().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2019-08-14 21:45:46 -05:00 committed by Alexandre Julliard
parent bf31a900d1
commit b4fe4ccc96
6 changed files with 23 additions and 16 deletions

View File

@ -1651,8 +1651,8 @@ static void write_forward_decls(FILE *header, const statement_list_t *stmts)
if (is_object(iface) || is_attr(iface->attrs, ATTR_DISPINTERFACE)) if (is_object(iface) || is_attr(iface->attrs, ATTR_DISPINTERFACE))
{ {
write_forward(header, iface); write_forward(header, iface);
if (iface->details.iface->async_iface) if (type_iface_get_async_iface(iface))
write_forward(header, iface->details.iface->async_iface); write_forward(header, type_iface_get_async_iface(iface));
} }
} }
else if (type_get_type(stmt->u.type) == TYPE_COCLASS) else if (type_get_type(stmt->u.type) == TYPE_COCLASS)
@ -1688,7 +1688,7 @@ static void write_header_stmts(FILE *header, const statement_list_t *stmts, cons
if (type_get_type(stmt->u.type) == TYPE_INTERFACE) if (type_get_type(stmt->u.type) == TYPE_INTERFACE)
{ {
type_t *iface = stmt->u.type; type_t *iface = stmt->u.type;
type_t *async_iface = iface->details.iface->async_iface; type_t *async_iface = type_iface_get_async_iface(iface);
if (is_object(iface)) is_object_interface++; if (is_object(iface)) is_object_interface++;
if (is_attr(stmt->u.type->attrs, ATTR_DISPINTERFACE) || is_object(stmt->u.type)) if (is_attr(stmt->u.type->attrs, ATTR_DISPINTERFACE) || is_object(stmt->u.type))
{ {

View File

@ -2809,7 +2809,7 @@ static void check_async_uuid(type_t *iface)
inherit = iface->details.iface->inherit; inherit = iface->details.iface->inherit;
if (inherit && strcmp(inherit->name, "IUnknown")) if (inherit && strcmp(inherit->name, "IUnknown"))
inherit = inherit->details.iface->async_iface; inherit = type_iface_get_async_iface(inherit);
if (!inherit) if (!inherit)
error_loc("async_uuid applied to an interface with incompatible parent\n"); error_loc("async_uuid applied to an interface with incompatible parent\n");

View File

@ -739,7 +739,7 @@ static void write_proxy(type_t *iface, unsigned int *proc_offset)
print_proxy( "{\n"); print_proxy( "{\n");
indent++; indent++;
print_proxy( "%s_%s\n", print_proxy( "%s_%s\n",
iface->details.iface->async_iface == iface ? "CStdAsyncStubBuffer" : "CStdStubBuffer", type_iface_get_async_iface(iface) == iface ? "CStdAsyncStubBuffer" : "CStdStubBuffer",
need_delegation_indirect(iface) ? "DELEGATING_METHODS" : "METHODS"); need_delegation_indirect(iface) ? "DELEGATING_METHODS" : "METHODS");
indent--; indent--;
print_proxy( "}\n"); print_proxy( "}\n");
@ -840,8 +840,8 @@ static void write_proxy_stmts(const statement_list_t *stmts, unsigned int *proc_
if (need_proxy(iface)) if (need_proxy(iface))
{ {
write_proxy(iface, proc_offset); write_proxy(iface, proc_offset);
if (iface->details.iface->async_iface) if (type_iface_get_async_iface(iface))
write_proxy(iface->details.iface->async_iface, proc_offset); write_proxy(type_iface_get_async_iface(iface), proc_offset);
} }
} }
} }
@ -870,9 +870,9 @@ static void build_iface_list( const statement_list_t *stmts, type_t **ifaces[],
{ {
*ifaces = xrealloc( *ifaces, (*count + 1) * sizeof(**ifaces) ); *ifaces = xrealloc( *ifaces, (*count + 1) * sizeof(**ifaces) );
(*ifaces)[(*count)++] = iface; (*ifaces)[(*count)++] = iface;
if (iface->details.iface->async_iface) if (type_iface_get_async_iface(iface))
{ {
iface = iface->details.iface->async_iface; iface = type_iface_get_async_iface(iface);
*ifaces = xrealloc( *ifaces, (*count + 1) * sizeof(**ifaces) ); *ifaces = xrealloc( *ifaces, (*count + 1) * sizeof(**ifaces) );
(*ifaces)[(*count)++] = iface; (*ifaces)[(*count)++] = iface;
} }
@ -1012,7 +1012,7 @@ static void write_proxy_routines(const statement_list_t *stmts)
table_version = get_stub_mode() == MODE_Oif ? 2 : 1; table_version = get_stub_mode() == MODE_Oif ? 2 : 1;
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
if (interfaces[i]->details.iface->async_iface != interfaces[i]) continue; if (type_iface_get_async_iface(interfaces[i]) != interfaces[i]) continue;
if (table_version != 6) if (table_version != 6)
{ {
fprintf(proxy, "static const IID *_AsyncInterfaceTable[] =\n"); fprintf(proxy, "static const IID *_AsyncInterfaceTable[] =\n");

View File

@ -1394,7 +1394,7 @@ static void write_proc_func_header( FILE *file, int indent, const type_t *iface,
if (is_attr( func->attrs, ATTR_NOTIFY )) ext_flags |= 0x08; /* HasNotify */ if (is_attr( func->attrs, ATTR_NOTIFY )) ext_flags |= 0x08; /* HasNotify */
if (is_attr( func->attrs, ATTR_NOTIFYFLAG )) ext_flags |= 0x10; /* HasNotify2 */ if (is_attr( func->attrs, ATTR_NOTIFYFLAG )) ext_flags |= 0x10; /* HasNotify2 */
if (iface == iface->details.iface->async_iface) oi2_flags |= 0x20; if (iface == type_iface_get_async_iface(iface)) oi2_flags |= 0x20;
size = get_function_buffer_size( func, PASS_IN ); size = get_function_buffer_size( func, PASS_IN );
print_file( file, indent, "NdrFcShort(0x%x),\t/* client buffer = %u */\n", size, size ); print_file( file, indent, "NdrFcShort(0x%x),\t/* client buffer = %u */\n", size, size );
@ -1493,8 +1493,8 @@ static void for_each_iface(const statement_list_t *stmts,
iface = stmt->u.type; iface = stmt->u.type;
if (!pred(iface)) continue; if (!pred(iface)) continue;
proc(iface, file, indent, offset); proc(iface, file, indent, offset);
if (iface->details.iface->async_iface) if (type_iface_get_async_iface(iface))
proc(iface->details.iface->async_iface, file, indent, offset); proc(type_iface_get_async_iface(iface), file, indent, offset);
} }
} }

View File

@ -162,6 +162,13 @@ static inline type_t *type_iface_get_inherit(const type_t *type)
return type->details.iface->inherit; return type->details.iface->inherit;
} }
static inline type_t *type_iface_get_async_iface(const type_t *type)
{
type = type_get_real_type(type);
assert(type_get_type(type) == TYPE_INTERFACE);
return type->details.iface->async_iface;
}
static inline var_list_t *type_dispiface_get_props(const type_t *type) static inline var_list_t *type_dispiface_get_props(const type_t *type)
{ {
type = type_get_real_type(type); type = type_get_real_type(type);

View File

@ -494,10 +494,10 @@ static void write_id_data_stmts(const statement_list_t *stmts)
uuid = get_attrp(type->attrs, ATTR_UUID); uuid = get_attrp(type->attrs, ATTR_UUID);
write_id_guid(idfile, "IID", is_attr(type->attrs, ATTR_DISPINTERFACE) ? "DIID" : "IID", write_id_guid(idfile, "IID", is_attr(type->attrs, ATTR_DISPINTERFACE) ? "DIID" : "IID",
type->name, uuid); type->name, uuid);
if (type->details.iface->async_iface) if (type_iface_get_async_iface(type))
{ {
uuid = get_attrp(type->details.iface->async_iface->attrs, ATTR_UUID); uuid = get_attrp(type_iface_get_async_iface(type)->attrs, ATTR_UUID);
write_id_guid(idfile, "IID", "IID", type->details.iface->async_iface->name, uuid); write_id_guid(idfile, "IID", "IID", type_iface_get_async_iface(type)->name, uuid);
} }
} }
else if (type_get_type(type) == TYPE_COCLASS) else if (type_get_type(type) == TYPE_COCLASS)