For struct-fields of an enum type store references to the enum instead of just their name

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5430 4a71c877-e1ca-e34f-864e-861f7616d084
master
Giel van Schijndel 2008-07-09 12:16:55 +00:00
parent ba1df9e976
commit 3f0b1959f2
4 changed files with 6 additions and 7 deletions

View File

@ -62,8 +62,7 @@ sub postProcessField
if (/set/)
{
my $enumName = ${$field}{"enum"};
my $enum = ${$enumMap}{$enumName};
my $enum = ${$field}{"enum"};
my $enumSize = @{${$enum}{"values"}};
$$output .= "\[${enumSize}]" if (/set/);

View File

@ -128,7 +128,9 @@ sub parseStruct
# Parse set and enum field declarations
elsif (/^\s*(set|enum)\s+(\w+)\s+(unique\s+)?(\w+)\s*;\s*$/)
{
my %field = (type=>$1, enum=>$2, name=>$4);
die "error: Cannot use enum \"$2\" as it isn't declared yet" unless exists($enumMap{$2});
my %field = (type=>$1, enum=>$enumMap{$2}, name=>$4);
push @{$field{"qualifiers"}}, $3 if $3;

View File

@ -33,8 +33,7 @@ sub printStructFields
if (${$field}{"type"} and ${$field}{"type"} =~ /set/)
{
my $enumName = ${$field}{"enum"};
my $enum = ${$enumMap}{$enumName};
my $enum = ${$field}{"enum"};
my @values = @{${$enum}{"values"}};
while (@values)

View File

@ -59,8 +59,7 @@ sub printStructFields
if (${$field}{"type"} and ${$field}{"type"} =~ /set/)
{
my $enumName = ${$field}{"enum"};
my $enum = ${$enumMap}{$enumName};
my $enum = ${$field}{"enum"};
my @values = @{${$enum}{"values"}};
my $unique_string = "UNIQUE(";