[PATCH 2/6] widl: Rename ifref_t to typeref_t.
Rémi Bernon
rbernon at codeweavers.com
Wed Feb 17 12:33:31 CST 2021
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
tools/widl/parser.y | 34 +++++++++++++++++-----------------
tools/widl/typetree.c | 14 +++++++-------
tools/widl/typetree.h | 8 ++++----
tools/widl/widltypes.h | 5 ++---
tools/widl/write_msft.c | 6 +++---
5 files changed, 33 insertions(+), 34 deletions(-)
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 54006529ba9..dd8012ca5f4 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -57,8 +57,8 @@ static attr_t *make_custom_attr(UUID *id, expr_t *pval);
static expr_list_t *append_expr(expr_list_t *list, expr_t *expr);
static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, declarator_t *decl, int top);
static var_list_t *set_var_types(attr_list_t *attrs, decl_spec_t *decl_spec, declarator_list_t *decls);
-static ifref_list_t *append_ifref(ifref_list_t *list, ifref_t *iface);
-static ifref_t *make_ifref(type_t *iface);
+static ifref_list_t *append_typeref(ifref_list_t *list, typeref_t *ref);
+static typeref_t *make_typeref(type_t *type);
static var_list_t *append_var_list(var_list_t *list, var_list_t *vars);
static declarator_list_t *append_declarator(declarator_list_t *list, declarator_t *p);
static declarator_t *make_declarator(var_t *var);
@@ -137,7 +137,7 @@ static typelib_t *current_typelib;
statement_list_t *stmt_list;
warning_t *warning;
warning_list_t *warning_list;
- ifref_t *ifref;
+ typeref_t *typeref;
ifref_list_t *ifref_list;
char *str;
UUID *uuid;
@@ -293,7 +293,7 @@ static typelib_t *current_typelib;
%type <type> type unqualified_type qualified_type
%type <type> type_parameter
%type <type_list> type_parameters
-%type <ifref> class_interface
+%type <typeref> class_interface
%type <ifref_list> class_interfaces
%type <ifref_list> requires required_types
%type <var> arg ne_union_field union_field s_field case enum enum_member declaration
@@ -934,12 +934,12 @@ namespacedef: tNAMESPACE aIDENTIFIER { $$ = $2; }
;
class_interfaces: { $$ = NULL; }
- | class_interfaces class_interface { $$ = append_ifref( $1, $2 ); }
+ | class_interfaces class_interface { $$ = append_typeref( $1, $2 ); }
;
class_interface:
- m_attributes interfaceref ';' { $$ = make_ifref($2); $$->attrs = $1; }
- | m_attributes dispinterfaceref ';' { $$ = make_ifref($2); $$->attrs = $1; }
+ m_attributes interfaceref ';' { $$ = make_typeref($2); $$->attrs = $1; }
+ | m_attributes dispinterfaceref ';' { $$ = make_typeref($2); $$->attrs = $1; }
;
dispinterface: tDISPINTERFACE typename { $$ = type_dispinterface_declare($2); }
@@ -982,8 +982,8 @@ interface:
;
required_types:
- qualified_type { $$ = append_ifref(NULL, make_ifref($1)); }
- | required_types ',' qualified_type { $$ = append_ifref($1, make_ifref($3)); }
+ qualified_type { $$ = append_typeref(NULL, make_typeref($1)); }
+ | required_types ',' qualified_type { $$ = append_typeref($1, make_typeref($3)); }
requires: { $$ = NULL; }
| tREQUIRES required_types { $$ = $2; }
@@ -1809,24 +1809,24 @@ static var_list_t *set_var_types(attr_list_t *attrs, decl_spec_t *decl_spec, dec
return var_list;
}
-static ifref_list_t *append_ifref(ifref_list_t *list, ifref_t *iface)
+static ifref_list_t *append_typeref(ifref_list_t *list, typeref_t *ref)
{
- if (!iface) return list;
+ if (!ref) return list;
if (!list)
{
list = xmalloc( sizeof(*list) );
list_init( list );
}
- list_add_tail( list, &iface->entry );
+ list_add_tail( list, &ref->entry );
return list;
}
-static ifref_t *make_ifref(type_t *type)
+static typeref_t *make_typeref(type_t *type)
{
- ifref_t *l = xmalloc(sizeof(ifref_t));
- l->type = type;
- l->attrs = NULL;
- return l;
+ typeref_t *ref = xmalloc(sizeof(typeref_t));
+ ref->type = type;
+ ref->attrs = NULL;
+ return ref;
}
static type_list_t *append_type(type_list_t *list, type_t *type)
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index 2f49a92511a..d2a43a36c01 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -548,7 +548,7 @@ type_t *type_runtimeclass_declare(char *name, struct namespace *namespace)
type_t *type_runtimeclass_define(type_t *runtimeclass, attr_list_t *attrs, ifref_list_t *ifaces)
{
- ifref_t *ifref, *required, *tmp;
+ typeref_t *ref, *required, *tmp;
ifref_list_t *requires;
if (runtimeclass->defined)
@@ -560,24 +560,24 @@ type_t *type_runtimeclass_define(type_t *runtimeclass, attr_list_t *attrs, ifref
if (!type_runtimeclass_get_default_iface(runtimeclass))
error_loc("missing default interface on runtimeclass %s\n", runtimeclass->name);
- LIST_FOR_EACH_ENTRY(ifref, ifaces, ifref_t, entry)
+ LIST_FOR_EACH_ENTRY(ref, ifaces, typeref_t, entry)
{
/* FIXME: this should probably not be allowed, here or in coclass, */
/* but for now there's too many places in Wine IDL where it is to */
/* even print a warning. */
- if (!(ifref->type->defined)) continue;
- if (!(requires = type_iface_get_requires(ifref->type))) continue;
- LIST_FOR_EACH_ENTRY(required, requires, ifref_t, entry)
+ if (!(ref->type->defined)) continue;
+ if (!(requires = type_iface_get_requires(ref->type))) continue;
+ LIST_FOR_EACH_ENTRY(required, requires, typeref_t, entry)
{
int found = 0;
- LIST_FOR_EACH_ENTRY(tmp, ifaces, ifref_t, entry)
+ LIST_FOR_EACH_ENTRY(tmp, ifaces, typeref_t, entry)
if ((found = type_is_equal(tmp->type, required->type))) break;
if (!found)
error_loc("interface '%s' also requires interface '%s', "
"but runtimeclass '%s' does not implement it.\n",
- ifref->type->name, required->type->name, runtimeclass->name);
+ ref->type->name, required->type->name, runtimeclass->name);
}
}
diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h
index 186f42307f4..7c2e9d40026 100644
--- a/tools/widl/typetree.h
+++ b/tools/widl/typetree.h
@@ -358,12 +358,12 @@ static inline ifref_list_t *type_runtimeclass_get_ifaces(const type_t *type)
static inline type_t *type_runtimeclass_get_default_iface(const type_t *type)
{
ifref_list_t *ifaces = type_runtimeclass_get_ifaces(type);
- ifref_t *entry;
+ typeref_t *ref;
if (!ifaces) return NULL;
- LIST_FOR_EACH_ENTRY(entry, ifaces, ifref_t, entry)
- if (is_attr(entry->attrs, ATTR_DEFAULT))
- return entry->type;
+ LIST_FOR_EACH_ENTRY(ref, ifaces, typeref_t, entry)
+ if (is_attr(ref->attrs, ATTR_DEFAULT))
+ return ref->type;
return NULL;
}
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h
index f31d40cad91..8e83fc059fb 100644
--- a/tools/widl/widltypes.h
+++ b/tools/widl/widltypes.h
@@ -43,7 +43,7 @@ typedef struct _type_t type_t;
typedef struct _var_t var_t;
typedef struct _decl_spec_t decl_spec_t;
typedef struct _declarator_t declarator_t;
-typedef struct _ifref_t ifref_t;
+typedef struct _typeref_t typeref_t;
typedef struct _typelib_entry_t typelib_entry_t;
typedef struct _importlib_t importlib_t;
typedef struct _importinfo_t importinfo_t;
@@ -537,7 +537,7 @@ struct _declarator_t {
struct list entry;
};
-struct _ifref_t {
+struct _typeref_t {
type_t *type;
attr_list_t *attrs;
@@ -601,7 +601,6 @@ struct _statement_t {
enum statement_type type;
union
{
- ifref_t iface;
type_t *type;
const char *str;
var_t *var;
diff --git a/tools/widl/write_msft.c b/tools/widl/write_msft.c
index 63635cec011..fb532f7a227 100644
--- a/tools/widl/write_msft.c
+++ b/tools/widl/write_msft.c
@@ -2331,7 +2331,7 @@ static void add_typedef_typeinfo(msft_typelib_t *typelib, type_t *tdef)
static void add_coclass_typeinfo(msft_typelib_t *typelib, type_t *cls)
{
msft_typeinfo_t *msft_typeinfo;
- ifref_t *iref;
+ typeref_t *iref;
int num_ifaces = 0, offset, i;
MSFT_RefRecord *ref, *first = NULL, *first_source = NULL;
int have_default = 0, have_default_source = 0;
@@ -2345,13 +2345,13 @@ static void add_coclass_typeinfo(msft_typelib_t *typelib, type_t *cls)
msft_typeinfo = create_msft_typeinfo(typelib, TKIND_COCLASS, cls->name, cls->attrs);
ifaces = type_coclass_get_ifaces(cls);
- if (ifaces) LIST_FOR_EACH_ENTRY( iref, ifaces, ifref_t, entry ) num_ifaces++;
+ if (ifaces) LIST_FOR_EACH_ENTRY( iref, ifaces, typeref_t, entry ) num_ifaces++;
offset = msft_typeinfo->typeinfo->datatype1 = ctl2_alloc_segment(typelib, MSFT_SEG_REFERENCES,
num_ifaces * sizeof(*ref), 0);
i = 0;
- if (ifaces) LIST_FOR_EACH_ENTRY( iref, ifaces, ifref_t, entry ) {
+ if (ifaces) LIST_FOR_EACH_ENTRY( iref, ifaces, typeref_t, entry ) {
if(iref->type->typelib_idx == -1)
add_interface_typeinfo(typelib, iref->type);
ref = (MSFT_RefRecord*) (typelib->typelib_segment_data[MSFT_SEG_REFERENCES] + offset + i * sizeof(*ref));
--
2.30.0
More information about the wine-devel
mailing list