widl: Store function and function pointer types completely within type_t type.
This commit is contained in:
parent
a04b150839
commit
6a0c5a4fe9
|
@ -227,7 +227,7 @@ void write_type_left(FILE *h, type_t *t, int declonly)
|
|||
else fprintf(h, "enum {\n");
|
||||
t->written = TRUE;
|
||||
indentation++;
|
||||
write_enums(h, t->fields);
|
||||
write_enums(h, t->fields_or_args);
|
||||
indent(h, -1);
|
||||
fprintf(h, "}");
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ void write_type_left(FILE *h, type_t *t, int declonly)
|
|||
else fprintf(h, "struct {\n");
|
||||
t->written = TRUE;
|
||||
indentation++;
|
||||
write_fields(h, t->fields);
|
||||
write_fields(h, t->fields_or_args);
|
||||
indent(h, -1);
|
||||
fprintf(h, "}");
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ void write_type_left(FILE *h, type_t *t, int declonly)
|
|||
else fprintf(h, "union {\n");
|
||||
t->written = TRUE;
|
||||
indentation++;
|
||||
write_fields(h, t->fields);
|
||||
write_fields(h, t->fields_or_args);
|
||||
indent(h, -1);
|
||||
fprintf(h, "}");
|
||||
}
|
||||
|
@ -402,7 +402,7 @@ void check_for_additional_prototype_types(const var_list_t *list)
|
|||
}
|
||||
else
|
||||
{
|
||||
check_for_additional_prototype_types(type->fields);
|
||||
check_for_additional_prototype_types(type->fields_or_args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -690,13 +690,13 @@ void write_args(FILE *h, const var_list_t *args, const char *name, int method, i
|
|||
}
|
||||
else fprintf(h, ",");
|
||||
}
|
||||
if (arg->args)
|
||||
if (arg->type->type == RPC_FC_FUNCTION)
|
||||
{
|
||||
write_type_decl_left(h, arg->type);
|
||||
write_type_decl_left(h, arg->type->ref);
|
||||
fprintf(h, " (STDMETHODCALLTYPE *");
|
||||
write_name(h,arg);
|
||||
fprintf(h, ")(");
|
||||
write_args(h, arg->args, NULL, 0, FALSE);
|
||||
write_args(h, arg->type->fields_or_args, NULL, 0, FALSE);
|
||||
fprintf(h, ")");
|
||||
}
|
||||
else
|
||||
|
|
|
@ -92,7 +92,7 @@ static expr_t *make_expr3(enum expr_type type, expr_t *expr1, expr_t *expr2, exp
|
|||
static type_t *make_type(unsigned char type, type_t *ref);
|
||||
static expr_list_t *append_expr(expr_list_t *list, expr_t *expr);
|
||||
static array_dims_t *append_array(array_dims_t *list, expr_t *expr);
|
||||
static void set_type(var_t *v, type_t *type, int ptr_level, array_dims_t *arr, int top);
|
||||
static void set_type(var_t *v, type_t *type, const pident_t *pident, array_dims_t *arr, int top);
|
||||
static ifref_list_t *append_ifref(ifref_list_t *list, ifref_t *iface);
|
||||
static ifref_t *make_ifref(type_t *iface);
|
||||
static var_list_t *append_var(var_list_t *list, var_t *var);
|
||||
|
@ -100,7 +100,7 @@ static var_t *make_var(char *name);
|
|||
static pident_list_t *append_pident(pident_list_t *list, pident_t *p);
|
||||
static pident_t *make_pident(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 func_t *make_func(var_t *def, var_list_t *args);
|
||||
static type_t *make_class(char *name);
|
||||
static type_t *make_safearray(type_t *type);
|
||||
static type_t *make_builtin(char *name);
|
||||
|
@ -397,11 +397,11 @@ args: arg { check_arg($1); $$ = append_var( NULL, $1 ); }
|
|||
/* split into two rules to get bison to resolve a tVOID conflict */
|
||||
arg: attributes type pident array { $$ = $3->var;
|
||||
$$->attrs = $1;
|
||||
set_type($$, $2, $3->ptr_level, $4, TRUE);
|
||||
set_type($$, $2, $3, $4, TRUE);
|
||||
free($3);
|
||||
}
|
||||
| type pident array { $$ = $2->var;
|
||||
set_type($$, $1, $2->ptr_level, $3, TRUE);
|
||||
set_type($$, $1, $2, $3, TRUE);
|
||||
free($2);
|
||||
}
|
||||
;
|
||||
|
@ -537,7 +537,7 @@ case: tCASE expr ':' field { attr_t *a = make_attrp(ATTR_CASE, append_expr(
|
|||
;
|
||||
|
||||
constdef: tCONST type ident '=' expr_const { $$ = reg_const($3);
|
||||
set_type($$, $2, 0, NULL, FALSE);
|
||||
set_type($$, $2, NULL, NULL, FALSE);
|
||||
$$->eval = $5;
|
||||
}
|
||||
;
|
||||
|
@ -571,7 +571,7 @@ enum: ident '=' expr_const { $$ = reg_const($1);
|
|||
|
||||
enumdef: tENUM t_ident '{' enums '}' { $$ = get_typev(RPC_FC_ENUM16, $2, tsENUM);
|
||||
$$->kind = TKIND_ENUM;
|
||||
$$->fields = $4;
|
||||
$$->fields_or_args = $4;
|
||||
$$->defined = TRUE;
|
||||
if(in_typelib)
|
||||
add_typelib_entry($$);
|
||||
|
@ -631,7 +631,7 @@ expr_const: expr { $$ = $1;
|
|||
;
|
||||
|
||||
externdef: tEXTERN tCONST type ident { $$ = $4;
|
||||
set_type($$, $3, 0, NULL, FALSE);
|
||||
set_type($$, $3, NULL, NULL, FALSE);
|
||||
}
|
||||
;
|
||||
|
||||
|
@ -647,17 +647,18 @@ field: s_field ';' { $$ = $1; }
|
|||
|
||||
s_field: m_attributes type pident array { $$ = $3->var;
|
||||
$$->attrs = $1;
|
||||
set_type($$, $2, $3->ptr_level, $4, FALSE);
|
||||
set_type($$, $2, $3, $4, FALSE);
|
||||
free($3);
|
||||
}
|
||||
;
|
||||
|
||||
funcdef:
|
||||
m_attributes type callconv pident { var_t *v = $4->var;
|
||||
var_list_t *args = $4->args;
|
||||
v->attrs = $1;
|
||||
set_type(v, $2, $4->ptr_level, NULL, FALSE);
|
||||
set_type(v, $2, $4, NULL, FALSE);
|
||||
free($4);
|
||||
$$ = make_func(v);
|
||||
$$ = make_func(v, args);
|
||||
if (is_attr(v->attrs, ATTR_IN)) {
|
||||
error_loc("inapplicable attribute [in] for function '%s'\n",$$->def->name);
|
||||
}
|
||||
|
@ -779,14 +780,14 @@ dispinterfacedef: dispinterfacehdr '{'
|
|||
dispint_props
|
||||
dispint_meths
|
||||
'}' { $$ = $1;
|
||||
$$->fields = $3;
|
||||
$$->fields_or_args = $3;
|
||||
$$->funcs = $4;
|
||||
if (!parse_only && do_header) write_dispinterface($$);
|
||||
if (!parse_only && do_idfile) write_diid($$);
|
||||
}
|
||||
| dispinterfacehdr
|
||||
'{' interface ';' '}' { $$ = $1;
|
||||
$$->fields = $3->fields;
|
||||
$$->fields_or_args = $3->fields_or_args;
|
||||
$$->funcs = $3->funcs;
|
||||
if (!parse_only && do_header) write_dispinterface($$);
|
||||
if (!parse_only && do_idfile) write_diid($$);
|
||||
|
@ -865,7 +866,7 @@ pident: '*' pident %prec PPTR { $$ = $2; $$->ptr_level++; }
|
|||
| direct_ident
|
||||
;
|
||||
|
||||
func_ident: direct_ident '(' m_args ')' { $$ = $1; $1->var->args = $3; }
|
||||
func_ident: direct_ident '(' m_args ')' { $$ = $1; $1->args = $3; $1->is_func = TRUE; }
|
||||
|
||||
direct_ident: ident { $$ = make_pident($1); }
|
||||
| '(' pident ')' { $$ = $2; }
|
||||
|
@ -890,7 +891,7 @@ structdef: tSTRUCT t_ident '{' fields '}' { $$ = get_typev(RPC_FC_STRUCT, $2, ts
|
|||
/* overwrite RPC_FC_STRUCT with a more exact type */
|
||||
$$->type = get_struct_type( $4 );
|
||||
$$->kind = TKIND_RECORD;
|
||||
$$->fields = $4;
|
||||
$$->fields_or_args = $4;
|
||||
$$->defined = TRUE;
|
||||
if(in_typelib)
|
||||
add_typelib_entry($$);
|
||||
|
@ -917,7 +918,7 @@ typedef: tTYPEDEF m_attributes type pident_list { reg_typedefs($3, $4, $2);
|
|||
|
||||
uniondef: tUNION t_ident '{' fields '}' { $$ = get_typev(RPC_FC_NON_ENCAPSULATED_UNION, $2, tsUNION);
|
||||
$$->kind = TKIND_UNION;
|
||||
$$->fields = $4;
|
||||
$$->fields_or_args = $4;
|
||||
$$->defined = TRUE;
|
||||
}
|
||||
| tUNION t_ident
|
||||
|
@ -928,10 +929,10 @@ uniondef: tUNION t_ident '{' fields '}' { $$ = get_typev(RPC_FC_NON_ENCAPSULATE
|
|||
if (!u) u = make_var( xstrdup("tagged_union") );
|
||||
u->type = make_type(RPC_FC_NON_ENCAPSULATED_UNION, NULL);
|
||||
u->type->kind = TKIND_UNION;
|
||||
u->type->fields = $9;
|
||||
u->type->fields_or_args = $9;
|
||||
u->type->defined = TRUE;
|
||||
$$->fields = append_var( $$->fields, $5 );
|
||||
$$->fields = append_var( $$->fields, u );
|
||||
$$->fields_or_args = append_var( $$->fields_or_args, $5 );
|
||||
$$->fields_or_args = append_var( $$->fields_or_args, u );
|
||||
$$->defined = TRUE;
|
||||
}
|
||||
;
|
||||
|
@ -1296,7 +1297,7 @@ static type_t *make_type(unsigned char type, type_t *ref)
|
|||
t->attrs = NULL;
|
||||
t->orig = NULL;
|
||||
t->funcs = NULL;
|
||||
t->fields = NULL;
|
||||
t->fields_or_args = NULL;
|
||||
t->ifaces = NULL;
|
||||
t->dim = 0;
|
||||
t->size_is = NULL;
|
||||
|
@ -1315,7 +1316,7 @@ static type_t *make_type(unsigned char type, type_t *ref)
|
|||
return t;
|
||||
}
|
||||
|
||||
static void set_type(var_t *v, type_t *type, int ptr_level, array_dims_t *arr,
|
||||
static void set_type(var_t *v, type_t *type, const pident_t *pident, array_dims_t *arr,
|
||||
int top)
|
||||
{
|
||||
expr_list_t *sizes = get_attrp(v->attrs, ATTR_SIZEIS);
|
||||
|
@ -1325,6 +1326,7 @@ static void set_type(var_t *v, type_t *type, int ptr_level, array_dims_t *arr,
|
|||
int sizeless, has_varconf;
|
||||
expr_t *dim;
|
||||
type_t *atype, **ptype;
|
||||
int ptr_level = (pident ? pident->ptr_level : 0);
|
||||
|
||||
v->type = type;
|
||||
|
||||
|
@ -1355,6 +1357,16 @@ static void set_type(var_t *v, type_t *type, int ptr_level, array_dims_t *arr,
|
|||
error("%s: pointer attribute applied to non-pointer type\n", v->name);
|
||||
}
|
||||
|
||||
if (pident && pident->is_func) {
|
||||
int func_ptr_level = pident->func_ptr_level;
|
||||
/* function pointers always have one implicit level of pointer */
|
||||
if (func_ptr_level == 1) func_ptr_level = 0;
|
||||
v->type = make_type(RPC_FC_FUNCTION, v->type);
|
||||
v->type->fields_or_args = pident->args;
|
||||
for (; func_ptr_level > 0; func_ptr_level--)
|
||||
v->type = make_type(ptr_type, v->type);
|
||||
}
|
||||
|
||||
sizeless = FALSE;
|
||||
if (arr) LIST_FOR_EACH_ENTRY_REV(dim, arr, expr_t, entry)
|
||||
{
|
||||
|
@ -1506,7 +1518,6 @@ static var_t *make_var(char *name)
|
|||
var_t *v = xmalloc(sizeof(var_t));
|
||||
v->name = name;
|
||||
v->type = NULL;
|
||||
v->args = NULL;
|
||||
v->attrs = NULL;
|
||||
v->eval = NULL;
|
||||
return v;
|
||||
|
@ -1527,8 +1538,10 @@ static pident_t *make_pident(var_t *var)
|
|||
{
|
||||
pident_t *p = xmalloc(sizeof(*p));
|
||||
p->var = var;
|
||||
p->is_func = FALSE;
|
||||
p->ptr_level = 0;
|
||||
p->func_ptr_level = 0;
|
||||
p->args = NULL;
|
||||
return p;
|
||||
}
|
||||
|
||||
|
@ -1544,12 +1557,11 @@ static func_list_t *append_func(func_list_t *list, func_t *func)
|
|||
return list;
|
||||
}
|
||||
|
||||
static func_t *make_func(var_t *def)
|
||||
static func_t *make_func(var_t *def, var_list_t *args)
|
||||
{
|
||||
func_t *f = xmalloc(sizeof(func_t));
|
||||
f->def = def;
|
||||
f->args = def->args;
|
||||
def->args = NULL;
|
||||
f->args = args;
|
||||
f->ignore = parse_only;
|
||||
f->idx = -1;
|
||||
return f;
|
||||
|
@ -1630,7 +1642,7 @@ static void fix_type(type_t *t)
|
|||
if (t->kind == TKIND_ALIAS && is_incomplete(t)) {
|
||||
type_t *ot = t->orig;
|
||||
fix_type(ot);
|
||||
t->fields = ot->fields;
|
||||
t->fields_or_args = ot->fields_or_args;
|
||||
t->defined = ot->defined;
|
||||
}
|
||||
}
|
||||
|
@ -1700,6 +1712,15 @@ static type_t *reg_typedefs(type_t *type, pident_list_t *pidents, attr_list_t *a
|
|||
cptr++;
|
||||
}
|
||||
}
|
||||
if (pident->is_func) {
|
||||
int func_ptr_level = pident->func_ptr_level;
|
||||
/* function pointers always have one implicit level of pointer */
|
||||
if (func_ptr_level == 1) func_ptr_level = 0;
|
||||
cur = make_type(RPC_FC_FUNCTION, cur);
|
||||
cur->fields_or_args = pident->args;
|
||||
for (; func_ptr_level > 0; func_ptr_level--)
|
||||
cur = make_type(pointer_default, cur);
|
||||
}
|
||||
cur = alias(cur, name->name);
|
||||
cur->attrs = attrs;
|
||||
if (ptr_type)
|
||||
|
|
|
@ -168,7 +168,7 @@ static int type_has_pointers(const type_t *type)
|
|||
else if (is_struct(type->type))
|
||||
{
|
||||
const var_t *field;
|
||||
if (type->fields) LIST_FOR_EACH_ENTRY( field, type->fields, const var_t, entry )
|
||||
if (type->fields_or_args) LIST_FOR_EACH_ENTRY( field, type->fields_or_args, const var_t, entry )
|
||||
{
|
||||
if (type_has_pointers(field->type))
|
||||
return TRUE;
|
||||
|
@ -180,11 +180,11 @@ static int type_has_pointers(const type_t *type)
|
|||
const var_t *field;
|
||||
if (type->type == RPC_FC_ENCAPSULATED_UNION)
|
||||
{
|
||||
const var_t *uv = LIST_ENTRY(list_tail(type->fields), const var_t, entry);
|
||||
fields = uv->type->fields;
|
||||
const var_t *uv = LIST_ENTRY(list_tail(type->fields_or_args), const var_t, entry);
|
||||
fields = uv->type->fields_or_args;
|
||||
}
|
||||
else
|
||||
fields = type->fields;
|
||||
fields = type->fields_or_args;
|
||||
if (fields) LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry )
|
||||
{
|
||||
if (field->type && type_has_pointers(field->type))
|
||||
|
@ -208,7 +208,7 @@ static int type_has_full_pointer(const type_t *type)
|
|||
else if (is_struct(type->type))
|
||||
{
|
||||
const var_t *field;
|
||||
if (type->fields) LIST_FOR_EACH_ENTRY( field, type->fields, const var_t, entry )
|
||||
if (type->fields_or_args) LIST_FOR_EACH_ENTRY( field, type->fields_or_args, const var_t, entry )
|
||||
{
|
||||
if (type_has_full_pointer(field->type))
|
||||
return TRUE;
|
||||
|
@ -220,11 +220,11 @@ static int type_has_full_pointer(const type_t *type)
|
|||
const var_t *field;
|
||||
if (type->type == RPC_FC_ENCAPSULATED_UNION)
|
||||
{
|
||||
const var_t *uv = LIST_ENTRY(list_tail(type->fields), const var_t, entry);
|
||||
fields = uv->type->fields;
|
||||
const var_t *uv = LIST_ENTRY(list_tail(type->fields_or_args), const var_t, entry);
|
||||
fields = uv->type->fields_or_args;
|
||||
}
|
||||
else
|
||||
fields = type->fields;
|
||||
fields = type->fields_or_args;
|
||||
if (fields) LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry )
|
||||
{
|
||||
if (field->type && type_has_full_pointer(field->type))
|
||||
|
@ -710,7 +710,7 @@ static size_t write_conf_or_var_desc(FILE *file, const type_t *structure,
|
|||
size_t offset = 0;
|
||||
const var_t *var;
|
||||
|
||||
if (structure->fields) LIST_FOR_EACH_ENTRY( var, structure->fields, const var_t, entry )
|
||||
if (structure->fields_or_args) LIST_FOR_EACH_ENTRY( var, structure->fields_or_args, const var_t, entry )
|
||||
{
|
||||
unsigned int align = 0;
|
||||
/* FIXME: take alignment into account */
|
||||
|
@ -925,11 +925,11 @@ size_t type_memsize(const type_t *t, unsigned int *align)
|
|||
case RPC_FC_CSTRUCT:
|
||||
case RPC_FC_PSTRUCT:
|
||||
case RPC_FC_BOGUS_STRUCT:
|
||||
size = fields_memsize(t->fields, align);
|
||||
size = fields_memsize(t->fields_or_args, align);
|
||||
break;
|
||||
case RPC_FC_ENCAPSULATED_UNION:
|
||||
case RPC_FC_NON_ENCAPSULATED_UNION:
|
||||
size = union_memsize(t->fields, align);
|
||||
size = union_memsize(t->fields_or_args, align);
|
||||
break;
|
||||
case RPC_FC_SMFARRAY:
|
||||
case RPC_FC_LGFARRAY:
|
||||
|
@ -1147,7 +1147,7 @@ static void write_end(FILE *file, unsigned int *tfsoff)
|
|||
static void write_descriptors(FILE *file, type_t *type, unsigned int *tfsoff)
|
||||
{
|
||||
unsigned int offset = 0;
|
||||
var_list_t *fs = type->fields;
|
||||
var_list_t *fs = type->fields_or_args;
|
||||
var_t *f;
|
||||
|
||||
if (fs) LIST_FOR_EACH_ENTRY(f, fs, var_t, entry)
|
||||
|
@ -1221,7 +1221,7 @@ static int write_no_repeat_pointer_descriptions(
|
|||
if (is_non_complex_struct(type))
|
||||
{
|
||||
const var_t *v;
|
||||
LIST_FOR_EACH_ENTRY( v, type->fields, const var_t, entry )
|
||||
LIST_FOR_EACH_ENTRY( v, type->fields_or_args, const var_t, entry )
|
||||
written += write_no_repeat_pointer_descriptions(
|
||||
file, v->type,
|
||||
offset_in_memory, offset_in_buffer, typestring_offset);
|
||||
|
@ -1283,7 +1283,7 @@ static int write_pointer_description_offsets(
|
|||
{
|
||||
/* otherwise search for interesting fields to parse */
|
||||
const var_t *v;
|
||||
LIST_FOR_EACH_ENTRY( v, type->fields, const var_t, entry )
|
||||
LIST_FOR_EACH_ENTRY( v, type->fields_or_args, const var_t, entry )
|
||||
{
|
||||
written += write_pointer_description_offsets(
|
||||
file, v->attrs, v->type, offset_in_memory, offset_in_buffer,
|
||||
|
@ -1346,7 +1346,7 @@ static int write_fixed_array_pointer_descriptions(
|
|||
else if (is_struct(type->type))
|
||||
{
|
||||
const var_t *v;
|
||||
LIST_FOR_EACH_ENTRY( v, type->fields, const var_t, entry )
|
||||
LIST_FOR_EACH_ENTRY( v, type->fields_or_args, const var_t, entry )
|
||||
{
|
||||
pointer_count += write_fixed_array_pointer_descriptions(
|
||||
file, v->attrs, v->type, offset_in_memory, offset_in_buffer,
|
||||
|
@ -1457,7 +1457,7 @@ static int write_varying_array_pointer_descriptions(
|
|||
else if (is_struct(type->type))
|
||||
{
|
||||
const var_t *v;
|
||||
LIST_FOR_EACH_ENTRY( v, type->fields, const var_t, entry )
|
||||
LIST_FOR_EACH_ENTRY( v, type->fields_or_args, const var_t, entry )
|
||||
{
|
||||
pointer_count += write_varying_array_pointer_descriptions(
|
||||
file, v->attrs, v->type, offset_in_memory, offset_in_buffer,
|
||||
|
@ -1730,7 +1730,7 @@ static size_t write_array_tfs(FILE *file, const attr_list_t *attrs, type_t *type
|
|||
|
||||
static const var_t *find_array_or_string_in_struct(const type_t *type)
|
||||
{
|
||||
const var_t *last_field = LIST_ENTRY( list_tail(type->fields), const var_t, entry );
|
||||
const var_t *last_field = LIST_ENTRY( list_tail(type->fields_or_args), const var_t, entry );
|
||||
const type_t *ft = last_field->type;
|
||||
|
||||
if (ft->declarray && is_conformant_array(ft))
|
||||
|
@ -1750,7 +1750,7 @@ static void write_struct_members(FILE *file, const type_t *type,
|
|||
int salign = -1;
|
||||
int padding;
|
||||
|
||||
if (type->fields) LIST_FOR_EACH_ENTRY( field, type->fields, const var_t, entry )
|
||||
if (type->fields_or_args) LIST_FOR_EACH_ENTRY( field, type->fields_or_args, const var_t, entry )
|
||||
{
|
||||
type_t *ft = field->type;
|
||||
if (!ft->declarray || !is_conformant_array(ft))
|
||||
|
@ -1816,7 +1816,7 @@ static size_t write_struct_tfs(FILE *file, type_t *type,
|
|||
error("structure size for %s exceeds %d bytes by %d bytes\n",
|
||||
name, USHRT_MAX, total_size - USHRT_MAX);
|
||||
|
||||
if (type->fields) LIST_FOR_EACH_ENTRY(f, type->fields, var_t, entry)
|
||||
if (type->fields_or_args) LIST_FOR_EACH_ENTRY(f, type->fields_or_args, var_t, entry)
|
||||
has_pointers |= write_embedded_types(file, f->attrs, f->type, f->name,
|
||||
FALSE, tfsoff);
|
||||
if (!has_pointers) has_pointers = type_has_pointers(type);
|
||||
|
@ -1880,7 +1880,7 @@ static size_t write_struct_tfs(FILE *file, type_t *type,
|
|||
|
||||
if (type->type == RPC_FC_BOGUS_STRUCT)
|
||||
{
|
||||
const var_list_t *fs = type->fields;
|
||||
const var_list_t *fs = type->fields_or_args;
|
||||
const var_t *f;
|
||||
|
||||
type->ptrdesc = *tfsoff;
|
||||
|
@ -1990,11 +1990,11 @@ static size_t write_union_tfs(FILE *file, type_t *type, unsigned int *tfsoff)
|
|||
|
||||
if (type->type == RPC_FC_ENCAPSULATED_UNION)
|
||||
{
|
||||
const var_t *uv = LIST_ENTRY(list_tail(type->fields), const var_t, entry);
|
||||
fields = uv->type->fields;
|
||||
const var_t *uv = LIST_ENTRY(list_tail(type->fields_or_args), const var_t, entry);
|
||||
fields = uv->type->fields_or_args;
|
||||
}
|
||||
else
|
||||
fields = type->fields;
|
||||
fields = type->fields_or_args;
|
||||
|
||||
if (fields) LIST_FOR_EACH_ENTRY(f, fields, var_t, entry)
|
||||
{
|
||||
|
@ -2010,7 +2010,7 @@ static size_t write_union_tfs(FILE *file, type_t *type, unsigned int *tfsoff)
|
|||
print_start_tfs_comment(file, type, start_offset);
|
||||
if (type->type == RPC_FC_ENCAPSULATED_UNION)
|
||||
{
|
||||
const var_t *sv = LIST_ENTRY(list_head(type->fields), const var_t, entry);
|
||||
const var_t *sv = LIST_ENTRY(list_head(type->fields_or_args), const var_t, entry);
|
||||
const type_t *st = sv->type;
|
||||
|
||||
switch (st->type)
|
||||
|
@ -2458,8 +2458,8 @@ static unsigned int get_required_buffer_size_type(
|
|||
{
|
||||
size_t size = 0;
|
||||
const var_t *field;
|
||||
if (!type->fields) return 0;
|
||||
LIST_FOR_EACH_ENTRY( field, type->fields, const var_t, entry )
|
||||
if (!type->fields_or_args) return 0;
|
||||
LIST_FOR_EACH_ENTRY( field, type->fields_or_args, const var_t, entry )
|
||||
{
|
||||
unsigned int alignment;
|
||||
size += get_required_buffer_size_type(field->type, field->name,
|
||||
|
@ -2513,8 +2513,8 @@ static unsigned int get_required_buffer_size(const var_t *var, unsigned int *ali
|
|||
const var_t *field;
|
||||
unsigned int size = 36;
|
||||
|
||||
if (!type->fields) return size;
|
||||
LIST_FOR_EACH_ENTRY( field, type->fields, const var_t, entry )
|
||||
if (!type->fields_or_args) return size;
|
||||
LIST_FOR_EACH_ENTRY( field, type->fields_or_args, const var_t, entry )
|
||||
{
|
||||
unsigned int align;
|
||||
size += get_required_buffer_size_type(
|
||||
|
@ -2543,8 +2543,8 @@ static unsigned int get_required_buffer_size(const var_t *var, unsigned int *ali
|
|||
unsigned int size = 36;
|
||||
const var_t *field;
|
||||
|
||||
if (!type->fields) return size;
|
||||
LIST_FOR_EACH_ENTRY( field, type->fields, const var_t, entry )
|
||||
if (!type->fields_or_args) return size;
|
||||
LIST_FOR_EACH_ENTRY( field, type->fields_or_args, const var_t, entry )
|
||||
{
|
||||
unsigned int align;
|
||||
size += get_required_buffer_size_type(
|
||||
|
@ -3311,7 +3311,7 @@ int write_expr_eval_routines(FILE *file, const char *iface)
|
|||
LIST_FOR_EACH_ENTRY(eval, &expr_eval_routines, struct expr_eval_routine, entry)
|
||||
{
|
||||
const char *name = eval->structure->name;
|
||||
const var_list_t *fields = eval->structure->fields;
|
||||
const var_list_t *fields = eval->structure->fields_or_args;
|
||||
result = 1;
|
||||
|
||||
print_file(file, 0, "static void __RPC_USER %s_%sExprEval_%04u(PMIDL_STUB_MESSAGE pStubMsg)\n",
|
||||
|
|
|
@ -34,6 +34,8 @@ typedef GUID UUID;
|
|||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
#define RPC_FC_FUNCTION 0xfe
|
||||
|
||||
typedef struct _attr_t attr_t;
|
||||
typedef struct _expr_t expr_t;
|
||||
typedef struct _type_t type_t;
|
||||
|
@ -212,7 +214,7 @@ struct _type_t {
|
|||
struct _type_t *ref;
|
||||
const attr_list_t *attrs;
|
||||
func_list_t *funcs; /* interfaces and modules */
|
||||
var_list_t *fields; /* interfaces, structures and enumerations */
|
||||
var_list_t *fields_or_args; /* interfaces, structures, enumerations and functions (for args) */
|
||||
ifref_list_t *ifaces; /* coclasses */
|
||||
unsigned long dim; /* array dimension */
|
||||
expr_t *size_is, *length_is;
|
||||
|
@ -233,7 +235,6 @@ struct _type_t {
|
|||
struct _var_t {
|
||||
char *name;
|
||||
type_t *type;
|
||||
var_list_t *args; /* for function pointers */
|
||||
attr_list_t *attrs;
|
||||
expr_t *eval;
|
||||
|
||||
|
@ -244,8 +245,11 @@ struct _var_t {
|
|||
struct _pident_t {
|
||||
var_t *var;
|
||||
int ptr_level;
|
||||
|
||||
int is_func;
|
||||
/* levels of indirection for function pointers */
|
||||
int func_ptr_level;
|
||||
var_list_t *args;
|
||||
|
||||
/* parser-internal */
|
||||
struct list entry;
|
||||
|
@ -332,7 +336,7 @@ int is_union(unsigned char tc);
|
|||
|
||||
static inline type_t *get_func_return_type(const func_t *func)
|
||||
{
|
||||
return func->def->type;
|
||||
return func->def->type->ref;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1948,8 +1948,8 @@ static void add_dispinterface_typeinfo(msft_typelib_t *typelib, type_t *dispinte
|
|||
if (dispinterface->funcs)
|
||||
LIST_FOR_EACH_ENTRY( func, dispinterface->funcs, const func_t, entry ) idx++;
|
||||
|
||||
if (dispinterface->fields)
|
||||
LIST_FOR_EACH_ENTRY( var, dispinterface->fields, var_t, entry )
|
||||
if (dispinterface->fields_or_args)
|
||||
LIST_FOR_EACH_ENTRY( var, dispinterface->fields_or_args, var_t, entry )
|
||||
add_var_desc(msft_typeinfo, idx++, var);
|
||||
|
||||
if (dispinterface->funcs)
|
||||
|
@ -2032,8 +2032,8 @@ static void add_structure_typeinfo(msft_typelib_t *typelib, type_t *structure)
|
|||
msft_typeinfo = create_msft_typeinfo(typelib, TKIND_RECORD, structure->name, structure->attrs);
|
||||
msft_typeinfo->typeinfo->size = 0;
|
||||
|
||||
if (structure->fields)
|
||||
LIST_FOR_EACH_ENTRY( cur, structure->fields, var_t, entry )
|
||||
if (structure->fields_or_args)
|
||||
LIST_FOR_EACH_ENTRY( cur, structure->fields_or_args, var_t, entry )
|
||||
add_var_desc(msft_typeinfo, idx++, cur);
|
||||
}
|
||||
|
||||
|
@ -2047,8 +2047,8 @@ static void add_enum_typeinfo(msft_typelib_t *typelib, type_t *enumeration)
|
|||
msft_typeinfo = create_msft_typeinfo(typelib, TKIND_ENUM, enumeration->name, enumeration->attrs);
|
||||
msft_typeinfo->typeinfo->size = 0;
|
||||
|
||||
if (enumeration->fields)
|
||||
LIST_FOR_EACH_ENTRY( cur, enumeration->fields, var_t, entry )
|
||||
if (enumeration->fields_or_args)
|
||||
LIST_FOR_EACH_ENTRY( cur, enumeration->fields_or_args, var_t, entry )
|
||||
add_var_desc(msft_typeinfo, idx++, cur);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue