widl: Replace type_list_t with typeref_list_t.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
84966c9b59
commit
94b5af4b34
|
@ -373,9 +373,9 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
|
||||||
}
|
}
|
||||||
case STMT_TYPEDEF:
|
case STMT_TYPEDEF:
|
||||||
{
|
{
|
||||||
const type_list_t *type_entry;
|
typeref_t *ref;
|
||||||
for (type_entry = stmt->u.type_list; type_entry; type_entry = type_entry->next)
|
if (stmt->u.type_list) LIST_FOR_EACH_ENTRY(ref, stmt->u.type_list, typeref_t, entry)
|
||||||
write_serialize_functions(client, type_entry->type, iface);
|
write_serialize_functions(client, ref->type, iface);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -539,11 +539,11 @@ static void write_client_ifaces(const statement_list_t *stmts, int expr_eval_rou
|
||||||
}
|
}
|
||||||
if (stmt2->type == STMT_TYPEDEF)
|
if (stmt2->type == STMT_TYPEDEF)
|
||||||
{
|
{
|
||||||
const type_list_t *type_entry;
|
typeref_t *ref;
|
||||||
for (type_entry = stmt2->u.type_list; type_entry; type_entry = type_entry->next)
|
if (stmt2->u.type_list) LIST_FOR_EACH_ENTRY(ref, stmt2->u.type_list, typeref_t, entry)
|
||||||
{
|
{
|
||||||
if (is_attr(type_entry->type->attrs, ATTR_ENCODE)
|
if (is_attr(ref->type->attrs, ATTR_ENCODE)
|
||||||
|| is_attr(type_entry->type->attrs, ATTR_DECODE))
|
|| is_attr(ref->type->attrs, ATTR_DECODE))
|
||||||
{
|
{
|
||||||
needs_stub = 1;
|
needs_stub = 1;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -776,7 +776,7 @@ static int for_each_serializable(const statement_list_t *stmts, FILE *header,
|
||||||
{
|
{
|
||||||
statement_t *stmt, *iface_stmt;
|
statement_t *stmt, *iface_stmt;
|
||||||
statement_list_t *iface_stmts;
|
statement_list_t *iface_stmts;
|
||||||
const type_list_t *type_entry;
|
typeref_t *ref;
|
||||||
|
|
||||||
if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, statement_t, entry )
|
if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, statement_t, entry )
|
||||||
{
|
{
|
||||||
|
@ -787,12 +787,12 @@ static int for_each_serializable(const statement_list_t *stmts, FILE *header,
|
||||||
if (iface_stmts) LIST_FOR_EACH_ENTRY( iface_stmt, iface_stmts, statement_t, entry )
|
if (iface_stmts) LIST_FOR_EACH_ENTRY( iface_stmt, iface_stmts, statement_t, entry )
|
||||||
{
|
{
|
||||||
if (iface_stmt->type != STMT_TYPEDEF) continue;
|
if (iface_stmt->type != STMT_TYPEDEF) continue;
|
||||||
for (type_entry = iface_stmt->u.type_list; type_entry; type_entry = type_entry->next)
|
if (iface_stmt->u.type_list) LIST_FOR_EACH_ENTRY(ref, iface_stmt->u.type_list, typeref_t, entry)
|
||||||
{
|
{
|
||||||
if (!is_attr(type_entry->type->attrs, ATTR_ENCODE)
|
if (!is_attr(ref->type->attrs, ATTR_ENCODE)
|
||||||
&& !is_attr(type_entry->type->attrs, ATTR_DECODE))
|
&& !is_attr(ref->type->attrs, ATTR_DECODE))
|
||||||
continue;
|
continue;
|
||||||
if (!proc(header, type_entry->type))
|
if (!proc(header, ref->type))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1887,9 +1887,9 @@ static void write_header_stmts(FILE *header, const statement_list_t *stmts, cons
|
||||||
break;
|
break;
|
||||||
case STMT_TYPEDEF:
|
case STMT_TYPEDEF:
|
||||||
{
|
{
|
||||||
const type_list_t *type_entry = stmt->u.type_list;
|
typeref_t *ref;
|
||||||
for (; type_entry; type_entry = type_entry->next)
|
if (stmt->u.type_list) LIST_FOR_EACH_ENTRY(ref, stmt->u.type_list, typeref_t, entry)
|
||||||
write_typedef(header, type_entry->type, stmt->declonly);
|
write_typedef(header, ref->type, stmt->declonly);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case STMT_LIBRARY:
|
case STMT_LIBRARY:
|
||||||
|
|
|
@ -45,7 +45,6 @@ struct _import_t
|
||||||
};
|
};
|
||||||
|
|
||||||
static str_list_t *append_str(str_list_t *list, char *str);
|
static str_list_t *append_str(str_list_t *list, char *str);
|
||||||
static type_list_t *append_type(type_list_t *list, type_t *type);
|
|
||||||
static attr_list_t *append_attr(attr_list_t *list, attr_t *attr);
|
static attr_list_t *append_attr(attr_list_t *list, attr_t *attr);
|
||||||
static attr_list_t *append_attr_list(attr_list_t *new_list, attr_list_t *old_list);
|
static attr_list_t *append_attr_list(attr_list_t *new_list, attr_list_t *old_list);
|
||||||
static decl_spec_t *make_decl_spec(type_t *type, decl_spec_t *left, decl_spec_t *right,
|
static decl_spec_t *make_decl_spec(type_t *type, decl_spec_t *left, decl_spec_t *right,
|
||||||
|
@ -128,7 +127,6 @@ static typelib_t *current_typelib;
|
||||||
expr_t *expr;
|
expr_t *expr;
|
||||||
expr_list_t *expr_list;
|
expr_list_t *expr_list;
|
||||||
type_t *type;
|
type_t *type;
|
||||||
type_list_t *type_list;
|
|
||||||
var_t *var;
|
var_t *var;
|
||||||
var_list_t *var_list;
|
var_list_t *var_list;
|
||||||
declarator_t *declarator;
|
declarator_t *declarator;
|
||||||
|
@ -292,7 +290,7 @@ static typelib_t *current_typelib;
|
||||||
%type <type> enumdef structdef uniondef typedecl
|
%type <type> enumdef structdef uniondef typedecl
|
||||||
%type <type> type unqualified_type qualified_type
|
%type <type> type unqualified_type qualified_type
|
||||||
%type <type> type_parameter
|
%type <type> type_parameter
|
||||||
%type <type_list> type_parameters
|
%type <typeref_list> type_parameters
|
||||||
%type <typeref> class_interface
|
%type <typeref> class_interface
|
||||||
%type <typeref_list> class_interfaces
|
%type <typeref_list> class_interfaces
|
||||||
%type <typeref_list> requires required_types
|
%type <typeref_list> requires required_types
|
||||||
|
@ -976,8 +974,8 @@ type_parameter: typename { $$ = get_type(TYPE_PARAMETER, $1, parameters_namesp
|
||||||
;
|
;
|
||||||
|
|
||||||
type_parameters:
|
type_parameters:
|
||||||
type_parameter { $$ = append_type(NULL, $1); }
|
type_parameter { $$ = append_typeref(NULL, make_typeref($1)); }
|
||||||
| type_parameters ',' type_parameter { $$ = append_type($1, $3); }
|
| type_parameters ',' type_parameter { $$ = append_typeref($1, make_typeref($3)); }
|
||||||
;
|
;
|
||||||
|
|
||||||
interface:
|
interface:
|
||||||
|
@ -1834,16 +1832,6 @@ static typeref_t *make_typeref(type_t *type)
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
static type_list_t *append_type(type_list_t *list, type_t *type)
|
|
||||||
{
|
|
||||||
type_list_t *entry;
|
|
||||||
if (!type) return list;
|
|
||||||
entry = xmalloc( sizeof(*entry) );
|
|
||||||
entry->type = type;
|
|
||||||
entry->next = list;
|
|
||||||
return entry;
|
|
||||||
}
|
|
||||||
|
|
||||||
var_list_t *append_var(var_list_t *list, var_t *var)
|
var_list_t *append_var(var_list_t *list, var_t *var)
|
||||||
{
|
{
|
||||||
if (!var) return list;
|
if (!var) return list;
|
||||||
|
@ -3214,24 +3202,18 @@ static statement_t *make_statement_typedef(declarator_list_t *decls, int declonl
|
||||||
{
|
{
|
||||||
declarator_t *decl, *next;
|
declarator_t *decl, *next;
|
||||||
statement_t *stmt;
|
statement_t *stmt;
|
||||||
type_list_t **type_list;
|
|
||||||
|
|
||||||
if (!decls) return NULL;
|
if (!decls) return NULL;
|
||||||
|
|
||||||
stmt = make_statement(STMT_TYPEDEF);
|
stmt = make_statement(STMT_TYPEDEF);
|
||||||
stmt->u.type_list = NULL;
|
stmt->u.type_list = NULL;
|
||||||
type_list = &stmt->u.type_list;
|
|
||||||
stmt->declonly = declonly;
|
stmt->declonly = declonly;
|
||||||
|
|
||||||
LIST_FOR_EACH_ENTRY_SAFE( decl, next, decls, declarator_t, entry )
|
LIST_FOR_EACH_ENTRY_SAFE( decl, next, decls, declarator_t, entry )
|
||||||
{
|
{
|
||||||
var_t *var = decl->var;
|
var_t *var = decl->var;
|
||||||
type_t *type = find_type_or_error(current_namespace, var->name);
|
type_t *type = find_type_or_error(current_namespace, var->name);
|
||||||
*type_list = xmalloc(sizeof(type_list_t));
|
stmt->u.type_list = append_typeref(stmt->u.type_list, make_typeref(type));
|
||||||
(*type_list)->type = type;
|
|
||||||
(*type_list)->next = NULL;
|
|
||||||
|
|
||||||
type_list = &(*type_list)->next;
|
|
||||||
free(decl);
|
free(decl);
|
||||||
free(var);
|
free(var);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3747,13 +3747,13 @@ static void process_tfs_iface(type_t *iface, FILE *file, int indent, unsigned in
|
||||||
}
|
}
|
||||||
case STMT_TYPEDEF:
|
case STMT_TYPEDEF:
|
||||||
{
|
{
|
||||||
const type_list_t *type_entry;
|
typeref_t *ref;
|
||||||
for (type_entry = stmt->u.type_list; type_entry; type_entry = type_entry->next)
|
if (stmt->u.type_list) LIST_FOR_EACH_ENTRY(ref, stmt->u.type_list, typeref_t, entry)
|
||||||
{
|
{
|
||||||
if (is_attr(type_entry->type->attrs, ATTR_ENCODE)
|
if (is_attr(ref->type->attrs, ATTR_ENCODE)
|
||||||
|| is_attr(type_entry->type->attrs, ATTR_DECODE))
|
|| is_attr(ref->type->attrs, ATTR_DECODE))
|
||||||
type_entry->type->typestring_offset = write_type_tfs( file,
|
ref->type->typestring_offset = write_type_tfs( file,
|
||||||
type_entry->type->attrs, type_entry->type, type_entry->type->name,
|
ref->type->attrs, ref->type, ref->type->name,
|
||||||
TYPE_CONTEXT_CONTAINER, offset);
|
TYPE_CONTEXT_CONTAINER, offset);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -603,7 +603,7 @@ type_t *type_apicontract_define(type_t *apicontract, attr_list_t *attrs)
|
||||||
return apicontract;
|
return apicontract;
|
||||||
}
|
}
|
||||||
|
|
||||||
type_t *type_parameterized_interface_declare(char *name, struct namespace *namespace, type_list_t *params)
|
type_t *type_parameterized_interface_declare(char *name, struct namespace *namespace, typeref_list_t *params)
|
||||||
{
|
{
|
||||||
type_t *type = get_type(TYPE_PARAMETERIZED_TYPE, name, namespace, 0);
|
type_t *type = get_type(TYPE_PARAMETERIZED_TYPE, name, namespace, 0);
|
||||||
if (type_get_type_detect_alias(type) != TYPE_PARAMETERIZED_TYPE)
|
if (type_get_type_detect_alias(type) != TYPE_PARAMETERIZED_TYPE)
|
||||||
|
|
|
@ -62,7 +62,7 @@ type_t *type_coclass_define(type_t *coclass, attr_list_t *attrs, typeref_list_t
|
||||||
type_t *type_runtimeclass_define(type_t *runtimeclass, attr_list_t *attrs, typeref_list_t *ifaces);
|
type_t *type_runtimeclass_define(type_t *runtimeclass, attr_list_t *attrs, typeref_list_t *ifaces);
|
||||||
type_t *type_apicontract_declare(char *name, struct namespace *namespace);
|
type_t *type_apicontract_declare(char *name, struct namespace *namespace);
|
||||||
type_t *type_apicontract_define(type_t *apicontract, attr_list_t *attrs);
|
type_t *type_apicontract_define(type_t *apicontract, attr_list_t *attrs);
|
||||||
type_t *type_parameterized_interface_declare(char *name, struct namespace *namespace, type_list_t *params);
|
type_t *type_parameterized_interface_declare(char *name, struct namespace *namespace, typeref_list_t *params);
|
||||||
type_t *type_parameterized_interface_define(type_t *type, attr_list_t *attrs, type_t *inherit, statement_list_t *stmts, typeref_list_t *requires);
|
type_t *type_parameterized_interface_define(type_t *type, attr_list_t *attrs, type_t *inherit, statement_list_t *stmts, typeref_list_t *requires);
|
||||||
int type_is_equal(const type_t *type1, const type_t *type2);
|
int type_is_equal(const type_t *type1, const type_t *type2);
|
||||||
const char *type_get_name(const type_t *type, enum name_type name_type);
|
const char *type_get_name(const type_t *type, enum name_type name_type);
|
||||||
|
|
|
@ -51,7 +51,6 @@ typedef struct _typelib_t typelib_t;
|
||||||
typedef struct _user_type_t user_type_t;
|
typedef struct _user_type_t user_type_t;
|
||||||
typedef struct _user_type_t context_handle_t;
|
typedef struct _user_type_t context_handle_t;
|
||||||
typedef struct _user_type_t generic_handle_t;
|
typedef struct _user_type_t generic_handle_t;
|
||||||
typedef struct _type_list_t type_list_t;
|
|
||||||
typedef struct _statement_t statement_t;
|
typedef struct _statement_t statement_t;
|
||||||
typedef struct _warning_t warning_t;
|
typedef struct _warning_t warning_t;
|
||||||
|
|
||||||
|
@ -439,7 +438,7 @@ struct runtimeclass_details
|
||||||
struct parameterized_details
|
struct parameterized_details
|
||||||
{
|
{
|
||||||
type_t *type;
|
type_t *type;
|
||||||
type_list_t *params;
|
typeref_list_t *params;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define HASHMAX 64
|
#define HASHMAX 64
|
||||||
|
@ -591,11 +590,6 @@ struct _user_type_t {
|
||||||
const char *name;
|
const char *name;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _type_list_t {
|
|
||||||
type_t *type;
|
|
||||||
struct _type_list_t *next;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _statement_t {
|
struct _statement_t {
|
||||||
struct list entry;
|
struct list entry;
|
||||||
enum statement_type type;
|
enum statement_type type;
|
||||||
|
@ -605,7 +599,7 @@ struct _statement_t {
|
||||||
const char *str;
|
const char *str;
|
||||||
var_t *var;
|
var_t *var;
|
||||||
typelib_t *lib;
|
typelib_t *lib;
|
||||||
type_list_t *type_list;
|
typeref_list_t *type_list;
|
||||||
} u;
|
} u;
|
||||||
unsigned int declonly : 1; /* for STMT_TYPE and STMT_TYPEDEF */
|
unsigned int declonly : 1; /* for STMT_TYPE and STMT_TYPEDEF */
|
||||||
};
|
};
|
||||||
|
|
|
@ -2479,14 +2479,14 @@ static void add_entry(msft_typelib_t *typelib, const statement_t *stmt)
|
||||||
break;
|
break;
|
||||||
case STMT_TYPEDEF:
|
case STMT_TYPEDEF:
|
||||||
{
|
{
|
||||||
const type_list_t *type_entry = stmt->u.type_list;
|
typeref_t *ref;
|
||||||
for (; type_entry; type_entry = type_entry->next) {
|
if (stmt->u.type_list) LIST_FOR_EACH_ENTRY(ref, stmt->u.type_list, typeref_t, entry) {
|
||||||
/* if the type is public then add the typedef, otherwise attempt
|
/* if the type is public then add the typedef, otherwise attempt
|
||||||
* to add the aliased type */
|
* to add the aliased type */
|
||||||
if (is_attr(type_entry->type->attrs, ATTR_PUBLIC))
|
if (is_attr(ref->type->attrs, ATTR_PUBLIC))
|
||||||
add_typedef_typeinfo(typelib, type_entry->type);
|
add_typedef_typeinfo(typelib, ref->type);
|
||||||
else
|
else
|
||||||
add_type_typeinfo(typelib, type_alias_get_aliasee_type(type_entry->type));
|
add_type_typeinfo(typelib, type_alias_get_aliasee_type(ref->type));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue