widl: Remove func_t type.
It was just a simple indirection to get to a var_t, so just replace all uses of it with the latter.
This commit is contained in:
parent
a3f649f730
commit
979bdf28b6
|
@ -108,8 +108,6 @@ static ifref_t *make_ifref(type_t *iface);
|
||||||
static var_list_t *append_var_list(var_list_t *list, var_list_t *vars);
|
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_list_t *append_declarator(declarator_list_t *list, declarator_t *p);
|
||||||
static declarator_t *make_declarator(var_t *var);
|
static declarator_t *make_declarator(var_t *var);
|
||||||
static func_list_t *append_func(func_list_t *list, func_t *func);
|
|
||||||
static func_t *make_func(var_t *def);
|
|
||||||
static type_t *make_safearray(type_t *type);
|
static type_t *make_safearray(type_t *type);
|
||||||
static typelib_t *make_library(const char *name, const attr_list_t *attrs);
|
static typelib_t *make_library(const char *name, const attr_list_t *attrs);
|
||||||
static type_t *append_ptrchain_type(type_t *ptrchain, type_t *type);
|
static type_t *append_ptrchain_type(type_t *ptrchain, type_t *type);
|
||||||
|
@ -165,8 +163,6 @@ static statement_list_t *append_statement(statement_list_t *list, statement_t *s
|
||||||
var_list_t *var_list;
|
var_list_t *var_list;
|
||||||
declarator_t *declarator;
|
declarator_t *declarator;
|
||||||
declarator_list_t *declarator_list;
|
declarator_list_t *declarator_list;
|
||||||
func_t *func;
|
|
||||||
func_list_t *func_list;
|
|
||||||
statement_t *statement;
|
statement_t *statement;
|
||||||
statement_list_t *stmt_list;
|
statement_list_t *stmt_list;
|
||||||
ifref_t *ifref;
|
ifref_t *ifref;
|
||||||
|
@ -293,14 +289,14 @@ static statement_list_t *append_statement(statement_list_t *list, statement_t *s
|
||||||
%type <ifref> coclass_int
|
%type <ifref> coclass_int
|
||||||
%type <ifref_list> coclass_ints
|
%type <ifref_list> coclass_ints
|
||||||
%type <var> arg ne_union_field union_field s_field case enum declaration
|
%type <var> arg ne_union_field union_field s_field case enum declaration
|
||||||
%type <var_list> m_args arg_list args
|
%type <var> funcdef
|
||||||
|
%type <var_list> m_args arg_list args dispint_meths
|
||||||
%type <var_list> fields ne_union_fields cases enums enum_list dispint_props field
|
%type <var_list> fields ne_union_fields cases enums enum_list dispint_props field
|
||||||
%type <var> m_ident ident
|
%type <var> m_ident ident
|
||||||
%type <declarator> declarator direct_declarator init_declarator struct_declarator
|
%type <declarator> declarator direct_declarator init_declarator struct_declarator
|
||||||
%type <declarator> m_any_declarator any_declarator any_declarator_no_direct any_direct_declarator
|
%type <declarator> m_any_declarator any_declarator any_declarator_no_direct any_direct_declarator
|
||||||
%type <declarator> m_abstract_declarator abstract_declarator abstract_declarator_no_direct abstract_direct_declarator
|
%type <declarator> m_abstract_declarator abstract_declarator abstract_declarator_no_direct abstract_direct_declarator
|
||||||
%type <declarator_list> declarator_list struct_declarator_list
|
%type <declarator_list> declarator_list struct_declarator_list
|
||||||
%type <func> funcdef
|
|
||||||
%type <type> coclass coclasshdr coclassdef
|
%type <type> coclass coclasshdr coclassdef
|
||||||
%type <num> pointer_type version
|
%type <num> pointer_type version
|
||||||
%type <str> libraryhdr callconv cppquote importlib import t_ident
|
%type <str> libraryhdr callconv cppquote importlib import t_ident
|
||||||
|
@ -308,7 +304,7 @@ static statement_list_t *append_statement(statement_list_t *list, statement_t *s
|
||||||
%type <import> import_start
|
%type <import> import_start
|
||||||
%type <typelib> library_start librarydef
|
%type <typelib> library_start librarydef
|
||||||
%type <statement> statement typedef
|
%type <statement> statement typedef
|
||||||
%type <stmt_list> gbl_statements imp_statements int_statements dispint_meths
|
%type <stmt_list> gbl_statements imp_statements int_statements
|
||||||
|
|
||||||
%left ','
|
%left ','
|
||||||
%right '?' ':'
|
%right '?' ':'
|
||||||
|
@ -720,12 +716,10 @@ s_field: m_attributes decl_spec declarator { $$ = declare_var(check_field_attrs
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
funcdef:
|
funcdef: declaration { $$ = $1;
|
||||||
m_attributes decl_spec declarator { var_t *v;
|
if (type_get_type($$->type) != TYPE_FUNCTION)
|
||||||
v = declare_var(check_function_attrs($3->var->name, $1),
|
error_loc("only methods may be declared inside the methods section of a dispinterface\n");
|
||||||
$2, $3, FALSE);
|
check_function_attrs($$->name, $$->attrs);
|
||||||
free($3);
|
|
||||||
$$ = make_func(v);
|
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -826,7 +820,7 @@ dispint_props: tPROPERTIES ':' { $$ = NULL; }
|
||||||
;
|
;
|
||||||
|
|
||||||
dispint_meths: tMETHODS ':' { $$ = NULL; }
|
dispint_meths: tMETHODS ':' { $$ = NULL; }
|
||||||
| dispint_meths funcdef ';' { $$ = append_func( $1, $2 ); }
|
| dispint_meths funcdef ';' { $$ = append_var( $1, $2 ); }
|
||||||
;
|
;
|
||||||
|
|
||||||
dispinterfacedef: dispinterfacehdr '{'
|
dispinterfacedef: dispinterfacehdr '{'
|
||||||
|
@ -1693,25 +1687,6 @@ static declarator_t *make_declarator(var_t *var)
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
static func_list_t *append_func(func_list_t *list, func_t *func)
|
|
||||||
{
|
|
||||||
if (!func) return list;
|
|
||||||
if (!list)
|
|
||||||
{
|
|
||||||
list = xmalloc( sizeof(*list) );
|
|
||||||
list_init( list );
|
|
||||||
}
|
|
||||||
list_add_tail( list, &func->entry );
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
static func_t *make_func(var_t *def)
|
|
||||||
{
|
|
||||||
func_t *f = xmalloc(sizeof(func_t));
|
|
||||||
f->def = def;
|
|
||||||
return f;
|
|
||||||
}
|
|
||||||
|
|
||||||
static type_t *make_safearray(type_t *type)
|
static type_t *make_safearray(type_t *type)
|
||||||
{
|
{
|
||||||
return type_new_array(NULL, type_new_alias(type, "SAFEARRAY"), TRUE, 0,
|
return type_new_array(NULL, type_new_alias(type, "SAFEARRAY"), TRUE, 0,
|
||||||
|
|
|
@ -386,7 +386,7 @@ void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stm
|
||||||
compute_method_indexes(iface);
|
compute_method_indexes(iface);
|
||||||
}
|
}
|
||||||
|
|
||||||
void type_dispinterface_define(type_t *iface, var_list_t *props, func_list_t *methods)
|
void type_dispinterface_define(type_t *iface, var_list_t *props, var_list_t *methods)
|
||||||
{
|
{
|
||||||
iface->details.iface = xmalloc(sizeof(*iface->details.iface));
|
iface->details.iface = xmalloc(sizeof(*iface->details.iface));
|
||||||
iface->details.iface->disp_props = props;
|
iface->details.iface->disp_props = props;
|
||||||
|
|
|
@ -41,7 +41,7 @@ type_t *type_new_nonencapsulated_union(const char *name, int defined, var_list_t
|
||||||
type_t *type_new_encapsulated_union(char *name, var_t *switch_field, var_t *union_field, var_list_t *cases);
|
type_t *type_new_encapsulated_union(char *name, var_t *switch_field, var_t *union_field, var_list_t *cases);
|
||||||
type_t *type_new_bitfield(type_t *field_type, const expr_t *bits);
|
type_t *type_new_bitfield(type_t *field_type, const expr_t *bits);
|
||||||
void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stmts);
|
void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stmts);
|
||||||
void type_dispinterface_define(type_t *iface, var_list_t *props, func_list_t *methods);
|
void type_dispinterface_define(type_t *iface, var_list_t *props, var_list_t *methods);
|
||||||
void type_dispinterface_define_from_iface(type_t *dispiface, type_t *iface);
|
void type_dispinterface_define_from_iface(type_t *dispiface, type_t *iface);
|
||||||
void type_module_define(type_t *module, statement_list_t *stmts);
|
void type_module_define(type_t *module, statement_list_t *stmts);
|
||||||
type_t *type_coclass_define(type_t *coclass, ifref_list_t *ifaces);
|
type_t *type_coclass_define(type_t *coclass, ifref_list_t *ifaces);
|
||||||
|
|
|
@ -41,7 +41,6 @@ typedef struct _expr_t expr_t;
|
||||||
typedef struct _type_t type_t;
|
typedef struct _type_t type_t;
|
||||||
typedef struct _var_t var_t;
|
typedef struct _var_t var_t;
|
||||||
typedef struct _declarator_t declarator_t;
|
typedef struct _declarator_t declarator_t;
|
||||||
typedef struct _func_t func_t;
|
|
||||||
typedef struct _ifref_t ifref_t;
|
typedef struct _ifref_t ifref_t;
|
||||||
typedef struct _typelib_entry_t typelib_entry_t;
|
typedef struct _typelib_entry_t typelib_entry_t;
|
||||||
typedef struct _importlib_t importlib_t;
|
typedef struct _importlib_t importlib_t;
|
||||||
|
@ -54,7 +53,6 @@ typedef struct _statement_t statement_t;
|
||||||
|
|
||||||
typedef struct list attr_list_t;
|
typedef struct list attr_list_t;
|
||||||
typedef struct list str_list_t;
|
typedef struct list str_list_t;
|
||||||
typedef struct list func_list_t;
|
|
||||||
typedef struct list expr_list_t;
|
typedef struct list expr_list_t;
|
||||||
typedef struct list var_list_t;
|
typedef struct list var_list_t;
|
||||||
typedef struct list declarator_list_t;
|
typedef struct list declarator_list_t;
|
||||||
|
@ -301,7 +299,7 @@ struct func_details
|
||||||
struct iface_details
|
struct iface_details
|
||||||
{
|
{
|
||||||
statement_list_t *stmts;
|
statement_list_t *stmts;
|
||||||
func_list_t *disp_methods;
|
var_list_t *disp_methods;
|
||||||
var_list_t *disp_props;
|
var_list_t *disp_props;
|
||||||
struct _type_t *inherit;
|
struct _type_t *inherit;
|
||||||
};
|
};
|
||||||
|
@ -309,7 +307,6 @@ struct iface_details
|
||||||
struct module_details
|
struct module_details
|
||||||
{
|
{
|
||||||
statement_list_t *stmts;
|
statement_list_t *stmts;
|
||||||
func_list_t *funcs;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct array_details
|
struct array_details
|
||||||
|
@ -418,13 +415,6 @@ struct _declarator_t {
|
||||||
struct list entry;
|
struct list entry;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _func_t {
|
|
||||||
var_t *def;
|
|
||||||
|
|
||||||
/* parser-internal */
|
|
||||||
struct list entry;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _ifref_t {
|
struct _ifref_t {
|
||||||
type_t *iface;
|
type_t *iface;
|
||||||
attr_list_t *attrs;
|
attr_list_t *attrs;
|
||||||
|
|
|
@ -1950,7 +1950,7 @@ static void add_dispatch(msft_typelib_t *typelib)
|
||||||
static void add_dispinterface_typeinfo(msft_typelib_t *typelib, type_t *dispinterface)
|
static void add_dispinterface_typeinfo(msft_typelib_t *typelib, type_t *dispinterface)
|
||||||
{
|
{
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
const func_t *func;
|
var_t *func;
|
||||||
var_t *var;
|
var_t *var;
|
||||||
msft_typeinfo_t *msft_typeinfo;
|
msft_typeinfo_t *msft_typeinfo;
|
||||||
|
|
||||||
|
@ -1970,7 +1970,7 @@ static void add_dispinterface_typeinfo(msft_typelib_t *typelib, type_t *dispinte
|
||||||
|
|
||||||
/* count the no of methods, as the variable indices come after the funcs */
|
/* count the no of methods, as the variable indices come after the funcs */
|
||||||
if (dispinterface->details.iface->disp_methods)
|
if (dispinterface->details.iface->disp_methods)
|
||||||
LIST_FOR_EACH_ENTRY( func, dispinterface->details.iface->disp_methods, const func_t, entry )
|
LIST_FOR_EACH_ENTRY( func, dispinterface->details.iface->disp_methods, var_t, entry )
|
||||||
idx++;
|
idx++;
|
||||||
|
|
||||||
if (type_dispiface_get_props(dispinterface))
|
if (type_dispiface_get_props(dispinterface))
|
||||||
|
@ -1980,8 +1980,8 @@ static void add_dispinterface_typeinfo(msft_typelib_t *typelib, type_t *dispinte
|
||||||
if (type_dispiface_get_methods(dispinterface))
|
if (type_dispiface_get_methods(dispinterface))
|
||||||
{
|
{
|
||||||
idx = 0;
|
idx = 0;
|
||||||
LIST_FOR_EACH_ENTRY( func, type_dispiface_get_methods(dispinterface), const func_t, entry )
|
LIST_FOR_EACH_ENTRY( func, type_dispiface_get_methods(dispinterface), var_t, entry )
|
||||||
if(add_func_desc(msft_typeinfo, func->def, idx) == S_OK)
|
if(add_func_desc(msft_typeinfo, func, idx) == S_OK)
|
||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue