From e43e8fcf55e55fa2cc54b83c8a4111f3a6e4eae7 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 10 Jul 2005 08:07:12 +0000 Subject: r8283: make sure we build constant variables for both pull and push side of enums (This used to be commit 529370ed92f5a683ae7bd34d0cd2ce01c2bda81a) --- source4/build/pidl/Parse/Pidl/Samba/EJS.pm | 32 +++++++++++++++++++----------- 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'source4/build') 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; -- cgit