From 8b5a9537250e2d55a782c40f51fbedafa3d6bee7 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 9 Sep 2005 10:59:54 +0000 Subject: r10111: Make pidl by default assume the input file is an IDL file rather then a .pidl file. (This used to be commit d8a31d3048a6421a3d49d3c121bc86d748838b3a) --- source4/lib/registry/config.mk | 2 +- source4/pidl/pidl | 41 ++++++++++++++++++++++------------------- source4/pidl/pidl.1.xml | 30 ++++++++++++++++-------------- 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] [--] [...] 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 @@ pidl --help --outputdir OUTNAME - --parse - --dump + --parse-tree + --dump-tree --ndr-header[=OUTPUT] --header[=OUTPUT] --ejs[=OUTPUT] @@ -36,7 +36,7 @@ --template --eth-parser[=OUTPUT] --diff - --keep + --dump-idl idlfile idlfile2 ... @@ -93,16 +93,17 @@ - --parse + --parse-tree - Tell pidl the files specified are (midl-style) IDL files. + Read internal tree structure from input files rather + then assuming they contain IDL. - --dump + --dump-idl - Convert .pidl files to (midl-style) IDL files. FIle will be named OUTNAME.idl. + Generate a new IDL file. File will be named OUTNAME.idl. @@ -162,17 +163,18 @@ --diff - 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. - --keep + --dump-tree - 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. @@ -562,10 +564,10 @@ The following commands are currently supported: # 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 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 -- cgit