widl: Added support for namespaced structs.
This commit is contained in:
parent
8d43c54ed2
commit
7c29a53208
|
@ -314,7 +314,7 @@ void write_type_left(FILE *h, type_t *t, enum name_type name_type, int declonly)
|
||||||
case TYPE_STRUCT:
|
case TYPE_STRUCT:
|
||||||
case TYPE_ENCAPSULATED_UNION:
|
case TYPE_ENCAPSULATED_UNION:
|
||||||
if (!declonly && t->defined && !t->written) {
|
if (!declonly && t->defined && !t->written) {
|
||||||
if (t->name) fprintf(h, "struct %s {\n", t->name);
|
if (name) fprintf(h, "struct %s {\n", name);
|
||||||
else fprintf(h, "struct {\n");
|
else fprintf(h, "struct {\n");
|
||||||
t->written = TRUE;
|
t->written = TRUE;
|
||||||
indentation++;
|
indentation++;
|
||||||
|
@ -325,7 +325,7 @@ void write_type_left(FILE *h, type_t *t, enum name_type name_type, int declonly)
|
||||||
indent(h, -1);
|
indent(h, -1);
|
||||||
fprintf(h, "}");
|
fprintf(h, "}");
|
||||||
}
|
}
|
||||||
else fprintf(h, "struct %s", t->name ? t->name : "");
|
else fprintf(h, "struct %s", name ? name : "");
|
||||||
break;
|
break;
|
||||||
case TYPE_UNION:
|
case TYPE_UNION:
|
||||||
if (!declonly && t->defined && !t->written) {
|
if (!declonly && t->defined && !t->written) {
|
||||||
|
|
|
@ -380,7 +380,7 @@ typedecl:
|
||||||
enumdef
|
enumdef
|
||||||
| tENUM aIDENTIFIER { $$ = type_new_enum($2, current_namespace, FALSE, NULL); }
|
| tENUM aIDENTIFIER { $$ = type_new_enum($2, current_namespace, FALSE, NULL); }
|
||||||
| structdef
|
| structdef
|
||||||
| tSTRUCT aIDENTIFIER { $$ = type_new_struct($2, FALSE, NULL); }
|
| tSTRUCT aIDENTIFIER { $$ = type_new_struct($2, current_namespace, FALSE, NULL); }
|
||||||
| uniondef
|
| uniondef
|
||||||
| tUNION aIDENTIFIER { $$ = type_new_nonencapsulated_union($2, FALSE, NULL); }
|
| tUNION aIDENTIFIER { $$ = type_new_nonencapsulated_union($2, FALSE, NULL); }
|
||||||
| attributes enumdef { $$ = $2; $$->attrs = check_enum_attrs($1); }
|
| attributes enumdef { $$ = $2; $$->attrs = check_enum_attrs($1); }
|
||||||
|
@ -1091,7 +1091,7 @@ pointer_type:
|
||||||
| tPTR { $$ = RPC_FC_FP; }
|
| tPTR { $$ = RPC_FC_FP; }
|
||||||
;
|
;
|
||||||
|
|
||||||
structdef: tSTRUCT t_ident '{' fields '}' { $$ = type_new_struct($2, TRUE, $4); }
|
structdef: tSTRUCT t_ident '{' fields '}' { $$ = type_new_struct($2, current_namespace, TRUE, $4); }
|
||||||
;
|
;
|
||||||
|
|
||||||
type: tVOID { $$ = type_new_void(); }
|
type: tVOID { $$ = type_new_void(); }
|
||||||
|
@ -1100,7 +1100,7 @@ type: tVOID { $$ = type_new_void(); }
|
||||||
| enumdef { $$ = $1; }
|
| enumdef { $$ = $1; }
|
||||||
| tENUM aIDENTIFIER { $$ = type_new_enum($2, current_namespace, FALSE, NULL); }
|
| tENUM aIDENTIFIER { $$ = type_new_enum($2, current_namespace, FALSE, NULL); }
|
||||||
| structdef { $$ = $1; }
|
| structdef { $$ = $1; }
|
||||||
| tSTRUCT aIDENTIFIER { $$ = type_new_struct($2, FALSE, NULL); }
|
| tSTRUCT aIDENTIFIER { $$ = type_new_struct($2, current_namespace, FALSE, NULL); }
|
||||||
| uniondef { $$ = $1; }
|
| uniondef { $$ = $1; }
|
||||||
| tUNION aIDENTIFIER { $$ = type_new_nonencapsulated_union($2, FALSE, NULL); }
|
| tUNION aIDENTIFIER { $$ = type_new_nonencapsulated_union($2, FALSE, NULL); }
|
||||||
| tSAFEARRAY '(' type ')' { $$ = make_safearray($3); }
|
| tSAFEARRAY '(' type ')' { $$ = make_safearray($3); }
|
||||||
|
|
|
@ -297,11 +297,13 @@ type_t *type_new_enum(const char *name, struct namespace *namespace, int defined
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
type_t *type_new_struct(char *name, int defined, var_list_t *fields)
|
type_t *type_new_struct(char *name, struct namespace *namespace, int defined, var_list_t *fields)
|
||||||
{
|
{
|
||||||
type_t *tag_type = name ? find_type(name, NULL, tsSTRUCT) : NULL;
|
type_t *tag_type = name ? find_type(name, namespace, tsSTRUCT) : NULL;
|
||||||
type_t *t = make_type(TYPE_STRUCT);
|
type_t *t = make_type(TYPE_STRUCT);
|
||||||
t->name = name;
|
t->name = name;
|
||||||
|
t->namespace = namespace;
|
||||||
|
|
||||||
if (tag_type && tag_type->details.structure)
|
if (tag_type && tag_type->details.structure)
|
||||||
t->details.structure = tag_type->details.structure;
|
t->details.structure = tag_type->details.structure;
|
||||||
else if (defined)
|
else if (defined)
|
||||||
|
@ -313,7 +315,7 @@ type_t *type_new_struct(char *name, int defined, var_list_t *fields)
|
||||||
if (name)
|
if (name)
|
||||||
{
|
{
|
||||||
if (defined)
|
if (defined)
|
||||||
reg_type(t, name, NULL, tsSTRUCT);
|
reg_type(t, name, namespace, tsSTRUCT);
|
||||||
else
|
else
|
||||||
add_incomplete(t);
|
add_incomplete(t);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ type_t *type_new_int(enum type_basic_type basic_type, int sign);
|
||||||
type_t *type_new_void(void);
|
type_t *type_new_void(void);
|
||||||
type_t *type_new_coclass(char *name);
|
type_t *type_new_coclass(char *name);
|
||||||
type_t *type_new_enum(const char *name, struct namespace *namespace, int defined, var_list_t *enums);
|
type_t *type_new_enum(const char *name, struct namespace *namespace, int defined, var_list_t *enums);
|
||||||
type_t *type_new_struct(char *name, int defined, var_list_t *fields);
|
type_t *type_new_struct(char *name, struct namespace *namespace, int defined, var_list_t *fields);
|
||||||
type_t *type_new_nonencapsulated_union(const char *name, int defined, var_list_t *fields);
|
type_t *type_new_nonencapsulated_union(const char *name, int defined, var_list_t *fields);
|
||||||
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);
|
||||||
|
|
Loading…
Reference in New Issue