diff options
Diffstat (limited to 'source4/build')
-rw-r--r-- | source4/build/pidl/client.pm | 1 | ||||
-rw-r--r-- | source4/build/pidl/idl.gram | 13 | ||||
-rw-r--r-- | source4/build/pidl/parser.pm | 40 | ||||
-rwxr-xr-x | source4/build/pidl/pidl.pl | 12 |
4 files changed, 35 insertions, 31 deletions
diff --git a/source4/build/pidl/client.pm b/source4/build/pidl/client.pm index b0c78d7b3a..495fe3dd7c 100644 --- a/source4/build/pidl/client.pm +++ b/source4/build/pidl/client.pm @@ -67,7 +67,6 @@ sub Parse($) { my($idl) = shift; $res = "/* dcerpc client calls generated by pidl */\n\n"; - $res .= "#include \"includes.h\"\n\n"; foreach my $x (@{$idl}) { ($x->{TYPE} eq "INTERFACE") && ParseInterface($x); diff --git a/source4/build/pidl/idl.gram b/source4/build/pidl/idl.gram index 897a5ad769..b354b9772a 100644 --- a/source4/build/pidl/idl.gram +++ b/source4/build/pidl/idl.gram @@ -2,7 +2,11 @@ use util; } -idl: cpp_prefix(s?) module_header interface +idl: idl_interface(s?) + {{ util::FlattenArray($item[1]) }} + | <error> + +idl_interface: module_header interface { [$item{module_header}, $item{interface}] } | <error> @@ -25,8 +29,7 @@ interface: 'interface' <commit> identifier '{' definition(s?) '}' }} | <error?> -definition : cpp_prefix - | typedef { $item[1] } +definition : typedef { $item[1] } | function { $item[1] } | const { $item[1] } @@ -148,11 +151,12 @@ identifier: /[\w?]+/ expression: /[\w.?\/+*-_]+/ -function : type identifier '(' <commit> element_list2 ');' +function : property_list(s?) type identifier '(' <commit> element_list2 ');' {{ "TYPE" => "FUNCTION", "NAME" => $item{identifier}, "RETURN_TYPE" => $item{type}, + "PROPERTIES" => util::FlattenArray($item[1]), "DATA" => $item{element_list2} }} | <error?> @@ -177,4 +181,3 @@ anytext: text2 '(' <commit> anytext ')' anytext constant: /-?[\dx]+/ | '*' -cpp_prefix: '#' /.*/ 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; diff --git a/source4/build/pidl/pidl.pl b/source4/build/pidl/pidl.pl index edeab1564e..77b80d8bfd 100755 --- a/source4/build/pidl/pidl.pl +++ b/source4/build/pidl/pidl.pl @@ -18,7 +18,6 @@ use dump; use header; use parser; use eparser; -use client; use validator; use util; @@ -29,7 +28,6 @@ my($opt_diff) = 0; my($opt_header) = 0; my($opt_parser) = 0; my($opt_eparser) = 0; -my($opt_client); my($opt_keep) = 0; my($opt_output); @@ -73,7 +71,6 @@ sub ShowHelp() --header create a C header file --parser create a C parser --eparser create an ethereal parser - --client FILENAME create client calls in FILENAME --diff run diff on the idl and dumped output --keep keep the .pidl file \n"; @@ -89,7 +86,6 @@ GetOptions ( 'header' => \$opt_header, 'parser' => \$opt_parser, 'eparser' => \$opt_eparser, - 'client=s' => \$opt_client, 'diff' => \$opt_diff, 'keep' => \$opt_keep ); @@ -149,14 +145,6 @@ sub process_file($) util::FileSave($parser, IdlEParser::Parse($idl)); } - if ($opt_client) { - my($idl) = util::LoadStructure($pidl_file); - my($client) = $opt_client . $basename; - $client = util::ChangeExtension($client, "c"); - print "Generating $client client calls\n"; - util::FileSave($client, IdlClient::Parse($idl)); - } - if ($opt_diff) { my($idl) = util::LoadStructure($pidl_file); my($tempfile) = util::ChangeExtension($output, "tmp"); |