diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-12-25 17:12:52 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:47:44 -0500 |
commit | 94793b80d7fbd6121bb30e36b25e63abe078feee (patch) | |
tree | edec0fe69da42c0001276b02a58e5fd53985b574 /source4/pidl/lib/Parse/Pidl/NDR.pm | |
parent | 25d57c0ad8704894ee055f74bab2f33b688a7d72 (diff) | |
download | samba-94793b80d7fbd6121bb30e36b25e63abe078feee.tar.gz samba-94793b80d7fbd6121bb30e36b25e63abe078feee.tar.bz2 samba-94793b80d7fbd6121bb30e36b25e63abe078feee.zip |
r12484: Initial work on supporting non-typedeffed types
(This used to be commit e7ac6c708dde7afb4c92a8cc4dea7a95b7054e3e)
Diffstat (limited to 'source4/pidl/lib/Parse/Pidl/NDR.pm')
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/NDR.pm | 69 |
1 files changed, 36 insertions, 33 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/NDR.pm b/source4/pidl/lib/Parse/Pidl/NDR.pm index e7b790d1e5..0dd1ab4dd2 100644 --- a/source4/pidl/lib/Parse/Pidl/NDR.pm +++ b/source4/pidl/lib/Parse/Pidl/NDR.pm @@ -330,8 +330,9 @@ sub find_largest_alignment($) ##################################################################### # align a type -sub align_type +sub align_type($) { + sub align_type($); my $e = shift; unless (hasType($e)) { @@ -369,9 +370,9 @@ sub ParseElement($) }; } -sub ParseStruct($) +sub ParseStruct($$) { - my $struct = shift; + my ($ndr,$struct) = @_; my @elements = (); my $surrounding = undef; @@ -405,9 +406,9 @@ sub ParseStruct($) }; } -sub ParseUnion($) +sub ParseUnion($$) { - my $e = shift; + my ($ndr,$e) = @_; my @elements = (); my $switch_type = has_property($e, "switch_type"); unless (defined($switch_type)) { $switch_type = "uint32"; } @@ -444,9 +445,9 @@ sub ParseUnion($) }; } -sub ParseEnum($) +sub ParseEnum($$) { - my $e = shift; + my ($ndr,$e) = @_; return { TYPE => "ENUM", @@ -457,9 +458,9 @@ sub ParseEnum($) }; } -sub ParseBitmap($) +sub ParseBitmap($$) { - my $e = shift; + my ($ndr,$e) = @_; return { TYPE => "BITMAP", @@ -470,26 +471,34 @@ sub ParseBitmap($) }; } -sub ParseTypedef($$) +sub ParseType($$) { - my ($ndr,$d) = @_; - my $data; + my ($ndr, $d) = @_; - if ($d->{DATA}->{TYPE} eq "STRUCT" or $d->{DATA}->{TYPE} eq "UNION") { - CheckPointerTypes($d->{DATA}, $ndr->{PROPERTIES}->{pointer_default}); + if ($d->{TYPE} eq "STRUCT" or $d->{TYPE} eq "UNION") { + CheckPointerTypes($d, $ndr->{PROPERTIES}->{pointer_default}); } - if (defined($d->{PROPERTIES}) && !defined($d->{DATA}->{PROPERTIES})) { - $d->{DATA}->{PROPERTIES} = $d->{PROPERTIES}; - } - - $data = { + my $data = { STRUCT => \&ParseStruct, UNION => \&ParseUnion, ENUM => \&ParseEnum, - BITMAP => \&ParseBitmap - }->{$d->{DATA}->{TYPE}}->($d->{DATA}); + BITMAP => \&ParseBitmap, + TYPEDEF => \&ParseTypedef, + }->{$d->{TYPE}}->($ndr, $d); + + return $data; +} + +sub ParseTypedef($$) +{ + my ($ndr,$d) = @_; + if (defined($d->{PROPERTIES}) && !defined($d->{DATA}->{PROPERTIES})) { + $d->{DATA}->{PROPERTIES} = $d->{PROPERTIES}; + } + + my $data = ParseType($ndr, $d->{DATA}); $data->{ALIGN} = align_type($d->{NAME}); return { @@ -563,7 +572,7 @@ sub CheckPointerTypes($$) sub ParseInterface($) { my $idl = shift; - my @typedefs = (); + my @types = (); my @consts = (); my @functions = (); my @endpoints; @@ -582,20 +591,14 @@ sub ParseInterface($) } foreach my $d (@{$idl->{DATA}}) { - if ($d->{TYPE} eq "TYPEDEF") { - push (@typedefs, ParseTypedef($idl, $d)); - } - if ($d->{TYPE} eq "DECLARE") { push (@declares, $d); - } - - if ($d->{TYPE} eq "FUNCTION") { + } elsif ($d->{TYPE} eq "FUNCTION") { push (@functions, ParseFunction($idl, $d, \$opnum)); - } - - if ($d->{TYPE} eq "CONST") { + } elsif ($d->{TYPE} eq "CONST") { push (@consts, ParseConst($idl, $d)); + } else { + push (@types, ParseType($idl, $d)); } } @@ -620,7 +623,7 @@ sub ParseInterface($) PROPERTIES => $idl->{PROPERTIES}, FUNCTIONS => \@functions, CONSTS => \@consts, - TYPEDEFS => \@typedefs, + TYPES => \@types, DECLARES => \@declares, ENDPOINTS => \@endpoints }; |