Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexey Alyaev
wine
Commits
7c711d07
Commit
7c711d07
authored
16 years ago
by
Robert Shearman
Committed by
Alexandre Julliard
16 years ago
Browse files
Options
Downloads
Patches
Plain Diff
widl: Allow enum and union tags to be used without being defined.
parent
4866026d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/widl/parser.y
+42
-17
42 additions, 17 deletions
tools/widl/parser.y
with
42 additions
and
17 deletions
tools/widl/parser.y
+
42
−
17
View file @
7c711d07
...
...
@@ -117,9 +117,9 @@ static type_t *make_safearray(type_t *type);
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 *type_new_enum(char *name, var_list_t *enums);
static type_t *type_new_enum(
const
char *name,
int defined,
var_list_t *enums);
static type_t *type_new_struct(char *name, int defined, var_list_t *fields);
static type_t *type_new_nonencapsulated_union(char *name, var_list_t *fields);
static type_t *type_new_nonencapsulated_union(
const
char *name,
int defined,
var_list_t *fields);
static type_t *type_new_encapsulated_union(char *name, var_t *switch_field, var_t *union_field, var_list_t *cases);
static type_t *reg_type(type_t *type, const char *name, int t);
...
...
@@ -614,7 +614,7 @@ enum: ident '=' expr_int_const { $$ = reg_const($1);
}
;
enumdef: tENUM t_ident '{' enums '}' { $$ = type_new_enum($2, $4); }
enumdef: tENUM t_ident '{' enums '}' { $$ = type_new_enum($2,
TRUE,
$4); }
;
m_exprs: m_expr { $$ = append_expr( NULL, $1 ); }
...
...
@@ -980,11 +980,11 @@ type: tVOID { $$ = type_new_void(); }
| aKNOWNTYPE { $$ = find_type_or_error($1, 0); }
| base_type { $$ = $1; }
| enumdef { $$ = $1; }
| tENUM aIDENTIFIER { $$ =
find_type_or_error2($2, tsENUM
); }
| tENUM aIDENTIFIER { $$ =
type_new_enum($2, FALSE, NULL
); }
| structdef { $$ = $1; }
| tSTRUCT aIDENTIFIER { $$ = type_new_struct($2, FALSE, NULL); }
| uniondef { $$ = $1; }
| tUNION aIDENTIFIER { $$ =
find_type_or_error2($2, tsUNION
); }
| tUNION aIDENTIFIER { $$ =
type_new_nonencapsulated_union($2, FALSE, NULL
); }
| tSAFEARRAY '(' type ')' { $$ = make_safearray($3); }
;
...
...
@@ -995,7 +995,7 @@ typedef: tTYPEDEF m_attributes decl_spec declarator_list
;
uniondef: tUNION t_ident '{' ne_union_fields '}'
{ $$ = type_new_nonencapsulated_union($2, $4); }
{ $$ = type_new_nonencapsulated_union($2,
TRUE,
$4); }
| tUNION t_ident
tSWITCH '(' s_field ')'
m_ident '{' cases '}' { $$ = type_new_encapsulated_union($2, $5, $7, $9); }
...
...
@@ -1240,17 +1240,28 @@ void clear_all_offsets(void)
node->data.typestring_offset = node->data.ptrdesc = 0;
}
static type_t *type_new_enum(char *name, var_list_t *enums)
static type_t *type_new_enum(
const
char *name,
int defined,
var_list_t *enums)
{
type_t *t = get_type(TYPE_ENUM, name, tsENUM);
if (enums)
type_t *tag_type = name ? find_type(name, tsENUM) : NULL;
type_t *t = make_type(TYPE_ENUM);
t->name = name;
if (tag_type && tag_type->details.enumeration)
t->details.enumeration = tag_type->details.enumeration;
else if (defined)
{
t->details.enumeration = xmalloc(sizeof(*t->details.enumeration));
t->details.enumeration->enums = enums;
t->defined = TRUE;
}
if (name)
{
if (defined)
reg_type(t, name, tsENUM);
else
add_incomplete(t);
}
else
t->details.enumeration = NULL;
t->defined = TRUE;
return t;
}
...
...
@@ -1280,12 +1291,26 @@ static type_t *type_new_struct(char *name, int defined, var_list_t *fields)
return t;
}
static type_t *type_new_nonencapsulated_union(char *name, var_list_t *fields)
static type_t *type_new_nonencapsulated_union(
const
char *name,
int defined,
var_list_t *fields)
{
type_t *t = get_type(TYPE_UNION, name, tsUNION);
t->details.structure = xmalloc(sizeof(*t->details.structure));
t->details.structure->fields = fields;
t->defined = TRUE;
type_t *tag_type = name ? find_type(name, tsUNION) : NULL;
type_t *t = make_type(TYPE_UNION);
t->name = name;
if (tag_type && tag_type->details.structure)
t->details.structure = tag_type->details.structure;
else if (defined)
{
t->details.structure = xmalloc(sizeof(*t->details.structure));
t->details.structure->fields = fields;
t->defined = TRUE;
}
if (name)
{
if (defined)
reg_type(t, name, tsUNION);
else
add_incomplete(t);
}
return t;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment