summaryrefslogtreecommitdiff
path: root/source4/build
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-02-21 01:16:47 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:10:49 -0500
commit7e400d38ecfdbf2b0ba744b182db14fe286da404 (patch)
tree60117d7f2c282e2959e6d199f96bc445871c42fb /source4/build
parente770d5696ee0265661fd6cc2fa24a24b19a0b889 (diff)
downloadsamba-7e400d38ecfdbf2b0ba744b182db14fe286da404.tar.gz
samba-7e400d38ecfdbf2b0ba744b182db14fe286da404.tar.bz2
samba-7e400d38ecfdbf2b0ba744b182db14fe286da404.zip
r5479: Add ODL input support.
The ODL module can convert an ODL structure to an IDL structure so that: - The COM subsystem can use the ODL structure - The DCE/RPC subsystem can use the IDL structure (This used to be commit a339765d99c90c46f29e2bd71a6aa271febb096d)
Diffstat (limited to 'source4/build')
-rw-r--r--source4/build/pidl/idl.pm2
-rw-r--r--source4/build/pidl/idl.yp2
-rw-r--r--source4/build/pidl/ndr.pm27
-rw-r--r--source4/build/pidl/odl.pm59
-rwxr-xr-xsource4/build/pidl/pidl.pl10
5 files changed, 69 insertions, 31 deletions
diff --git a/source4/build/pidl/idl.pm b/source4/build/pidl/idl.pm
index 6ae7cb463f..5ba427e70c 100644
--- a/source4/build/pidl/idl.pm
+++ b/source4/build/pidl/idl.pm
@@ -2383,8 +2383,6 @@ sub parse_idl($$)
my $idl = $self->YYParse( yylex => \&_Lexer, yyerror => \&_Error );
foreach my $x (@{$idl}) {
- NdrParser::InterfaceORPC($x);
-
# Do the inheritance
if (defined($x->{BASE}) and $x->{BASE} ne "") {
my $parent = util::get_interface($idl, $x->{BASE});
diff --git a/source4/build/pidl/idl.yp b/source4/build/pidl/idl.yp
index aff7f82f69..b12c45c34d 100644
--- a/source4/build/pidl/idl.yp
+++ b/source4/build/pidl/idl.yp
@@ -374,8 +374,6 @@ sub parse_idl($$)
my $idl = $self->YYParse( yylex => \&_Lexer, yyerror => \&_Error );
foreach my $x (@{$idl}) {
- NdrParser::InterfaceORPC($x);
-
# Do the inheritance
if (defined($x->{BASE}) and $x->{BASE} ne "") {
my $parent = util::get_interface($idl, $x->{BASE});
diff --git a/source4/build/pidl/ndr.pm b/source4/build/pidl/ndr.pm
index 0d9b38d07b..019300d784 100644
--- a/source4/build/pidl/ndr.pm
+++ b/source4/build/pidl/ndr.pm
@@ -2114,33 +2114,6 @@ sub LoadInterface($)
}
}
-# Add ORPC specific bits to an interface.
-sub InterfaceORPC($)
-{
- my $x = shift;
- # Add [in] ORPCTHIS *this, [out] ORPCTHAT *that
- # for 'object' interfaces
- if (util::has_property($x, "object")) {
- foreach my $e (@{$x->{DATA}}) {
- if($e->{TYPE} eq "FUNCTION") {
- $e->{PROPERTIES}->{object} = 1;
- unshift(@{$e->{ELEMENTS}},
- { 'NAME' => 'ORPCthis',
- 'POINTERS' => 0,
- 'PROPERTIES' => { 'in' => '1' },
- 'TYPE' => 'ORPCTHIS'
- });
- unshift(@{$e->{ELEMENTS}},
- { 'NAME' => 'ORPCthat',
- 'POINTERS' => 0,
- 'PROPERTIES' => { 'out' => '1' },
- 'TYPE' => 'ORPCTHAT'
- });
- }
- }
- }
-}
-
sub Load($)
{
my $idl = shift;
diff --git a/source4/build/pidl/odl.pm b/source4/build/pidl/odl.pm
new file mode 100644
index 0000000000..37c8a5a687
--- /dev/null
+++ b/source4/build/pidl/odl.pm
@@ -0,0 +1,59 @@
+##########################################
+# Converts ODL stuctures to IDL structures
+# (C) 2004-2005 Jelmer Vernooij <jelmer@samba.org>
+
+package ODL;
+
+use strict;
+
+sub FunctionAddObjArgs($)
+{
+ my $e = shift;
+
+ unshift(@{$e->{ELEMENTS}}, {
+ 'NAME' => 'ORPCthis',
+ 'POINTERS' => 0,
+ 'PROPERTIES' => { 'in' => '1' },
+ 'TYPE' => 'ORPCTHIS'
+ });
+ unshift(@{$e->{ELEMENTS}}, {
+ 'NAME' => 'ORPCthat',
+ 'POINTERS' => 0,
+ 'PROPERTIES' => { 'out' => '1' },
+ 'TYPE' => 'ORPCTHAT'
+ });
+}
+
+sub ReplaceInterfacePointers($)
+{
+ my $e = shift;
+
+ foreach my $x (@{$e->{ELEMENTS}}) {
+ next unless typelist::hasType($x);
+ next unless typelist::getType($x)->{DATA}->{TYPE} eq "INTERFACE";
+
+ $x->{TYPE} = "MInterfacePointer";
+ }
+}
+
+# Add ORPC specific bits to an interface.
+sub ODL2IDL($)
+{
+ my $odl = shift;
+ my @idl = @{$odl};
+
+ foreach my $x (@idl) {
+ # Add [in] ORPCTHIS *this, [out] ORPCTHAT *that
+ # for 'object' interfaces
+ if (util::has_property($x, "object")) {
+ foreach my $e (@{$x->{DATA}}) {
+ ($e->{TYPE} eq "FUNCTION") && FunctionAddObjArgs($e);
+ ReplaceInterfacePointers($e);
+ }
+ }
+ }
+
+ return \@idl;
+}
+
+1;
diff --git a/source4/build/pidl/pidl.pl b/source4/build/pidl/pidl.pl
index eedbb91d4e..b535215d03 100755
--- a/source4/build/pidl/pidl.pl
+++ b/source4/build/pidl/pidl.pl
@@ -21,6 +21,7 @@ use client;
use proxy;
use stub;
use ndr;
+use odl;
use eparser;
use validator;
use typelist;
@@ -40,6 +41,7 @@ my($opt_parser) = 0;
my($opt_eparser) = 0;
my($opt_keep) = 0;
my($opt_swig) = 0;
+my($opt_odl) = 0;
my($opt_output);
my $idl_parser = new idl;
@@ -79,6 +81,7 @@ sub ShowHelp()
--swig create swig wrapper file
--diff run diff on the idl and dumped output
--keep keep the .pidl file
+ --odl accept ODL input
\n";
exit(0);
}
@@ -96,6 +99,7 @@ GetOptions (
'client' => \$opt_client,
'eparser' => \$opt_eparser,
'diff' => \$opt_diff,
+ 'odl' => \$opt_odl,
'keep' => \$opt_keep,
'swig' => \$opt_swig
);
@@ -109,6 +113,7 @@ sub process_file($)
{
my $idl_file = shift;
my $output;
+ my $podl;
my $pidl;
my $basename = basename($idl_file, ".idl");
@@ -143,6 +148,11 @@ sub process_file($)
typelist::LoadIdl($pidl);
}
+ if ($opt_odl) {
+ $podl = $pidl;
+ $pidl = ODL::ODL2IDL($podl);
+ }
+
if ($opt_header) {
my($header) = util::ChangeExtension($output, ".h");
util::FileSave($header, IdlHeader::Parse($pidl));