Code generators don't need to know how many code to generate anymore

A slight modification to the code generators removes their need for needing to know how many elements (enums or structs) it needs to generate code.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5366 4a71c877-e1ca-e34f-864e-861f7616d084
master
Giel van Schijndel 2008-07-03 19:10:25 +00:00
parent f5055899db
commit 6d7cbe3576
3 changed files with 7 additions and 19 deletions

View File

@ -161,11 +161,8 @@ sub printStructs()
{
my ($structList, $structMap, $enumMap) = @_;
my @structs = @{$structList};
while (@structs)
foreach my $struct (@{$structList})
{
my $struct = shift(@structs);
my $name;
my $prefix = "";
@ -178,8 +175,7 @@ sub printStructs()
$name = $prefix . $name;
print "} ${name};\n";
print "\n" if @structs;
print "} ${name};\n\n";
}
}
@ -212,7 +208,7 @@ sub endFile()
{
my ($name) = @_;
print "\n#endif // ";
print "#endif // ";
printHdrGuard($name);
print "\n";
}

View File

@ -124,12 +124,9 @@ sub printEnums()
sub printStructs()
{
my ($structList, $structMap, $enumMap) = @_;
my @structs = @{$structList};
while (@structs)
foreach my $struct (@{$structList})
{
my $struct = shift(@structs);
printComments(${$struct}{"comment"}, 0);
# Start printing the select statement
@ -141,8 +138,7 @@ sub printStructs()
printBaseStruct($struct, $structMap);
printStructJoins($struct, $structMap);
print ";\n";
print "\n" if @structs;
print ";\n\n";
}
}

View File

@ -127,11 +127,8 @@ sub printStructs()
{
my ($structList, $structMap, $enumMap) = @_;
my @structs = @{$structList};
while (@structs)
foreach my $struct (@{$structList})
{
my $struct = shift(@structs);
my $name = ${$struct}{"name"};
printComments(${$struct}{"comment"}, 0);
@ -141,8 +138,7 @@ sub printStructs()
printStruct($struct, \$name, $structMap, $enumMap, 1);
print ");\n";
print "\n" if @structs;
print ");\n\n";
}
}