summaryrefslogtreecommitdiff
path: root/source4/pidl
diff options
context:
space:
mode:
Diffstat (limited to 'source4/pidl')
-rw-r--r--source4/pidl/lib/Parse/Pidl.pm2
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm6
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4.pm1
-rwxr-xr-xsource4/pidl/pidl25
-rw-r--r--source4/pidl/tests/samba3-srv.pl18
5 files changed, 48 insertions, 4 deletions
diff --git a/source4/pidl/lib/Parse/Pidl.pm b/source4/pidl/lib/Parse/Pidl.pm
index 0c6e0e5727..c2c9463d03 100644
--- a/source4/pidl/lib/Parse/Pidl.pm
+++ b/source4/pidl/lib/Parse/Pidl.pm
@@ -9,7 +9,7 @@ package Parse::Pidl;
require Exporter;
@ISA = qw(Exporter);
-@EXPORT_OK = qw(warning error fatal);
+@EXPORT_OK = qw(warning error fatal $VERSION);
use strict;
diff --git a/source4/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm b/source4/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm
index 47312bc83d..ca9e7d15db 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm
@@ -6,13 +6,17 @@
package Parse::Pidl::Samba3::ServerNDR;
+use Exporter;
+@ISA = qw(Exporter);
+@EXPORT_OK = qw(DeclLevel);
+
use strict;
use Parse::Pidl qw(warning fatal);
use Parse::Pidl::Typelist qw(mapTypeName scalar_is_reference);
use Parse::Pidl::Util qw(ParseExpr has_property is_constant);
use Parse::Pidl::NDR qw(GetNextLevel);
use Parse::Pidl::Samba4 qw(ElementStars DeclLong);
-use Parse::Pidl::Samba4::NDR::Parser qw(GenerateFunctionOutEnv);
+use Parse::Pidl::Samba4::Header qw(GenerateFunctionOutEnv);
use vars qw($VERSION);
$VERSION = '0.01';
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4.pm b/source4/pidl/lib/Parse/Pidl/Samba4.pm
index 5848543a60..d42e01cdb0 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4.pm
@@ -12,6 +12,7 @@ require Exporter;
use Parse::Pidl::Util qw(has_property is_constant);
use Parse::Pidl::NDR qw(GetNextLevel);
use Parse::Pidl::Typelist qw(mapTypeName scalar_is_reference);
+use Parse::Pidl qw(fatal);
use strict;
use vars qw($VERSION);
diff --git a/source4/pidl/pidl b/source4/pidl/pidl
index 4dfd57dc20..220d62cd71 100755
--- a/source4/pidl/pidl
+++ b/source4/pidl/pidl
@@ -52,6 +52,10 @@ both marshalling/unmarshalling and debugging purposes).
=item I<--help>
Show list of available options.
+
+=item I<--version>
+
+Show pidl version
=item I<--outputdir OUTNAME>
@@ -403,7 +407,7 @@ use lib "$RealBin";
use lib "$RealBin/lib";
use Getopt::Long;
use File::Basename;
-use Parse::Pidl;
+use Parse::Pidl qw ( $VERSION );
use Parse::Pidl::Util;
#####################################################################
@@ -453,6 +457,7 @@ sub FileSave($$)
my(@opt_incdirs) = ();
my($opt_help) = 0;
+my($opt_version) = 0;
my($opt_parse_idl_tree) = 0;
my($opt_dump_idl_tree);
my($opt_dump_ndr_tree);
@@ -483,7 +488,9 @@ my($opt_warn_compat) = 0;
# display help text
sub ShowHelp()
{
-print "perl IDL parser and code generator
+print "perl IDL parser and code generator\n";
+ShowVersion();
+print"
Copyright (C) Andrew Tridgell <tridge\@samba.org>
Copyright (C) Jelmer Vernooij <jelmer\@samba.org>
@@ -491,6 +498,7 @@ Usage: $Script [options] [--] <idlfile> [<idlfile>...]
Generic Options:
--help this help page
+ --version show pidl version
--outputdir=OUTDIR put output in OUTDIR/ [.]
--warn-compat warn about incompatibility with other compilers
--quiet be quiet
@@ -528,9 +536,17 @@ Wireshark parsers:
exit(0);
}
+#########################################
+# Display version
+sub ShowVersion()
+{
+ print "perl IDL version $VERSION\n";
+}
+
# main program
my $result = GetOptions (
'help|h|?' => \$opt_help,
+ 'version' => \$opt_version,
'outputdir=s' => \$opt_outputdir,
'dump-idl' => \$opt_dump_idl,
'dump-idl-tree:s' => \$opt_dump_idl_tree,
@@ -565,6 +581,11 @@ if ($opt_help) {
exit(0);
}
+if ($opt_version) {
+ ShowVersion();
+ exit(0);
+}
+
sub process_file($)
{
my $idl_file = shift;
diff --git a/source4/pidl/tests/samba3-srv.pl b/source4/pidl/tests/samba3-srv.pl
new file mode 100644
index 0000000000..d1e2bc9545
--- /dev/null
+++ b/source4/pidl/tests/samba3-srv.pl
@@ -0,0 +1,18 @@
+#!/usr/bin/perl
+# (C) 2008 Jelmer Vernooij <jelmer@samba.org>
+# Published under the GNU General Public License
+use strict;
+use warnings;
+
+use Test::More tests => 1;
+use FindBin qw($RealBin);
+use lib "$RealBin";
+use Util;
+use Parse::Pidl::Util qw(MyDumper has_property);
+use Parse::Pidl::Samba3::ServerNDR qw(DeclLevel);
+
+my $l = { TYPE => "DATA", DATA_TYPE => "uint32" };
+my $e = { FILE => "foo", LINE => 0, PROPERTIES => { }, TYPE => "uint32",
+ LEVELS => [ $l ] };
+
+is("uint32_t", DeclLevel($e, 0));