diff options
-rw-r--r-- | source4/lib/registry/config.mk | 2 | ||||
-rwxr-xr-x | source4/pidl/pidl | 41 | ||||
-rw-r--r-- | source4/pidl/pidl.1.xml | 30 | ||||
-rwxr-xr-x | source4/script/build_idl.sh | 2 |
4 files changed, 40 insertions, 35 deletions
diff --git a/source4/lib/registry/config.mk b/source4/lib/registry/config.mk index b68046ca69..4cf73bf66a 100644 --- a/source4/lib/registry/config.mk +++ b/source4/lib/registry/config.mk @@ -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 diff --git a/source4/pidl/pidl b/source4/pidl/pidl index 89c6194257..3d33ca88b5 100755 --- a/source4/pidl/pidl +++ b/source4/pidl/pidl @@ -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); } diff --git a/source4/pidl/pidl.1.xml b/source4/pidl/pidl.1.xml index a379dced1f..6dd0d47530 100644 --- a/source4/pidl/pidl.1.xml +++ b/source4/pidl/pidl.1.xml @@ -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> @@ -93,16 +93,17 @@ </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> @@ -162,17 +163,18 @@ <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> diff --git a/source4/script/build_idl.sh b/source4/script/build_idl.sh index a9bc752857..668d5df975 100755 --- a/source4/script/build_idl.sh +++ b/source4/script/build_idl.sh @@ -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 |