summaryrefslogtreecommitdiff
path: root/source4/build/pidl/pidl.pl
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-05-25 13:50:27 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:17:01 -0500
commite427f58622e3d88c59953d6c1fb583acfb046213 (patch)
tree4fe708ec07cdcb85dd3af028e158505e065ca59e /source4/build/pidl/pidl.pl
parente7b3f91678a27d85791f7a62fc418988edc92214 (diff)
downloadsamba-e427f58622e3d88c59953d6c1fb583acfb046213.tar.gz
samba-e427f58622e3d88c59953d6c1fb583acfb046213.tar.bz2
samba-e427f58622e3d88c59953d6c1fb583acfb046213.zip
r6973: Merge new version of pidl into the main SAMBA_4_0 branch.
The main difference in this new version is the extra data structure generated between the IDL data structure and the NDR parser: IDL -> NDR -> { ndr_parser, ndr_header, eparser, etc } This makes the ndr_parser.pm internals much more sane. Other changes include: - Remove unnecessary calls with NDR_BUFFERS (for example, GUID doesn't have any buffers, just scalars) as well as some (unnecessary) nested setting of flags. - Parse array loops in the C code rather then calling ndr_pull_array(). This allows us to have, for example, arrays of pointers or arrays of pointers to arrays, etc.. - Use if() {} rather then if () goto foo; everywhere - NDR_IN no longer implies LIBNDR_FLAG_REF_ALLOC - By default, top level pointers are now "ref" (as is the default in most other IDL compilers). This can be overridden using the default_pointer_top() property. - initial work on new ethereal parser generators by Alan DeKok and me - pidl now writes errors in the standard format used by compilers, which is parsable by most editors - ability to warn about the fact that pidl extension(s) have been used, useful for making sure IDL files work with other IDL compilers. oh, and there's probably some other things I can't think of right now.. (This used to be commit 13cf227615f6b9e0e5fa62e59197024410254f01)
Diffstat (limited to 'source4/build/pidl/pidl.pl')
-rwxr-xr-xsource4/build/pidl/pidl.pl62
1 files changed, 45 insertions, 17 deletions
diff --git a/source4/build/pidl/pidl.pl b/source4/build/pidl/pidl.pl
index 2305d9243b..c7b98a0d34 100755
--- a/source4/build/pidl/pidl.pl
+++ b/source4/build/pidl/pidl.pl
@@ -14,9 +14,9 @@ use lib "$RealBin";
use lib "$RealBin/lib";
use Getopt::Long;
use File::Basename;
+use idl;
use dump;
use ndr_client;
-use idl;
use ndr_header;
use ndr_parser;
use server;
@@ -24,12 +24,14 @@ use dcom_proxy;
use dcom_stub;
use com_header;
use odl;
-use eparser;
+use eth_parser;
+use eth_header;
use validator;
use typelist;
use util;
use template;
use swig;
+use compat;
my($opt_help) = 0;
my($opt_parse) = 0;
@@ -40,7 +42,8 @@ my($opt_template) = 0;
my($opt_client) = 0;
my($opt_server) = 0;
my($opt_parser);
-my($opt_eparser) = 0;
+my($opt_eth_parser);
+my($opt_eth_header);
my($opt_keep) = 0;
my($opt_swig) = 0;
my($opt_dcom_proxy) = 0;
@@ -48,6 +51,7 @@ my($opt_com_header) = 0;
my($opt_odl) = 0;
my($opt_quiet) = 0;
my($opt_output);
+my($opt_warn_compat) = 0;
my $idl_parser = new idl;
@@ -71,13 +75,15 @@ sub ShowHelp()
--client create a C NDR client
--server create server boilerplate
--template print a template for a pipe
- --eparser create an ethereal parser
+ --eth-parser create an ethereal parser
+ --eth-header create an ethereal header file
--swig create swig wrapper file
--diff run diff on the idl and dumped output
--keep keep the .pidl file
--odl accept ODL input
--dcom-proxy create DCOM proxy (implies --odl)
--com-header create header for COM interfaces (implies --odl)
+ --warn-compat warn about incompatibility with other compilers
--quiet be quiet
\n";
exit(0);
@@ -94,14 +100,16 @@ GetOptions (
'template' => \$opt_template,
'parser:s' => \$opt_parser,
'client' => \$opt_client,
- 'eparser' => \$opt_eparser,
+ 'eth-parser:s' => \$opt_eth_parser,
+ 'eth-header:s' => \$opt_eth_header,
'diff' => \$opt_diff,
'odl' => \$opt_odl,
'keep' => \$opt_keep,
'swig' => \$opt_swig,
'dcom-proxy' => \$opt_dcom_proxy,
'com-header' => \$opt_com_header,
- 'quiet' => \$opt_quiet
+ 'quiet' => \$opt_quiet,
+ 'warn-compat' => \$opt_warn_compat
);
if ($opt_help) {
@@ -114,6 +122,7 @@ sub process_file($)
my $idl_file = shift;
my $output;
my $pidl;
+ my $ndr;
my $basename = basename($idl_file, ".idl");
@@ -175,21 +184,25 @@ sub process_file($)
$opt_odl = 1;
}
+ if ($opt_warn_compat) {
+ IDLCompat::Check($pidl);
+ }
+
if ($opt_odl) {
$pidl = ODL::ODL2IDL($pidl);
}
+ if (defined($opt_header) or defined($opt_eth_parser) or defined($opt_eth_header) or $opt_client or $opt_server or defined($opt_parser)) {
+ $ndr = Ndr::Parse($pidl);
+# print util::MyDumper($ndr);
+ }
+
if (defined($opt_header)) {
my $header = $opt_header;
if ($header eq "") {
$header = util::ChangeExtension($output, ".h");
}
-
- util::FileSave($header, NdrHeader::Parse($pidl));
- if ($opt_eparser) {
- my($eparserhdr) = dirname($output) . "/packet-dcerpc-$basename.h";
- IdlEParser::RewriteHeader($pidl, $header, $eparserhdr);
- }
+ util::FileSave($header, NdrHeader::Parse($ndr));
if ($opt_swig) {
my($filename) = $output;
$filename =~ s/\/ndr_/\//;
@@ -198,6 +211,15 @@ sub process_file($)
}
}
+ if (defined($opt_eth_header)) {
+ my($eparserhdr) = $opt_eth_header;
+ if ($eparserhdr eq "") {
+ $eparserhdr = dirname($output) . "/packet-dcerpc-$basename.h";
+ }
+
+ util::FileSave($eparserhdr, EthHeader::Parse($ndr));
+ }
+
if ($opt_client) {
my ($client) = util::ChangeExtension($output, "_c.c");
my $res = "";
@@ -250,13 +272,19 @@ $dcom
if ($parser eq "") {
$parser = util::ChangeExtension($output, ".c");
}
- util::FileSave($parser, NdrParser::Parse($pidl, $parser));
- if($opt_eparser) {
- my($eparser) = dirname($output) . "/packet-dcerpc-$basename.c";
- IdlEParser::RewriteC($pidl, $parser, $eparser);
- }
+
+ util::FileSave($parser, NdrParser::Parse($ndr, $parser));
}
+ if (defined($opt_eth_parser)) {
+ my($eparser) = $opt_eth_parser;
+ if ($eparser eq "") {
+ $eparser = dirname($output) . "/packet-dcerpc-$basename.c";
+ }
+ util::FileSave($eparser, EthParser::Parse($ndr, $basename, $eparser));
+ }
+
+
if ($opt_template) {
print IdlTemplate::Parse($pidl);
}