summaryrefslogtreecommitdiff
path: root/source4/build/pidl/pidl.pl
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2005-01-02 00:00:43 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:07:54 -0500
commit971112285c3320a3972ff619f2c38fdf6783231c (patch)
treef593b89d9fdde4ab4f8c6da9f4c778c39f1f8cf3 /source4/build/pidl/pidl.pl
parent9681464dc861a0be240ecd7080b340bf460929f7 (diff)
downloadsamba-971112285c3320a3972ff619f2c38fdf6783231c.tar.gz
samba-971112285c3320a3972ff619f2c38fdf6783231c.tar.bz2
samba-971112285c3320a3972ff619f2c38fdf6783231c.zip
r4469: Version n + 1 of the pidl ethereal parser generator. This version is
based on the idea of manipulating the .c and .h files generated by parser.pm with perl regexps and glueing it all together to make an ethereal plugin. I thought this was a pretty crazy idea to start off with but it has turned out to be not as complicated as I thought and has the huge advantage of not duplicating any of the difficult code in parser.pm. (This used to be commit 7007522f83740f41f9a47f5ad5942ea46320d405)
Diffstat (limited to 'source4/build/pidl/pidl.pl')
-rwxr-xr-xsource4/build/pidl/pidl.pl26
1 files changed, 17 insertions, 9 deletions
diff --git a/source4/build/pidl/pidl.pl b/source4/build/pidl/pidl.pl
index c430c75236..6d0ff69081 100755
--- a/source4/build/pidl/pidl.pl
+++ b/source4/build/pidl/pidl.pl
@@ -205,15 +205,23 @@ $dcom
}
if ($opt_eparser) {
- my($parser) = dirname($output) . "/packet-dcerpc-$basename.c";
- IdlEParser::Parse($pidl, $parser);
- $parser = dirname($output) . "/packet-dcerpc-proto-$basename.h";
- IdlEParser::ParseHeader($pidl, $parser);
- my($header) = dirname($output) . "/packet-dcerpc-proto.h";
- open(OUT, ">>$header") || die "can't open $header";
- print OUT "#include \"ndr_$basename.h\"\n";
- print OUT "#include \"packet-dcerpc-proto-$basename.h\"\n";
- close(OUT);
+
+ # Generate regular .c and .h files for marshaling and
+ # unmarshaling.
+
+ my($parser) = util::ChangeExtension($output, ".c");
+ IdlParser::Parse($pidl, $parser);
+
+ my($header) = util::ChangeExtension($output, ".h");
+ util::FileSave($header, IdlHeader::Parse($pidl));
+
+ # Postprocess to produce ethereal parsers.
+
+ my($eparser) = dirname($output) . "/packet-dcerpc-$basename.c";
+ IdlEParser::RewriteC($pidl, $parser, $eparser);
+
+ my($eparserhdr) = dirname($output) . "/packet-dcerpc-$basename.h";
+ IdlEParser::RewriteHeader($pidl, $header, $eparserhdr);
}
if ($opt_swig) {