From 47fff7a1b91c3ae89b8c1c1713366d74ac3497bb Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 11 Jan 2008 20:19:47 +0100 Subject: pidl: Remove multiple copies of get_pointer_of and get_value_of. (This used to be commit 79344c9c5e0e38155facb0c7b16e84a0dca3d2eb) --- source4/pidl/lib/Parse/Pidl/CUtil.pm | 39 ++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 source4/pidl/lib/Parse/Pidl/CUtil.pm (limited to 'source4/pidl/lib/Parse/Pidl/CUtil.pm') diff --git a/source4/pidl/lib/Parse/Pidl/CUtil.pm b/source4/pidl/lib/Parse/Pidl/CUtil.pm new file mode 100644 index 0000000000..bd7b16812c --- /dev/null +++ b/source4/pidl/lib/Parse/Pidl/CUtil.pm @@ -0,0 +1,39 @@ +################################################### +# C utility functions for pidl +# Copyright jelmer@samba.org 2005-2007 +# released under the GNU GPL +package Parse::Pidl::CUtil; + +require Exporter; +@ISA = qw(Exporter); +@EXPORT = qw(get_pointer_to get_value_of); +use vars qw($VERSION); +$VERSION = '0.01'; + +use strict; + +sub get_pointer_to($) +{ + my $var_name = shift; + + if ($var_name =~ /^\*(.*)$/) { + return $1; + } elsif ($var_name =~ /^\&(.*)$/) { + return "&($var_name)"; + } else { + return "&$var_name"; + } +} + +sub get_value_of($) +{ + my $var_name = shift; + + if ($var_name =~ /^\&(.*)$/) { + return $1; + } else { + return "*$var_name"; + } +} + +1; -- cgit From 9e999a67a7d3ff6172a7bb5db28c2f528d74f87f Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 31 Jan 2008 14:57:35 +0100 Subject: CHECKED... pidl/Samba4::NDR::Parser: correctly get the name of an array element When we have "*r->out.ous" (char ***ous, a pointer to a pointer to an array). we need to use "(*r->out.ous)[3]" to access the 3rd element of the array "*r->out.ous[3]" was generated before, but that's the same as "*(r->out.ous[3])". metze (This used to be commit 13afc89a87716063180723f0e9cb4f76daca837e) --- source4/pidl/lib/Parse/Pidl/CUtil.pm | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'source4/pidl/lib/Parse/Pidl/CUtil.pm') diff --git a/source4/pidl/lib/Parse/Pidl/CUtil.pm b/source4/pidl/lib/Parse/Pidl/CUtil.pm index bd7b16812c..9deb6ee177 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); +@EXPORT = qw(get_pointer_to get_value_of get_array_element); use vars qw($VERSION); $VERSION = '0.01'; @@ -36,4 +36,17 @@ 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; -- cgit From e22c627ea1e700c30568399cf94df5b88b05f216 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sat, 2 Feb 2008 11:13:03 +0100 Subject: 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) --- source4/pidl/lib/Parse/Pidl/CUtil.pm | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'source4/pidl/lib/Parse/Pidl/CUtil.pm') 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; -- cgit From c3008e086b1a87c5f4add2a7d1474c2f9a34bfd2 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 31 Jan 2008 14:57:35 +0100 Subject: pidl/Samba4::NDR::Parser: correctly get the name of an array element When we have "*r->out.ous" (char ***ous, a pointer to a pointer to an array of pointers). we need to use "(*r->out.ous)[3]" to access the 3rd element of the array "*r->out.ous[3]" was generated before, but that's the same as "*(r->out.ous[3])" which would mean the array would apply to a different level. This patch prepares support for: [out,ref,size_is(,num)] [string,charset(UTF16)] uint16 ***names; It means a [ref] pointer to a [unique] pointer to an array of [unique] pointers which point to an UTF16 string. metze (This used to be commit ec0ee2aa5f4bef32f09a426d91c28c985f843038) --- source4/pidl/lib/Parse/Pidl/CUtil.pm | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'source4/pidl/lib/Parse/Pidl/CUtil.pm') diff --git a/source4/pidl/lib/Parse/Pidl/CUtil.pm b/source4/pidl/lib/Parse/Pidl/CUtil.pm index bd7b16812c..9deb6ee177 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); +@EXPORT = qw(get_pointer_to get_value_of get_array_element); use vars qw($VERSION); $VERSION = '0.01'; @@ -36,4 +36,17 @@ 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; -- cgit