aboutsummaryrefslogtreecommitdiffstats
path: root/tools/pidl/lib/Parse/Pidl/Samba4.pm
diff options
context:
space:
mode:
authorJörg Mayer <jmayer@loplof.de>2007-09-24 07:00:59 +0000
committerJörg Mayer <jmayer@loplof.de>2007-09-24 07:00:59 +0000
commitb2020800688458627abae49f331560c14b55e135 (patch)
tree60b28f0268c05e35c7fae3fcd8b9c5a12dde607d /tools/pidl/lib/Parse/Pidl/Samba4.pm
parent094e2a9a5f15ba8ade40546518c8e53daeb919a6 (diff)
Update pidl to current samba tree. This changes the license
of the *tool* to GPLv3. The license of the generated code is is most likely not affected (see mail on wireshark-dev from Jelmer). Update from samba tree revision 23750 to 25198 ============================ Samba log start ============ ------------------------------------------------------------------------ r23792 | tridge | 2007-07-10 04:07:03 +0200 (Tue, 10 Jul 2007) | 6 lines convert Samba4 to GPLv3 There are still a few tidyups of old FSF addresses to come (in both s3 and s4). More commits soon. ------------------------------------------------------------------------ r24407 | metze | 2007-08-14 13:50:45 +0200 (Tue, 14 Aug 2007) | 6 lines $element->{ARRAY_LEN} doesn't exist... and a few lines above we use $element->{ORIGINAL}->{ARRAY_LEN} I assume it was just forgotten in the update. metze ------------------------------------------------------------------------ r24446 | metze | 2007-08-15 08:08:02 +0200 (Wed, 15 Aug 2007) | 4 lines We only need one genric GenerateFunctionInEnv function metze ------------------------------------------------------------------------ r24447 | metze | 2007-08-15 10:55:16 +0200 (Wed, 15 Aug 2007) | 3 lines fix samba3-cli pidl tests metze ------------------------------------------------------------------------ r24452 | metze | 2007-08-15 11:18:25 +0200 (Wed, 15 Aug 2007) | 4 lines bail out instead of only giving a warning on incorrect idl files metze ------------------------------------------------------------------------ r24454 | metze | 2007-08-15 12:23:28 +0200 (Wed, 15 Aug 2007) | 3 lines when level 0 is a pointer we need to look for an array in level 1... metze ------------------------------------------------------------------------ r24463 | metze | 2007-08-15 16:02:23 +0200 (Wed, 15 Aug 2007) | 4 lines we have a function to correctly create an $env object so don't try it manually and introduce bugs:-) metze ------------------------------------------------------------------------ r24482 | metze | 2007-08-16 12:07:19 +0200 (Thu, 16 Aug 2007) | 3 lines white space cleanup only... metze ------------------------------------------------------------------------ r24484 | metze | 2007-08-16 12:54:11 +0200 (Thu, 16 Aug 2007) | 3 lines pass down $ndr tree instead of the $pidl tree to Samba4/Header.pm metze ------------------------------------------------------------------------ r24487 | metze | 2007-08-16 15:27:41 +0200 (Thu, 16 Aug 2007) | 3 lines fix formating and add defined($opt_header) metze ------------------------------------------------------------------------ r24488 | metze | 2007-08-16 15:29:38 +0200 (Thu, 16 Aug 2007) | 3 lines enum's and bitmap's not have nested types metze ------------------------------------------------------------------------ r24489 | metze | 2007-08-16 15:34:54 +0200 (Thu, 16 Aug 2007) | 4 lines only typedef enum { ... } foo; enum's should look for has_properties() of $enum->{PARENT} metze ------------------------------------------------------------------------ r24490 | metze | 2007-08-16 15:39:30 +0200 (Thu, 16 Aug 2007) | 8 lines For ParseBitmap() we use Parse::Pidl::Typelist::bitmap_type_fn() so for ParseEnum() we should also use Parse::Pidl::Typelist::enum_type_fn(). Also the base_type() property isn't standard IDL and we should not support it. This changes TDR enum to also to default to uint16 (as with NDR enums). metze ------------------------------------------------------------------------ r24492 | metze | 2007-08-16 15:41:48 +0200 (Thu, 16 Aug 2007) | 4 lines Parse::Pidl::Samba4::Header::Parse() now takes an $ndr tree not the $pidl tree anymore. metze ------------------------------------------------------------------------ r24493 | metze | 2007-08-16 16:42:22 +0200 (Thu, 16 Aug 2007) | 11 lines - it turns out that foreach my $e (@{$union->{ELEMENTS}}) { changes $union->{ELEMENTS} from undef into an empty array. this removes the difference between struct foo { }; and struct foo; So we need to explicit return before. - we should return the same element for layout for structs and unions with no elements. - fix the testsuite to match metze ------------------------------------------------------------------------ r24505 | metze | 2007-08-17 09:06:02 +0200 (Fri, 17 Aug 2007) | 3 lines pass down $fn one level metze ------------------------------------------------------------------------ r24506 | metze | 2007-08-17 09:46:34 +0200 (Fri, 17 Aug 2007) | 3 lines pass $fn down one more layer metze ------------------------------------------------------------------------ r24507 | metze | 2007-08-17 10:05:57 +0200 (Fri, 17 Aug 2007) | 3 lines pass $d down to HeaderTypedef metze ------------------------------------------------------------------------ r24508 | metze | 2007-08-17 10:47:38 +0200 (Fri, 17 Aug 2007) | 3 lines add HeaderTypeNew() which will go if everything is converted metze ------------------------------------------------------------------------ r24509 | metze | 2007-08-17 11:01:19 +0200 (Fri, 17 Aug 2007) | 4 lines pass down the full ndr elements instead of the old pidl elements from ->{ORIGINAL} metze ------------------------------------------------------------------------ r24511 | metze | 2007-08-17 11:12:13 +0200 (Fri, 17 Aug 2007) | 3 lines pass the correct thing to fatal() metze ------------------------------------------------------------------------ r24514 | metze | 2007-08-17 13:09:46 +0200 (Fri, 17 Aug 2007) | 3 lines IS_* elemements sound be perl integers consistantly... metze ------------------------------------------------------------------------ r24515 | metze | 2007-08-17 13:24:25 +0200 (Fri, 17 Aug 2007) | 3 lines use fatal() wrapper instead of die() directly metze ------------------------------------------------------------------------ r24516 | metze | 2007-08-17 14:04:41 +0200 (Fri, 17 Aug 2007) | 3 lines don't use ->{ORIGINAL} metze ------------------------------------------------------------------------ r24517 | metze | 2007-08-17 14:55:47 +0200 (Fri, 17 Aug 2007) | 4 lines move skipping pointer before an array logic into the pointer loop as we do in other places metze ------------------------------------------------------------------------ r24518 | metze | 2007-08-17 15:01:51 +0200 (Fri, 17 Aug 2007) | 4 lines get rid of using ->{ORIGINAL} and move stuff into subfunctions metze ------------------------------------------------------------------------ r24520 | metze | 2007-08-17 15:08:00 +0200 (Fri, 17 Aug 2007) | 4 lines make use of the new ElementStars() and ArrayBrackets() functions metze ------------------------------------------------------------------------ r24521 | metze | 2007-08-17 15:42:09 +0200 (Fri, 17 Aug 2007) | 3 lines we don't yet have optional args to DeclLong() metze ------------------------------------------------------------------------ r24522 | metze | 2007-08-17 15:45:18 +0200 (Fri, 17 Aug 2007) | 3 lines make the "skip pointer to an array" logic a bit easier metze ------------------------------------------------------------------------ r24523 | metze | 2007-08-17 15:47:03 +0200 (Fri, 17 Aug 2007) | 4 lines we don't support multi-dimentional [out] arrays for the samba3 server stubs yet, so bail out. metze ------------------------------------------------------------------------ r24524 | metze | 2007-08-17 15:53:12 +0200 (Fri, 17 Aug 2007) | 3 lines make use of ElementStars() metze ------------------------------------------------------------------------ r24535 | metze | 2007-08-18 12:30:40 +0200 (Sat, 18 Aug 2007) | 4 lines rename struct dcerpc_interface_call -> struct ndr_interface_call and move it to librpc/ndr/libndr.h metze ------------------------------------------------------------------------ r24540 | metze | 2007-08-18 14:25:37 +0200 (Sat, 18 Aug 2007) | 4 lines rename struct dcerpc_endpoint_list/struct dcerpc_authservice_list into ndr_interface_string_array and move it to libndr.h metze ------------------------------------------------------------------------ r24551 | metze | 2007-08-19 22:46:45 +0200 (Sun, 19 Aug 2007) | 6 lines rename dcerpc_interface_table -> ndr_interface_table rename dcerpc_interface_list -> ndr_interface_list and move them to libndr.h metze ------------------------------------------------------------------------ r24557 | metze | 2007-08-19 23:23:03 +0200 (Sun, 19 Aug 2007) | 3 lines rename 'dcerpc_table_' -> 'ndr_table_' metze ------------------------------------------------------------------------ r24560 | metze | 2007-08-20 00:09:21 +0200 (Mon, 20 Aug 2007) | 3 lines rename some DCERPC_ prefixes into NDR_ metze ------------------------------------------------------------------------ r24563 | metze | 2007-08-20 00:23:17 +0200 (Mon, 20 Aug 2007) | 3 lines remove unused DCERPC specific stuff from the generated NDR code metze ------------------------------------------------------------------------ r24592 | metze | 2007-08-21 14:19:56 +0200 (Tue, 21 Aug 2007) | 4 lines pass down the ndr_interface_table in the samba3 client bindings instead of the pull and push functions metze ------------------------------------------------------------------------ r24596 | metze | 2007-08-21 16:06:33 +0200 (Tue, 21 Aug 2007) | 7 lines - talloc request structure for the samba3 server bindings and make that the primary context for the request which the implementations can also use. - go via functions pointers in the ndr_interface_table instead of calling functions directly. metze ------------------------------------------------------------------------ r24717 | jelmer | 2007-08-27 20:43:18 +0200 (Mon, 27 Aug 2007) | 2 lines D /branches/SAMBA_4_0/BRANCH.TODO Some more easy bool conversions, update TODO for registry ------------------------------------------------------------------------ r24721 | jelmer | 2007-08-27 21:47:23 +0200 (Mon, 27 Aug 2007) | 1 line Avoid True and False because they are only available within Samba. ------------------------------------------------------------------------ r24812 | jelmer | 2007-08-31 00:25:59 +0200 (Fri, 31 Aug 2007) | 1 line Fix headers for external users. ------------------------------------------------------------------------ r24815 | jelmer | 2007-08-31 02:03:54 +0200 (Fri, 31 Aug 2007) | 1 line Support cpp_quote(). ------------------------------------------------------------------------ r24816 | jelmer | 2007-08-31 02:31:32 +0200 (Fri, 31 Aug 2007) | 4 lines D /branches/SAMBA_4_0/source/include/core.h Move the rest of the contents of core.h to more appropriate places. include/ now only contains build system related headers, all other headers are now near the source code they're related to. ------------------------------------------------------------------------ r24983 | metze | 2007-09-06 15:48:01 +0200 (Thu, 06 Sep 2007) | 4 lines setup the correct talloc name for structures used in the generated server stubs metze ------------------------------------------------------------------------ r25114 | metze | 2007-09-12 14:31:19 +0200 (Wed, 12 Sep 2007) | 7 lines handle structs and unions without typedefs better in can_contain_deffered() jelmer: we need to handle this more genericly, I assume we have a lot of other related bugs metze ------------------------------------------------------------------------ r25166 | jelmer | 2007-09-14 20:06:51 +0200 (Fri, 14 Sep 2007) | 1 line Simplify can_contain_deferred and add tests for it. ------------------------------------------------------------------------ r25168 | jelmer | 2007-09-14 20:26:23 +0200 (Fri, 14 Sep 2007) | 1 line Fix include for gen_ndr/misc.h. Patch by Julien Kerihuel. ------------------------------------------------------------------------ r25185 | jelmer | 2007-09-16 01:03:34 +0200 (Sun, 16 Sep 2007) | 1 line Check that can_contain_deferred returns true if one of the members of a type can contain deferred data. ------------------------------------------------------------------------ ============================ Samba log end ============== svn path=/trunk/; revision=22935
Diffstat (limited to 'tools/pidl/lib/Parse/Pidl/Samba4.pm')
-rw-r--r--tools/pidl/lib/Parse/Pidl/Samba4.pm97
1 files changed, 71 insertions, 26 deletions
diff --git a/tools/pidl/lib/Parse/Pidl/Samba4.pm b/tools/pidl/lib/Parse/Pidl/Samba4.pm
index f6c0ee38f7..5848543a60 100644
--- a/tools/pidl/lib/Parse/Pidl/Samba4.pm
+++ b/tools/pidl/lib/Parse/Pidl/Samba4.pm
@@ -7,9 +7,10 @@ package Parse::Pidl::Samba4;
require Exporter;
@ISA = qw(Exporter);
-@EXPORT = qw(is_intree choose_header DeclLong);
+@EXPORT = qw(is_intree choose_header NumStars ElementStars ArrayBrackets DeclLong);
use Parse::Pidl::Util qw(has_property is_constant);
+use Parse::Pidl::NDR qw(GetNextLevel);
use Parse::Pidl::Typelist qw(mapTypeName scalar_is_reference);
use strict;
@@ -34,40 +35,84 @@ sub choose_header($$)
return "#include <$out>";
}
+sub NumStars($;$)
+{
+ my ($e, $d) = @_;
+ $d = 0 unless defined($d);
+ my $n = 0;
+
+ foreach my $l (@{$e->{LEVELS}}) {
+ next unless ($l->{TYPE} eq "POINTER");
+
+ my $nl = GetNextLevel($e, $l);
+ next if (defined($nl) and $nl->{TYPE} eq "ARRAY");
+
+ $n++;
+ }
+
+ if ($n >= 1) {
+ $n-- if (scalar_is_reference($e->{TYPE}));
+ }
+
+ foreach my $l (@{$e->{LEVELS}}) {
+ next unless ($l->{TYPE} eq "ARRAY");
+ next if ($l->{IS_FIXED}) and not has_property($e, "charset");
+ $n++;
+ }
+
+ fatal($e->{ORIGINAL}, "Too few pointers $n < $d") if ($n < $d);
+
+ $n -= $d;
+
+ return $n;
+}
+
+sub ElementStars($;$)
+{
+ my ($e, $d) = @_;
+ my $res = "";
+ my $n = 0;
+
+ $n = NumStars($e, $d);
+ $res .= "*" foreach (1..$n);
+
+ return $res;
+}
+
+sub ArrayBrackets($)
+{
+ my ($e) = @_;
+ my $res = "";
+
+ foreach my $l (@{$e->{LEVELS}}) {
+ next unless ($l->{TYPE} eq "ARRAY");
+ next unless ($l->{IS_FIXED}) and not has_property($e, "charset");
+ $res .= "[$l->{SIZE_IS}]";
+ }
+
+ return $res;
+}
+
sub DeclLong($)
{
- my($element) = shift;
- my $ret = "";
+ my ($e) = shift;
+ my $res = "";
- if (has_property($element, "represent_as")) {
- $ret.=mapTypeName($element->{PROPERTIES}->{represent_as})." ";
+ if (has_property($e, "represent_as")) {
+ $res .= mapTypeName($e->{PROPERTIES}->{represent_as})." ";
} else {
- if (has_property($element, "charset")) {
- $ret.="const char";
+ if (has_property($e, "charset")) {
+ $res .= "const char ";
} else {
- $ret.=mapTypeName($element->{TYPE});
+ $res .= mapTypeName($e->{TYPE})." ";
}
- $ret.=" ";
- my $numstar = $element->{ORIGINAL}->{POINTERS};
- if ($numstar >= 1) {
- $numstar-- if scalar_is_reference($element->{TYPE});
- }
- foreach (@{$element->{ORIGINAL}->{ARRAY_LEN}})
- {
- next if is_constant($_) and
- not has_property($element, "charset");
- $numstar++;
- }
- $ret.="*" foreach (1..$numstar);
- }
- $ret.=$element->{NAME};
- foreach (@{$element->{ARRAY_LEN}}) {
- next unless (is_constant($_) and not has_property($element, "charset"));
- $ret.="[$_]";
+ $res .= ElementStars($e);
}
+ $res .= $e->{NAME};
+ $res .= ArrayBrackets($e);
- return $ret;
+ return $res;
}
1;