From eaae8b6f5f21c758db90a1008e91967fcfbc3513 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 8 Jun 2004 12:33:47 +0000 Subject: r1083: Generate prototypes for structs and unions marked "public" in the idl. Delete various hacks to work around not doing this before. (This used to be commit 5c3c3d3e72d8dd5d995a5bc5b2c7d7217b7c0432) --- source4/build/pidl/eparser.pm | 52 ++++++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 21 deletions(-) (limited to 'source4/build/pidl/eparser.pm') diff --git a/source4/build/pidl/eparser.pm b/source4/build/pidl/eparser.pm index fb8d0e39ca..fd2f721f36 100644 --- a/source4/build/pidl/eparser.pm +++ b/source4/build/pidl/eparser.pm @@ -785,7 +785,7 @@ sub ParseInterface($) my($data) = $interface->{DATA}; foreach my $d (@{$data}) { - if ($d->{TYPE} eq "TYPEDEF") { + if ($d->{TYPE} eq "TYPEDEF") { $structs{$d->{NAME}} = $d; } } @@ -827,8 +827,6 @@ sub NeededFunction($) 'ft' => type2ft($e->{TYPE}), 'base' => type2base($e->{TYPE}) }; - $needed{"proto_$e->{TYPE}"} = 1, - if !util::is_builtin_type($e->{TYPE}); $e->{PARENT} = $fn; } } @@ -851,9 +849,6 @@ sub NeededTypedef($) 'base' => type2base($e->{TYPE}) }; - $needed{"proto_$e->{TYPE}"} = 1, - if !util::is_builtin_type($e->{TYPE}); - $e->{PARENT} = $t->{DATA}; if ($needed{"pull_$t->{NAME}"}) { $needed{"pull_$e->{TYPE}"} = 1; @@ -861,11 +856,9 @@ sub NeededTypedef($) } } if ($t->{DATA}->{TYPE} eq "UNION") { - $needed{"proto_$t->{NAME}"} = "union"; for my $e (@{$t->{DATA}->{DATA}}) { $e->{PARENT} = $t->{DATA}; if ($e->{TYPE} eq "UNION_ELEMENT") { - $needed{"proto_$e->{DATA}->{TYPE}"} = 1; if ($needed{"pull_$t->{NAME}"}) { $needed{"pull_$e->{DATA}->{TYPE}"} = 1; } @@ -901,6 +894,36 @@ sub ModuleHeader($) $if_endpoints = $h->{PROPERTIES}->{endpoints}; } +sub ParseHeader($$) +{ + my($idl) = shift; + my($filename) = shift; + + open(OUT, ">$filename") || die "can't open $filename"; + + pidl "/* parser auto-generated by pidl */\n\n"; + + foreach my $x (@{$idl}) { + if ($x->{TYPE} eq "INTERFACE") { + foreach my $d (@{$x->{DATA}}) { + if ($d->{TYPE} eq "TYPEDEF" and + util::has_property($d->{DATA}, "public")) { + + if ($d->{DATA}{TYPE} eq "STRUCT") { + pidl "void ndr_pull_$d->{NAME}(struct e_ndr_pull *ndr, int ndr_flags);\n"; + } + + if ($d->{DATA}{TYPE} eq "UNION") { + pidl "void ndr_pull_$d->{NAME}(struct e_ndr_pull *ndr, int ndr_flags, int level);\n"; + } + } + } + } + } + + close(OUT); +} + ##################################################################### # parse a parsed IDL structure back into an IDL file sub Parse($$) @@ -944,19 +967,6 @@ sub Parse($$) pidl "static int $y = -1;\n", if $y =~ /^hf_/; } - # Function prototypes - - foreach my $x (keys(%needed)) { - next, if !($x =~ /^proto_/); - my $name = $x; - $name =~ s/^proto_//; - pidl "void ndr_pull_$name(struct e_ndr_pull *ndr, int ndr_flags"; - - pidl ", int level", if $needed{$x} eq "union"; - - pidl ");\n"; - } - ParseInterface($x); } } -- cgit