summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-04-29 17:33:32 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:05:17 -0500
commit1a4effad3d4c9d69a8aec4a7bb509c4dff309edb (patch)
tree924a0c9323993ba5d122a0e1391bcff84b31b360 /source4
parent51d6e09bbe2ffcf46142fa0d5b91c0a00d1793d9 (diff)
downloadsamba-1a4effad3d4c9d69a8aec4a7bb509c4dff309edb.tar.gz
samba-1a4effad3d4c9d69a8aec4a7bb509c4dff309edb.tar.bz2
samba-1a4effad3d4c9d69a8aec4a7bb509c4dff309edb.zip
r15327: Support 'nosize'. Also write prototypes for print and size functions that are manually written.
(This used to be commit f10b38b824d0ddfdccea498b7522efcc03a020d0)
Diffstat (limited to 'source4')
-rw-r--r--source4/pidl/lib/Parse/Pidl/NDR.pm1
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm37
2 files changed, 24 insertions, 14 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/NDR.pm b/source4/pidl/lib/Parse/Pidl/NDR.pm
index 1efd0694e5..a4008a1545 100644
--- a/source4/pidl/lib/Parse/Pidl/NDR.pm
+++ b/source4/pidl/lib/Parse/Pidl/NDR.pm
@@ -787,6 +787,7 @@ my %property_list = (
"public" => ["FUNCTION", "TYPEDEF"],
"nopush" => ["FUNCTION", "TYPEDEF"],
"nopull" => ["FUNCTION", "TYPEDEF"],
+ "nosize" => ["FUNCTION", "TYPEDEF"],
"noprint" => ["FUNCTION", "TYPEDEF"],
"noejs" => ["FUNCTION", "TYPEDEF"],
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index 4d40699435..b7ae526e68 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -198,12 +198,19 @@ sub fn_declare($$$)
{
my ($type,$fn,$decl) = @_;
- if (has_property($fn, "no$type") or has_property($fn, "public")) {
+ if (has_property($fn, "no$type")) {
pidl_hdr "$decl;";
- pidl "_PUBLIC_ $decl" unless (has_property($fn, "no$type"));
+ return 0;
+ }
+
+ if (has_property($fn, "public")) {
+ pidl_hdr "$decl;";
+ pidl "_PUBLIC_ $decl";
} else {
pidl "static $decl";
}
+
+ return 1;
}
###################################################################
@@ -1814,7 +1821,7 @@ sub ParseTypedefPush($)
my($e) = shift;
my $args = $typefamily{$e->{DATA}->{TYPE}}->{DECL}->($e,"push");
- fn_declare("push", $e, "NTSTATUS ndr_push_$e->{NAME}(struct ndr_push *ndr, int ndr_flags, $args)");
+ fn_declare("push", $e, "NTSTATUS ndr_push_$e->{NAME}(struct ndr_push *ndr, int ndr_flags, $args)") or return;
pidl "{";
indent;
@@ -1833,7 +1840,7 @@ sub ParseTypedefPull($)
my $args = $typefamily{$e->{DATA}->{TYPE}}->{DECL}->($e,"pull");
- fn_declare("pull", $e, "NTSTATUS ndr_pull_$e->{NAME}(struct ndr_pull *ndr, int ndr_flags, $args)");
+ fn_declare("pull", $e, "NTSTATUS ndr_pull_$e->{NAME}(struct ndr_pull *ndr, int ndr_flags, $args)") or return;
pidl "{";
indent;
@@ -1852,8 +1859,11 @@ sub ParseTypedefPrint($)
my $args = $typefamily{$e->{DATA}->{TYPE}}->{DECL}->($e,"print");
- pidl "_PUBLIC_ void ndr_print_$e->{NAME}(struct ndr_print *ndr, const char *name, $args)";
pidl_hdr "void ndr_print_$e->{NAME}(struct ndr_print *ndr, const char *name, $args);";
+
+ return if (has_property($e, "noprint"));
+
+ pidl "_PUBLIC_ void ndr_print_$e->{NAME}(struct ndr_print *ndr, const char *name, $args)";
pidl "{";
indent;
$typefamily{$e->{DATA}->{TYPE}}->{PRINT_FN_BODY}->($e->{DATA}, $e->{NAME});
@@ -1871,7 +1881,7 @@ sub ParseTypedefNdrSize($)
my $tf = $typefamily{$t->{DATA}->{TYPE}};
my $args = $tf->{SIZE_FN_ARGS}->($t);
- fn_declare("size", $t, "size_t ndr_size_$t->{NAME}($args)");
+ fn_declare("size", $t, "size_t ndr_size_$t->{NAME}($args)") or return;
pidl "{";
indent;
@@ -1887,10 +1897,11 @@ sub ParseFunctionPrint($)
{
my($fn) = shift;
+ pidl_hdr "void ndr_print_$fn->{NAME}(struct ndr_print *ndr, const char *name, int flags, const struct $fn->{NAME} *r);";
+
return if has_property($fn, "noprint");
pidl "_PUBLIC_ void ndr_print_$fn->{NAME}(struct ndr_print *ndr, const char *name, int flags, const struct $fn->{NAME} *r)";
- pidl_hdr "void ndr_print_$fn->{NAME}(struct ndr_print *ndr, const char *name, int flags, const struct $fn->{NAME} *r);";
pidl "{";
indent;
@@ -1952,7 +1963,7 @@ sub ParseFunctionPush($)
{
my($fn) = shift;
- fn_declare("push", $fn, "NTSTATUS ndr_push_$fn->{NAME}(struct ndr_push *ndr, int flags, const struct $fn->{NAME} *r)");
+ fn_declare("push", $fn, "NTSTATUS ndr_push_$fn->{NAME}(struct ndr_push *ndr, int flags, const struct $fn->{NAME} *r)") or return;
return if has_property($fn, "nopush");
@@ -2033,9 +2044,7 @@ sub ParseFunctionPull($)
my($fn) = shift;
# pull function args
- fn_declare("pull", $fn, "NTSTATUS ndr_pull_$fn->{NAME}(struct ndr_pull *ndr, int flags, struct $fn->{NAME} *r)");
-
- return if has_property($fn, "nopull");
+ fn_declare("pull", $fn, "NTSTATUS ndr_pull_$fn->{NAME}(struct ndr_pull *ndr, int flags, struct $fn->{NAME} *r)") or return;
pidl "{";
indent;
@@ -2405,9 +2414,9 @@ sub NeededTypedef($$)
{
my ($t,$needed) = @_;
if (has_property($t, "public")) {
- $needed->{"pull_$t->{NAME}"} = not has_property($t, "nopull");
- $needed->{"push_$t->{NAME}"} = not has_property($t, "nopush");
- $needed->{"print_$t->{NAME}"} = not has_property($t, "noprint");
+ $needed->{"pull_$t->{NAME}"} = 1;
+ $needed->{"push_$t->{NAME}"} = 1;
+ $needed->{"print_$t->{NAME}"} = 1;
}
if ($t->{DATA}->{TYPE} eq "STRUCT" or $t->{DATA}->{TYPE} eq "UNION") {