diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-10-05 14:52:35 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:39:25 -0500 |
commit | 5df3b426ee691adaaaa65424aa2cee22dcc10607 (patch) | |
tree | 880508a1ec2edf0d3650577e180990bf2c9fbdca /source4/pidl/lib/Parse/Pidl/Samba3/Header.pm | |
parent | 7838e13e917041fa3786eaa442765ab88b9f0039 (diff) | |
download | samba-5df3b426ee691adaaaa65424aa2cee22dcc10607.tar.gz samba-5df3b426ee691adaaaa65424aa2cee22dcc10607.tar.bz2 samba-5df3b426ee691adaaaa65424aa2cee22dcc10607.zip |
r10732: Generate _ctr structures for unions
(This used to be commit bd8fcb05003ad75f521783ad9603c923eacafc1a)
Diffstat (limited to 'source4/pidl/lib/Parse/Pidl/Samba3/Header.pm')
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/Samba3/Header.pm | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba3/Header.pm b/source4/pidl/lib/Parse/Pidl/Samba3/Header.pm index 5b7fddc14f..6254abaa2d 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba3/Header.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba3/Header.pm @@ -101,10 +101,31 @@ sub ParseUnion($$$) { my ($if,$u,$n) = @_; - pidl "typedef union $if->{NAME}_$n {"; - #FIXME: What about elements that require more then one variable? + my $extra = {"switch_value" => 1}; + + foreach my $e (@{$u->{ELEMENTS}}) { + foreach my $l (@{$e->{LEVELS}}) { + if ($l->{TYPE} eq "ARRAY") { + if ($l->{IS_CONFORMANT}) { + $extra->{"size"} = 1; + } + if ($l->{IS_VARYING}) { + $extra->{"length"} = $extra->{"offset"} = 1; + } + } elsif ($l->{TYPE} eq "POINTER") { + $extra->{"ptr"} = 1; + } elsif ($l->{TYPE} eq "SWITCH") { + $extra->{"level"} = 1; + } + } + } + + pidl "typedef struct $if->{NAME}_$n\_ctr {"; + pidl "\tuint32 $_;" foreach (keys %$extra); + pidl "\tunion {"; ParseElement($_) foreach (@{$u->{ELEMENTS}}); - pidl "} ".uc($if->{NAME}."_".$n) .";"; + pidl "\t} u;"; + pidl "} ".uc("$if->{NAME}_$n\_ctr") .";"; pidl ""; } |