diff options
author | Stefan Metzmacher <metze@samba.org> | 2008-02-02 11:13:03 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2008-02-02 11:13:03 +0100 |
commit | e22c627ea1e700c30568399cf94df5b88b05f216 (patch) | |
tree | 0e81ec21588b62e66abc9ca8bd934e82fa557b36 /source4 | |
parent | 4117839d7725a814c76c3869a23b6bd65cedf079 (diff) | |
download | samba-e22c627ea1e700c30568399cf94df5b88b05f216.tar.gz samba-e22c627ea1e700c30568399cf94df5b88b05f216.tar.bz2 samba-e22c627ea1e700c30568399cf94df5b88b05f216.zip |
pidl: revert changes it didn't want to push...sorry!
8ebf16c0741085fa769fcc2929f275ab49b1ea5d Works!!!...pidl/Samba4::NDR::Parser: fix support for embedded "ref" pointers
6fcf2456d0e81898b5779ef1650f38b4c5363a80 WORKS!!!...pidl/NDR: fix handling of multilevel pointers in function elements
0569139ca2960ec5478829c3e66f7ff69bdb55cd LOOKS OK... pidl: get the pointer types correct when an element has multiple pointe
rs
13afc89a87716063180723f0e9cb4f76daca837e CHECKED... pidl/Samba4::NDR::Parser: correctly get the name of an array element
29c104944bcad30c6a2a3fa70d527bf0ee8969de CHECKED... TODO:MSG pidl/Samba4::NDR::Parser: fix ...
3369015f5d8c425e1a9f9d861471028f03f163bb CHECKED... pidl/Samba4::NDR::Parser: move logic for extra get_pointer_of() into a f
unction
metze
(This used to be commit 0bcc8e53d1470ba9dfe93e5d6925b8f4c20c7c66)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/CUtil.pm | 15 | ||||
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/NDR.pm | 37 | ||||
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm | 96 | ||||
-rwxr-xr-x | source4/pidl/tests/ndr.pl | 289 |
4 files changed, 58 insertions, 379 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/CUtil.pm b/source4/pidl/lib/Parse/Pidl/CUtil.pm index 9deb6ee177..bd7b16812c 100644 --- a/source4/pidl/lib/Parse/Pidl/CUtil.pm +++ b/source4/pidl/lib/Parse/Pidl/CUtil.pm @@ -6,7 +6,7 @@ package Parse::Pidl::CUtil; require Exporter; @ISA = qw(Exporter); -@EXPORT = qw(get_pointer_to get_value_of get_array_element); +@EXPORT = qw(get_pointer_to get_value_of); use vars qw($VERSION); $VERSION = '0.01'; @@ -36,17 +36,4 @@ sub get_value_of($) } } -sub get_array_element($$) -{ - my ($var_name, $idx) = @_; - - if ($var_name =~ /^\*.*$/) { - $var_name = "($var_name)"; - } elsif ($var_name =~ /^\&.*$/) { - $var_name = "($var_name)"; - } - - return "$var_name"."[$idx]"; -} - 1; diff --git a/source4/pidl/lib/Parse/Pidl/NDR.pm b/source4/pidl/lib/Parse/Pidl/NDR.pm index 003eaf0ba7..98e8f183a2 100644 --- a/source4/pidl/lib/Parse/Pidl/NDR.pm +++ b/source4/pidl/lib/Parse/Pidl/NDR.pm @@ -72,9 +72,9 @@ my $scalar_alignment = { 'ipv4address' => 4 }; -sub GetElementLevelTable($$) +sub GetElementLevelTable($) { - my ($e, $pointer_default) = @_; + my $e = shift; my $order = []; my $is_deferred = 0; @@ -157,45 +157,32 @@ sub GetElementLevelTable($$) # Next, all the pointers foreach my $i (1..$e->{POINTERS}) { + my $pt = pointer_type($e); + my $level = "EMBEDDED"; # Top level "ref" pointers do not have a referrent identifier - $level = "TOP" if ($i == 1 and $e->{PARENT}->{TYPE} eq "FUNCTION"); - - my $pt; - # - # Only the first level gets the pointer type from the - # pointer property, the others get them from - # the pointer_default() interface property - # - # see http://msdn2.microsoft.com/en-us/library/aa378984(VS.85).aspx - # (Here they talk about the rightmost pointer, but testing shows - # they mean the leftmost pointer.) - # - # --metze - # - $pt = pointer_type($e); - if ($i > 1) { - $is_deferred = 1 if ($pt ne "ref" and $e->{PARENT}->{TYPE} eq "FUNCTION"); - $pt = $pointer_default; - } + $level = "TOP" if ( defined($pt) + and $i == 1 + and $e->{PARENT}->{TYPE} eq "FUNCTION"); push (@$order, { TYPE => "POINTER", - POINTER_TYPE => $pt, + # for now, there can only be one pointer type per element + POINTER_TYPE => pointer_type($e), POINTER_INDEX => $pointer_idx, IS_DEFERRED => "$is_deferred", LEVEL => $level }); warning($e, "top-level \[out\] pointer `$e->{NAME}' is not a \[ref\] pointer") - if ($i == 1 and $pt ne "ref" and + if ($i == 1 and pointer_type($e) ne "ref" and $e->{PARENT}->{TYPE} eq "FUNCTION" and not has_property($e, "in")); $pointer_idx++; # everything that follows will be deferred - $is_deferred = 1 if ($level ne "TOP"); + $is_deferred = 1 if ($e->{PARENT}->{TYPE} ne "FUNCTION"); my $array_size = shift @size_is; my $array_length; @@ -404,7 +391,7 @@ sub ParseElement($$) NAME => $e->{NAME}, TYPE => $e->{TYPE}, PROPERTIES => $e->{PROPERTIES}, - LEVELS => GetElementLevelTable($e, $pointer_default), + LEVELS => GetElementLevelTable($e), REPRESENTATION_TYPE => ($e->{PROPERTIES}->{represent_as} or $e->{TYPE}), ALIGN => align_type($e->{TYPE}), ORIGINAL => $e diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm index 6e6d227681..8326ce5fb6 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm @@ -14,7 +14,7 @@ require Exporter; use strict; use Parse::Pidl::Typelist qw(hasType getType mapTypeName typeHasBody); use Parse::Pidl::Util qw(has_property ParseExpr ParseExprExt print_uuid); -use Parse::Pidl::CUtil qw(get_pointer_to get_value_of get_array_element); +use Parse::Pidl::CUtil qw(get_pointer_to get_value_of); use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel ContainsDeferred is_charset_array); use Parse::Pidl::Samba4 qw(is_intree choose_header); use Parse::Pidl::Samba4::Header qw(GenerateFunctionInEnv GenerateFunctionOutEnv EnvSubstituteValue GenerateStructEnv); @@ -42,21 +42,19 @@ sub append_prefix($$) { my ($e, $var_name) = @_; my $pointers = 0; - my $arrays = 0; foreach my $l (@{$e->{LEVELS}}) { if ($l->{TYPE} eq "POINTER") { $pointers++; } elsif ($l->{TYPE} eq "ARRAY") { - $arrays++; if (($pointers == 0) and (not $l->{IS_FIXED}) and (not $l->{IS_INLINE})) { - return get_value_of($var_name); + return get_value_of($var_name); } } elsif ($l->{TYPE} eq "DATA") { if (Parse::Pidl::Typelist::scalar_is_reference($l->{DATA_TYPE})) { - return get_value_of($var_name) unless ($pointers or $arrays); + return get_value_of($var_name) unless ($pointers); } } } @@ -584,7 +582,7 @@ sub ParseElementPushLevel my $length = ParseExpr($l->{LENGTH_IS}, $env, $e->{ORIGINAL}); my $counter = "cntr_$e->{NAME}_$l->{LEVEL_INDEX}"; - $var_name = get_array_element($var_name, $counter); + $var_name = $var_name . "[$counter]"; if (($primitives and not $l->{IS_DEFERRED}) or ($deferred and $l->{IS_DEFERRED})) { $self->pidl("for ($counter = 0; $counter < $length; $counter++) {"); @@ -671,48 +669,23 @@ sub ParsePtrPush($$$$) } } -sub need_pointer_to($$$) -{ - my ($e, $l, $scalar_only) = @_; - - my $t; - if (ref($l->{DATA_TYPE})) { - $t = "$l->{DATA_TYPE}->{TYPE}_$l->{DATA_TYPE}->{NAME}"; - } else { - $t = $l->{DATA_TYPE}; - } - - if (not Parse::Pidl::Typelist::is_scalar($t)) { - return 1 if $scalar_only; - } - - my $arrays = 0; - - foreach my $tl (@{$e->{LEVELS}}) { - last if $l == $tl; - if ($tl->{TYPE} eq "ARRAY") { - $arrays++; - } - } - - if (Parse::Pidl::Typelist::scalar_is_reference($t)) { - return 1 unless $arrays; - } - - return 0; -} - sub ParseDataPrint($$$$) { my ($self, $e, $l, $var_name) = @_; - if (not ref($l->{DATA_TYPE}) or defined($l->{DATA_TYPE}->{NAME})) { - - if (need_pointer_to($e, $l, 1)) { + if (not ref($l->{DATA_TYPE}) or + defined($l->{DATA_TYPE}->{NAME})) { + my $t; + if (ref($l->{DATA_TYPE})) { + $t = "$l->{DATA_TYPE}->{TYPE}_$l->{DATA_TYPE}->{NAME}"; + } else { + $t = $l->{DATA_TYPE}; + } + if (not Parse::Pidl::Typelist::is_scalar($t) or + Parse::Pidl::Typelist::scalar_is_reference($t)) { $var_name = get_pointer_to($var_name); } - - $self->pidl(TypeFunctionName("ndr_print", $l->{DATA_TYPE})."(ndr, \"$e->{NAME}\", $var_name);"); + $self->pidl("ndr_print_$t(ndr, \"$e->{NAME}\", $var_name);"); } else { $self->ParseTypePrint($l->{DATA_TYPE}, $var_name); } @@ -779,7 +752,7 @@ sub ParseElementPrint($$$$) $self->pidl("if (idx_$l->{LEVEL_INDEX}) {"); $self->indent; - $var_name = get_array_element($var_name, $counter); + $var_name = $var_name . "[$counter]"; } } elsif ($l->{TYPE} eq "DATA") { $self->ParseDataPrint($e, $l, $var_name); @@ -842,11 +815,12 @@ sub ParseDataPull($$$$$$$) { my ($self,$e,$l,$ndr,$var_name,$primitives,$deferred) = @_; - if (not ref($l->{DATA_TYPE}) or defined($l->{DATA_TYPE}->{NAME})) { + if (not ref($l->{DATA_TYPE}) or + defined($l->{DATA_TYPE}->{NAME})) { my $ndr_flags = CalcNdrFlags($l, $primitives, $deferred); - if (need_pointer_to($e, $l, 0)) { + if (Parse::Pidl::Typelist::scalar_is_reference($l->{DATA_TYPE})) { $var_name = get_pointer_to($var_name); } @@ -871,15 +845,21 @@ sub ParseDataPush($$$$$$$) my ($self,$e,$l,$ndr,$var_name,$primitives,$deferred) = @_; if (not ref($l->{DATA_TYPE}) or defined($l->{DATA_TYPE}->{NAME})) { - - my $ndr_flags = CalcNdrFlags($l, $primitives, $deferred); - + my $t; + if (ref($l->{DATA_TYPE}) eq "HASH") { + $t = "$l->{DATA_TYPE}->{TYPE}_$l->{DATA_TYPE}->{NAME}"; + } else { + $t = $l->{DATA_TYPE}; + } + # strings are passed by value rather than reference - if (need_pointer_to($e, $l, 1)) { + if (not Parse::Pidl::Typelist::is_scalar($t) or + Parse::Pidl::Typelist::scalar_is_reference($t)) { $var_name = get_pointer_to($var_name); } - $self->pidl("NDR_CHECK(".TypeFunctionName("ndr_push", $l->{DATA_TYPE})."($ndr, $ndr_flags, $var_name));"); + my $ndr_flags = CalcNdrFlags($l, $primitives, $deferred); + $self->pidl("NDR_CHECK(ndr_push_$t($ndr, $ndr_flags, $var_name));"); } else { $self->ParseTypePush($l->{DATA_TYPE}, $var_name, $primitives, $deferred); } @@ -929,7 +909,7 @@ sub ParseMemCtxPullFlags($$$$) ($nl->{DATA_TYPE} eq "string")); if ($next_is_array or $next_is_string) { return undef; - } elsif ($l->{LEVEL} eq "TOP") { + } else { $mem_flags = "LIBNDR_FLAG_REF_ALLOC"; } } @@ -1048,7 +1028,7 @@ sub ParseElementPullLevel my $counter = "cntr_$e->{NAME}_$l->{LEVEL_INDEX}"; my $array_name = $var_name; - $var_name = get_array_element($var_name, $counter); + $var_name = $var_name . "[$counter]"; $self->ParseMemCtxPullStart($e, $l, $array_name); @@ -1129,7 +1109,10 @@ sub ParsePtrPull($$$$$) my $next_is_string = (($nl->{TYPE} eq "DATA") and ($nl->{DATA_TYPE} eq "string")); - if ($l->{POINTER_TYPE} eq "ref" and $l->{LEVEL} eq "TOP") { + if ($l->{POINTER_TYPE} eq "ref") { + if ($l->{LEVEL} eq "EMBEDDED") { + $self->pidl("NDR_CHECK(ndr_pull_ref_ptr($ndr, &_ptr_$e->{NAME}));"); + } if (!$next_is_array and !$next_is_string) { $self->pidl("if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {"); @@ -1138,19 +1121,16 @@ sub ParsePtrPull($$$$$) } return; - } elsif ($l->{POINTER_TYPE} eq "ref" and $l->{LEVEL} eq "EMBEDDED") { - $self->pidl("NDR_CHECK(ndr_pull_ref_ptr($ndr, &_ptr_$e->{NAME}));"); } elsif (($l->{POINTER_TYPE} eq "unique") or ($l->{POINTER_TYPE} eq "relative") or ($l->{POINTER_TYPE} eq "full")) { $self->pidl("NDR_CHECK(ndr_pull_generic_ptr($ndr, &_ptr_$e->{NAME}));"); + $self->pidl("if (_ptr_$e->{NAME}) {"); + $self->indent; } else { die("Unhandled pointer type $l->{POINTER_TYPE}"); } - $self->pidl("if (_ptr_$e->{NAME}) {"); - $self->indent; - # Don't do this for arrays, they're allocated at the actual level # of the array unless ($next_is_array or $next_is_string) { diff --git a/source4/pidl/tests/ndr.pl b/source4/pidl/tests/ndr.pl index 504b7ec8de..7fcc7ef40e 100755 --- a/source4/pidl/tests/ndr.pl +++ b/source4/pidl/tests/ndr.pl @@ -4,7 +4,7 @@ use strict; use warnings; -use Test::More tests => 46; +use Test::More tests => 40; use FindBin qw($RealBin); use lib "$RealBin"; use Util; @@ -22,7 +22,7 @@ my $e = { 'PARENT' => { TYPE => 'STRUCT' }, 'LINE' => 42 }; -is_deeply(GetElementLevelTable($e, "unique"), [ +is_deeply(GetElementLevelTable($e), [ { 'IS_DEFERRED' => 0, 'LEVEL_INDEX' => 0, @@ -33,7 +33,7 @@ is_deeply(GetElementLevelTable($e, "unique"), [ } ]); -my $ne = ParseElement($e, "unique"); +my $ne = ParseElement($e, undef); is($ne->{ORIGINAL}, $e); is($ne->{NAME}, "v"); is($ne->{ALIGN}, 1); @@ -60,7 +60,7 @@ $e = { 'TYPE' => 'uint8', 'LINE' => 42 }; -is_deeply(GetElementLevelTable($e, "unique"), [ +is_deeply(GetElementLevelTable($e), [ { LEVEL_INDEX => 0, IS_DEFERRED => 0, @@ -90,7 +90,7 @@ $e = { 'PARENT' => { TYPE => 'STRUCT' }, 'LINE' => 42 }; -is_deeply(GetElementLevelTable($e, "unique"), [ +is_deeply(GetElementLevelTable($e), [ { LEVEL_INDEX => 0, IS_DEFERRED => 0, @@ -128,7 +128,7 @@ $e = { 'PARENT' => { TYPE => 'STRUCT' }, 'LINE' => 42 }; -is_deeply(GetElementLevelTable($e, "unique"), [ +is_deeply(GetElementLevelTable($e), [ { LEVEL_INDEX => 0, IS_DEFERRED => 0, @@ -147,97 +147,6 @@ is_deeply(GetElementLevelTable($e, "unique"), [ } ]); -# Case 3 : ref pointers -# -$e = { - 'FILE' => 'foo.idl', - 'NAME' => 'v', - 'PROPERTIES' => {"ref" => 1}, - 'POINTERS' => 3, - 'TYPE' => 'uint8', - 'PARENT' => { TYPE => 'STRUCT' }, - 'LINE' => 42 }; - -is_deeply(GetElementLevelTable($e, "unique"), [ - { - LEVEL_INDEX => 0, - IS_DEFERRED => 0, - TYPE => 'POINTER', - POINTER_TYPE => "ref", - POINTER_INDEX => 0, - LEVEL => 'EMBEDDED' - }, - { - LEVEL_INDEX => 1, - IS_DEFERRED => 1, - TYPE => 'POINTER', - POINTER_TYPE => "unique", - POINTER_INDEX => 1, - LEVEL => 'EMBEDDED' - }, - { - LEVEL_INDEX => 2, - IS_DEFERRED => 1, - TYPE => 'POINTER', - POINTER_TYPE => "unique", - POINTER_INDEX => 2, - LEVEL => 'EMBEDDED' - }, - { - 'IS_DEFERRED' => 1, - 'LEVEL_INDEX' => 3, - 'DATA_TYPE' => 'uint8', - 'CONTAINS_DEFERRED' => 0, - 'TYPE' => 'DATA', - 'IS_SURROUNDING' => 0, - } -]); - -# Case 3 : ref pointers -# -$e = { - 'FILE' => 'foo.idl', - 'NAME' => 'v', - 'PROPERTIES' => {"ref" => 1}, - 'POINTERS' => 3, - 'TYPE' => 'uint8', - 'PARENT' => { TYPE => 'STRUCT' }, - 'LINE' => 42 }; - -is_deeply(GetElementLevelTable($e, "ref"), [ - { - LEVEL_INDEX => 0, - IS_DEFERRED => 0, - TYPE => 'POINTER', - POINTER_TYPE => "ref", - POINTER_INDEX => 0, - LEVEL => 'EMBEDDED' - }, - { - LEVEL_INDEX => 1, - IS_DEFERRED => 1, - TYPE => 'POINTER', - POINTER_TYPE => "ref", - POINTER_INDEX => 1, - LEVEL => 'EMBEDDED' - }, - { - LEVEL_INDEX => 2, - IS_DEFERRED => 1, - TYPE => 'POINTER', - POINTER_TYPE => "ref", - POINTER_INDEX => 2, - LEVEL => 'EMBEDDED' - }, - { - 'IS_DEFERRED' => 1, - 'LEVEL_INDEX' => 3, - 'DATA_TYPE' => 'uint8', - 'CONTAINS_DEFERRED' => 0, - 'TYPE' => 'DATA', - 'IS_SURROUNDING' => 0, - } -]); # Case 4 : top-level ref pointers # @@ -250,7 +159,7 @@ $e = { 'PARENT' => { TYPE => 'FUNCTION' }, 'LINE' => 42 }; -is_deeply(GetElementLevelTable($e, "unique"), [ +is_deeply(GetElementLevelTable($e), [ { LEVEL_INDEX => 0, IS_DEFERRED => 0, @@ -269,190 +178,6 @@ is_deeply(GetElementLevelTable($e, "unique"), [ } ]); -# Case 4 : top-level ref pointers, triple with pointer_default("unique") -# -$e = { - 'FILE' => 'foo.idl', - 'NAME' => 'v', - 'PROPERTIES' => {"ref" => 1}, - 'POINTERS' => 3, - 'TYPE' => 'uint8', - 'PARENT' => { TYPE => 'FUNCTION' }, - 'LINE' => 42 }; - -is_deeply(GetElementLevelTable($e, "unique"), [ - { - LEVEL_INDEX => 0, - IS_DEFERRED => 0, - TYPE => 'POINTER', - POINTER_TYPE => "ref", - POINTER_INDEX => 0, - LEVEL => 'TOP' - }, - { - LEVEL_INDEX => 1, - IS_DEFERRED => 0, - TYPE => 'POINTER', - POINTER_TYPE => "unique", - POINTER_INDEX => 1, - LEVEL => 'EMBEDDED' - }, - { - LEVEL_INDEX => 2, - IS_DEFERRED => 1, - TYPE => 'POINTER', - POINTER_TYPE => "unique", - POINTER_INDEX => 2, - LEVEL => 'EMBEDDED' - }, - { - 'IS_DEFERRED' => 1, - 'LEVEL_INDEX' => 3, - 'DATA_TYPE' => 'uint8', - 'CONTAINS_DEFERRED' => 0, - 'TYPE' => 'DATA', - 'IS_SURROUNDING' => 0, - } -]); - -# Case 4 : top-level unique pointers, triple with pointer_default("unique") -# -$e = { - 'FILE' => 'foo.idl', - 'NAME' => 'v', - 'PROPERTIES' => {"unique" => 1, "in" => 1}, - 'POINTERS' => 3, - 'TYPE' => 'uint8', - 'PARENT' => { TYPE => 'FUNCTION' }, - 'LINE' => 42 }; - -is_deeply(GetElementLevelTable($e, "unique"), [ - { - LEVEL_INDEX => 0, - IS_DEFERRED => 0, - TYPE => 'POINTER', - POINTER_TYPE => "unique", - POINTER_INDEX => 0, - LEVEL => 'TOP' - }, - { - LEVEL_INDEX => 1, - IS_DEFERRED => 1, - TYPE => 'POINTER', - POINTER_TYPE => "unique", - POINTER_INDEX => 1, - LEVEL => 'EMBEDDED' - }, - { - LEVEL_INDEX => 2, - IS_DEFERRED => 1, - TYPE => 'POINTER', - POINTER_TYPE => "unique", - POINTER_INDEX => 2, - LEVEL => 'EMBEDDED' - }, - { - 'IS_DEFERRED' => 1, - 'LEVEL_INDEX' => 3, - 'DATA_TYPE' => 'uint8', - 'CONTAINS_DEFERRED' => 0, - 'TYPE' => 'DATA', - 'IS_SURROUNDING' => 0, - } -]); - -# Case 4 : top-level unique pointers, triple with pointer_default("ref") -# -$e = { - 'FILE' => 'foo.idl', - 'NAME' => 'v', - 'PROPERTIES' => {"unique" => 1, "in" => 1}, - 'POINTERS' => 3, - 'TYPE' => 'uint8', - 'PARENT' => { TYPE => 'FUNCTION' }, - 'LINE' => 42 }; - -is_deeply(GetElementLevelTable($e, "ref"), [ - { - LEVEL_INDEX => 0, - IS_DEFERRED => 0, - TYPE => 'POINTER', - POINTER_TYPE => "unique", - POINTER_INDEX => 0, - LEVEL => 'TOP' - }, - { - LEVEL_INDEX => 1, - IS_DEFERRED => 1, - TYPE => 'POINTER', - POINTER_TYPE => "ref", - POINTER_INDEX => 1, - LEVEL => 'EMBEDDED' - }, - { - LEVEL_INDEX => 2, - IS_DEFERRED => 1, - TYPE => 'POINTER', - POINTER_TYPE => "ref", - POINTER_INDEX => 2, - LEVEL => 'EMBEDDED' - }, - { - 'IS_DEFERRED' => 1, - 'LEVEL_INDEX' => 3, - 'DATA_TYPE' => 'uint8', - 'CONTAINS_DEFERRED' => 0, - 'TYPE' => 'DATA', - 'IS_SURROUNDING' => 0, - } -]); - -# Case 4 : top-level ref pointers, triple with pointer_default("ref") -# -$e = { - 'FILE' => 'foo.idl', - 'NAME' => 'v', - 'PROPERTIES' => {"ref" => 1}, - 'POINTERS' => 3, - 'TYPE' => 'uint8', - 'PARENT' => { TYPE => 'FUNCTION' }, - 'LINE' => 42 }; - -is_deeply(GetElementLevelTable($e, "ref"), [ - { - LEVEL_INDEX => 0, - IS_DEFERRED => 0, - TYPE => 'POINTER', - POINTER_TYPE => "ref", - POINTER_INDEX => 0, - LEVEL => 'TOP' - }, - { - LEVEL_INDEX => 1, - IS_DEFERRED => 0, - TYPE => 'POINTER', - POINTER_TYPE => "ref", - POINTER_INDEX => 1, - LEVEL => 'EMBEDDED' - }, - { - LEVEL_INDEX => 2, - IS_DEFERRED => 1, - TYPE => 'POINTER', - POINTER_TYPE => "ref", - POINTER_INDEX => 2, - LEVEL => 'EMBEDDED' - }, - { - 'IS_DEFERRED' => 1, - 'LEVEL_INDEX' => 3, - 'DATA_TYPE' => 'uint8', - 'CONTAINS_DEFERRED' => 0, - 'TYPE' => 'DATA', - 'IS_SURROUNDING' => 0, - } -]); - # representation_type $e = { 'FILE' => 'foo.idl', |