summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-01-12 22:15:12 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-01-12 22:15:12 +0100
commit97ad5d5d80d0967c3ca7dbcd424883d3ad613138 (patch)
treefb0b3a74d4bdf9e2798a29c9c97f39aae8ca74c8
parentc9e39b1d908e88fb6c6f3ff245827050a60ba851 (diff)
downloadsamba-97ad5d5d80d0967c3ca7dbcd424883d3ad613138.tar.gz
samba-97ad5d5d80d0967c3ca7dbcd424883d3ad613138.tar.bz2
samba-97ad5d5d80d0967c3ca7dbcd424883d3ad613138.zip
pidl: Add ability to write type metadata to a file.
(This used to be commit e8ab241ff47f2c3e6f80f9c62373139e4c9f5a1e)
-rw-r--r--source4/pidl/lib/Parse/Pidl/Typelist.pm7
-rwxr-xr-xsource4/pidl/pidl15
2 files changed, 20 insertions, 2 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Typelist.pm b/source4/pidl/lib/Parse/Pidl/Typelist.pm
index 8fb7448070..3721800b97 100644
--- a/source4/pidl/lib/Parse/Pidl/Typelist.pm
+++ b/source4/pidl/lib/Parse/Pidl/Typelist.pm
@@ -238,7 +238,7 @@ sub mapTypeName($)
sub LoadIdl($)
{
- my $idl = shift;
+ my ($idl) = @_;
foreach my $x (@{$idl}) {
next if $x->{TYPE} ne "INTERFACE";
@@ -254,6 +254,11 @@ sub LoadIdl($)
}
}
+sub GenerateTypeLib()
+{
+ return Parse::Pidl::Util::MyDumper(\%types);
+}
+
RegisterScalars();
1;
diff --git a/source4/pidl/pidl b/source4/pidl/pidl
index 4395df2020..500b4dcbfc 100755
--- a/source4/pidl/pidl
+++ b/source4/pidl/pidl
@@ -17,7 +17,7 @@ pidl - An IDL compiler written in Perl
pidl --help
-pidl [--outputdir[=OUTNAME]] [--includedir DIR...] [--parse-idl-tree] [--dump-idl-tree] [--dump-ndr-tree] [--header[=OUTPUT]] [--ejs[=OUTPUT]] [--python[=OUTPUT]] [--swig[=OUTPUT]] [--ndr-parser[=OUTPUT]] [--client] [--server] [--warn-compat] [--quiet] [--verbose] [--template] [--ws-parser[=OUTPUT]] [--diff] [--dump-idl] [--tdr-parser[=OUTPUT]] [--samba3-ndr-client[=OUTPUT]] [--samba3-ndr-server[=OUTPUT]] [<idlfile>.idl]...
+pidl [--outputdir[=OUTNAME]] [--includedir DIR...] [--parse-idl-tree] [--dump-idl-tree] [--dump-ndr-tree] [--header[=OUTPUT]] [--ejs[=OUTPUT]] [--python[=OUTPUT]] [--swig[=OUTPUT]] [--ndr-parser[=OUTPUT]] [--client] [--server] [--warn-compat] [--quiet] [--verbose] [--template] [--ws-parser[=OUTPUT]] [--diff] [--dump-idl] [--tdr-parser[=OUTPUT]] [--samba3-ndr-client[=OUTPUT]] [--samba3-ndr-server[=OUTPUT]] [--typelib=[OUTPUT]] [<idlfile>.idl]...
=head1 DESCRIPTION
@@ -88,6 +88,10 @@ Generate a C file and C header containing TDR parsers. The filename for
the parser defaults to tdr_OUTNAME.c. The header filename will be the
parser filename with the extension changed from .c to .h.
+=item I<--typelib>
+
+Write type information to the specified file.
+
=item I<--server>
Generate boilerplate for the RPC server that implements
@@ -462,6 +466,7 @@ my($opt_samba3_ndr_client);
my($opt_samba3_ndr_server);
my($opt_template) = 0;
my($opt_client);
+my($opt_typelib);
my($opt_server);
my($opt_ndr_parser);
my($opt_tdr_parser);
@@ -498,6 +503,7 @@ Debugging:
--dump-ndr-tree[=FILE] dump internal NDR data tree to file [BASENAME.ndr]
--dump-idl regenerate IDL file
--diff run diff on original IDL and dumped output
+ --typelib print type information
Samba 4 output:
--header[=OUTFILE] create generic header file [BASENAME.h]
@@ -534,6 +540,7 @@ my $result = GetOptions (
'samba3-ndr-server:s' => \$opt_samba3_ndr_server,
'header:s' => \$opt_header,
'server:s' => \$opt_server,
+ 'typelib:s' => \$opt_typelib,
'tdr-parser:s' => \$opt_tdr_parser,
'template' => \$opt_template,
'ndr-parser:s' => \$opt_ndr_parser,
@@ -711,6 +718,12 @@ sub process_file($)
FileSave($tdr_header, $hdr);
}
+ if (defined($opt_typelib)) {
+ my $typelib = ($opt_typelib or "$outputdir/$basename.tlb");
+ require Parse::Pidl::Typelist;
+ FileSave($typelib, Parse::Pidl::Typelist::GenerateTypeLib());
+ }
+
if ($opt_template) {
require Parse::Pidl::Samba4::Template;
print Parse::Pidl::Samba4::Template::Parse($pidl);