summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-01-12 23:06:00 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-01-12 23:06:00 +0100
commit532154af9bebbdf76b2f62ee2b0810e66bc431c7 (patch)
tree702e86f81dadf33cd2099b4f57a3538bc70c13b1 /source4
parent90198fa7ca83b41516ac5bea014ae0396a1d128f (diff)
downloadsamba-532154af9bebbdf76b2f62ee2b0810e66bc431c7.tar.gz
samba-532154af9bebbdf76b2f62ee2b0810e66bc431c7.tar.bz2
samba-532154af9bebbdf76b2f62ee2b0810e66bc431c7.zip
pidl: Move more stuff outside ifdef when defining enums and generate pretty code for enums without body.
(This used to be commit d91af936ae51e33c8598d88c77575abbeb0e556b)
Diffstat (limited to 'source4')
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/Header.pm56
1 files changed, 27 insertions, 29 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/Header.pm b/source4/pidl/lib/Parse/Pidl/Samba4/Header.pm
index 9e27719d51..b96a58783c 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/Header.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/Header.pm
@@ -107,9 +107,9 @@ sub HeaderEnum($$)
my($enum,$name) = @_;
my $first = 1;
- pidl "#ifndef USE_UINT_ENUMS\n";
pidl "enum $name";
if (defined($enum->{ELEMENTS})) {
+ pidl "\n#ifndef USE_UINT_ENUMS\n";
pidl " {\n";
$tab_depth++;
foreach my $e (@{$enum->{ELEMENTS}}) {
@@ -121,37 +121,35 @@ sub HeaderEnum($$)
pidl "\n";
$tab_depth--;
pidl "}";
- }
- pidl "\n";
- pidl "#else\n";
- my $count = 0;
- pidl "enum $name";
- my $with_val = 0;
- my $without_val = 0;
- if (defined($enum->{ELEMENTS})) {
- pidl " { __donnot_use_enum_$name=0x7FFFFFFF}";
- foreach my $e (@{$enum->{ELEMENTS}}) {
- my $t = "$e";
- my $name;
- my $value;
- if ($t =~ /(.*)=(.*)/) {
- $name = $1;
- $value = $2;
- $with_val = 1;
- fatal($e->{ORIGINAL}, "you can't mix enum member with values and without values!")
- unless ($without_val == 0);
- } else {
- $name = $t;
- $value = $count++;
- $without_val = 1;
- fatal($e->{ORIGINAL}, "you can't mix enum member with values and without values!")
- unless ($with_val == 0);
+ pidl "\n";
+ pidl "#else\n";
+ my $count = 0;
+ my $with_val = 0;
+ my $without_val = 0;
+ if (defined($enum->{ELEMENTS})) {
+ pidl " { __donnot_use_enum_$name=0x7FFFFFFF}\n";
+ foreach my $e (@{$enum->{ELEMENTS}}) {
+ my $t = "$e";
+ my $name;
+ my $value;
+ if ($t =~ /(.*)=(.*)/) {
+ $name = $1;
+ $value = $2;
+ $with_val = 1;
+ fatal($e->{ORIGINAL}, "you can't mix enum member with values and without values!")
+ unless ($without_val == 0);
+ } else {
+ $name = $t;
+ $value = $count++;
+ $without_val = 1;
+ fatal($e->{ORIGINAL}, "you can't mix enum member with values and without values!")
+ unless ($with_val == 0);
+ }
+ pidl "#define $name ( $value )\n";
}
- pidl "\n#define $name ( $value )";
}
+ pidl "#endif\n";
}
- pidl "\n";
- pidl "#endif\n";
}
#####################################################################