From 1deb402445c07dae69c4637a1a4b191f10b0bee1 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 28 May 2005 23:38:52 +0000 Subject: [PATCH] r7059: Use namespaces for pidl and the build system, so we can later on call out to the build system to compile the various pidl tests (without having to rely on shared library support). Initial work on an ndr_array test. (This used to be commit 2b08c4b92b4f56180c123a502bdcc6c40188c07f) --- source4/build/pidl/com_header.pm | 2 +- source4/build/pidl/dcom_proxy.pm | 2 +- source4/build/pidl/eth_header.pm | 1 - source4/build/pidl/eth_parser.pm | 4 +- source4/build/pidl/idl.pm | 2 +- source4/build/pidl/idl.yp | 2 +- source4/build/pidl/ndr.pm | 2 +- source4/build/pidl/ndr_header.pm | 2 +- source4/build/pidl/ndr_parser.pm | 4 +- source4/build/pidl/pidl.pl | 92 +++++++++++++------------- source4/build/pidl/test.pm | 2 +- source4/build/pidl/tests/ndr_align.pl | 2 +- source4/build/pidl/tests/ndr_alloc.pl | 2 +- source4/build/pidl/tests/ndr_array.pl | 47 +++++++++++++ source4/build/pidl/tests/ndr_refptr.pl | 2 +- source4/build/pidl/tests/ndr_simple.pl | 2 +- source4/build/pidl/tests/ndr_string.pl | 2 +- source4/build/smb_build/config_mk.pm | 2 +- source4/build/smb_build/core.m4 | 4 +- source4/build/smb_build/main.pm | 12 ++-- source4/script/tests/test_pidl.sh | 1 + 21 files changed, 118 insertions(+), 73 deletions(-) create mode 100755 source4/build/pidl/tests/ndr_array.pl diff --git a/source4/build/pidl/com_header.pm b/source4/build/pidl/com_header.pm index 1e5f338828e..1e178eed850 100644 --- a/source4/build/pidl/com_header.pm +++ b/source4/build/pidl/com_header.pm @@ -3,7 +3,7 @@ package COMHeader; -use typelist; +use pidl::typelist; use strict; diff --git a/source4/build/pidl/dcom_proxy.pm b/source4/build/pidl/dcom_proxy.pm index 3d460645484..bb45f774ef7 100644 --- a/source4/build/pidl/dcom_proxy.pm +++ b/source4/build/pidl/dcom_proxy.pm @@ -6,7 +6,7 @@ package DCOMProxy; -use com_header; +use pidl::com_header; use strict; diff --git a/source4/build/pidl/eth_header.pm b/source4/build/pidl/eth_header.pm index 2e0397df37a..229b4f80510 100644 --- a/source4/build/pidl/eth_header.pm +++ b/source4/build/pidl/eth_header.pm @@ -7,7 +7,6 @@ package EthHeader; use strict; -use typelist; my($res); my($tab_depth); diff --git a/source4/build/pidl/eth_parser.pm b/source4/build/pidl/eth_parser.pm index d0a4ae7c66f..43ed8b841a2 100644 --- a/source4/build/pidl/eth_parser.pm +++ b/source4/build/pidl/eth_parser.pm @@ -8,8 +8,8 @@ package EthParser; use strict; -use typelist; -use ndr; +use pidl::typelist; +use pidl::ndr; # the list of needed functions diff --git a/source4/build/pidl/idl.pm b/source4/build/pidl/idl.pm index 21c06ab2005..156a3435e60 100644 --- a/source4/build/pidl/idl.pm +++ b/source4/build/pidl/idl.pm @@ -2390,7 +2390,7 @@ sub #line 305 "build/pidl/idl.yp" -use util; +use pidl::util; sub _Error { if (exists $_[0]->YYData->{ERRMSG}) { diff --git a/source4/build/pidl/idl.yp b/source4/build/pidl/idl.yp index 2b839b0e21a..e2832376276 100644 --- a/source4/build/pidl/idl.yp +++ b/source4/build/pidl/idl.yp @@ -304,7 +304,7 @@ optional_semicolon: # start code %% -use util; +use pidl::util; sub _Error { if (exists $_[0]->YYData->{ERRMSG}) { diff --git a/source4/build/pidl/ndr.pm b/source4/build/pidl/ndr.pm index a7c10d4906b..98e3d2b4bc6 100644 --- a/source4/build/pidl/ndr.pm +++ b/source4/build/pidl/ndr.pm @@ -8,7 +8,7 @@ package Ndr; use strict; -use typelist; +use pidl::typelist; ##################################################################### # return a table describing the order in which the parts of an element diff --git a/source4/build/pidl/ndr_header.pm b/source4/build/pidl/ndr_header.pm index 05265bbf5bd..576361260f1 100644 --- a/source4/build/pidl/ndr_header.pm +++ b/source4/build/pidl/ndr_header.pm @@ -7,7 +7,7 @@ package NdrHeader; use strict; -use typelist; +use pidl::typelist; my($res); my($tab_depth); diff --git a/source4/build/pidl/ndr_parser.pm b/source4/build/pidl/ndr_parser.pm index f94de5e2be3..be663269f86 100644 --- a/source4/build/pidl/ndr_parser.pm +++ b/source4/build/pidl/ndr_parser.pm @@ -8,8 +8,8 @@ package NdrParser; use strict; -use typelist; -use ndr; +use pidl::typelist; +use pidl::ndr; # list of known types my %typefamily; diff --git a/source4/build/pidl/pidl.pl b/source4/build/pidl/pidl.pl index c7b98a0d34e..478c7a273a9 100755 --- a/source4/build/pidl/pidl.pl +++ b/source4/build/pidl/pidl.pl @@ -10,28 +10,27 @@ use strict; use FindBin qw($RealBin); -use lib "$RealBin"; -use lib "$RealBin/lib"; +use lib "$RealBin/.."; use Getopt::Long; use File::Basename; -use idl; -use dump; -use ndr_client; -use ndr_header; -use ndr_parser; -use server; -use dcom_proxy; -use dcom_stub; -use com_header; -use odl; -use eth_parser; -use eth_header; -use validator; -use typelist; -use util; -use template; -use swig; -use compat; +use pidl::idl; +use pidl::dump; +use pidl::ndr_client; +use pidl::ndr_header; +use pidl::ndr_parser; +use pidl::server; +use pidl::dcom_proxy; +use pidl::dcom_stub; +use pidl::com_header; +use pidl::odl; +use pidl::eth_parser; +use pidl::eth_header; +use pidl::validator; +use pidl::typelist; +use pidl::util; +use pidl::template; +use pidl::swig; +use pidl::compat; my($opt_help) = 0; my($opt_parse) = 0; @@ -59,33 +58,32 @@ my $idl_parser = new idl; # display help text sub ShowHelp() { - print " - perl IDL parser and code generator - Copyright (C) tridge\@samba.org - - Usage: pidl.pl [options] - - Options: - --help this help page - --output=OUTNAME put output in OUTNAME.* - --parse parse a idl file to a .pidl file - --dump dump a pidl file back to idl - --header[=OUTFILE] create a C NDR header file - --parser[=OUTFILE] create a C NDR parser - --client create a C NDR client - --server create server boilerplate - --template print a template for a pipe - --eth-parser create an ethereal parser - --eth-header create an ethereal header file - --swig create swig wrapper file - --diff run diff on the idl and dumped output - --keep keep the .pidl file - --odl accept ODL input - --dcom-proxy create DCOM proxy (implies --odl) - --com-header create header for COM interfaces (implies --odl) - --warn-compat warn about incompatibility with other compilers - --quiet be quiet - \n"; +print "perl IDL parser and code generator +Copyright (C) tridge\@samba.org + +Usage: pidl.pl [options] + +Options: + --help this help page + --output=OUTNAME put output in OUTNAME.* + --parse parse a idl file to a .pidl file + --dump dump a pidl file back to idl + --header[=OUTFILE] create a C NDR header file + --parser[=OUTFILE] create a C NDR parser + --client create a C NDR client + --server create server boilerplate + --template print a template for a pipe + --eth-parser create an ethereal parser + --eth-header create an ethereal header file + --swig create swig wrapper file + --diff run diff on the idl and dumped output + --keep keep the .pidl file + --odl accept ODL input + --dcom-proxy create DCOM proxy (implies --odl) + --com-header create header for COM interfaces (implies --odl) + --warn-compat warn about incompatibility with other compilers + --quiet be quiet +\n"; exit(0); } diff --git a/source4/build/pidl/test.pm b/source4/build/pidl/test.pm index 5f25d4195c1..ba102aab128 100644 --- a/source4/build/pidl/test.pm +++ b/source4/build/pidl/test.pm @@ -5,7 +5,7 @@ package Test; use strict; -use util; +use pidl::util; use Getopt::Long; my $cc = $ENV{CC}; diff --git a/source4/build/pidl/tests/ndr_align.pl b/source4/build/pidl/tests/ndr_align.pl index 03b09e87588..1796c045f56 100755 --- a/source4/build/pidl/tests/ndr_align.pl +++ b/source4/build/pidl/tests/ndr_align.pl @@ -4,7 +4,7 @@ use strict; use FindBin qw($RealBin); -use lib "$RealBin/.."; +use lib "$RealBin/../.."; use test; my %settings = Test::GetSettings(@ARGV); diff --git a/source4/build/pidl/tests/ndr_alloc.pl b/source4/build/pidl/tests/ndr_alloc.pl index 7918f312d49..d3827599306 100755 --- a/source4/build/pidl/tests/ndr_alloc.pl +++ b/source4/build/pidl/tests/ndr_alloc.pl @@ -4,7 +4,7 @@ use strict; use FindBin qw($RealBin); -use lib "$RealBin/.."; +use lib "$RealBin/../.."; use test; my %settings = Test::GetSettings(@ARGV); diff --git a/source4/build/pidl/tests/ndr_array.pl b/source4/build/pidl/tests/ndr_array.pl new file mode 100755 index 00000000000..bd78f3432a9 --- /dev/null +++ b/source4/build/pidl/tests/ndr_array.pl @@ -0,0 +1,47 @@ +#!/usr/bin/perl +# Array testing +# (C) 2005 Jelmer Vernooij +# Published under the GNU General Public License +use strict; + +use FindBin qw($RealBin); +use lib "$RealBin/../.."; +use test; + +my %settings = Test::GetSettings(@ARGV); +$settings{'IDL-Arguments'} = ['--quiet', '--parse', '--parser=ndr_test.c', '--header=ndr_test.h']; +$settings{'IncludeFiles'} = ['ndr_test.h']; +$settings{'ExtraFiles'} = ['ndr_test.c']; + +Test::test_idl( + # Name + 'Fixed-Array', + + # Settings + \%settings, + + # IDL + '[public] void Test([in] uint8 x[10]);', + + # C Test + ' + uint8_t data[] = {1,2,3,4,5,6,7,8,9,10}; + int i; + DATA_BLOB b; + struct ndr_pull *ndr; + struct Test r; + + b.data = data; + b.length = 10; + ndr = ndr_pull_init_blob(&b, mem_ctx); + + if (NT_STATUS_IS_ERR(ndr_pull_Test(ndr, NDR_IN, &r))) + return 1; + + if (ndr->offset != 10) + return 2; + + for (i = 0; i < 10; i++) { + if (r.in.x[i] != i+1) return 3; + } +'); diff --git a/source4/build/pidl/tests/ndr_refptr.pl b/source4/build/pidl/tests/ndr_refptr.pl index 59ebd295f69..d42a34d1b0e 100755 --- a/source4/build/pidl/tests/ndr_refptr.pl +++ b/source4/build/pidl/tests/ndr_refptr.pl @@ -6,7 +6,7 @@ use strict; use FindBin qw($RealBin); -use lib "$RealBin/.."; +use lib "$RealBin/../.."; use test; my %settings = Test::GetSettings(@ARGV); diff --git a/source4/build/pidl/tests/ndr_simple.pl b/source4/build/pidl/tests/ndr_simple.pl index 7049dfa68d6..de2f34383ed 100755 --- a/source4/build/pidl/tests/ndr_simple.pl +++ b/source4/build/pidl/tests/ndr_simple.pl @@ -5,7 +5,7 @@ use strict; use FindBin qw($RealBin); -use lib "$RealBin/.."; +use lib "$RealBin/../.."; use test; my %settings = Test::GetSettings(@ARGV); diff --git a/source4/build/pidl/tests/ndr_string.pl b/source4/build/pidl/tests/ndr_string.pl index 9ea4ca42b64..1c75eb90ccd 100755 --- a/source4/build/pidl/tests/ndr_string.pl +++ b/source4/build/pidl/tests/ndr_string.pl @@ -5,7 +5,7 @@ use strict; use FindBin qw($RealBin); -use lib "$RealBin/.."; +use lib "$RealBin/../.."; use test; my %settings = Test::GetSettings(@ARGV); diff --git a/source4/build/smb_build/config_mk.pm b/source4/build/smb_build/config_mk.pm index 36ce80a8ebb..f6e2e4bdcde 100644 --- a/source4/build/smb_build/config_mk.pm +++ b/source4/build/smb_build/config_mk.pm @@ -7,7 +7,7 @@ ########################################################### package config_mk; -use input; +use smb_build::input; use strict; diff --git a/source4/build/smb_build/core.m4 b/source4/build/smb_build/core.m4 index 1ef6eea3adf..215ca5195e7 100644 --- a/source4/build/smb_build/core.m4 +++ b/source4/build/smb_build/core.m4 @@ -19,12 +19,12 @@ dnl ) AC_DEFUN([_SMB_BUILD_CORE], [ -$PERL -I$srcdir/build/smb_build <<\_SMB_ACEOF +$PERL -I$srcdir/build <<\_SMB_ACEOF use strict; my %INPUT; -use main; +use smb_build::main; ########################################################### ### First we list all info from configure ### diff --git a/source4/build/smb_build/main.pm b/source4/build/smb_build/main.pm index 620812a457d..dd0487110aa 100644 --- a/source4/build/smb_build/main.pm +++ b/source4/build/smb_build/main.pm @@ -6,12 +6,12 @@ ### Released under the GNU GPL ### ########################################################### -use makefile; -use smb_build_h; -use input; -use config_mk; -use output; -use dot; +use smb_build::makefile; +use smb_build::smb_build_h; +use smb_build::input; +use smb_build::config_mk; +use smb_build::output; +use smb_build::dot; use strict; sub smb_build_main($) diff --git a/source4/script/tests/test_pidl.sh b/source4/script/tests/test_pidl.sh index 07c144a65fe..0fd2eb89985 100755 --- a/source4/script/tests/test_pidl.sh +++ b/source4/script/tests/test_pidl.sh @@ -4,3 +4,4 @@ ./build/pidl/tests/ndr_alloc.pl ./build/pidl/tests/ndr_refptr.pl ./build/pidl/tests/ndr_string.pl +./build/pidl/tests/ndr_array.pl -- 2.34.1