summaryrefslogtreecommitdiff
path: root/source4/pidl/lib/Parse/Pidl/Samba3
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-05-06 16:19:29 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:05:38 -0500
commit55969efea3185a9aaf2ffa86969be9554c84863b (patch)
tree8be5aa50f88f9d6eeb9bce381056eb129a27daa6 /source4/pidl/lib/Parse/Pidl/Samba3
parenta3f2ed12b9cde474a8d5ec96eb0bd0b6211c45a9 (diff)
downloadsamba-55969efea3185a9aaf2ffa86969be9554c84863b.tar.gz
samba-55969efea3185a9aaf2ffa86969be9554c84863b.tar.bz2
samba-55969efea3185a9aaf2ffa86969be9554c84863b.zip
r15474: Generate proper type declarations, fix headers
(This used to be commit 1405f59d5501319c7d08861e19165e012c4bc3a9)
Diffstat (limited to 'source4/pidl/lib/Parse/Pidl/Samba3')
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm53
1 files changed, 45 insertions, 8 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm b/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
index 92bb440e7c..eda2ab99d7 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
@@ -7,10 +7,9 @@
package Parse::Pidl::Samba3::ClientNDR;
use strict;
-use Parse::Pidl::Typelist qw(hasType getType mapType);
-use Parse::Pidl::Util qw(has_property ParseExpr);
+use Parse::Pidl::Typelist qw(hasType getType mapType scalar_is_reference);
+use Parse::Pidl::Util qw(has_property ParseExpr is_constant);
use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel ContainsDeferred);
-use Parse::Pidl::Samba3::Types qw(DeclLong);
use vars qw($VERSION);
$VERSION = '0.01';
@@ -47,6 +46,42 @@ sub CopyLevel($$$$)
}
}
+sub DeclLong($)
+{
+ my($element) = shift;
+ my $ret = "";
+
+ if (has_property($element, "represent_as")) {
+ $ret.=mapType($element->{PROPERTIES}->{represent_as})." ";
+ } else {
+ if (has_property($element, "charset")) {
+ $ret.="const char";
+ } else {
+ $ret.=mapType($element->{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.="[$_]";
+ }
+
+ return $ret;
+}
+
sub ParseFunction($$)
{
my ($if,$fn) = @_;
@@ -73,7 +108,7 @@ sub ParseFunction($$)
}
}
- pidl "status = cli_do_rpc_ndr(cli, mem_ctx, PI_$uif, $ufn, &r, ndr_pull_$fn->{NAME}, ndr_push_$fn->{NAME});";
+ pidl "status = cli_do_rpc_ndr(cli, mem_ctx, PI_$uif, $ufn, &r, (ndr_pull_flags_fn_t)ndr_pull_$fn->{NAME}, (ndr_push_flags_fn_t)ndr_push_$fn->{NAME});";
pidl "if (NT_STATUS_IS_ERR(status)) {";
pidl "\treturn status;";
pidl "}";
@@ -92,9 +127,9 @@ sub ParseFunction($$)
if (not $fn->{RETURN_TYPE}) {
pidl "return NT_STATUS_OK;";
} elsif ($fn->{RETURN_TYPE} eq "NTSTATUS") {
- pidl "return r.status;";
+ pidl "return r.out.result;";
} elsif ($fn->{RETURN_TYPE} eq "WERROR") {
- pidl "return werror_to_ntstatus(r.status);";
+ pidl "return werror_to_ntstatus(r.out.result);";
} else {
pidl "/* Sorry, don't know how to convert $fn->{RETURN_TYPE} to NTSTATUS */";
pidl "return NT_STATUS_OK;";
@@ -117,9 +152,9 @@ sub ParseInterface($)
pidl_hdr "#endif /* __CLI_$uif\__ */";
}
-sub Parse($$)
+sub Parse($$$)
{
- my($ndr,$filename) = @_;
+ my($ndr,$header,$ndr_header) = @_;
$res = "";
$res_hdr = "";
@@ -130,6 +165,8 @@ sub Parse($$)
pidl " */";
pidl "";
pidl "#include \"includes.h\"";
+ pidl "#include \"$header\"";
+ pidl_hdr "#include \"$ndr_header\"";
pidl "";
foreach (@$ndr) {