summaryrefslogtreecommitdiff
path: root/source4/build/pidl/Parse/Pidl/Samba
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-07-10 08:07:12 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:19:31 -0500
commite43e8fcf55e55fa2cc54b83c8a4111f3a6e4eae7 (patch)
treefb0726c811ccec1f943922590db49148757869a6 /source4/build/pidl/Parse/Pidl/Samba
parent9281b58398de76815c23361826615478a611bc60 (diff)
downloadsamba-e43e8fcf55e55fa2cc54b83c8a4111f3a6e4eae7.tar.gz
samba-e43e8fcf55e55fa2cc54b83c8a4111f3a6e4eae7.tar.bz2
samba-e43e8fcf55e55fa2cc54b83c8a4111f3a6e4eae7.zip
r8283: make sure we build constant variables for both pull and push side of enums
(This used to be commit 529370ed92f5a683ae7bd34d0cd2ce01c2bda81a)
Diffstat (limited to 'source4/build/pidl/Parse/Pidl/Samba')
-rw-r--r--source4/build/pidl/Parse/Pidl/Samba/EJS.pm32
1 files changed, 20 insertions, 12 deletions
diff --git a/source4/build/pidl/Parse/Pidl/Samba/EJS.pm b/source4/build/pidl/Parse/Pidl/Samba/EJS.pm
index 4411324b05..b50646595e 100644
--- a/source4/build/pidl/Parse/Pidl/Samba/EJS.pm
+++ b/source4/build/pidl/Parse/Pidl/Samba/EJS.pm
@@ -289,12 +289,31 @@ sub EjsUnionPull($$)
pidl "}";
}
+##############################################
+# put the enum elements in the constants array
+sub EjsEnumConstant($)
+{
+ my $d = shift;
+ my $v = 0;
+ foreach my $e (@{$d->{ELEMENTS}}) {
+ my $el = $e;
+ chomp $el;
+ if ($el =~ /^(.*)=\s*(.*)\s*$/) {
+ $el = $1;
+ $v = $2;
+ }
+ $constants{$el} = $v;
+ $v++;
+ }
+}
+
###########################
# pull a enum
sub EjsEnumPull($$)
{
my $name = shift;
my $d = shift;
+ EjsEnumConstant($d);
pidl fn_prefix($d);
pidl "NTSTATUS ejs_pull_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, enum $name *r)\n{";
indent;
@@ -536,18 +555,7 @@ sub EjsEnumPush($$)
{
my $name = shift;
my $d = shift;
- my $v = 0;
- # put the enum elements in the constants array
- foreach my $e (@{$d->{ELEMENTS}}) {
- my $el = $e;
- chomp $el;
- if ($el =~ /^(.*)=\s*(.*)\s*$/) {
- $el = $1;
- $v = $2;
- }
- $constants{$el} = $v;
- $v++;
- }
+ EjsEnumConstant($d);
pidl fn_prefix($d);
pidl "NTSTATUS ejs_push_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, const enum $name *r)\n{";
indent;