diff options
Diffstat (limited to 'source4/build')
-rwxr-xr-x | source4/build/pidl/pidl.pl | 8 | ||||
-rw-r--r-- | source4/build/pidl/server.pm | 2 | ||||
-rw-r--r-- | source4/build/pidl/template.pm | 88 |
3 files changed, 96 insertions, 2 deletions
diff --git a/source4/build/pidl/pidl.pl b/source4/build/pidl/pidl.pl index ce8250826a..9b870d7263 100755 --- a/source4/build/pidl/pidl.pl +++ b/source4/build/pidl/pidl.pl @@ -21,12 +21,14 @@ use parser; use eparser; use validator; use util; +use template; my($opt_help) = 0; my($opt_parse) = 0; my($opt_dump) = 0; my($opt_diff) = 0; my($opt_header) = 0; +my($opt_template) = 0; my($opt_server) = 0; my($opt_parser) = 0; my($opt_eparser) = 0; @@ -64,6 +66,7 @@ sub ShowHelp() --header create a C header file --parser create a C parser --server create server boilterplate + --template print a template for a pipe --eparser create an ethereal parser --diff run diff on the idl and dumped output --keep keep the .pidl file @@ -79,6 +82,7 @@ GetOptions ( 'dump' => \$opt_dump, 'header' => \$opt_header, 'server' => \$opt_server, + 'template' => \$opt_template, 'parser' => \$opt_parser, 'eparser' => \$opt_eparser, 'diff' => \$opt_diff, @@ -149,6 +153,10 @@ sub process_file($) system("diff -wu $idl_file $tempfile"); unlink($tempfile); } + + if ($opt_template) { + print IdlTemplate::Parse($pidl); + } } diff --git a/source4/build/pidl/server.pm b/source4/build/pidl/server.pm index e87a6a00be..f5256d18a6 100644 --- a/source4/build/pidl/server.pm +++ b/source4/build/pidl/server.pm @@ -1,5 +1,3 @@ - - ################################################### # server boilerplate generator # Copyright tridge@samba.org 2003 diff --git a/source4/build/pidl/template.pm b/source4/build/pidl/template.pm new file mode 100644 index 0000000000..f9f9897ce2 --- /dev/null +++ b/source4/build/pidl/template.pm @@ -0,0 +1,88 @@ +################################################### +# server template function generator +# Copyright tridge@samba.org 2003 +# released under the GNU GPL + +package IdlTemplate; + +use strict; + +my($res); + +##################################################################### +# produce boilerplate code for a interface +sub Template($) +{ + my($interface) = shift; + my($data) = $interface->{DATA}; + my $name = $interface->{NAME}; + + $res .= +" +/* + Unix SMB/CIFS implementation. + + endpoint server for the $name pipe + + Copyright (C) YOUR NAME HERE XXXX + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include \"includes.h\" + +"; + + foreach my $d (@{$data}) { + if ($d->{TYPE} eq "FUNCTION") { + my $fname = $d->{NAME}; + $res .= +" +/* + $fname +*/ +static NTSTATUS $fname(struct dcesrv_state *dce, TALLOC_CTX *mem_ctx, + struct $fname *r) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} + +"; + } + } + + $res .= +" +/* include the generated boilerplate */ +#include \"librpc/gen_ndr/ndr_$name\_s.c\" +" +} + + +##################################################################### +# parse a parsed IDL structure back into an IDL file +sub Parse($) +{ + my($idl) = shift; + $res = ""; + foreach my $x (@{$idl}) { + ($x->{TYPE} eq "INTERFACE") && + Template($x); + } + return $res; +} + +1; + |