summaryrefslogtreecommitdiff
path: root/source4/build/pidl/ndr_header.pm
diff options
context:
space:
mode:
Diffstat (limited to 'source4/build/pidl/ndr_header.pm')
-rw-r--r--source4/build/pidl/ndr_header.pm39
1 files changed, 33 insertions, 6 deletions
diff --git a/source4/build/pidl/ndr_header.pm b/source4/build/pidl/ndr_header.pm
index 429f603f88..e3e6022ded 100644
--- a/source4/build/pidl/ndr_header.pm
+++ b/source4/build/pidl/ndr_header.pm
@@ -120,17 +120,44 @@ sub HeaderEnum($$)
my($name) = shift;
my $first = 1;
- pidl "\nenum $name {\n";
- $tab_depth++;
- foreach my $e (@{$enum->{ELEMENTS}}) {
+ if (not util::useUintEnums()) {
+ pidl "\nenum $name {\n";
+ $tab_depth++;
+ foreach my $e (@{$enum->{ELEMENTS}}) {
unless ($first) { pidl ",\n"; }
$first = 0;
tabs();
pidl $e;
+ }
+ pidl "\n";
+ $tab_depth--;
+ pidl "}";
+ } else {
+ my $count = 0;
+ pidl "\nenum $name { __donnot_use_enum_$name=0x7FFFFFFF};\n";
+ my $with_val = 0;
+ my $without_val = 0;
+ foreach my $e (@{$enum->{ELEMENTS}}) {
+ my $t = "$e";
+ my $name;
+ my $value;
+ if ($t =~ /(.*)=(.*)/) {
+ $name = $1;
+ $value = $2;
+ $with_val = 1;
+ die ("you can't mix enum member with values and without values when using --uint-enums!")
+ unless ($without_val == 0);
+ } else {
+ $name = $t;
+ $value = $count++;
+ $without_val = 1;
+ die ("you can't mix enum member with values and without values when using --uint-enums!")
+ unless ($with_val == 0);
+ }
+ pidl "#define $name ( $value )\n";
+ }
+ pidl "\n";
}
- pidl "\n";
- $tab_depth--;
- pidl "}";
}
#####################################################################