r10111: Make pidl by default assume the input file is an IDL file rather
authorJelmer Vernooij <jelmer@samba.org>
Fri, 9 Sep 2005 10:59:54 +0000 (10:59 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:38:00 +0000 (13:38 -0500)
then a .pidl file.

source/lib/registry/config.mk
source/pidl/pidl
source/pidl/pidl.1.xml
source/script/build_idl.sh

index b68046ca69ff575c8ff31533556e499fc7259626..4cf73bf66a542588c63aaa0b488e8e37ec5bfcbf 100644 (file)
@@ -18,7 +18,7 @@ INIT_OBJ_FILES = lib/registry/tdr_regf.o
 
 lib/registry/reg_backend_nt4.c: lib/registry/tdr_regf.c
 lib/registry/tdr_regf.c: lib/registry/regf.idl
-       @CPP="$(CPP)" $(PERL) pidl/pidl --header --outputdir=lib/registry --parse --tdr-header --tdr-parser -- lib/registry/regf.idl
+       @CPP="$(CPP)" $(PERL) pidl/pidl --header --outputdir=lib/registry --tdr-header --tdr-parser -- lib/registry/regf.idl
 
 ################################################
 # Start MODULE registry_w95
index 89c6194257c8a659d4115aecf6a0a68d00d78f65..3d33ca88b54f0d554a7c7fb3a61d93791b7dc6d4 100755 (executable)
@@ -62,8 +62,9 @@ sub FileSave($$)
 }
 
 my($opt_help) = 0;
-my($opt_parse) = 0;
-my($opt_dump) = 0;
+my($opt_parse_tree) = 0;
+my($opt_dump_tree);
+my($opt_dump_idl) = 0;
 my($opt_uint_enums) = 0;
 my($opt_diff) = 0;
 my($opt_header);
@@ -75,7 +76,6 @@ my($opt_ndr_parser);
 my($opt_tdr_header);
 my($opt_tdr_parser);
 my($opt_eth_parser);
-my($opt_keep);
 my($opt_swig);
 my($opt_dcom_proxy);
 my($opt_com_header);
@@ -98,15 +98,17 @@ Usage: pidl [options] [--] <idlfile> [<idlfile>...]
 Generic Options:
  --help                  this help page
  --outputdir=OUTDIR      put output in OUTDIR/ [.]
- --parse                 parse a idl file to a .pidl file
- --dump                  dump a pidl file back to idl
- --diff                  run diff on the idl and dumped output
- --keep[=OUTFILE]        keep the .pidl file [BASENAME.pidl]
  --odl                   accept ODL input
  --warn-compat           warn about incompatibility with other compilers
  --quiet                 be quiet
  --verbose               be verbose
 
+Debugging:
+ --dump-tree[=OUTFILE]   dump internal representation to file [BASENAME.pidl]
+ --parse-tree            read internal representation instead of IDL
+ --dump-idl              regenerate IDL file
+ --diff                  run diff on original IDL and dumped output
+
 Samba 4 output:
  --header[=OUTFILE]      create generic header file [BASENAME.h]
  --uint-enums            don't use C enums, instead use uint* types
@@ -132,8 +134,9 @@ Ethereal parsers:
 GetOptions (
            'help|h|?' => \$opt_help, 
            'outputdir=s' => \$opt_outputdir,
-           'parse' => \$opt_parse,
-           'dump' => \$opt_dump,
+           'dump-idl' => \$opt_dump_idl,
+               'dump-tree:s' => \$opt_dump_tree,
+               'parse-tree' => \$opt_parse_tree,
            'uint-enums' => \$opt_uint_enums,
            'ndr-header:s' => \$opt_ndr_header,
                'header:s' => \$opt_header,
@@ -147,7 +150,6 @@ GetOptions (
            'ejs' => \$opt_ejs,
            'diff' => \$opt_diff,
            'odl' => \$opt_odl,
-           'keep:s' => \$opt_keep,
            'swig:s' => \$opt_swig,
            'dcom-proxy:s' => \$opt_dcom_proxy,
            'com-header:s' => \$opt_com_header,
@@ -170,11 +172,14 @@ sub process_file($)
 
        my $basename = basename($idl_file, ".idl");
 
-       my($pidl_file) = ($opt_keep or "$outputdir/$basename.pidl");
+       my($pidl_file) = ($opt_dump_tree or "$outputdir/$basename.pidl");
 
        unless ($opt_quiet) { print "Compiling $idl_file\n"; }
 
-       if ($opt_parse) {
+       if ($opt_parse_tree) {
+               $pidl = LoadStructure($pidl_file);
+               defined $pidl || die "Failed to load $pidl_file";
+       } else {
                require Parse::Pidl::IDL;
                my $idl_parser = new Parse::Pidl::IDL;
 
@@ -182,19 +187,17 @@ sub process_file($)
                defined @$pidl || die "Failed to parse $idl_file";
                require Parse::Pidl::Typelist;
                Parse::Pidl::Typelist::LoadIdl($pidl);
-               if (defined($opt_keep) && !SaveStructure($pidl_file, $pidl)) {
-                           die "Failed to save $pidl_file\n";
-               }
-       } else {
-               $pidl = LoadStructure($pidl_file);
-               defined $pidl || die "Failed to load $pidl_file - maybe you need --parse\n";
+       }
+       
+       if (defined($opt_dump_tree) && !SaveStructure($pidl_file, $pidl)) {
+                   die "Failed to save $pidl_file\n";
        }
 
        if ($opt_uint_enums) {
                Parse::Pidl::Util::setUseUintEnums(1);
        }
 
-       if ($opt_dump) {
+       if ($opt_dump_idl) {
                require Parse::Pidl::Dump;
                print Parse::Pidl::Dump($pidl);
        }
index a379dced1f25d9584e1581161ce18dc18c2394bd..6dd0d475306867c32f9813c1b905cd31cf98f4f3 100644 (file)
@@ -17,8 +17,8 @@
                <command>pidl</command>
                <arg choice="opt">--help</arg>
                <arg choice="opt">--outputdir OUTNAME</arg>
-               <arg choice="opt">--parse</arg>
-               <arg choice="opt">--dump</arg>
+               <arg choice="opt">--parse-tree</arg>
+               <arg choice="opt">--dump-tree</arg>
                <arg choice="opt">--ndr-header[=OUTPUT]</arg>
                <arg choice="opt">--header[=OUTPUT]</arg>
                <arg choice="opt">--ejs[=OUTPUT]</arg>
@@ -36,7 +36,7 @@
                <arg choice="opt">--template</arg>
                <arg choice="opt">--eth-parser[=OUTPUT]</arg>
                <arg choice="opt">--diff</arg>
-               <arg choice="opt">--keep</arg>
+               <arg choice="opt">--dump-idl</arg>
                <arg choice="req">idlfile</arg>
                <arg choice="opt">idlfile2</arg>
                <arg choice="opt">...</arg>
                </varlistentry>
                
                <varlistentry>
-               <term>--parse</term>
+               <term>--parse-tree</term>
                <listitem><para>
-                               Tell pidl the files specified are (midl-style) IDL files.</para></listitem>
+                               Read internal tree structure from input files rather 
+               then assuming they contain IDL.</para></listitem>
                </varlistentry>
 
 
                <varlistentry>
-               <term>--dump</term>
+               <term>--dump-idl</term>
                <listitem><para>
-                               Convert .pidl files to (midl-style) IDL files. FIle will be named OUTNAME.idl.</para></listitem>
+                               Generate a new IDL file. File will be named OUTNAME.idl.</para></listitem>
                </varlistentry>
 
 
                <varlistentry>
                <term>--diff</term>
                <listitem><para>
-               Convert an IDL file to a pidl file and then back to a 
-               IDL file and see if there are any differences with the 
+                               Parse an IDL file,  generate a new IDL file based 
+                               on the internal data structures and see if there are 
+                               any differences with the 
                original IDL file. Useful for debugging pidl.</para></listitem>
                </varlistentry>
 
 
                <varlistentry>
-               <term>--keep</term>
+               <term>--dump-tree</term>
                <listitem><para>
-               Tell pidl to keep the pidl files (used as intermediate files 
-               between the IDL files and the parser/server/etc code). Useful 
+               Tell pidl to dump the internal tree representation of an IDL 
+               file the to disk. Useful 
                for debugging pidl.</para></listitem>
                </varlistentry>
        </variablelist>
@@ -562,10 +564,10 @@ The following commands are currently supported:
 
        <programlisting>
        # Generating an ethereal parser
-       $ ./pidl --eth-parser --parse -- atsvc.idl
+       $ ./pidl --eth-parser -- atsvc.idl
        
        # Generating a TDR parser
-       $ ./pidl --tdr-parser --tdr-header --header --parse -- regf.idl
+       $ ./pidl --tdr-parser --tdr-header --header -- regf.idl
        </programlisting>
 
 </refsect1>
index a9bc752857e981f39b532a4773857168c2d5374c..668d5df975851342db98d5a5619c87dd7ce1b424 100755 (executable)
@@ -6,7 +6,7 @@ PIDL_EXTRA_ARGS="$*"
 
 [ -d librpc/gen_ndr ] || mkdir -p librpc/gen_ndr || exit 1
 
-PIDL="$PERL ./pidl/pidl --outputdir librpc/gen_ndr --parse --ndr-header --header --ndr-parser --server --client --dcom-proxy --com-header --swig --odl --ejs $PIDL_EXTRA_ARGS"
+PIDL="$PERL ./pidl/pidl --outputdir librpc/gen_ndr --ndr-header --header --ndr-parser --server --client --dcom-proxy --com-header --swig --odl --ejs $PIDL_EXTRA_ARGS"
 
 if [ x$FULLBUILD = xFULL ]; then
       echo Rebuilding all idl files in librpc/idl