summaryrefslogtreecommitdiff
path: root/source4/build/pidl/Parse/Pidl/ODL.pm
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-07-09 15:32:08 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:19:27 -0500
commitfa1445f4bc962efb3e639d3a4e345b1db14155b7 (patch)
tree8799d04bc9ec022569fedd636e899bcc29a57935 /source4/build/pidl/Parse/Pidl/ODL.pm
parentc222331d6d3785075bb0c961315aae9380101e47 (diff)
downloadsamba-fa1445f4bc962efb3e639d3a4e345b1db14155b7.tar.gz
samba-fa1445f4bc962efb3e639d3a4e345b1db14155b7.tar.bz2
samba-fa1445f4bc962efb3e639d3a4e345b1db14155b7.zip
r8264: - Use standard perl package structure for pidl.
- Only "use" pidl modules in the main executable when necessary Try 'make install' in build/pidl to install the package (should work stand-alone). (This used to be commit c620095692122a65ae1c5d85ca20468d4de93c54)
Diffstat (limited to 'source4/build/pidl/Parse/Pidl/ODL.pm')
-rw-r--r--source4/build/pidl/Parse/Pidl/ODL.pm89
1 files changed, 89 insertions, 0 deletions
diff --git a/source4/build/pidl/Parse/Pidl/ODL.pm b/source4/build/pidl/Parse/Pidl/ODL.pm
new file mode 100644
index 0000000000..eddf7e417c
--- /dev/null
+++ b/source4/build/pidl/Parse/Pidl/ODL.pm
@@ -0,0 +1,89 @@
+##########################################
+# Converts ODL stuctures to IDL structures
+# (C) 2004-2005 Jelmer Vernooij <jelmer@samba.org>
+
+package Parse::Pidl::ODL;
+
+use strict;
+
+#####################################################################
+# find an interface in an array of interfaces
+sub get_interface($$)
+{
+ my($if) = shift;
+ my($n) = shift;
+
+ foreach(@{$if}) {
+ if($_->{NAME} eq $n) { return $_; }
+ }
+
+ return 0;
+}
+
+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 (Parse::Pidl::Typelist::hasType($x->{TYPE}));
+ next unless Parse::Pidl::Typelist::getType($x->{TYPE})->{DATA}->{TYPE} eq "INTERFACE";
+
+ $x->{TYPE} = "MInterfacePointer";
+ }
+}
+
+# Add ORPC specific bits to an interface.
+sub ODL2IDL($)
+{
+ my $odl = shift;
+
+ foreach my $x (@{$odl}) {
+ # Add [in] ORPCTHIS *this, [out] ORPCTHAT *that
+ # and replace interfacepointers with MInterfacePointer
+ # for 'object' interfaces
+ if (Parse::Pidl::Util::has_property($x, "object")) {
+ foreach my $e (@{$x->{DATA}}) {
+ ($e->{TYPE} eq "FUNCTION") && FunctionAddObjArgs($e);
+ ReplaceInterfacePointers($e);
+ }
+ # Object interfaces use ORPC
+ my @depends = ();
+ if(Parse::Pidl::Util::has_property($x, "depends")) {
+ @depends = split /,/, $x->{PROPERTIES}->{depends};
+ }
+ push @depends, "orpc";
+ $x->{PROPERTIES}->{depends} = join(',',@depends);
+ }
+
+ if ($x->{BASE}) {
+ my $base = get_interface($odl, $x->{BASE});
+
+ foreach my $fn (reverse @{$base->{DATA}}) {
+ next unless ($fn->{TYPE} eq "FUNCTION");
+ unshift (@{$x->{DATA}}, $fn);
+ }
+ }
+ }
+
+ return $odl;
+}
+
+1;