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 #####################################################################
12 # find an interface in an array of interfaces
19 if($_->{NAME} eq $n) { return $_; }
25 sub FunctionAddObjArgs($)
29 unshift(@{$e->{ELEMENTS}}, {
32 'PROPERTIES' => { 'in' => '1' },
35 unshift(@{$e->{ELEMENTS}}, {
38 'PROPERTIES' => { 'out' => '1' },
43 sub ReplaceInterfacePointers($)
47 foreach my $x (@{$e->{ELEMENTS}}) {
48 next unless (hasType($x->{TYPE}));
49 next unless getType($x->{TYPE})->{DATA}->{TYPE} eq "INTERFACE";
51 $x->{TYPE} = "MInterfacePointer";
55 # Add ORPC specific bits to an interface.
60 foreach my $x (@{$odl}) {
61 # Add [in] ORPCTHIS *this, [out] ORPCTHAT *that
62 # and replace interfacepointers with MInterfacePointer
63 # for 'object' interfaces
64 if (has_property($x, "object")) {
65 foreach my $e (@{$x->{DATA}}) {
66 ($e->{TYPE} eq "FUNCTION") && FunctionAddObjArgs($e);
67 ReplaceInterfacePointers($e);
69 # Object interfaces use ORPC
71 if(has_property($x, "depends")) {
72 @depends = split /,/, $x->{PROPERTIES}->{depends};
74 push @depends, "orpc";
75 $x->{PROPERTIES}->{depends} = join(',',@depends);
79 my $base = get_interface($odl, $x->{BASE});
81 foreach my $fn (reverse @{$base->{DATA}}) {
82 next unless ($fn->{TYPE} eq "FUNCTION");
83 unshift (@{$x->{DATA}}, $fn);
84 push (@{$x->{INHERITED_FUNCTIONS}}, $fn->{NAME});