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 | |
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')
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/Ethereal/NDR.pm | 2 | ||||
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/NDR.pm | 69 | ||||
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/Samba3/Header.pm | 2 | ||||
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/Samba3/Parser.pm | 2 | ||||
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/Samba3/Types.pm | 2 | ||||
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm | 4 | ||||
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/Samba4/EJSHeader.pm | 4 | ||||
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm | 4 |
8 files changed, 45 insertions, 44 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Ethereal/NDR.pm b/source4/pidl/lib/Parse/Pidl/Ethereal/NDR.pm index b400d1ade0..0b81536795 100644 --- a/source4/pidl/lib/Parse/Pidl/Ethereal/NDR.pm +++ b/source4/pidl/lib/Parse/Pidl/Ethereal/NDR.pm @@ -112,7 +112,7 @@ sub Interface($) { my($interface) = @_; Const($_,$interface->{NAME}) foreach (@{$interface->{CONSTS}}); - Typedef($_,$interface->{NAME}) foreach (@{$interface->{TYPEDEFS}}); + Typedef($_,$interface->{NAME}) foreach (@{$interface->{TYPES}}); Function($_,$interface->{NAME}) foreach (@{$interface->{FUNCTIONS}}); } 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 }; diff --git a/source4/pidl/lib/Parse/Pidl/Samba3/Header.pm b/source4/pidl/lib/Parse/Pidl/Samba3/Header.pm index b49e64c337..fb02120a42 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba3/Header.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba3/Header.pm @@ -183,7 +183,7 @@ sub ParseInterface($) pidl ""; - foreach (@{$if->{TYPEDEFS}}) { + foreach (@{$if->{TYPES}}) { ParseStruct($if, $_->{DATA}, $_->{NAME}) if ($_->{DATA}->{TYPE} eq "STRUCT"); ParseEnum($if, $_->{DATA}, $_->{NAME}) if ($_->{DATA}->{TYPE} eq "ENUM"); ParseBitmap($if, $_->{DATA}, $_->{NAME}) if ($_->{DATA}->{TYPE} eq "BITMAP"); diff --git a/source4/pidl/lib/Parse/Pidl/Samba3/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba3/Parser.pm index 9ef8f09dc4..c12f7554e9 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba3/Parser.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba3/Parser.pm @@ -566,7 +566,7 @@ sub ParseInterface($) # Structures first pidl "/* $if->{NAME} structures */"; - foreach (@{$if->{TYPEDEFS}}) { + foreach (@{$if->{TYPES}}) { ParseStruct($if, $_->{DATA}, $_->{NAME}) if ($_->{DATA}->{TYPE} eq "STRUCT"); ParseUnion($if, $_->{DATA}, $_->{NAME}) if ($_->{DATA}->{TYPE} eq "UNION"); } diff --git a/source4/pidl/lib/Parse/Pidl/Samba3/Types.pm b/source4/pidl/lib/Parse/Pidl/Samba3/Types.pm index 3f7e8ae134..d1f1032714 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba3/Types.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba3/Types.pm @@ -350,7 +350,7 @@ sub LoadTypes($) foreach my $if (@{$ndr}) { next unless ($if->{TYPE} eq "INTERFACE"); - foreach my $td (@{$if->{TYPEDEFS}}) { + foreach my $td (@{$if->{TYPES}}) { my $decl = uc("$if->{NAME}_$td->{NAME}"); my $init = sub { diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm b/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm index f5aea73d12..8c576c44f9 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm @@ -706,7 +706,7 @@ sub EjsInterface($$) %constants = (); - foreach my $d (@{$interface->{TYPEDEFS}}) { + foreach my $d (@{$interface->{TYPES}}) { ($needed->{"push_$d->{NAME}"}) && EjsTypedefPush($d); ($needed->{"pull_$d->{NAME}"}) && EjsTypedefPull($d); } @@ -831,7 +831,7 @@ sub NeededInterface($$) foreach my $d (@{$interface->{FUNCTIONS}}) { NeededFunction($d, $needed); } - foreach my $d (reverse @{$interface->{TYPEDEFS}}) { + foreach my $d (reverse @{$interface->{TYPES}}) { NeededTypedef($d, $needed); } } diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/EJSHeader.pm b/source4/pidl/lib/Parse/Pidl/Samba4/EJSHeader.pm index a204ee7a56..eae7ddce5f 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/EJSHeader.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/EJSHeader.pm @@ -54,9 +54,7 @@ sub HeaderInterface($) pidl "\n"; - foreach my $d (@{$interface->{TYPEDEFS}}) { - HeaderTypedefProto($d); - } + HeaderTypedefProto($_) foreach (@{$interface->{TYPES}}); pidl "\n"; pidl "#endif /* _HEADER_EJS_$interface->{NAME} */\n"; diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm index 2242323747..bb9d32487a 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm @@ -2313,7 +2313,7 @@ sub ParseInterface($$) HeaderInterface($interface); # Typedefs - foreach my $d (@{$interface->{TYPEDEFS}}) { + foreach my $d (@{$interface->{TYPES}}) { ($needed->{"push_$d->{NAME}"}) && ParseTypedefPush($d); ($needed->{"pull_$d->{NAME}"}) && ParseTypedefPull($d); ($needed->{"print_$d->{NAME}"}) && ParseTypedefPrint($d); @@ -2456,7 +2456,7 @@ sub NeededInterface($$) { my ($interface,$needed) = @_; NeededFunction($_, $needed) foreach (@{$interface->{FUNCTIONS}}); - NeededTypedef($_, $needed) foreach (reverse @{$interface->{TYPEDEFS}}); + NeededTypedef($_, $needed) foreach (reverse @{$interface->{TYPES}}); } 1; |