From 3425f1bfe4b74d88fe63735e60d4a43c6c678d7f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 18 Nov 2003 04:59:29 +0000 Subject: auto-generate the pipe UUID version and name (This used to be commit cdba426e62a5b30263b75f53f97b191da224a55f) --- source4/build/pidl/header.pm | 41 ++++++++++++++++++++++++++++++++--------- source4/build/pidl/idl.gram | 4 ++-- 2 files changed, 34 insertions(+), 11 deletions(-) (limited to 'source4/build') diff --git a/source4/build/pidl/header.pm b/source4/build/pidl/header.pm index cb64fe0ea3..60605fb619 100644 --- a/source4/build/pidl/header.pm +++ b/source4/build/pidl/header.pm @@ -8,6 +8,8 @@ use Data::Dumper; my($res); my($tab_depth); +my $if_uuid; +my $if_version; sub tabs() { @@ -190,18 +192,16 @@ sub HeaderInterface($) { my($interface) = shift; my($data) = $interface->{DATA}; - foreach my $d (@{$data}) { - if (!defined $d->{TYPE}) { - print Dumper $d; - } - ($d->{TYPE} eq "TYPEDEF") && - HeaderTypedef($d); - ($d->{TYPE} eq "FUNCTION") && - HeaderFunction($d); - } my $count = 0; + if (defined $if_uuid) { + my $name = uc $interface->{NAME}; + $res .= "#define DCERPC_$name\_UUID \"$if_uuid\"\n"; + $res .= "#define DCERPC_$name\_VERSION $if_version\n"; + $res .= "#define DCERPC_$name\_NAME \"$interface->{NAME}\"\n\n"; + } + foreach my $d (@{$data}) { if ($d->{TYPE} eq "FUNCTION") { $u_name = uc $d->{NAME}; @@ -209,6 +209,26 @@ sub HeaderInterface($) $count++; } } + + $res .= "\n\n"; + + foreach my $d (@{$data}) { + ($d->{TYPE} eq "TYPEDEF") && + HeaderTypedef($d); + ($d->{TYPE} eq "FUNCTION") && + HeaderFunction($d); + } + +} + +##################################################################### +# parse the interface definitions +sub ModuleHeader($) +{ + my($h) = shift; + + $if_uuid = $h->{PROPERTIES}->{uuid}; + $if_version = $h->{PROPERTIES}->{version}; } @@ -221,6 +241,9 @@ sub Parse($) $res = "/* header auto-generated by pidl */\n\n"; foreach my $x (@{$idl}) { + ($x->{TYPE} eq "MODULEHEADER") && + ModuleHeader($x); + ($x->{TYPE} eq "INTERFACE") && HeaderInterface($x); } diff --git a/source4/build/pidl/idl.gram b/source4/build/pidl/idl.gram index 69a6e2458b..9b265b8cba 100644 --- a/source4/build/pidl/idl.gram +++ b/source4/build/pidl/idl.gram @@ -6,10 +6,10 @@ idl: cpp_prefix(s?) module_header interface { [$item{module_header}, $item{interface}] } | -module_header: '[' module_param(s /,/) ']' +module_header: '[' module_param(s? /,/) ']' {{ "TYPE" => "MODULEHEADER", - "DATA" => util::FlattenHash($item[3]) + "PROPERTIES" => util::FlattenHash($item[3]) }} | -- cgit