summaryrefslogtreecommitdiff
path: root/source4/build/pidl/parser.pm
diff options
context:
space:
mode:
Diffstat (limited to 'source4/build/pidl/parser.pm')
-rw-r--r--source4/build/pidl/parser.pm40
1 files changed, 27 insertions, 13 deletions
diff --git a/source4/build/pidl/parser.pm b/source4/build/pidl/parser.pm
index 5c80812ec1..a10058a160 100644
--- a/source4/build/pidl/parser.pm
+++ b/source4/build/pidl/parser.pm
@@ -8,6 +8,7 @@ package IdlParser;
use strict;
use Data::Dumper;
+use client;
# the list of needed functions
my %needed;
@@ -15,7 +16,7 @@ my %structs;
sub pidl($)
{
- print IDL shift;
+ print OUT shift;
}
#####################################################################
@@ -111,11 +112,19 @@ sub find_size_var($$$)
# work out is a parse function should be declared static or not
sub fn_prefix($)
{
- my $e = shift;
- if (util::has_property($e, "public")) {
- return "static ";
+ my $fn = shift;
+ if ($fn->{TYPE} eq "TYPEDEF") {
+ if (util::has_property($fn->{DATA}, "public")) {
+ return "";
+ }
}
- return "";
+
+ if ($fn->{TYPE} eq "FUNCTION") {
+ if (util::has_property($fn, "public")) {
+ return "";
+ }
+ }
+ return "static ";
}
@@ -997,7 +1006,7 @@ sub ParseTypedefPush($)
}
if ($e->{DATA}->{TYPE} eq "STRUCT") {
- pidl "$static" . "NTSTATUS ndr_push_$e->{NAME}(struct ndr_push *ndr, int ndr_flags, struct $e->{NAME} *r)";
+ pidl $static . "NTSTATUS ndr_push_$e->{NAME}(struct ndr_push *ndr, int ndr_flags, struct $e->{NAME} *r)";
pidl "\n{\n";
ParseTypePush($e->{DATA});
pidl "\treturn NT_STATUS_OK;\n";
@@ -1005,7 +1014,7 @@ sub ParseTypedefPush($)
}
if ($e->{DATA}->{TYPE} eq "UNION") {
- pidl "$static" . "NTSTATUS ndr_push_$e->{NAME}(struct ndr_push *ndr, int ndr_flags, uint16 level, union $e->{NAME} *r)";
+ pidl $static . "NTSTATUS ndr_push_$e->{NAME}(struct ndr_push *ndr, int ndr_flags, uint16 level, union $e->{NAME} *r)";
pidl "\n{\n";
ParseTypePush($e->{DATA});
pidl "\treturn NT_STATUS_OK;\n";
@@ -1027,7 +1036,7 @@ sub ParseTypedefPull($)
}
if ($e->{DATA}->{TYPE} eq "STRUCT") {
- pidl "$static" . "NTSTATUS ndr_pull_$e->{NAME}(struct ndr_pull *ndr, int ndr_flags, struct $e->{NAME} *r)";
+ pidl $static . "NTSTATUS ndr_pull_$e->{NAME}(struct ndr_pull *ndr, int ndr_flags, struct $e->{NAME} *r)";
pidl "\n{\n";
ParseTypePull($e->{DATA});
pidl "\treturn NT_STATUS_OK;\n";
@@ -1035,7 +1044,7 @@ sub ParseTypedefPull($)
}
if ($e->{DATA}->{TYPE} eq "UNION") {
- pidl "$static" . "NTSTATUS ndr_pull_$e->{NAME}(struct ndr_pull *ndr, int ndr_flags, uint16 level, union $e->{NAME} *r)";
+ pidl $static . "NTSTATUS ndr_pull_$e->{NAME}(struct ndr_pull *ndr, int ndr_flags, uint16 level, union $e->{NAME} *r)";
pidl "\n{\n";
ParseTypePull($e->{DATA});
pidl "\treturn NT_STATUS_OK;\n";
@@ -1139,8 +1148,9 @@ sub ParseFunctionElementPush($$)
sub ParseFunctionPush($)
{
my($fn) = shift;
+ my $static = fn_prefix($fn);
- pidl "NTSTATUS ndr_push_$fn->{NAME}(struct ndr_push *ndr, int flags, struct $fn->{NAME} *r)\n{\n";
+ pidl $static . "NTSTATUS ndr_push_$fn->{NAME}(struct ndr_push *ndr, int flags, struct $fn->{NAME} *r)\n{\n";
pidl "\n\tif (!(flags & NDR_IN)) goto ndr_out;\n\n";
foreach my $e (@{$fn->{DATA}}) {
@@ -1205,9 +1215,10 @@ sub ParseFunctionElementPull($$)
sub ParseFunctionPull($)
{
my($fn) = shift;
+ my $static = fn_prefix($fn);
# pull function args
- pidl "NTSTATUS ndr_pull_$fn->{NAME}(struct ndr_pull *ndr, int flags, struct $fn->{NAME} *r)\n{\n";
+ pidl $static . "NTSTATUS ndr_pull_$fn->{NAME}(struct ndr_pull *ndr, int flags, struct $fn->{NAME} *r)\n{\n";
# declare any internal pointers we need
foreach my $e (@{$fn->{DATA}}) {
@@ -1384,7 +1395,7 @@ sub Parse($$)
my($idl) = shift;
my($filename) = shift;
- open(IDL, ">$filename") || die "can't open $filename";
+ open(OUT, ">$filename") || die "can't open $filename";
pidl "/* parser auto-generated by pidl */\n\n";
pidl "#include \"includes.h\"\n\n";
@@ -1394,7 +1405,10 @@ sub Parse($$)
ParseInterface($x);
}
}
- close(IDL);
+
+ pidl IdlClient::Parse($idl);
+
+ close(OUT);
}
1;