diff options
Diffstat (limited to 'source4/build/pidl/parser.pm')
-rw-r--r-- | source4/build/pidl/parser.pm | 82 |
1 files changed, 5 insertions, 77 deletions
diff --git a/source4/build/pidl/parser.pm b/source4/build/pidl/parser.pm index 15dd1cd70e..cec972911e 100644 --- a/source4/build/pidl/parser.pm +++ b/source4/build/pidl/parser.pm @@ -9,9 +9,9 @@ package IdlParser; use strict; use client; +use needed; # the list of needed functions -my %needed; my %structs; sub pidl($) @@ -1127,7 +1127,7 @@ sub ParseTypedefPush($) my($e) = shift; my $static = fn_prefix($e); - if (! $needed{"push_$e->{NAME}"}) { + if (! needed::is_needed("push_$e->{NAME}")) { # print "push_$e->{NAME} not needed\n"; return; } @@ -1157,7 +1157,7 @@ sub ParseTypedefPull($) my($e) = shift; my $static = fn_prefix($e); - if (! $needed{"pull_$e->{NAME}"}) { + if (! needed::is_needed("pull_$e->{NAME}")) { # print "pull_$e->{NAME} not needed\n"; return; } @@ -1208,7 +1208,7 @@ sub ParseTypedefPrint($) sub ParseTypedefNdrSize($) { my($t) = shift; - if (! $needed{"ndr_size_$t->{NAME}"}) { + if (! needed::is_needed("ndr_size_$t->{NAME}")) { return; } @@ -1557,78 +1557,6 @@ sub ParseInterface($) } -sub NeededFunction($) -{ - my $fn = shift; - $needed{"pull_$fn->{NAME}"} = 1; - $needed{"push_$fn->{NAME}"} = 1; - foreach my $e (@{$fn->{DATA}}) { - $e->{PARENT} = $fn; - $needed{"pull_$e->{TYPE}"} = 1; - $needed{"push_$e->{TYPE}"} = 1; - } -} - -sub NeededTypedef($) -{ - my $t = shift; - if (util::has_property($t->{DATA}, "public")) { - $needed{"pull_$t->{NAME}"} = 1; - $needed{"push_$t->{NAME}"} = 1; - } - - if ($t->{DATA}->{TYPE} eq "STRUCT") { - if (util::has_property($t->{DATA}, "gensize")) { - $needed{"ndr_size_$t->{NAME}"} = 1; - } - - for my $e (@{$t->{DATA}->{ELEMENTS}}) { - $e->{PARENT} = $t->{DATA}; - if ($needed{"pull_$t->{NAME}"}) { - $needed{"pull_$e->{TYPE}"} = 1; - } - if ($needed{"push_$t->{NAME}"}) { - $needed{"push_$e->{TYPE}"} = 1; - } - if ($needed{"ndr_size_$t->{NAME}"}) { - $needed{"ndr_size_$e->{TYPE}"} = 1; - } - } - } - if ($t->{DATA}->{TYPE} eq "UNION") { - for my $e (@{$t->{DATA}->{DATA}}) { - $e->{PARENT} = $t->{DATA}; - if ($e->{TYPE} eq "UNION_ELEMENT") { - if ($needed{"pull_$t->{NAME}"}) { - $needed{"pull_$e->{DATA}->{TYPE}"} = 1; - } - if ($needed{"push_$t->{NAME}"}) { - $needed{"push_$e->{DATA}->{TYPE}"} = 1; - } - if ($needed{"ndr_size_$t->{NAME}"}) { - $needed{"ndr_size_$e->{DATA}->{TYPE}"} = 1; - } - } - } - } -} - -##################################################################### -# work out what parse functions are needed -sub BuildNeeded($) -{ - my($interface) = shift; - my($data) = $interface->{DATA}; - foreach my $d (@{$data}) { - ($d->{TYPE} eq "FUNCTION") && - NeededFunction($d); - } - foreach my $d (reverse @{$data}) { - ($d->{TYPE} eq "TYPEDEF") && - NeededTypedef($d); - } -} - ##################################################################### # parse a parsed IDL structure back into an IDL file sub Parse($$) @@ -1642,7 +1570,7 @@ sub Parse($$) pidl "#include \"includes.h\"\n\n"; foreach my $x (@{$idl}) { if ($x->{TYPE} eq "INTERFACE") { - BuildNeeded($x); + needed::BuildNeeded($x); ParseInterface($x); } } |