diff options
Diffstat (limited to 'source4/pidl/lib/Parse')
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm b/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm index 9edd2a4a33..c254bfad38 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm @@ -9,7 +9,7 @@ package Parse::Pidl::Samba4::EJS; use Exporter; @ISA = qw(Exporter); @EXPORT_OK = qw(get_pointer_to get_value_of check_null_pointer $res - $res_hdr fn_declare); + $res_hdr fn_declare TypeFunctionName); use strict; use Parse::Pidl::Typelist; @@ -737,8 +737,8 @@ sub EjsInterface($$) pidl_hdr "\n"; foreach my $d (@{$interface->{TYPES}}) { - ($needed->{"push_$d->{NAME}"}) && EjsTypePushFunction($d, $d->{NAME}); - ($needed->{"pull_$d->{NAME}"}) && EjsTypePullFunction($d, $d->{NAME}); + ($needed->{TypeFunctionName("ejs_push", $d)}) && EjsTypePushFunction($d, $d->{NAME}); + ($needed->{TypeFunctionName("ejs_pull", $d)}) && EjsTypePullFunction($d, $d->{NAME}); } foreach my $d (@{$interface->{FUNCTIONS}}) { @@ -831,16 +831,16 @@ sub NeededFunction($$) { my ($fn,$needed) = @_; - $needed->{"pull_$fn->{NAME}"} = 1; - $needed->{"push_$fn->{NAME}"} = 1; + $needed->{"ejs_pull_$fn->{NAME}"} = 1; + $needed->{"ejs_push_$fn->{NAME}"} = 1; foreach (@{$fn->{ELEMENTS}}) { next if (has_property($_, "subcontext")); #FIXME: Support subcontexts if (grep(/in/, @{$_->{DIRECTION}})) { - $needed->{"pull_$_->{TYPE}"} = 1; + $needed->{TypeFunctionName("ejs_pull", $_->{TYPE})} = 1; } if (grep(/out/, @{$_->{DIRECTION}})) { - $needed->{"push_$_->{TYPE}"} = 1; + $needed->{TypeFunctionName("ejs_push", $_->{TYPE})} = 1; } } } @@ -858,10 +858,8 @@ sub NeededType($$$) foreach (@{$t->{ELEMENTS}}) { next if (has_property($_, "subcontext")); #FIXME: Support subcontexts my $n; - if (ref($_->{TYPE}) eq "HASH" and defined($_->{TYPE}->{NAME})) { - $needed->{"$req\_$_->{TYPE}->{TYPE}_$_->{TYPE}->{NAME}"} = 1; - } elsif (ref($_->{TYPE}) ne "HASH") { - $needed->{$req."_".$_->{TYPE}} = 1; + if (ref($_->{TYPE}) ne "HASH" or defined($_->{TYPE}->{NAME})) { + $needed->{TypeFunctionName("ejs_$req", $_->{TYPE})} = 1; } NeededType($_->{TYPE}, $needed, $req) if (ref($_->{TYPE}) eq "HASH"); } @@ -877,13 +875,25 @@ sub NeededInterface($$) foreach (reverse @{$interface->{TYPES}}) { if (has_property($_, "public")) { - $needed->{"pull_$_->{NAME}"} = not has_property($_, "noejs"); - $needed->{"push_$_->{NAME}"} = not has_property($_, "noejs"); + $needed->{TypeFunctionName("ejs_pull", $_)} = not has_property($_, "noejs"); + $needed->{TypeFunctionName("ejs_push", $_)} = not has_property($_, "noejs"); } - NeededType($_, $needed, "pull") if ($needed->{"pull_$_->{NAME}"}); - NeededType($_, $needed, "push") if ($needed->{"push_$_->{NAME}"}); + NeededType($_, $needed, "pull") if ($needed->{TypeFunctionName("ejs_pull", $_)}); + NeededType($_, $needed, "push") if ($needed->{TypeFunctionName("ejs_push", $_)}); } } +sub TypeFunctionName($$) +{ + my ($prefix, $t) = @_; + + return "$prefix\_$t->{NAME}" if (ref($t) eq "HASH" and + ($t->{TYPE} eq "TYPEDEF" or $t->{TYPE} eq "DECLARE")); + return "$prefix\_$t->{TYPE}_$t->{NAME}" if (ref($t) eq "HASH"); + return "$prefix\_$t"; +} + + + 1; |