summaryrefslogtreecommitdiff
path: root/source4/build/pidl/ndr_header.pm
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-06-09 07:48:26 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:17:51 -0500
commit0f247a39a65cb435ccb3f44fe446026648e20780 (patch)
tree1e13951410c7b5426b05522eae229d83761cd331 /source4/build/pidl/ndr_header.pm
parent0b119901d8d948e62d46f760b2dd40ba5331afc9 (diff)
downloadsamba-0f247a39a65cb435ccb3f44fe446026648e20780.tar.gz
samba-0f247a39a65cb435ccb3f44fe446026648e20780.tar.bz2
samba-0f247a39a65cb435ccb3f44fe446026648e20780.zip
r7424: add --uint-enums option to pidl to generate
defines for the enum members (this hopefully will fix the build on AIX) metze (This used to be commit 9d4d5163de8b78c5a03348a10ceedb220c92f7b2)
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 "}";
}
#####################################################################