1 ##########################################
2 # Converts ODL stuctures to IDL structures
3 # (C) 2004-2005 Jelmer Vernooij <jelmer@samba.org>
5 package Parse::Pidl::ODL;
7 use Parse::Pidl::Util qw(has_property);
8 use Parse::Pidl::Typelist qw(hasType getType);
11 use vars qw($VERSION);
14 #####################################################################
15 # find an interface in an array of interfaces
21 next if ($_->{TYPE} ne "INTERFACE");
22 return $_ if($_->{NAME} eq $n);
28 sub FunctionAddObjArgs($)
32 unshift(@{$e->{ELEMENTS}}, {
35 'PROPERTIES' => { 'in' => '1' },
40 unshift(@{$e->{ELEMENTS}}, {
43 'PROPERTIES' => { 'out' => '1', 'ref' => '1' },
50 sub ReplaceInterfacePointers($)
54 foreach my $x (@{$e->{ELEMENTS}}) {
55 next unless (hasType($x->{TYPE}));
56 next unless getType($x->{TYPE})->{DATA}->{TYPE} eq "INTERFACE";
58 $x->{TYPE} = "MInterfacePointer";
62 # Add ORPC specific bits to an interface.
68 foreach my $x (@$odl) {
69 next if ($x->{TYPE} ne "INTERFACE");
70 # Add [in] ORPCTHIS *this, [out] ORPCTHAT *that
71 # and replace interfacepointers with MInterfacePointer
72 # for 'object' interfaces
73 if (has_property($x, "object")) {
74 foreach my $e (@{$x->{DATA}}) {
75 ($e->{TYPE} eq "FUNCTION") && FunctionAddObjArgs($e);
76 ReplaceInterfacePointers($e);
82 my $base = get_interface($odl, $x->{BASE});
84 foreach my $fn (reverse @{$base->{DATA}}) {
85 next unless ($fn->{TYPE} eq "FUNCTION");
86 unshift (@{$x->{DATA}}, $fn);
87 push (@{$x->{INHERITED_FUNCTIONS}}, $fn->{NAME});
94 PATHS => [ "\"orpc.idl\"" ],