diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-09-12 14:57:19 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-09-15 17:39:44 +0200 |
commit | f29220fe11a938efc93ea6b5b6ded5e612dcbcf1 (patch) | |
tree | cf2beb74d06a1dbff536db9236c24f72787688a3 | |
parent | 1ca80d037d767230f28aea12f58c4afbaa86b71c (diff) | |
download | samba-f29220fe11a938efc93ea6b5b6ded5e612dcbcf1.tar.gz samba-f29220fe11a938efc93ea6b5b6ded5e612dcbcf1.tar.bz2 samba-f29220fe11a938efc93ea6b5b6ded5e612dcbcf1.zip |
Allow base classes to be defined in other files.
-rw-r--r-- | source4/librpc/idl/dcom.idl | 2 | ||||
-rw-r--r-- | source4/librpc/idl/wmi.idl | 2 | ||||
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/ODL.pm | 81 | ||||
-rwxr-xr-x | source4/pidl/pidl | 2 |
4 files changed, 48 insertions, 39 deletions
diff --git a/source4/librpc/idl/dcom.idl b/source4/librpc/idl/dcom.idl index dfb8792044..64e1c1850b 100644 --- a/source4/librpc/idl/dcom.idl +++ b/source4/librpc/idl/dcom.idl @@ -3,8 +3,6 @@ http://www.ietf.org/internet-drafts/draft-brown-dcom-v1-spec-04.txt */ -import "orpc.idl"; - [ uuid("18f70770-8e64-11cf-9af1-0020af6e72f4"), pointer_default(unique), diff --git a/source4/librpc/idl/wmi.idl b/source4/librpc/idl/wmi.idl index 44540b154e..c4a8ff706a 100644 --- a/source4/librpc/idl/wmi.idl +++ b/source4/librpc/idl/wmi.idl @@ -1,6 +1,6 @@ #include "idl_types.h" -import "orpc.idl"; +import "dcom.idl"; [ uuid("8BC3F05E-D86B-11d0-A075-00C04FB68820") diff --git a/source4/pidl/lib/Parse/Pidl/ODL.pm b/source4/pidl/lib/Parse/Pidl/ODL.pm index 897d921485..951f7c8725 100644 --- a/source4/pidl/lib/Parse/Pidl/ODL.pm +++ b/source4/pidl/lib/Parse/Pidl/ODL.pm @@ -5,27 +5,14 @@ package Parse::Pidl::ODL; use Parse::Pidl qw(error); -use Parse::Pidl::Util qw(has_property); +use Parse::Pidl::IDL; +use Parse::Pidl::Util qw(has_property unmake_str); use Parse::Pidl::Typelist qw(hasType getType); use strict; use vars qw($VERSION); $VERSION = '0.01'; -##################################################################### -# find an interface in an array of interfaces -sub get_interface($$) -{ - my($if,$n) = @_; - - foreach(@$if) { - next if ($_->{TYPE} ne "INTERFACE"); - return $_ if($_->{NAME} eq $n); - } - - return undef; -} - sub FunctionAddObjArgs($) { my $e = shift; @@ -60,34 +47,58 @@ sub ReplaceInterfacePointers($) } # Add ORPC specific bits to an interface. -sub ODL2IDL($) +sub ODL2IDL { - my $odl = shift; + my ($odl, $basedir, $opt_incdirs) = (@_); my $addedorpc = 0; + my $interfaces = {}; foreach my $x (@$odl) { - next if ($x->{TYPE} ne "INTERFACE"); - # Add [in] ORPCTHIS *this, [out] ORPCTHAT *that - # and replace interfacepointers with MInterfacePointer - # for 'object' interfaces - if (has_property($x, "object")) { - foreach my $e (@{$x->{DATA}}) { - ($e->{TYPE} eq "FUNCTION") && FunctionAddObjArgs($e); - ReplaceInterfacePointers($e); + if ($x->{TYPE} eq "IMPORT") { + foreach my $idl_file (@{$x->{PATHS}}) { + $idl_file = unmake_str($idl_file); + my $podl = Parse::Pidl::IDL::parse_file("$basedir/$idl_file", $opt_incdirs); + if (defined(@$podl)) { + require Parse::Pidl::Typelist; + + Parse::Pidl::Typelist::LoadIdl($podl); + my $pidl = ODL2IDL($podl); + + foreach my $y (@$pidl) { + if ($y->{TYPE} eq "INTERFACE") { + $interfaces->{$y->{NAME}} = $y; + } + } + } else { + error($x, "Failed to parse $idl_file"); + } } - $addedorpc = 1; } - if ($x->{BASE}) { - my $base = get_interface($odl, $x->{BASE}); + if ($x->{TYPE} eq "INTERFACE") { + $interfaces->{$x->{NAME}} = $x; + # Add [in] ORPCTHIS *this, [out] ORPCTHAT *that + # and replace interfacepointers with MInterfacePointer + # for 'object' interfaces + if (has_property($x, "object")) { + foreach my $e (@{$x->{DATA}}) { + ($e->{TYPE} eq "FUNCTION") && FunctionAddObjArgs($e); + ReplaceInterfacePointers($e); + } + $addedorpc = 1; + } + + if ($x->{BASE}) { + my $base = $interfaces->{$x->{BASE}}; - unless (defined($base)) { - error($x, "Undefined base interface `$x->{BASE}'"); - } else { - foreach my $fn (reverse @{$base->{DATA}}) { - next unless ($fn->{TYPE} eq "FUNCTION"); - unshift (@{$x->{DATA}}, $fn); - push (@{$x->{INHERITED_FUNCTIONS}}, $fn->{NAME}); + unless (defined($base)) { + error($x, "Undefined base interface `$x->{BASE}'"); + } else { + foreach my $fn (reverse @{$base->{DATA}}) { + next unless ($fn->{TYPE} eq "FUNCTION"); + unshift (@{$x->{DATA}}, $fn); + push (@{$x->{INHERITED_FUNCTIONS}}, $fn->{NAME}); + } } } } diff --git a/source4/pidl/pidl b/source4/pidl/pidl index 646f7952e9..0a6b0a97ca 100755 --- a/source4/pidl/pidl +++ b/source4/pidl/pidl @@ -656,7 +656,7 @@ sub process_file($) Parse::Pidl::Compat::Check($pidl); } - $pidl = Parse::Pidl::ODL::ODL2IDL($pidl); + $pidl = Parse::Pidl::ODL::ODL2IDL($pidl, dirname($idl_file), \@opt_incdirs); if (defined($opt_ws_parser) or defined($opt_client) or |