diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-11-01 05:25:05 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:05:08 -0500 |
commit | 2c52f52e02ca1e7286d0faa15d5031f2a4ac11ed (patch) | |
tree | 4da99bdf8b7211c15158bae19a4b76b1e42df862 /source4/build/pidl/parser.pm | |
parent | 38ee8f04ef945f9b109f8cdb39dc7c3c5ee90dd3 (diff) | |
download | samba-2c52f52e02ca1e7286d0faa15d5031f2a4ac11ed.tar.gz samba-2c52f52e02ca1e7286d0faa15d5031f2a4ac11ed.tar.bz2 samba-2c52f52e02ca1e7286d0faa15d5031f2a4ac11ed.zip |
r3423: auto-generate prototypes for all external functions in pidl
(This used to be commit 009488dfe55f5219b24c30222b1a8bf411a7e939)
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); } } |