aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJörg Mayer <jmayer@loplof.de>2007-02-08 13:54:27 +0000
committerJörg Mayer <jmayer@loplof.de>2007-02-08 13:54:27 +0000
commit5862f39a81facdfe27b1025ef17e268573a90336 (patch)
tree4f4695906f7ef9bb060db3023a570926f2c49df5 /tools
parent49808356a37160ddbcde65f91fc30dca0be666a5 (diff)
Update from samba tree revision 20292 to 21237
============================ Samba log start ============ ------------------------------------------------------------------------ r20298 | jelmer | 2006-12-21 02:51:35 +0100 (Thu, 21 Dec 2006) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/build/smb_build/makefile.pm M /branches/SAMBA_4_0/source/build/smb_build/output.pm M /branches/SAMBA_4_0/source/include/includes.h M /branches/SAMBA_4_0/source/pidl/tests/Util.pm Fix pidl tests (missing symlink..). ------------------------------------------------------------------------ r20299 | jelmer | 2006-12-21 03:48:46 +0100 (Thu, 21 Dec 2006) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/tests/Util.pm M /branches/SAMBA_4_0/source/pidl/tests/ndr_fullptr.pl M /branches/SAMBA_4_0/source/pidl/tests/ndr_string.pl Disable two new tests that are apparently broken. ------------------------------------------------------------------------ r20358 | metze | 2006-12-27 16:36:50 +0100 (Wed, 27 Dec 2006) | 6 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/EJS.pm M /branches/SAMBA_4_0/source/scripting/ejs/ejsrpc.c M /branches/SAMBA_4_0/source/scripting/ejs/ejsrpc.h - fix ejs generated code for ipv4address - (not Parse::Pidl::Typelist::scalar_is_reference($e->{TYPE})) is much more generic than ($e->{TYPE} ne "string") and handles ipv4address and other special types... metze ------------------------------------------------------------------------ r20511 | jelmer | 2007-01-03 16:34:01 +0100 (Wed, 03 Jan 2007) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Compat.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/NDR.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/TDR.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Wireshark/NDR.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl.pm Combine warnings/errors/fatal functions and move them to Parse::Pidl. ------------------------------------------------------------------------ r20543 | jelmer | 2007-01-05 13:56:15 +0100 (Fri, 05 Jan 2007) | 5 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Util.pm A /branches/SAMBA_4_0/source/pidl/tests/util.pl Merge some pidl bug fixes: * C expressions that just started with a constant were erroneously flagged as being a constant. * 1-length variable names in expressions were broken. ------------------------------------------------------------------------ r20545 | jelmer | 2007-01-05 15:25:21 +0100 (Fri, 05 Jan 2007) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Util.pm M /branches/SAMBA_4_0/source/pidl/tests/util.pl Fix is_constant(). ------------------------------------------------------------------------ r20547 | jelmer | 2007-01-05 15:55:26 +0100 (Fri, 05 Jan 2007) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl.pm M /branches/SAMBA_4_0/source/pidl/tests/Util.pm A /branches/SAMBA_4_0/source/pidl/tests/ndr_compat.pl A /branches/SAMBA_4_0/source/pidl/tests/test_util.pl Add tests for expected errors/warnings. ------------------------------------------------------------------------ r20548 | jelmer | 2007-01-05 16:03:21 +0100 (Fri, 05 Jan 2007) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl.pm M /branches/SAMBA_4_0/source/pidl/tests/Util.pm M /branches/SAMBA_4_0/source/pidl/tests/ndr_align.pl M /branches/SAMBA_4_0/source/pidl/tests/ndr_alloc.pl M /branches/SAMBA_4_0/source/pidl/tests/ndr_array.pl M /branches/SAMBA_4_0/source/pidl/tests/ndr_fullptr.pl M /branches/SAMBA_4_0/source/pidl/tests/ndr_refptr.pl M /branches/SAMBA_4_0/source/pidl/tests/ndr_represent.pl M /branches/SAMBA_4_0/source/pidl/tests/ndr_simple.pl M /branches/SAMBA_4_0/source/pidl/tests/ndr_string.pl M /branches/SAMBA_4_0/source/pidl/tests/ndr_tagtype.pl M /branches/SAMBA_4_0/source/pidl/tests/test_util.pl Remove unnecessary "use lib", fix warnings. ------------------------------------------------------------------------ r20550 | jelmer | 2007-01-05 16:20:23 +0100 (Fri, 05 Jan 2007) | 3 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/idl.yp M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/IDL.pm M /branches/SAMBA_4_0/source/pidl/tests/parse_idl.pl Use standard error mechanism in parser. Make sure errors are reported correctly. ------------------------------------------------------------------------ r20556 | jelmer | 2007-01-05 18:18:22 +0100 (Fri, 05 Jan 2007) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/tests/util.pl Add more tests to make sure nothing breaks when I replace the ParseExpr code. ------------------------------------------------------------------------ r20561 | jelmer | 2007-01-05 21:12:21 +0100 (Fri, 05 Jan 2007) | 2 lines Changed paths: A /branches/SAMBA_4_0/source/pidl/expr.yp A /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Expr.pm Add parser for subexpressions used in IDL attributes. ------------------------------------------------------------------------ r20562 | jelmer | 2007-01-05 21:13:48 +0100 (Fri, 05 Jan 2007) | 3 lines Changed paths: M /branches/SAMBA_4_0/source/main.mk M /branches/SAMBA_4_0/source/pidl/Makefile.PL A /branches/SAMBA_4_0/source/pidl/lib/Parse/Yapp A /branches/SAMBA_4_0/source/pidl/lib/Parse/Yapp/Driver.pm Start building expr parser. Add separate copy of Yapp::Driver rather than including it in each individual parser. ------------------------------------------------------------------------ r20563 | jelmer | 2007-01-05 21:18:33 +0100 (Fri, 05 Jan 2007) | 5 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/IDL.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Util.pm M /branches/SAMBA_4_0/source/pidl/tests/util.pl Start using the new parser in ParseExpr(). It's now trivial to use this to check for NULL pointers when pointers are being dereferenced (#4218). There are exactly 500 tests for pidl now :-) ------------------------------------------------------------------------ r20564 | jelmer | 2007-01-05 21:23:48 +0100 (Fri, 05 Jan 2007) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Expr.pm Regenerate. ------------------------------------------------------------------------ r20567 | jelmer | 2007-01-05 21:52:12 +0100 (Fri, 05 Jan 2007) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/expr.yp M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Expr.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/EJS.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/TDR.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Util.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Wireshark/NDR.pm M /branches/SAMBA_4_0/source/pidl/tests/util.pl Print proper errors with filename and line numbers in ParseExpr() ------------------------------------------------------------------------ r20571 | jelmer | 2007-01-05 22:26:28 +0100 (Fri, 05 Jan 2007) | 1 line Changed paths: M /branches/SAMBA_4_0/source/pidl/tests/util.pl fix '' case ------------------------------------------------------------------------ r20573 | metze | 2007-01-05 22:36:57 +0100 (Fri, 05 Jan 2007) | 3 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/EJS.pm fix handling of pointers handling to elements with the charset property metze ------------------------------------------------------------------------ r20625 | jelmer | 2007-01-09 07:02:41 +0100 (Tue, 09 Jan 2007) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/expr.yp M /branches/SAMBA_4_0/source/pidl/idl.yp M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Expr.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/IDL.pm M /branches/SAMBA_4_0/source/pidl/tests/Util.pm M /branches/SAMBA_4_0/source/pidl/tests/util.pl Fix couple of warnings. ------------------------------------------------------------------------ r20631 | jelmer | 2007-01-09 16:50:36 +0100 (Tue, 09 Jan 2007) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/NDR.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Util.pm A /branches/SAMBA_4_0/source/pidl/tests/ndr.pl Add some tests for the ndr parser. ------------------------------------------------------------------------ r20633 | jelmer | 2007-01-09 16:54:36 +0100 (Tue, 09 Jan 2007) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/tests/ndr.pl Add another test, fix warnings. ------------------------------------------------------------------------ r20637 | jelmer | 2007-01-10 00:41:25 +0100 (Wed, 10 Jan 2007) | 3 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Util.pm A /branches/SAMBA_4_0/source/pidl/tests/samba-ndr.pl Don't check for NULL pointers when the pointer is guaranteed to not be NULL (if it is a ref pointer). ------------------------------------------------------------------------ r20638 | jelmer | 2007-01-10 01:37:30 +0100 (Wed, 10 Jan 2007) | 3 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm M /branches/SAMBA_4_0/source/pidl/tests/samba-ndr.pl Check for NULL pointers (where possible) in print functions. Fixes #4218, but without reintroducing coverity warnings. ------------------------------------------------------------------------ r20675 | jelmer | 2007-01-11 03:10:01 +0100 (Thu, 11 Jan 2007) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/MANIFEST M /branches/SAMBA_4_0/source/pidl/Makefile.PL Fix installation. ------------------------------------------------------------------------ r20688 | jelmer | 2007-01-11 23:47:29 +0100 (Thu, 11 Jan 2007) | 1 line Changed paths: M /branches/SAMBA_4_0/source/pidl/pidl Use argv[0] equivalent of perl. ------------------------------------------------------------------------ r20746 | jelmer | 2007-01-14 02:33:16 +0100 (Sun, 14 Jan 2007) | 3 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Expr.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/IDL.pm D /branches/SAMBA_4_0/source/script/tests/test_smbclient.sh M /branches/SAMBA_4_0/source/script/tests/tests_all.sh A /branches/SAMBA_4_0/testprogs/blackbox A /branches/SAMBA_4_0/testprogs/blackbox/test_smbclient.sh (from /branches/SAMBA_4_0/source/script/tests/test_smbclient.sh:20745) Don't report each individual test in test_smbclient as a single testsuite. Create separate directory for blackbox tests. ------------------------------------------------------------------------ r20830 | jelmer | 2007-01-16 15:44:23 +0100 (Tue, 16 Jan 2007) | 1 line Changed paths: M /branches/SAMBA_4_0 M /branches/SAMBA_4_0/source/librpc/idl/mgmt.idl M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm M /branches/SAMBA_4_0/source/rpc_server/config.mk M /branches/SAMBA_4_0/source/rpc_server/dcerpc_server.c A /branches/SAMBA_4_0/source/rpc_server/dcesrv_mgmt.c (from /branches/SAMBA_4_0/source/rpc_server/mgmt/dcesrv_mgmt.c:20829) D /branches/SAMBA_4_0/source/rpc_server/mgmt M /branches/SAMBA_4_0/source/script/tests/test_rpc.sh M /branches/SAMBA_4_0/source/torture/rpc/mgmt.c merge mgmt work ------------------------------------------------------------------------ r20834 | jelmer | 2007-01-16 16:51:37 +0100 (Tue, 16 Jan 2007) | 1 line Changed paths: M /branches/SAMBA_4_0 M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4.pm No longer generate extra pointers for top-level [out] unique pointers. ------------------------------------------------------------------------ r20836 | jelmer | 2007-01-16 18:45:33 +0100 (Tue, 16 Jan 2007) | 1 line Changed paths: M /branches/SAMBA_4_0 M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm Use real type name, to fix compilation with -WC++-compat ------------------------------------------------------------------------ r20850 | jelmer | 2007-01-17 15:49:36 +0100 (Wed, 17 Jan 2007) | 1 line Changed paths: M /branches/SAMBA_4_0 M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/Template.pm M /branches/SAMBA_4_0/source/rpc_server/dcesrv_mgmt.c M /branches/SAMBA_4_0/source/rpc_server/drsuapi/dcesrv_drsuapi.c M /branches/SAMBA_4_0/source/rpc_server/echo/rpc_echo.c M /branches/SAMBA_4_0/source/rpc_server/epmapper/rpc_epmapper.c M /branches/SAMBA_4_0/source/rpc_server/lsa/dcesrv_lsa.c M /branches/SAMBA_4_0/source/rpc_server/netlogon/dcerpc_netlogon.c M /branches/SAMBA_4_0/source/rpc_server/samr/dcesrv_samr.c M /branches/SAMBA_4_0/source/rpc_server/samr/samr_password.c M /branches/SAMBA_4_0/source/rpc_server/spoolss/dcesrv_spoolss.c M /branches/SAMBA_4_0/source/rpc_server/srvsvc/dcesrv_srvsvc.c M /branches/SAMBA_4_0/source/rpc_server/unixinfo/dcesrv_unixinfo.c M /branches/SAMBA_4_0/source/rpc_server/winreg/rpc_winreg.c M /branches/SAMBA_4_0/source/rpc_server/wkssvc/dcesrv_wkssvc.c Prefix all server calls with dcesrv_ ------------------------------------------------------------------------ r20942 | jelmer | 2007-01-22 01:04:59 +0100 (Mon, 22 Jan 2007) | 1 line Changed paths: M /branches/SAMBA_4_0 M /branches/SAMBA_4_0/source/build/m4/check_cc.m4 M /branches/SAMBA_4_0/source/build/m4/check_perl.m4 M /branches/SAMBA_4_0/source/build/smb_build/makefile.pm M /branches/SAMBA_4_0/source/main.mk M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/Header.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Util.pm M /branches/SAMBA_4_0/source/pidl/pidl Simplify handling of systems that don't support negative enum values by using an ifdef rather than a pidl argument. ------------------------------------------------------------------------ r20967 | jelmer | 2007-01-23 11:08:08 +0100 (Tue, 23 Jan 2007) | 1 line Changed paths: M /branches/SAMBA_4_0 M /branches/SAMBA_4_0/source/pidl/tests/Util.pm M /branches/SAMBA_4_0/source/pidl/tests/ndr_align.pl M /branches/SAMBA_4_0/source/pidl/tests/ndr_refptr.pl M /branches/SAMBA_4_0/source/pidl/tests/ndr_tagtype.pl M /branches/SAMBA_4_0/source/script/tests/tests_all.sh M /branches/SAMBA_4_0/source/torture/config.mk Allow pidl tests to work with gcov ------------------------------------------------------------------------ r21075 | jelmer | 2007-01-31 12:54:01 +0100 (Wed, 31 Jan 2007) | 1 line Changed paths: M /branches/SAMBA_4_0 M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm Generate parameters in structs for the server side Samba 3 code. The current code in Samba 3 is already generated using this pidl patch. ------------------------------------------------------------------------ r21222 | jelmer | 2007-02-07 20:03:19 +0100 (Wed, 07 Feb 2007) | 8 lines Changed paths: M /branches/SAMBA_4_0 M /branches/SAMBA_4_0/source/pidl/TODO M /branches/SAMBA_4_0/source/pidl/expr.yp M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Expr.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/NDR.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Util.pm M /branches/SAMBA_4_0/source/pidl/pidl D /branches/SAMBA_4_0/source/pidl/ref_notes.txt A /branches/SAMBA_4_0/source/pidl/tests/ndr_deprecations.pl M /branches/SAMBA_4_0/source/pidl/tests/ndr_represent.pl M /branches/SAMBA_4_0/source/pidl/tests/util.pl M /branches/SAMBA_4_0/source/torture/smbtorture.c M /branches/SAMBA_4_0/source/torture/torture.c Merge a couple of pidl fixes: * Pidl will now warn when trying to use pointers as integers in expressions. * "subcontext()" is now marked as deprecated. The alternatives, transmit_as() / represent_as() should be available soon. * More tests. * Remove some unused code in smbtorture. ------------------------------------------------------------------------ ------------------------------------------------------------------------ ============================ Samba log end ============== svn path=/trunk/; revision=20744
Diffstat (limited to 'tools')
-rw-r--r--tools/pidl/MANIFEST8
-rwxr-xr-xtools/pidl/Makefile.PL4
-rw-r--r--tools/pidl/TODO4
-rw-r--r--tools/pidl/expr.yp150
-rw-r--r--tools/pidl/idl.yp40
-rw-r--r--tools/pidl/lib/Parse/Pidl.pm22
-rw-r--r--tools/pidl/lib/Parse/Pidl/Compat.pm8
-rw-r--r--tools/pidl/lib/Parse/Pidl/Expr.pm1442
-rw-r--r--tools/pidl/lib/Parse/Pidl/IDL.pm938
-rw-r--r--tools/pidl/lib/Parse/Pidl/NDR.pm55
-rw-r--r--tools/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm22
-rw-r--r--tools/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm66
-rw-r--r--tools/pidl/lib/Parse/Pidl/Samba4.pm29
-rw-r--r--tools/pidl/lib/Parse/Pidl/Samba4/EJS.pm41
-rw-r--r--tools/pidl/lib/Parse/Pidl/Samba4/Header.pm15
-rw-r--r--tools/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm222
-rw-r--r--tools/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm18
-rw-r--r--tools/pidl/lib/Parse/Pidl/Samba4/TDR.pm10
-rw-r--r--tools/pidl/lib/Parse/Pidl/Samba4/Template.pm2
-rw-r--r--tools/pidl/lib/Parse/Pidl/Util.pm71
-rw-r--r--tools/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm29
-rw-r--r--tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm29
-rw-r--r--tools/pidl/lib/Parse/Yapp/Driver.pm471
-rwxr-xr-xtools/pidl/pidl21
-rw-r--r--tools/pidl/tests/Util.pm74
-rwxr-xr-xtools/pidl/tests/ndr.pl191
-rwxr-xr-xtools/pidl/tests/ndr_align.pl11
-rwxr-xr-xtools/pidl/tests/ndr_alloc.pl1
-rwxr-xr-xtools/pidl/tests/ndr_array.pl1
-rwxr-xr-xtools/pidl/tests/ndr_compat.pl27
-rwxr-xr-xtools/pidl/tests/ndr_deprecations.pl28
-rwxr-xr-xtools/pidl/tests/ndr_fullptr.pl5
-rwxr-xr-xtools/pidl/tests/ndr_refptr.pl37
-rw-r--r--tools/pidl/tests/ndr_represent.pl37
-rwxr-xr-xtools/pidl/tests/ndr_simple.pl1
-rwxr-xr-xtools/pidl/tests/ndr_string.pl11
-rwxr-xr-xtools/pidl/tests/ndr_tagtype.pl3
-rwxr-xr-xtools/pidl/tests/parse_idl.pl63
-rwxr-xr-xtools/pidl/tests/samba-ndr.pl135
-rwxr-xr-xtools/pidl/tests/test_util.pl21
-rwxr-xr-xtools/pidl/tests/util.pl112
41 files changed, 3393 insertions, 1082 deletions
diff --git a/tools/pidl/MANIFEST b/tools/pidl/MANIFEST
index 0a4df7ba89..f51afe2a48 100644
--- a/tools/pidl/MANIFEST
+++ b/tools/pidl/MANIFEST
@@ -7,6 +7,14 @@ tests/ndr_simple.pl
tests/ndr_align.pl
tests/ndr_alloc.pl
tests/ndr_array.pl
+tests/ndr.pl
+tests/samba-ndr.pl
+tests/util.pl
+tests/test_util.pl
+tests/ndr_represent.pl
+tests/ndr_compat.pl
+tests/ndr_fullptr.pl
+tests/ndr_tagtype.pl
lib/Parse/Pidl/Samba3/Client.pm
lib/Parse/Pidl/Samba3/ClientNDR.pm
lib/Parse/Pidl/Samba3/Header.pm
diff --git a/tools/pidl/Makefile.PL b/tools/pidl/Makefile.PL
index f5cd3e4eff..2a405fcc2b 100755
--- a/tools/pidl/Makefile.PL
+++ b/tools/pidl/Makefile.PL
@@ -9,7 +9,9 @@ WriteMakefile(
sub MY::postamble {
<<'EOT';
lib/Parse/Pidl/IDL.pm: idl.yp
- yapp -s -m 'Parse::Pidl::IDL' -o lib/Parse/Pidl/IDL.pm idl.yp
+ yapp -m 'Parse::Pidl::IDL' -o lib/Parse/Pidl/IDL.pm idl.yp
+lib/Parse/Pidl/Expr.pm: expr.yp
+ yapp -m 'Parse::Pidl::Expr' -o lib/Parse/Pidl/Expr.pm expr.yp
EOT
}
diff --git a/tools/pidl/TODO b/tools/pidl/TODO
index 5b3610232c..7cf6a4209a 100644
--- a/tools/pidl/TODO
+++ b/tools/pidl/TODO
@@ -1,8 +1,6 @@
- EJS output backend shouldn't use the NDR levels stuff but instead
as the "C levels" and NDR levels don't necessarily match.
-- warn about [out] attributes on pointers (midl/samba3 compatibility)
-
- true multiple dimension array / strings in arrays support
- compatibility mode for generating MIDL-readable data:
@@ -21,3 +19,5 @@
- allow data structures outside of interfaces
- mem_ctx in the interface rather than as struct ndr member.
+
+- real typelibs
diff --git a/tools/pidl/expr.yp b/tools/pidl/expr.yp
new file mode 100644
index 0000000000..a8074875ff
--- /dev/null
+++ b/tools/pidl/expr.yp
@@ -0,0 +1,150 @@
+# expr.yp
+# Copyright (C) 2006 Jelmer Vernooij <jelmer@samba.org>
+# Published under the GNU GPL
+#
+%left '->'
+%right '!' '~'
+%left '*' '/' '%'
+%left '+' '-'
+%left '<<' '>>'
+%left '>' '<'
+%left '==' '!='
+%left '&'
+%left '|'
+%left '&&'
+%left '||'
+%left '?' ':'
+%left NEG DEREF ADDROF INV
+%left '.'
+
+%%
+exp: NUM
+ | TEXT { "\"$_[1]\"" }
+ | func
+ | var
+ | '~' exp %prec INV { "~$_[2]" }
+ | exp '+' exp { "$_[1] + $_[3]" }
+ | exp '-' exp { "$_[1] - $_[3]" }
+ | exp '*' exp { "$_[1] * $_[3]" }
+ | exp '%' exp { "$_[1] % $_[3]" }
+ | exp '<' exp { "$_[1] < $_[3]" }
+ | exp '>' exp { "$_[1] > $_[3]" }
+ | exp '|' exp { "$_[1] | $_[3]" }
+ | exp '==' exp { "$_[1] == $_[3]" }
+ | exp '<=' exp { "$_[1] <= $_[3]" }
+ | exp '=>' exp { "$_[1] => $_[3]" }
+ | exp '<<' exp { "$_[1] << $_[3]" }
+ | exp '>>' exp { "$_[1] >> $_[3]" }
+ | exp '!=' exp { "$_[1] != $_[3]" }
+ | exp '||' exp { "$_[1] || $_[3]" }
+ | exp '&&' exp { "$_[1] && $_[3]" }
+ | exp '&' exp { "$_[1] & $_[3]" }
+ | exp '?' exp ':' exp { "$_[1]?$_[3]:$_[5]" }
+ | '~' exp { "~$_[1]" }
+ | '!' exp { "not $_[1]" }
+ | exp '/' exp { "$_[1] / $_[3]" }
+ | '-' exp %prec NEG { "-$_[2]" }
+ | '&' exp %prec ADDROF { "&$_[2]" }
+ | exp '^' exp { "$_[1]^$_[3]" }
+ | '(' exp ')' { "($_[2])" }
+;
+
+possible_pointer:
+ VAR { $_[0]->_Lookup($_[1]) }
+ | '*' possible_pointer %prec DEREF { $_[0]->_Dereference($_[2]); "*$_[2]" }
+ ;
+
+var: possible_pointer { $_[0]->_Use($_[1]) }
+ | var '.' VAR { $_[0]->_Use("$_[1].$_[3]") }
+ | '(' var ')' { "($_[2])" }
+ | var '->' VAR { $_[0]->_Use("*$_[1]"); $_[1]."->".$_[3] }
+;
+
+
+func: VAR '(' opt_args ')' { "$_[1]($_[3])" };
+opt_args: { "" } | args;
+exp_or_possible_pointer: exp | possible_pointer;
+args: exp_or_possible_pointer
+ | exp_or_possible_pointer ',' args { "$_[1], $_[3]" }
+;
+
+%%
+
+package Parse::Pidl::Expr;
+
+sub _Lexer {
+ my($parser)=shift;
+
+ $parser->YYData->{INPUT}=~s/^[ \t]//;
+
+ for ($parser->YYData->{INPUT}) {
+ if (s/^(0x[0-9A-Fa-f]+)//) {
+ $parser->YYData->{LAST_TOKEN} = $1;
+ return('NUM',$1);
+ }
+ if (s/^([0-9]+(?:\.[0-9]+)?)//) {
+ $parser->YYData->{LAST_TOKEN} = $1;
+ return('NUM',$1);
+ }
+ if (s/^([A-Za-z_][A-Za-z0-9_]*)//) {
+ $parser->YYData->{LAST_TOKEN} = $1;
+ return('VAR',$1);
+ }
+ if (s/^\"(.*?)\"//) {
+ $parser->YYData->{LAST_TOKEN} = $1;
+ return('TEXT',$1);
+ }
+ if (s/^(==|!=|<=|>=|->|\|\||<<|>>|&&)//s) {
+ $parser->YYData->{LAST_TOKEN} = $1;
+ return($1,$1);
+ }
+ if (s/^(.)//s) {
+ $parser->YYData->{LAST_TOKEN} = $1;
+ return($1,$1);
+ }
+ }
+}
+
+sub _Use($$)
+{
+ my ($self, $x) = @_;
+ if (defined($self->YYData->{USE})) {
+ return $self->YYData->{USE}->($x);
+ }
+ return $x;
+}
+
+sub _Lookup($$)
+{
+ my ($self, $x) = @_;
+ return $self->YYData->{LOOKUP}->($x);
+}
+
+sub _Dereference($$)
+{
+ my ($self, $x) = @_;
+ if (defined($self->YYData->{DEREFERENCE})) {
+ $self->YYData->{DEREFERENCE}->($x);
+ }
+}
+
+sub _Error($)
+{
+ my ($self) = @_;
+ if (defined($self->YYData->{LAST_TOKEN})) {
+ $self->YYData->{ERROR}->("Parse error in `".$self->YYData->{FULL_INPUT}."' near `". $self->YYData->{LAST_TOKEN} . "'");
+ } else {
+ $self->YYData->{ERROR}->("Parse error in `".$self->YYData->{FULL_INPUT}."'");
+ }
+}
+
+sub Run {
+ my($self, $data, $error, $lookup, $deref, $use) = @_;
+ $self->YYData->{FULL_INPUT} = $data;
+ $self->YYData->{INPUT} = $data;
+ $self->YYData->{LOOKUP} = $lookup;
+ $self->YYData->{DEREFERENCE} = $deref;
+ $self->YYData->{ERROR} = $error;
+ $self->YYData->{USE} = $use;
+ return $self->YYParse( yylex => \&_Lexer, yyerror => \&_Error);
+}
diff --git a/tools/pidl/idl.yp b/tools/pidl/idl.yp
index 57061800b6..5ef4dca379 100644
--- a/tools/pidl/idl.yp
+++ b/tools/pidl/idl.yp
@@ -26,21 +26,21 @@ idl:
import: 'import' commalist ';' {{
"TYPE" => "IMPORT",
"PATHS" => $_[2],
- "FILE" => $_[0]->YYData->{INPUT_FILENAME},
+ "FILE" => $_[0]->YYData->{FILE},
"LINE" => $_[0]->YYData->{LINE}
}}
;
include: 'include' commalist ';' {{
"TYPE" => "INCLUDE",
"PATHS" => $_[2],
- "FILE" => $_[0]->YYData->{INPUT_FILENAME},
+ "FILE" => $_[0]->YYData->{FILE},
"LINE" => $_[0]->YYData->{LINE}
}}
;
importlib: 'importlib' commalist ';' {{
"TYPE" => "IMPORTLIB",
"PATHS" => $_[2],
- "FILE" => $_[0]->YYData->{INPUT_FILENAME},
+ "FILE" => $_[0]->YYData->{FILE},
"LINE" => $_[0]->YYData->{LINE}
}}
;
@@ -56,7 +56,7 @@ coclass: property_list 'coclass' identifier '{' interface_names '}' optional_sem
"PROPERTIES" => $_[1],
"NAME" => $_[3],
"DATA" => $_[5],
- "FILE" => $_[0]->YYData->{INPUT_FILENAME},
+ "FILE" => $_[0]->YYData->{FILE},
"LINE" => $_[0]->YYData->{LINE},
}}
;
@@ -73,7 +73,7 @@ interface: property_list 'interface' identifier base_interface '{' definitions '
"NAME" => $_[3],
"BASE" => $_[4],
"DATA" => $_[6],
- "FILE" => $_[0]->YYData->{INPUT_FILENAME},
+ "FILE" => $_[0]->YYData->{FILE},
"LINE" => $_[0]->YYData->{LINE},
}}
;
@@ -99,7 +99,7 @@ const: 'const' identifier pointers identifier '=' anytext ';'
"POINTERS" => $_[3],
"NAME" => $_[4],
"VALUE" => $_[6],
- "FILE" => $_[0]->YYData->{INPUT_FILENAME},
+ "FILE" => $_[0]->YYData->{FILE},
"LINE" => $_[0]->YYData->{LINE},
}}
| 'const' identifier pointers identifier array_len '=' anytext ';'
@@ -110,7 +110,7 @@ const: 'const' identifier pointers identifier '=' anytext ';'
"NAME" => $_[4],
"ARRAY_LEN" => $_[5],
"VALUE" => $_[7],
- "FILE" => $_[0]->YYData->{INPUT_FILENAME},
+ "FILE" => $_[0]->YYData->{FILE},
"LINE" => $_[0]->YYData->{LINE},
}}
;
@@ -123,7 +123,7 @@ function: property_list type identifier '(' element_list2 ')' ';'
"RETURN_TYPE" => $_[2],
"PROPERTIES" => $_[1],
"ELEMENTS" => $_[5],
- "FILE" => $_[0]->YYData->{INPUT_FILENAME},
+ "FILE" => $_[0]->YYData->{FILE},
"LINE" => $_[0]->YYData->{LINE},
}}
;
@@ -134,7 +134,7 @@ declare: 'declare' property_list decl_type identifier';'
"PROPERTIES" => $_[2],
"NAME" => $_[4],
"DATA" => $_[3],
- "FILE" => $_[0]->YYData->{INPUT_FILENAME},
+ "FILE" => $_[0]->YYData->{FILE},
"LINE" => $_[0]->YYData->{LINE},
}}
;
@@ -167,7 +167,7 @@ typedef: 'typedef' property_list type identifier array_len ';'
"NAME" => $_[4],
"DATA" => $_[3],
"ARRAY_LEN" => $_[5],
- "FILE" => $_[0]->YYData->{INPUT_FILENAME},
+ "FILE" => $_[0]->YYData->{FILE},
"LINE" => $_[0]->YYData->{LINE},
}}
;
@@ -179,7 +179,7 @@ typedecl: usertype ';' { $_[1] };
sign: 'signed' | 'unsigned';
existingtype:
- | sign identifier { "$_[1] $_[2]" }
+ sign identifier { ($_[1]?$_[1]:"signed") ." $_[2]" }
| identifier
;
@@ -242,7 +242,7 @@ empty_element: property_list ';'
"PROPERTIES" => $_[1],
"POINTERS" => 0,
"ARRAY_LEN" => [],
- "FILE" => $_[0]->YYData->{INPUT_FILENAME},
+ "FILE" => $_[0]->YYData->{FILE},
"LINE" => $_[0]->YYData->{LINE},
}}
;
@@ -276,7 +276,7 @@ base_element: property_list type pointers identifier array_len
"PROPERTIES" => $_[1],
"POINTERS" => $_[3],
"ARRAY_LEN" => $_[5],
- "FILE" => $_[0]->YYData->{INPUT_FILENAME},
+ "FILE" => $_[0]->YYData->{FILE},
"LINE" => $_[0]->YYData->{LINE},
}}
;
@@ -374,6 +374,8 @@ optional_semicolon:
# start code
%%
+use Parse::Pidl qw(error);
+
#####################################################################
# flatten an array of hashes into a single hash
sub FlattenHash($)
@@ -420,15 +422,13 @@ sub CleanData($)
sub _Error {
if (exists $_[0]->YYData->{ERRMSG}) {
- print $_[0]->YYData->{ERRMSG};
+ error($_[0]->YYData, $_[0]->YYData->{ERRMSG});
delete $_[0]->YYData->{ERRMSG};
return;
};
- my $line = $_[0]->YYData->{LINE};
my $last_token = $_[0]->YYData->{LAST_TOKEN};
- my $file = $_[0]->YYData->{INPUT_FILENAME};
- print "$file:$line: Syntax error near '$last_token'\n";
+ error($_[0]->YYData, "Syntax error near '$last_token'");
}
sub _Lexer($)
@@ -444,12 +444,12 @@ again:
if (/^\#/) {
if (s/^\# (\d+) \"(.*?)\"( \d+|)//) {
$parser->YYData->{LINE} = $1-1;
- $parser->YYData->{INPUT_FILENAME} = $2;
+ $parser->YYData->{FILE} = $2;
goto again;
}
if (s/^\#line (\d+) \"(.*?)\"( \d+|)//) {
$parser->YYData->{LINE} = $1-1;
- $parser->YYData->{INPUT_FILENAME} = $2;
+ $parser->YYData->{FILE} = $2;
goto again;
}
if (s/^(\#.*)$//m) {
@@ -491,7 +491,7 @@ sub parse_string
my $self = new Parse::Pidl::IDL;
- $self->YYData->{INPUT_FILENAME} = $filename;
+ $self->YYData->{FILE} = $filename;
$self->YYData->{INPUT} = $data;
$self->YYData->{LINE} = 0;
$self->YYData->{LAST_TOKEN} = "NONE";
diff --git a/tools/pidl/lib/Parse/Pidl.pm b/tools/pidl/lib/Parse/Pidl.pm
index c60fc59aba..0c6e0e5727 100644
--- a/tools/pidl/lib/Parse/Pidl.pm
+++ b/tools/pidl/lib/Parse/Pidl.pm
@@ -7,10 +7,32 @@
package Parse::Pidl;
+require Exporter;
+@ISA = qw(Exporter);
+@EXPORT_OK = qw(warning error fatal);
+
use strict;
use vars qw ( $VERSION );
$VERSION = '0.02';
+sub warning
+{
+ my ($l,$m) = @_;
+ print STDERR "$l->{FILE}:$l->{LINE}: warning: $m\n";
+}
+
+sub error
+{
+ my ($l,$m) = @_;
+ print STDERR "$l->{FILE}:$l->{LINE}: error: $m\n";
+}
+
+sub fatal($$)
+{
+ my ($e,$s) = @_;
+ die("$e->{FILE}:$e->{LINE}: $s\n");
+}
+
1;
diff --git a/tools/pidl/lib/Parse/Pidl/Compat.pm b/tools/pidl/lib/Parse/Pidl/Compat.pm
index 944193ac1b..f1241ef341 100644
--- a/tools/pidl/lib/Parse/Pidl/Compat.pm
+++ b/tools/pidl/lib/Parse/Pidl/Compat.pm
@@ -5,6 +5,7 @@
package Parse::Pidl::Compat;
+use Parse::Pidl qw(warning);
use Parse::Pidl::Util qw(has_property);
use strict;
@@ -74,13 +75,6 @@ my %supported_properties = (
"length_is" => ["ELEMENT"],
);
-sub warning($$)
-{
- my ($l,$m) = @_;
-
- print STDERR "$l->{FILE}:$l->{LINE}:warning:$m\n";
-}
-
sub CheckTypedef($)
{
my ($td) = @_;
diff --git a/tools/pidl/lib/Parse/Pidl/Expr.pm b/tools/pidl/lib/Parse/Pidl/Expr.pm
new file mode 100644
index 0000000000..f64db508d6
--- /dev/null
+++ b/tools/pidl/lib/Parse/Pidl/Expr.pm
@@ -0,0 +1,1442 @@
+####################################################################
+#
+# This file was generated using Parse::Yapp version 1.05.
+#
+# Don't edit this file, use source file instead.
+#
+# ANY CHANGE MADE HERE WILL BE LOST !
+#
+####################################################################
+package Parse::Pidl::Expr;
+use vars qw ( @ISA );
+use strict;
+
+@ISA= qw ( Parse::Yapp::Driver );
+use Parse::Yapp::Driver;
+
+
+
+sub new {
+ my($class)=shift;
+ ref($class)
+ and $class=ref($class);
+
+ my($self)=$class->SUPER::new( yyversion => '1.05',
+ yystates =>
+[
+ {#State 0
+ ACTIONS => {
+ "-" => 1,
+ "~" => 3,
+ "&" => 4,
+ 'NUM' => 5,
+ 'TEXT' => 6,
+ "(" => 7,
+ "!" => 8,
+ "*" => 9,
+ 'VAR' => 10
+ },
+ GOTOS => {
+ 'exp' => 2,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
+ }
+ },
+ {#State 1
+ ACTIONS => {
+ "-" => 1,
+ "~" => 3,
+ "&" => 4,
+ 'TEXT' => 6,
+ 'NUM' => 5,
+ "(" => 7,
+ "!" => 8,
+ "*" => 9,
+ 'VAR' => 10
+ },
+ GOTOS => {
+ 'exp' => 14,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
+ }
+ },
+ {#State 2
+ ACTIONS => {
+ '' => 16,
+ "-" => 15,
+ "<" => 17,
+ "+" => 18,
+ "%" => 19,
+ "==" => 20,
+ "^" => 21,
+ "*" => 22,
+ ">>" => 23,
+ "!=" => 24,
+ "?" => 25,
+ "||" => 26,
+ "&&" => 27,
+ "&" => 28,
+ "/" => 29,
+ "|" => 30,
+ "<<" => 32,
+ "=>" => 31,
+ "<=" => 33,
+ ">" => 34
+ }
+ },
+ {#State 3
+ ACTIONS => {
+ "-" => 1,
+ "~" => 3,
+ "&" => 4,
+ 'TEXT' => 6,
+ 'NUM' => 5,
+ "!" => 8,
+ "(" => 7,
+ "*" => 9,
+ 'VAR' => 10
+ },
+ GOTOS => {
+ 'exp' => 35,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
+ }
+ },
+ {#State 4
+ ACTIONS => {
+ "-" => 1,
+ "~" => 3,
+ "&" => 4,
+ 'TEXT' => 6,
+ 'NUM' => 5,
+ "!" => 8,
+ "(" => 7,
+ "*" => 9,
+ 'VAR' => 10
+ },
+ GOTOS => {
+ 'exp' => 36,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
+ }
+ },
+ {#State 5
+ DEFAULT => -1
+ },
+ {#State 6
+ DEFAULT => -2
+ },
+ {#State 7
+ ACTIONS => {
+ "-" => 1,
+ "~" => 3,
+ "&" => 4,
+ 'TEXT' => 6,
+ 'NUM' => 5,
+ "!" => 8,
+ "(" => 7,
+ "*" => 9,
+ 'VAR' => 10
+ },
+ GOTOS => {
+ 'exp' => 38,
+ 'var' => 37,
+ 'func' => 12,
+ 'possible_pointer' => 13
+ }
+ },
+ {#State 8
+ ACTIONS => {
+ "-" => 1,
+ "~" => 3,
+ "&" => 4,
+ 'TEXT' => 6,
+ 'NUM' => 5,
+ "!" => 8,
+ "(" => 7,
+ "*" => 9,
+ 'VAR' => 10
+ },
+ GOTOS => {
+ 'exp' => 39,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
+ }
+ },
+ {#State 9
+ ACTIONS => {
+ "*" => 9,
+ 'VAR' => 41
+ },
+ GOTOS => {
+ 'possible_pointer' => 40
+ }
+ },
+ {#State 10
+ ACTIONS => {
+ "(" => 42
+ },
+ DEFAULT => -30
+ },
+ {#State 11
+ ACTIONS => {
+ "->" => 43,
+ "." => 44
+ },
+ DEFAULT => -4
+ },
+ {#State 12
+ DEFAULT => -3
+ },
+ {#State 13
+ DEFAULT => -32
+ },
+ {#State 14
+ ACTIONS => {
+ "^" => 21,
+ "=>" => 31,
+ "<=" => 33
+ },
+ DEFAULT => -26
+ },
+ {#State 15
+ ACTIONS => {
+ "-" => 1,
+ "~" => 3,
+ "&" => 4,
+ 'TEXT' => 6,
+ 'NUM' => 5,
+ "!" => 8,
+ "(" => 7,
+ "*" => 9,
+ 'VAR' => 10
+ },
+ GOTOS => {
+ 'exp' => 45,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
+ }
+ },
+ {#State 16
+ DEFAULT => 0
+ },
+ {#State 17
+ ACTIONS => {
+ "-" => 1,
+ "~" => 3,
+ "&" => 4,
+ 'TEXT' => 6,
+ 'NUM' => 5,
+ "!" => 8,
+ "(" => 7,
+ "*" => 9,
+ 'VAR' => 10
+ },
+ GOTOS => {
+ 'exp' => 46,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
+ }
+ },
+ {#State 18
+ ACTIONS => {
+ "-" => 1,
+ "~" => 3,
+ "&" => 4,
+ 'TEXT' => 6,
+ 'NUM' => 5,
+ "!" => 8,
+ "(" => 7,
+ "*" => 9,
+ 'VAR' => 10
+ },
+ GOTOS => {
+ 'exp' => 47,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
+ }
+ },
+ {#State 19
+ ACTIONS => {
+ "-" => 1,
+ "~" => 3,
+ "&" => 4,
+ 'TEXT' => 6,
+ 'NUM' => 5,
+ "!" => 8,
+ "(" => 7,
+ "*" => 9,
+ 'VAR' => 10
+ },
+ GOTOS => {
+ 'exp' => 48,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
+ }
+ },
+ {#State 20
+ ACTIONS => {
+ "-" => 1,
+ "~" => 3,
+ "&" => 4,
+ 'TEXT' => 6,
+ 'NUM' => 5,
+ "!" => 8,
+ "(" => 7,
+ "*" => 9,
+ 'VAR' => 10
+ },
+ GOTOS => {
+ 'exp' => 49,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
+ }
+ },
+ {#State 21
+ ACTIONS => {
+ "-" => 1,
+ "~" => 3,
+ "&" => 4,
+ 'TEXT' => 6,
+ 'NUM' => 5,
+ "!" => 8,
+ "(" => 7,
+ "*" => 9,
+ 'VAR' => 10
+ },
+ GOTOS => {
+ 'exp' => 50,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
+ }
+ },
+ {#State 22
+ ACTIONS => {
+ "-" => 1,
+ "~" => 3,
+ "&" => 4,
+ 'TEXT' => 6,
+ 'NUM' => 5,
+ "!" => 8,
+ "(" => 7,
+ "*" => 9,
+ 'VAR' => 10
+ },
+ GOTOS => {
+ 'exp' => 51,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
+ }
+ },
+ {#State 23
+ ACTIONS => {
+ "-" => 1,
+ "~" => 3,
+ "&" => 4,
+ 'TEXT' => 6,
+ 'NUM' => 5,
+ "!" => 8,
+ "(" => 7,
+ "*" => 9,
+ 'VAR' => 10
+ },
+ GOTOS => {
+ 'exp' => 52,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
+ }
+ },
+ {#State 24
+ ACTIONS => {
+ "-" => 1,
+ "~" => 3,
+ "&" => 4,
+ 'TEXT' => 6,
+ 'NUM' => 5,
+ "!" => 8,
+ "(" => 7,
+ "*" => 9,
+ 'VAR' => 10
+ },
+ GOTOS => {
+ 'exp' => 53,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
+ }
+ },
+ {#State 25
+ ACTIONS => {
+ "-" => 1,
+ "~" => 3,
+ "&" => 4,
+ 'TEXT' => 6,
+ 'NUM' => 5,
+ "!" => 8,
+ "(" => 7,
+ "*" => 9,
+ 'VAR' => 10
+ },
+ GOTOS => {
+ 'exp' => 54,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
+ }
+ },
+ {#State 26
+ ACTIONS => {
+ "-" => 1,
+ "~" => 3,
+ "&" => 4,
+ 'TEXT' => 6,
+ 'NUM' => 5,
+ "!" => 8,
+ "(" => 7,
+ "*" => 9,
+ 'VAR' => 10
+ },
+ GOTOS => {
+ 'exp' => 55,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
+ }
+ },
+ {#State 27
+ ACTIONS => {
+ "-" => 1,
+ "~" => 3,
+ "&" => 4,
+ 'TEXT' => 6,
+ 'NUM' => 5,
+ "!" => 8,
+ "(" => 7,
+ "*" => 9,
+ 'VAR' => 10
+ },
+ GOTOS => {
+ 'exp' => 56,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
+ }
+ },
+ {#State 28
+ ACTIONS => {
+ "-" => 1,
+ "~" => 3,
+ "&" => 4,
+ 'TEXT' => 6,
+ 'NUM' => 5,
+ "!" => 8,
+ "(" => 7,
+ "*" => 9,
+ 'VAR' => 10
+ },
+ GOTOS => {
+ 'exp' => 57,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
+ }
+ },
+ {#State 29
+ ACTIONS => {
+ "-" => 1,
+ "~" => 3,
+ "&" => 4,
+ 'TEXT' => 6,
+ 'NUM' => 5,
+ "!" => 8,
+ "(" => 7,
+ "*" => 9,
+ 'VAR' => 10
+ },
+ GOTOS => {
+ 'exp' => 58,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
+ }
+ },
+ {#State 30
+ ACTIONS => {
+ "-" => 1,
+ "~" => 3,
+ "&" => 4,
+ 'TEXT' => 6,
+ 'NUM' => 5,
+ "!" => 8,
+ "(" => 7,
+ "*" => 9,
+ 'VAR' => 10
+ },
+ GOTOS => {
+ 'exp' => 59,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
+ }
+ },
+ {#State 31
+ ACTIONS => {
+ "-" => 1,
+ "~" => 3,
+ "&" => 4,
+ 'TEXT' => 6,
+ 'NUM' => 5,
+ "!" => 8,
+ "(" => 7,
+ "*" => 9,
+ 'VAR' => 10
+ },
+ GOTOS => {
+ 'exp' => 60,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
+ }
+ },
+ {#State 32
+ ACTIONS => {
+ "-" => 1,
+ "~" => 3,
+ "&" => 4,
+ 'TEXT' => 6,
+ 'NUM' => 5,
+ "!" => 8,
+ "(" => 7,
+ "*" => 9,
+ 'VAR' => 10
+ },
+ GOTOS => {
+ 'exp' => 61,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
+ }
+ },
+ {#State 33
+ ACTIONS => {
+ "-" => 1,
+ "~" => 3,
+ "&" => 4,
+ 'TEXT' => 6,
+ 'NUM' => 5,
+ "!" => 8,
+ "(" => 7,
+ "*" => 9,
+ 'VAR' => 10
+ },
+ GOTOS => {
+ 'exp' => 62,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
+ }
+ },
+ {#State 34
+ ACTIONS => {
+ "-" => 1,
+ "~" => 3,
+ "&" => 4,
+ 'TEXT' => 6,
+ 'NUM' => 5,
+ "!" => 8,
+ "(" => 7,
+ "*" => 9,
+ 'VAR' => 10
+ },
+ GOTOS => {
+ 'exp' => 63,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
+ }
+ },
+ {#State 35
+ ACTIONS => {
+ "^" => 21,
+ "=>" => 31,
+ "<=" => 33
+ },
+ DEFAULT => -5
+ },
+ {#State 36
+ ACTIONS => {
+ "^" => 21,
+ "=>" => 31,
+ "<=" => 33
+ },
+ DEFAULT => -27
+ },
+ {#State 37
+ ACTIONS => {
+ ")" => 64,
+ "->" => 43,
+ "." => 44
+ },
+ DEFAULT => -4
+ },
+ {#State 38
+ ACTIONS => {
+ "-" => 15,
+ "<" => 17,
+ "+" => 18,
+ "%" => 19,
+ "==" => 20,
+ "^" => 21,
+ "*" => 22,
+ ")" => 65,
+ ">>" => 23,
+ "!=" => 24,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "&" => 28,
+ "/" => 29,
+ "|" => 30,
+ "=>" => 31,
+ "<<" => 32,
+ "<=" => 33,
+ ">" => 34
+ }
+ },
+ {#State 39
+ ACTIONS => {
+ "-" => 15,
+ "<" => 17,
+ "+" => 18,
+ "%" => 19,
+ "==" => 20,
+ "^" => 21,
+ "*" => 22,
+ ">>" => 23,
+ "!=" => 24,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "&" => 28,
+ "/" => 29,
+ "|" => 30,
+ "=>" => 31,
+ "<<" => 32,
+ "<=" => 33,
+ ">" => 34
+ },
+ DEFAULT => -24
+ },
+ {#State 40
+ DEFAULT => -31
+ },
+ {#State 41
+ DEFAULT => -30
+ },
+ {#State 42
+ ACTIONS => {
+ "-" => 1,
+ "~" => 3,
+ "&" => 4,
+ 'TEXT' => 6,
+ 'NUM' => 5,
+ "!" => 8,
+ "(" => 7,
+ "*" => 9,
+ 'VAR' => 10
+ },
+ DEFAULT => -37,
+ GOTOS => {
+ 'exp' => 69,
+ 'var' => 11,
+ 'args' => 66,
+ 'func' => 12,
+ 'opt_args' => 70,
+ 'exp_or_possible_pointer' => 67,
+ 'possible_pointer' => 68
+ }
+ },
+ {#State 43
+ ACTIONS => {
+ 'VAR' => 71
+ }
+ },
+ {#State 44
+ ACTIONS => {
+ 'VAR' => 72
+ }
+ },
+ {#State 45
+ ACTIONS => {
+ "<" => 17,
+ "==" => 20,
+ "^" => 21,
+ ">>" => 23,
+ "!=" => 24,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "&" => 28,
+ "|" => 30,
+ "=>" => 31,
+ "<<" => 32,
+ "<=" => 33,
+ ">" => 34
+ },
+ DEFAULT => -7
+ },
+ {#State 46
+ ACTIONS => {
+ "==" => 20,
+ "^" => 21,
+ "!=" => 24,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "&" => 28,
+ "|" => 30,
+ "=>" => 31,
+ "<=" => 33
+ },
+ DEFAULT => -10
+ },
+ {#State 47
+ ACTIONS => {
+ "<" => 17,
+ "==" => 20,
+ "^" => 21,
+ ">>" => 23,
+ "!=" => 24,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "&" => 28,
+ "|" => 30,
+ "=>" => 31,
+ "<<" => 32,
+ "<=" => 33,
+ ">" => 34
+ },
+ DEFAULT => -6
+ },
+ {#State 48
+ ACTIONS => {
+ "-" => 15,
+ "<" => 17,
+ "+" => 18,
+ "==" => 20,
+ "^" => 21,
+ ">>" => 23,
+ "!=" => 24,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "&" => 28,
+ "|" => 30,
+ "=>" => 31,
+ "<<" => 32,
+ "<=" => 33,
+ ">" => 34
+ },
+ DEFAULT => -9
+ },
+ {#State 49
+ ACTIONS => {
+ "^" => 21,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "&" => 28,
+ "|" => 30,
+ "=>" => 31,
+ "<=" => 33
+ },
+ DEFAULT => -13
+ },
+ {#State 50
+ ACTIONS => {
+ "-" => 15,
+ "<" => 17,
+ "+" => 18,
+ "%" => 19,
+ "==" => 20,
+ "^" => 21,
+ "*" => 22,
+ ">>" => 23,
+ "!=" => 24,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "&" => 28,
+ "/" => 29,
+ "|" => 30,
+ "=>" => 31,
+ "<<" => 32,
+ "<=" => 33,
+ ">" => 34
+ },
+ DEFAULT => -28
+ },
+ {#State 51
+ ACTIONS => {
+ "-" => 15,
+ "<" => 17,
+ "+" => 18,
+ "==" => 20,
+ "^" => 21,
+ ">>" => 23,
+ "!=" => 24,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "&" => 28,
+ "|" => 30,
+ "=>" => 31,
+ "<<" => 32,
+ "<=" => 33,
+ ">" => 34
+ },
+ DEFAULT => -8
+ },
+ {#State 52
+ ACTIONS => {
+ "<" => 17,
+ "==" => 20,
+ "^" => 21,
+ "!=" => 24,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "&" => 28,
+ "|" => 30,
+ "=>" => 31,
+ "<=" => 33,
+ ">" => 34
+ },
+ DEFAULT => -17
+ },
+ {#State 53
+ ACTIONS => {
+ "^" => 21,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "&" => 28,
+ "|" => 30,
+ "=>" => 31,
+ "<=" => 33
+ },
+ DEFAULT => -18
+ },
+ {#State 54
+ ACTIONS => {
+ ":" => 73,
+ "-" => 15,
+ "<" => 17,
+ "+" => 18,
+ "%" => 19,
+ "==" => 20,
+ "^" => 21,
+ "*" => 22,
+ ">>" => 23,
+ "!=" => 24,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "&" => 28,
+ "/" => 29,
+ "|" => 30,
+ "=>" => 31,
+ "<<" => 32,
+ "<=" => 33,
+ ">" => 34
+ }
+ },
+ {#State 55
+ ACTIONS => {
+ "^" => 21,
+ "?" => 25,
+ "=>" => 31,
+ "<=" => 33
+ },
+ DEFAULT => -19
+ },
+ {#State 56
+ ACTIONS => {
+ "^" => 21,
+ "?" => 25,
+ "||" => 26,
+ "=>" => 31,
+ "<=" => 33
+ },
+ DEFAULT => -20
+ },
+ {#State 57
+ ACTIONS => {
+ "^" => 21,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "|" => 30,
+ "=>" => 31,
+ "<=" => 33
+ },
+ DEFAULT => -21
+ },
+ {#State 58
+ ACTIONS => {
+ "-" => 15,
+ "<" => 17,
+ "+" => 18,
+ "==" => 20,
+ "^" => 21,
+ ">>" => 23,
+ "!=" => 24,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "&" => 28,
+ "|" => 30,
+ "=>" => 31,
+ "<<" => 32,
+ "<=" => 33,
+ ">" => 34
+ },
+ DEFAULT => -25
+ },
+ {#State 59
+ ACTIONS => {
+ "^" => 21,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "=>" => 31,
+ "<=" => 33
+ },
+ DEFAULT => -12
+ },
+ {#State 60
+ ACTIONS => {
+ "-" => 15,
+ "<" => 17,
+ "+" => 18,
+ "%" => 19,
+ "==" => 20,
+ "^" => 21,
+ "*" => 22,
+ ">>" => 23,
+ "!=" => 24,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "&" => 28,
+ "/" => 29,
+ "|" => 30,
+ "=>" => 31,
+ "<<" => 32,
+ "<=" => 33,
+ ">" => 34
+ },
+ DEFAULT => -15
+ },
+ {#State 61
+ ACTIONS => {
+ "<" => 17,
+ "==" => 20,
+ "^" => 21,
+ "!=" => 24,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "&" => 28,
+ "|" => 30,
+ "=>" => 31,
+ "<=" => 33,
+ ">" => 34
+ },
+ DEFAULT => -16
+ },
+ {#State 62
+ ACTIONS => {
+ "-" => 15,
+ "<" => 17,
+ "+" => 18,
+ "%" => 19,
+ "==" => 20,
+ "^" => 21,
+ "*" => 22,
+ ">>" => 23,
+ "!=" => 24,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "&" => 28,
+ "/" => 29,
+ "|" => 30,
+ "=>" => 31,
+ "<<" => 32,
+ "<=" => 33,
+ ">" => 34
+ },
+ DEFAULT => -14
+ },
+ {#State 63
+ ACTIONS => {
+ "==" => 20,
+ "^" => 21,
+ "!=" => 24,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "&" => 28,
+ "|" => 30,
+ "=>" => 31,
+ "<=" => 33
+ },
+ DEFAULT => -11
+ },
+ {#State 64
+ DEFAULT => -34
+ },
+ {#State 65
+ DEFAULT => -29
+ },
+ {#State 66
+ DEFAULT => -38
+ },
+ {#State 67
+ ACTIONS => {
+ "," => 74
+ },
+ DEFAULT => -41
+ },
+ {#State 68
+ DEFAULT => -32
+ },
+ {#State 69
+ ACTIONS => {
+ "-" => 15,
+ "<" => 17,
+ "+" => 18,
+ "%" => 19,
+ "==" => 20,
+ "^" => 21,
+ "*" => 22,
+ ">>" => 23,
+ "!=" => 24,
+ "?" => 25,
+ "&&" => 27,
+ "||" => 26,
+ "&" => 28,
+ "/" => 29,
+ "|" => 30,
+ "=>" => 31,
+ "<<" => 32,
+ "<=" => 33,
+ ">" => 34
+ },
+ DEFAULT => -39
+ },
+ {#State 70
+ ACTIONS => {
+ ")" => 75
+ }
+ },
+ {#State 71
+ DEFAULT => -35
+ },
+ {#State 72
+ DEFAULT => -33
+ },
+ {#State 73
+ ACTIONS => {
+ "-" => 1,
+ "~" => 3,
+ "&" => 4,
+ 'TEXT' => 6,
+ 'NUM' => 5,
+ "!" => 8,
+ "(" => 7,
+ "*" => 9,
+ 'VAR' => 10
+ },
+ GOTOS => {
+ 'exp' => 76,
+ 'var' => 11,
+ 'func' => 12,
+ 'possible_pointer' => 13
+ }
+ },
+ {#State 74
+ ACTIONS => {
+ "-" => 1,
+ "~" => 3,
+ "&" => 4,
+ 'TEXT' => 6,
+ 'NUM' => 5,
+ "!" => 8,
+ "(" => 7,
+ "*" => 9,
+ 'VAR' => 10
+ },
+ GOTOS => {
+ 'exp' => 69,
+ 'var' => 11,
+ 'args' => 77,
+ 'func' => 12,
+ 'exp_or_possible_pointer' => 67,
+ 'possible_pointer' => 68
+ }
+ },
+ {#State 75
+ DEFAULT => -36
+ },
+ {#State 76
+ ACTIONS => {
+ "^" => 21,
+ "=>" => 31,
+ "<=" => 33
+ },
+ DEFAULT => -22
+ },
+ {#State 77
+ DEFAULT => -42
+ }
+],
+ yyrules =>
+[
+ [#Rule 0
+ '$start', 2, undef
+ ],
+ [#Rule 1
+ 'exp', 1, undef
+ ],
+ [#Rule 2
+ 'exp', 1,
+sub
+#line 22 "expr.yp"
+{ "\"$_[1]\"" }
+ ],
+ [#Rule 3
+ 'exp', 1, undef
+ ],
+ [#Rule 4
+ 'exp', 1, undef
+ ],
+ [#Rule 5
+ 'exp', 2,
+sub
+#line 25 "expr.yp"
+{ "~$_[2]" }
+ ],
+ [#Rule 6
+ 'exp', 3,
+sub
+#line 26 "expr.yp"
+{ "$_[1] + $_[3]" }
+ ],
+ [#Rule 7
+ 'exp', 3,
+sub
+#line 27 "expr.yp"
+{ "$_[1] - $_[3]" }
+ ],
+ [#Rule 8
+ 'exp', 3,
+sub
+#line 28 "expr.yp"
+{ "$_[1] * $_[3]" }
+ ],
+ [#Rule 9
+ 'exp', 3,
+sub
+#line 29 "expr.yp"
+{ "$_[1] % $_[3]" }
+ ],
+ [#Rule 10
+ 'exp', 3,
+sub
+#line 30 "expr.yp"
+{ "$_[1] < $_[3]" }
+ ],
+ [#Rule 11
+ 'exp', 3,
+sub
+#line 31 "expr.yp"
+{ "$_[1] > $_[3]" }
+ ],
+ [#Rule 12
+ 'exp', 3,
+sub
+#line 32 "expr.yp"
+{ "$_[1] | $_[3]" }
+ ],
+ [#Rule 13
+ 'exp', 3,
+sub
+#line 33 "expr.yp"
+{ "$_[1] == $_[3]" }
+ ],
+ [#Rule 14
+ 'exp', 3,
+sub
+#line 34 "expr.yp"
+{ "$_[1] <= $_[3]" }
+ ],
+ [#Rule 15
+ 'exp', 3,
+sub
+#line 35 "expr.yp"
+{ "$_[1] => $_[3]" }
+ ],
+ [#Rule 16
+ 'exp', 3,
+sub
+#line 36 "expr.yp"
+{ "$_[1] << $_[3]" }
+ ],
+ [#Rule 17
+ 'exp', 3,
+sub
+#line 37 "expr.yp"
+{ "$_[1] >> $_[3]" }
+ ],
+ [#Rule 18
+ 'exp', 3,
+sub
+#line 38 "expr.yp"
+{ "$_[1] != $_[3]" }
+ ],
+ [#Rule 19
+ 'exp', 3,
+sub
+#line 39 "expr.yp"
+{ "$_[1] || $_[3]" }
+ ],
+ [#Rule 20
+ 'exp', 3,
+sub
+#line 40 "expr.yp"
+{ "$_[1] && $_[3]" }
+ ],
+ [#Rule 21
+ 'exp', 3,
+sub
+#line 41 "expr.yp"
+{ "$_[1] & $_[3]" }
+ ],
+ [#Rule 22
+ 'exp', 5,
+sub
+#line 42 "expr.yp"
+{ "$_[1]?$_[3]:$_[5]" }
+ ],
+ [#Rule 23
+ 'exp', 2,
+sub
+#line 43 "expr.yp"
+{ "~$_[1]" }
+ ],
+ [#Rule 24
+ 'exp', 2,
+sub
+#line 44 "expr.yp"
+{ "not $_[1]" }
+ ],
+ [#Rule 25
+ 'exp', 3,
+sub
+#line 45 "expr.yp"
+{ "$_[1] / $_[3]" }
+ ],
+ [#Rule 26
+ 'exp', 2,
+sub
+#line 46 "expr.yp"
+{ "-$_[2]" }
+ ],
+ [#Rule 27
+ 'exp', 2,
+sub
+#line 47 "expr.yp"
+{ "&$_[2]" }
+ ],
+ [#Rule 28
+ 'exp', 3,
+sub
+#line 48 "expr.yp"
+{ "$_[1]^$_[3]" }
+ ],
+ [#Rule 29
+ 'exp', 3,
+sub
+#line 49 "expr.yp"
+{ "($_[2])" }
+ ],
+ [#Rule 30
+ 'possible_pointer', 1,
+sub
+#line 53 "expr.yp"
+{ $_[0]->_Lookup($_[1]) }
+ ],
+ [#Rule 31
+ 'possible_pointer', 2,
+sub
+#line 54 "expr.yp"
+{ $_[0]->_Dereference($_[2]); "*$_[2]" }
+ ],
+ [#Rule 32
+ 'var', 1,
+sub
+#line 57 "expr.yp"
+{ $_[0]->_Use($_[1]) }
+ ],
+ [#Rule 33
+ 'var', 3,
+sub
+#line 58 "expr.yp"
+{ $_[0]->_Use("$_[1].$_[3]") }
+ ],
+ [#Rule 34
+ 'var', 3,
+sub
+#line 59 "expr.yp"
+{ "($_[2])" }
+ ],
+ [#Rule 35
+ 'var', 3,
+sub
+#line 60 "expr.yp"
+{ $_[0]->_Use("*$_[1]"); $_[1]."->".$_[3] }
+ ],
+ [#Rule 36
+ 'func', 4,
+sub
+#line 64 "expr.yp"
+{ "$_[1]($_[3])" }
+ ],
+ [#Rule 37
+ 'opt_args', 0,
+sub
+#line 65 "expr.yp"
+{ "" }
+ ],
+ [#Rule 38
+ 'opt_args', 1, undef
+ ],
+ [#Rule 39
+ 'exp_or_possible_pointer', 1, undef
+ ],
+ [#Rule 40
+ 'exp_or_possible_pointer', 1, undef
+ ],
+ [#Rule 41
+ 'args', 1, undef
+ ],
+ [#Rule 42
+ 'args', 3,
+sub
+#line 68 "expr.yp"
+{ "$_[1], $_[3]" }
+ ]
+],
+ @_);
+ bless($self,$class);
+}
+
+#line 71 "expr.yp"
+
+
+package Parse::Pidl::Expr;
+
+sub _Lexer {
+ my($parser)=shift;
+
+ $parser->YYData->{INPUT}=~s/^[ \t]//;
+
+ for ($parser->YYData->{INPUT}) {
+ if (s/^(0x[0-9A-Fa-f]+)//) {
+ $parser->YYData->{LAST_TOKEN} = $1;
+ return('NUM',$1);
+ }
+ if (s/^([0-9]+(?:\.[0-9]+)?)//) {
+ $parser->YYData->{LAST_TOKEN} = $1;
+ return('NUM',$1);
+ }
+ if (s/^([A-Za-z_][A-Za-z0-9_]*)//) {
+ $parser->YYData->{LAST_TOKEN} = $1;
+ return('VAR',$1);
+ }
+ if (s/^\"(.*?)\"//) {
+ $parser->YYData->{LAST_TOKEN} = $1;
+ return('TEXT',$1);
+ }
+ if (s/^(==|!=|<=|>=|->|\|\||<<|>>|&&)//s) {
+ $parser->YYData->{LAST_TOKEN} = $1;
+ return($1,$1);
+ }
+ if (s/^(.)//s) {
+ $parser->YYData->{LAST_TOKEN} = $1;
+ return($1,$1);
+ }
+ }
+}
+
+sub _Use($$)
+{
+ my ($self, $x) = @_;
+ if (defined($self->YYData->{USE})) {
+ return $self->YYData->{USE}->($x);
+ }
+ return $x;
+}
+
+sub _Lookup($$)
+{
+ my ($self, $x) = @_;
+ return $self->YYData->{LOOKUP}->($x);
+}
+
+sub _Dereference($$)
+{
+ my ($self, $x) = @_;
+ if (defined($self->YYData->{DEREFERENCE})) {
+ $self->YYData->{DEREFERENCE}->($x);
+ }
+}
+
+sub _Error($)
+{
+ my ($self) = @_;
+ if (defined($self->YYData->{LAST_TOKEN})) {
+ $self->YYData->{ERROR}->("Parse error in `".$self->YYData->{FULL_INPUT}."' near `". $self->YYData->{LAST_TOKEN} . "'");
+ } else {
+ $self->YYData->{ERROR}->("Parse error in `".$self->YYData->{FULL_INPUT}."'");
+ }
+}
+
+sub Run {
+ my($self, $data, $error, $lookup, $deref, $use) = @_;
+ $self->YYData->{FULL_INPUT} = $data;
+ $self->YYData->{INPUT} = $data;
+ $self->YYData->{LOOKUP} = $lookup;
+ $self->YYData->{DEREFERENCE} = $deref;
+ $self->YYData->{ERROR} = $error;
+ $self->YYData->{USE} = $use;
+ return $self->YYParse( yylex => \&_Lexer, yyerror => \&_Error);
+}
+
+1;
diff --git a/tools/pidl/lib/Parse/Pidl/IDL.pm b/tools/pidl/lib/Parse/Pidl/IDL.pm
index 85c5b8b828..71c4470870 100644
--- a/tools/pidl/lib/Parse/Pidl/IDL.pm
+++ b/tools/pidl/lib/Parse/Pidl/IDL.pm
@@ -12,482 +12,7 @@ use vars qw ( @ISA );
use strict;
@ISA= qw ( Parse::Yapp::Driver );
-#Included Parse/Yapp/Driver.pm file----------------------------------------
-{
-#
-# Module Parse::Yapp::Driver
-#
-# This module is part of the Parse::Yapp package available on your
-# nearest CPAN
-#
-# Any use of this module in a standalone parser make the included
-# text under the same copyright as the Parse::Yapp module itself.
-#
-# This notice should remain unchanged.
-#
-# (c) Copyright 1998-2001 Francois Desarmenien, all rights reserved.
-# (see the pod text in Parse::Yapp module for use and distribution rights)
-#
-
-package Parse::Yapp::Driver;
-
-require 5.004;
-
-use strict;
-
-use vars qw ( $VERSION $COMPATIBLE $FILENAME );
-
-$VERSION = '1.05';
-$COMPATIBLE = '0.07';
-$FILENAME=__FILE__;
-
-use Carp;
-
-#Known parameters, all starting with YY (leading YY will be discarded)
-my(%params)=(YYLEX => 'CODE', 'YYERROR' => 'CODE', YYVERSION => '',
- YYRULES => 'ARRAY', YYSTATES => 'ARRAY', YYDEBUG => '');
-#Mandatory parameters
-my(@params)=('LEX','RULES','STATES');
-
-sub new {
- my($class)=shift;
- my($errst,$nberr,$token,$value,$check,$dotpos);
- my($self)={ ERROR => \&_Error,
- ERRST => \$errst,
- NBERR => \$nberr,
- TOKEN => \$token,
- VALUE => \$value,
- DOTPOS => \$dotpos,
- STACK => [],
- DEBUG => 0,
- CHECK => \$check };
-
- _CheckParams( [], \%params, \@_, $self );
-
- exists($$self{VERSION})
- and $$self{VERSION} < $COMPATIBLE
- and croak "Yapp driver version $VERSION ".
- "incompatible with version $$self{VERSION}:\n".
- "Please recompile parser module.";
-
- ref($class)
- and $class=ref($class);
-
- bless($self,$class);
-}
-
-sub YYParse {
- my($self)=shift;
- my($retval);
-
- _CheckParams( \@params, \%params, \@_, $self );
-
- if($$self{DEBUG}) {
- _DBLoad();
- $retval = eval '$self->_DBParse()';#Do not create stab entry on compile
- $@ and die $@;
- }
- else {
- $retval = $self->_Parse();
- }
- $retval
-}
-
-sub YYData {
- my($self)=shift;
-
- exists($$self{USER})
- or $$self{USER}={};
-
- $$self{USER};
-
-}
-
-sub YYErrok {
- my($self)=shift;
-
- ${$$self{ERRST}}=0;
- undef;
-}
-
-sub YYNberr {
- my($self)=shift;
-
- ${$$self{NBERR}};
-}
-
-sub YYRecovering {
- my($self)=shift;
-
- ${$$self{ERRST}} != 0;
-}
-
-sub YYAbort {
- my($self)=shift;
-
- ${$$self{CHECK}}='ABORT';
- undef;
-}
-
-sub YYAccept {
- my($self)=shift;
-
- ${$$self{CHECK}}='ACCEPT';
- undef;
-}
-
-sub YYError {
- my($self)=shift;
-
- ${$$self{CHECK}}='ERROR';
- undef;
-}
-
-sub YYSemval {
- my($self)=shift;
- my($index)= $_[0] - ${$$self{DOTPOS}} - 1;
-
- $index < 0
- and -$index <= @{$$self{STACK}}
- and return $$self{STACK}[$index][1];
-
- undef; #Invalid index
-}
-
-sub YYCurtok {
- my($self)=shift;
-
- @_
- and ${$$self{TOKEN}}=$_[0];
- ${$$self{TOKEN}};
-}
-
-sub YYCurval {
- my($self)=shift;
-
- @_
- and ${$$self{VALUE}}=$_[0];
- ${$$self{VALUE}};
-}
-
-sub YYExpect {
- my($self)=shift;
-
- keys %{$self->{STATES}[$self->{STACK}[-1][0]]{ACTIONS}}
-}
-
-sub YYLexer {
- my($self)=shift;
-
- $$self{LEX};
-}
-
-
-#################
-# Private stuff #
-#################
-
-
-sub _CheckParams {
- my($mandatory,$checklist,$inarray,$outhash)=@_;
- my($prm,$value);
- my($prmlst)={};
-
- while(($prm,$value)=splice(@$inarray,0,2)) {
- $prm=uc($prm);
- exists($$checklist{$prm})
- or croak("Unknow parameter '$prm'");
- ref($value) eq $$checklist{$prm}
- or croak("Invalid value for parameter '$prm'");
- $prm=unpack('@2A*',$prm);
- $$outhash{$prm}=$value;
- }
- for (@$mandatory) {
- exists($$outhash{$_})
- or croak("Missing mandatory parameter '".lc($_)."'");
- }
-}
-
-sub _Error {
- print "Parse error.\n";
-}
-
-sub _DBLoad {
- {
- no strict 'refs';
-
- exists(${__PACKAGE__.'::'}{_DBParse})#Already loaded ?
- and return;
- }
- my($fname)=__FILE__;
- my(@drv);
- open(DRV,"<$fname") or die "Report this as a BUG: Cannot open $fname";
- while(<DRV>) {
- /^\s*sub\s+_Parse\s*{\s*$/ .. /^\s*}\s*#\s*_Parse\s*$/
- and do {
- s/^#DBG>//;
- push(@drv,$_);
- }
- }
- close(DRV);
-
- $drv[0]=~s/_P/_DBP/;
- eval join('',@drv);
-}
-
-#Note that for loading debugging version of the driver,
-#this file will be parsed from 'sub _Parse' up to '}#_Parse' inclusive.
-#So, DO NOT remove comment at end of sub !!!
-sub _Parse {
- my($self)=shift;
-
- my($rules,$states,$lex,$error)
- = @$self{ 'RULES', 'STATES', 'LEX', 'ERROR' };
- my($errstatus,$nberror,$token,$value,$stack,$check,$dotpos)
- = @$self{ 'ERRST', 'NBERR', 'TOKEN', 'VALUE', 'STACK', 'CHECK', 'DOTPOS' };
-
-#DBG> my($debug)=$$self{DEBUG};
-#DBG> my($dbgerror)=0;
-
-#DBG> my($ShowCurToken) = sub {
-#DBG> my($tok)='>';
-#DBG> for (split('',$$token)) {
-#DBG> $tok.= (ord($_) < 32 or ord($_) > 126)
-#DBG> ? sprintf('<%02X>',ord($_))
-#DBG> : $_;
-#DBG> }
-#DBG> $tok.='<';
-#DBG> };
-
- $$errstatus=0;
- $$nberror=0;
- ($$token,$$value)=(undef,undef);
- @$stack=( [ 0, undef ] );
- $$check='';
-
- while(1) {
- my($actions,$act,$stateno);
-
- $stateno=$$stack[-1][0];
- $actions=$$states[$stateno];
-
-#DBG> print STDERR ('-' x 40),"\n";
-#DBG> $debug & 0x2
-#DBG> and print STDERR "In state $stateno:\n";
-#DBG> $debug & 0x08
-#DBG> and print STDERR "Stack:[".
-#DBG> join(',',map { $$_[0] } @$stack).
-#DBG> "]\n";
-
-
- if (exists($$actions{ACTIONS})) {
-
- defined($$token)
- or do {
- ($$token,$$value)=&$lex($self);
-#DBG> $debug & 0x01
-#DBG> and print STDERR "Need token. Got ".&$ShowCurToken."\n";
- };
-
- $act= exists($$actions{ACTIONS}{$$token})
- ? $$actions{ACTIONS}{$$token}
- : exists($$actions{DEFAULT})
- ? $$actions{DEFAULT}
- : undef;
- }
- else {
- $act=$$actions{DEFAULT};
-#DBG> $debug & 0x01
-#DBG> and print STDERR "Don't need token.\n";
- }
-
- defined($act)
- and do {
-
- $act > 0
- and do { #shift
-
-#DBG> $debug & 0x04
-#DBG> and print STDERR "Shift and go to state $act.\n";
-
- $$errstatus
- and do {
- --$$errstatus;
-
-#DBG> $debug & 0x10
-#DBG> and $dbgerror
-#DBG> and $$errstatus == 0
-#DBG> and do {
-#DBG> print STDERR "**End of Error recovery.\n";
-#DBG> $dbgerror=0;
-#DBG> };
- };
-
-
- push(@$stack,[ $act, $$value ]);
-
- $$token ne '' #Don't eat the eof
- and $$token=$$value=undef;
- next;
- };
-
- #reduce
- my($lhs,$len,$code,@sempar,$semval);
- ($lhs,$len,$code)=@{$$rules[-$act]};
-
-#DBG> $debug & 0x04
-#DBG> and $act
-#DBG> and print STDERR "Reduce using rule ".-$act." ($lhs,$len): ";
-
- $act
- or $self->YYAccept();
-
- $$dotpos=$len;
-
- unpack('A1',$lhs) eq '@' #In line rule
- and do {
- $lhs =~ /^\@[0-9]+\-([0-9]+)$/
- or die "In line rule name '$lhs' ill formed: ".
- "report it as a BUG.\n";
- $$dotpos = $1;
- };
-
- @sempar = $$dotpos
- ? map { $$_[1] } @$stack[ -$$dotpos .. -1 ]
- : ();
-
- $semval = $code ? &$code( $self, @sempar )
- : @sempar ? $sempar[0] : undef;
-
- splice(@$stack,-$len,$len);
-
- $$check eq 'ACCEPT'
- and do {
-
-#DBG> $debug & 0x04
-#DBG> and print STDERR "Accept.\n";
-
- return($semval);
- };
-
- $$check eq 'ABORT'
- and do {
-
-#DBG> $debug & 0x04
-#DBG> and print STDERR "Abort.\n";
-
- return(undef);
-
- };
-
-#DBG> $debug & 0x04
-#DBG> and print STDERR "Back to state $$stack[-1][0], then ";
-
- $$check eq 'ERROR'
- or do {
-#DBG> $debug & 0x04
-#DBG> and print STDERR
-#DBG> "go to state $$states[$$stack[-1][0]]{GOTOS}{$lhs}.\n";
-
-#DBG> $debug & 0x10
-#DBG> and $dbgerror
-#DBG> and $$errstatus == 0
-#DBG> and do {
-#DBG> print STDERR "**End of Error recovery.\n";
-#DBG> $dbgerror=0;
-#DBG> };
-
- push(@$stack,
- [ $$states[$$stack[-1][0]]{GOTOS}{$lhs}, $semval ]);
- $$check='';
- next;
- };
-
-#DBG> $debug & 0x04
-#DBG> and print STDERR "Forced Error recovery.\n";
-
- $$check='';
-
- };
-
- #Error
- $$errstatus
- or do {
-
- $$errstatus = 1;
- &$error($self);
- $$errstatus # if 0, then YYErrok has been called
- or next; # so continue parsing
-
-#DBG> $debug & 0x10
-#DBG> and do {
-#DBG> print STDERR "**Entering Error recovery.\n";
-#DBG> ++$dbgerror;
-#DBG> };
-
- ++$$nberror;
-
- };
-
- $$errstatus == 3 #The next token is not valid: discard it
- and do {
- $$token eq '' # End of input: no hope
- and do {
-#DBG> $debug & 0x10
-#DBG> and print STDERR "**At eof: aborting.\n";
- return(undef);
- };
-
-#DBG> $debug & 0x10
-#DBG> and print STDERR "**Dicard invalid token ".&$ShowCurToken.".\n";
-
- $$token=$$value=undef;
- };
-
- $$errstatus=3;
-
- while( @$stack
- and ( not exists($$states[$$stack[-1][0]]{ACTIONS})
- or not exists($$states[$$stack[-1][0]]{ACTIONS}{error})
- or $$states[$$stack[-1][0]]{ACTIONS}{error} <= 0)) {
-
-#DBG> $debug & 0x10
-#DBG> and print STDERR "**Pop state $$stack[-1][0].\n";
-
- pop(@$stack);
- }
-
- @$stack
- or do {
-
-#DBG> $debug & 0x10
-#DBG> and print STDERR "**No state left on stack: aborting.\n";
-
- return(undef);
- };
-
- #shift the error token
-
-#DBG> $debug & 0x10
-#DBG> and print STDERR "**Shift \$error token and go to state ".
-#DBG> $$states[$$stack[-1][0]]{ACTIONS}{error}.
-#DBG> ".\n";
-
- push(@$stack, [ $$states[$$stack[-1][0]]{ACTIONS}{error}, undef ]);
-
- }
-
- #never reached
- croak("Error in driver logic. Please, report it as a BUG");
-
-}#_Parse
-#DO NOT remove comment
-
-1;
-
-}
-#End of include--------------------------------------------------
-
+use Parse::Yapp::Driver;
@@ -512,7 +37,7 @@ sub new {
"import" => 6,
"include" => 11
},
- DEFAULT => -92,
+ DEFAULT => -91,
GOTOS => {
'importlib' => 9,
'interface' => 8,
@@ -581,7 +106,7 @@ sub new {
}
},
{#State 13
- DEFAULT => -125
+ DEFAULT => -124
},
{#State 14
DEFAULT => -10
@@ -636,7 +161,7 @@ sub new {
}
},
{#State 22
- DEFAULT => -121
+ DEFAULT => -120
},
{#State 23
ACTIONS => {
@@ -662,10 +187,10 @@ sub new {
ACTIONS => {
"(" => 36
},
- DEFAULT => -96
+ DEFAULT => -95
},
{#State 27
- DEFAULT => -94
+ DEFAULT => -93
},
{#State 28
DEFAULT => -7
@@ -705,7 +230,7 @@ sub new {
}
},
{#State 35
- DEFAULT => -93
+ DEFAULT => -92
},
{#State 36
ACTIONS => {
@@ -713,7 +238,7 @@ sub new {
'TEXT' => 13,
'IDENTIFIER' => 22
},
- DEFAULT => -102,
+ DEFAULT => -101,
GOTOS => {
'identifier' => 45,
'text' => 46,
@@ -741,7 +266,7 @@ sub new {
"const" => 58,
"struct" => 61
},
- DEFAULT => -92,
+ DEFAULT => -91,
GOTOS => {
'typedecl' => 62,
'function' => 51,
@@ -759,7 +284,7 @@ sub new {
}
},
{#State 40
- DEFAULT => -95
+ DEFAULT => -94
},
{#State 41
ACTIONS => {
@@ -779,7 +304,7 @@ sub new {
"." => 82,
">" => 83
},
- DEFAULT => -98
+ DEFAULT => -97
},
{#State 42
ACTIONS => {
@@ -788,22 +313,22 @@ sub new {
}
},
{#State 43
- DEFAULT => -104
+ DEFAULT => -103
},
{#State 44
- DEFAULT => -124
+ DEFAULT => -123
},
{#State 45
- DEFAULT => -103
+ DEFAULT => -102
},
{#State 46
- DEFAULT => -105
+ DEFAULT => -104
},
{#State 47
ACTIONS => {
";" => 86
},
- DEFAULT => -126,
+ DEFAULT => -125,
GOTOS => {
'optional_semicolon' => 87
}
@@ -817,7 +342,7 @@ sub new {
}
},
{#State 49
- DEFAULT => -92,
+ DEFAULT => -91,
GOTOS => {
'property_list' => 89
}
@@ -826,7 +351,7 @@ sub new {
ACTIONS => {
'IDENTIFIER' => 90
},
- DEFAULT => -123,
+ DEFAULT => -122,
GOTOS => {
'optional_identifier' => 91
}
@@ -845,7 +370,7 @@ sub new {
"const" => 58,
"struct" => 61
},
- DEFAULT => -92,
+ DEFAULT => -91,
GOTOS => {
'typedecl' => 62,
'function' => 51,
@@ -894,7 +419,7 @@ sub new {
DEFAULT => -18
},
{#State 56
- DEFAULT => -92,
+ DEFAULT => -91,
GOTOS => {
'property_list' => 103
}
@@ -920,7 +445,7 @@ sub new {
ACTIONS => {
'IDENTIFIER' => 90
},
- DEFAULT => -123,
+ DEFAULT => -122,
GOTOS => {
'optional_identifier' => 105
}
@@ -932,7 +457,7 @@ sub new {
ACTIONS => {
'IDENTIFIER' => 90
},
- DEFAULT => -123,
+ DEFAULT => -122,
GOTOS => {
'optional_identifier' => 106
}
@@ -941,7 +466,7 @@ sub new {
ACTIONS => {
'IDENTIFIER' => 90
},
- DEFAULT => -123,
+ DEFAULT => -122,
GOTOS => {
'optional_identifier' => 107
}
@@ -964,7 +489,7 @@ sub new {
'TEXT' => 13,
'IDENTIFIER' => 22
},
- DEFAULT => -102,
+ DEFAULT => -101,
GOTOS => {
'identifier' => 45,
'anytext' => 108,
@@ -978,7 +503,7 @@ sub new {
'TEXT' => 13,
'IDENTIFIER' => 22
},
- DEFAULT => -102,
+ DEFAULT => -101,
GOTOS => {
'identifier' => 45,
'anytext' => 109,
@@ -992,7 +517,7 @@ sub new {
'TEXT' => 13,
'IDENTIFIER' => 22
},
- DEFAULT => -102,
+ DEFAULT => -101,
GOTOS => {
'identifier' => 45,
'anytext' => 110,
@@ -1006,7 +531,7 @@ sub new {
'TEXT' => 13,
'IDENTIFIER' => 22
},
- DEFAULT => -102,
+ DEFAULT => -101,
GOTOS => {
'identifier' => 45,
'anytext' => 111,
@@ -1020,7 +545,7 @@ sub new {
'TEXT' => 13,
'IDENTIFIER' => 22
},
- DEFAULT => -102,
+ DEFAULT => -101,
GOTOS => {
'identifier' => 45,
'anytext' => 112,
@@ -1034,7 +559,7 @@ sub new {
'TEXT' => 13,
'IDENTIFIER' => 22
},
- DEFAULT => -102,
+ DEFAULT => -101,
GOTOS => {
'identifier' => 45,
'anytext' => 113,
@@ -1048,7 +573,7 @@ sub new {
'TEXT' => 13,
'IDENTIFIER' => 22
},
- DEFAULT => -102,
+ DEFAULT => -101,
GOTOS => {
'identifier' => 45,
'anytext' => 114,
@@ -1062,7 +587,7 @@ sub new {
'TEXT' => 13,
'IDENTIFIER' => 22
},
- DEFAULT => -102,
+ DEFAULT => -101,
GOTOS => {
'identifier' => 45,
'anytext' => 115,
@@ -1077,7 +602,7 @@ sub new {
'TEXT' => 13,
'IDENTIFIER' => 22
},
- DEFAULT => -102,
+ DEFAULT => -101,
GOTOS => {
'identifier' => 45,
'anytext' => 117,
@@ -1091,7 +616,7 @@ sub new {
'TEXT' => 13,
'IDENTIFIER' => 22
},
- DEFAULT => -102,
+ DEFAULT => -101,
GOTOS => {
'identifier' => 45,
'anytext' => 118,
@@ -1105,7 +630,7 @@ sub new {
'TEXT' => 13,
'IDENTIFIER' => 22
},
- DEFAULT => -102,
+ DEFAULT => -101,
GOTOS => {
'identifier' => 45,
'anytext' => 119,
@@ -1119,7 +644,7 @@ sub new {
'TEXT' => 13,
'IDENTIFIER' => 22
},
- DEFAULT => -102,
+ DEFAULT => -101,
GOTOS => {
'identifier' => 45,
'anytext' => 115,
@@ -1134,7 +659,7 @@ sub new {
'TEXT' => 13,
'IDENTIFIER' => 22
},
- DEFAULT => -102,
+ DEFAULT => -101,
GOTOS => {
'identifier' => 45,
'anytext' => 121,
@@ -1148,7 +673,7 @@ sub new {
'TEXT' => 13,
'IDENTIFIER' => 22
},
- DEFAULT => -102,
+ DEFAULT => -101,
GOTOS => {
'identifier' => 45,
'anytext' => 122,
@@ -1162,7 +687,7 @@ sub new {
'TEXT' => 13,
'IDENTIFIER' => 22
},
- DEFAULT => -102,
+ DEFAULT => -101,
GOTOS => {
'identifier' => 45,
'anytext' => 123,
@@ -1176,7 +701,7 @@ sub new {
'TEXT' => 13,
'IDENTIFIER' => 22
},
- DEFAULT => -102,
+ DEFAULT => -101,
GOTOS => {
'identifier' => 45,
'anytext' => 124,
@@ -1185,10 +710,10 @@ sub new {
}
},
{#State 85
- DEFAULT => -97
+ DEFAULT => -96
},
{#State 86
- DEFAULT => -127
+ DEFAULT => -126
},
{#State 87
DEFAULT => -12
@@ -1223,13 +748,13 @@ sub new {
}
},
{#State 90
- DEFAULT => -122
+ DEFAULT => -121
},
{#State 91
ACTIONS => {
"{" => 128
},
- DEFAULT => -77,
+ DEFAULT => -76,
GOTOS => {
'union_body' => 129,
'opt_union_body' => 127
@@ -1239,7 +764,7 @@ sub new {
ACTIONS => {
";" => 86
},
- DEFAULT => -126,
+ DEFAULT => -125,
GOTOS => {
'optional_semicolon' => 130
}
@@ -1251,13 +776,13 @@ sub new {
DEFAULT => -40
},
{#State 95
- DEFAULT => -48
+ DEFAULT => -47
},
{#State 96
- DEFAULT => -46
+ DEFAULT => -45
},
{#State 97
- DEFAULT => -45
+ DEFAULT => -44
},
{#State 98
ACTIONS => {
@@ -1268,7 +793,7 @@ sub new {
}
},
{#State 99
- DEFAULT => -47
+ DEFAULT => -46
},
{#State 100
DEFAULT => -41
@@ -1299,7 +824,7 @@ sub new {
}
},
{#State 104
- DEFAULT => -81,
+ DEFAULT => -80,
GOTOS => {
'pointers' => 140
}
@@ -1308,7 +833,7 @@ sub new {
ACTIONS => {
"{" => 142
},
- DEFAULT => -67,
+ DEFAULT => -66,
GOTOS => {
'struct_body' => 141,
'opt_struct_body' => 143
@@ -1318,7 +843,7 @@ sub new {
ACTIONS => {
"{" => 144
},
- DEFAULT => -50,
+ DEFAULT => -49,
GOTOS => {
'opt_enum_body' => 146,
'enum_body' => 145
@@ -1328,7 +853,7 @@ sub new {
ACTIONS => {
"{" => 148
},
- DEFAULT => -58,
+ DEFAULT => -57,
GOTOS => {
'bitmap_body' => 149,
'opt_bitmap_body' => 147
@@ -1352,7 +877,7 @@ sub new {
"." => 82,
">" => 83
},
- DEFAULT => -115
+ DEFAULT => -114
},
{#State 109
ACTIONS => {
@@ -1363,7 +888,7 @@ sub new {
"{" => 76,
"=" => 79
},
- DEFAULT => -106
+ DEFAULT => -105
},
{#State 110
ACTIONS => {
@@ -1383,7 +908,7 @@ sub new {
"." => 82,
">" => 83
},
- DEFAULT => -110
+ DEFAULT => -109
},
{#State 111
ACTIONS => {
@@ -1403,7 +928,7 @@ sub new {
"." => 82,
">" => 83
},
- DEFAULT => -118
+ DEFAULT => -117
},
{#State 112
ACTIONS => {
@@ -1414,7 +939,7 @@ sub new {
"{" => 76,
"=" => 79
},
- DEFAULT => -117
+ DEFAULT => -116
},
{#State 113
ACTIONS => {
@@ -1425,7 +950,7 @@ sub new {
"{" => 76,
"=" => 79
},
- DEFAULT => -108
+ DEFAULT => -107
},
{#State 114
ACTIONS => {
@@ -1445,7 +970,7 @@ sub new {
"." => 82,
">" => 83
},
- DEFAULT => -114
+ DEFAULT => -113
},
{#State 115
ACTIONS => {
@@ -1465,7 +990,7 @@ sub new {
"." => 82,
">" => 83
},
- DEFAULT => -100
+ DEFAULT => -99
},
{#State 116
ACTIONS => {
@@ -1482,7 +1007,7 @@ sub new {
"{" => 76,
"=" => 79
},
- DEFAULT => -112
+ DEFAULT => -111
},
{#State 118
ACTIONS => {
@@ -1493,7 +1018,7 @@ sub new {
"{" => 76,
"=" => 79
},
- DEFAULT => -113
+ DEFAULT => -112
},
{#State 119
ACTIONS => {
@@ -1513,7 +1038,7 @@ sub new {
"." => 82,
">" => 83
},
- DEFAULT => -116
+ DEFAULT => -115
},
{#State 120
ACTIONS => {
@@ -1530,7 +1055,7 @@ sub new {
"{" => 76,
"=" => 79
},
- DEFAULT => -111
+ DEFAULT => -110
},
{#State 122
ACTIONS => {
@@ -1541,7 +1066,7 @@ sub new {
"{" => 76,
"=" => 79
},
- DEFAULT => -107
+ DEFAULT => -106
},
{#State 123
ACTIONS => {
@@ -1552,7 +1077,7 @@ sub new {
"{" => 76,
"=" => 79
},
- DEFAULT => -109
+ DEFAULT => -108
},
{#State 124
ACTIONS => {
@@ -1572,7 +1097,7 @@ sub new {
"." => 82,
">" => 83
},
- DEFAULT => -99
+ DEFAULT => -98
},
{#State 125
DEFAULT => -14
@@ -1586,22 +1111,22 @@ sub new {
}
},
{#State 127
- DEFAULT => -79
+ DEFAULT => -78
},
{#State 128
- DEFAULT => -74,
+ DEFAULT => -73,
GOTOS => {
'union_elements' => 154
}
},
{#State 129
- DEFAULT => -78
+ DEFAULT => -77
},
{#State 130
DEFAULT => -15
},
{#State 131
- DEFAULT => -44
+ DEFAULT => -43
},
{#State 132
ACTIONS => {
@@ -1644,16 +1169,16 @@ sub new {
}
},
{#State 141
- DEFAULT => -68
+ DEFAULT => -67
},
{#State 142
- DEFAULT => -83,
+ DEFAULT => -82,
GOTOS => {
'element_list1' => 159
}
},
{#State 143
- DEFAULT => -69
+ DEFAULT => -68
},
{#State 144
ACTIONS => {
@@ -1666,19 +1191,19 @@ sub new {
}
},
{#State 145
- DEFAULT => -51
+ DEFAULT => -50
},
{#State 146
- DEFAULT => -52
+ DEFAULT => -51
},
{#State 147
- DEFAULT => -60
+ DEFAULT => -59
},
{#State 148
ACTIONS => {
'IDENTIFIER' => 22
},
- DEFAULT => -63,
+ DEFAULT => -62,
GOTOS => {
'identifier' => 165,
'bitmap_element' => 164,
@@ -1687,7 +1212,7 @@ sub new {
}
},
{#State 149
- DEFAULT => -59
+ DEFAULT => -58
},
{#State 150
ACTIONS => {
@@ -1695,7 +1220,7 @@ sub new {
'TEXT' => 13,
'IDENTIFIER' => 22
},
- DEFAULT => -102,
+ DEFAULT => -101,
GOTOS => {
'identifier' => 45,
'anytext' => 167,
@@ -1709,7 +1234,7 @@ sub new {
'TEXT' => 13,
'IDENTIFIER' => 22
},
- DEFAULT => -102,
+ DEFAULT => -101,
GOTOS => {
'identifier' => 45,
'anytext' => 168,
@@ -1723,7 +1248,7 @@ sub new {
'TEXT' => 13,
'IDENTIFIER' => 22
},
- DEFAULT => -102,
+ DEFAULT => -101,
GOTOS => {
'identifier' => 45,
'anytext' => 169,
@@ -1735,7 +1260,7 @@ sub new {
ACTIONS => {
"[" => 170
},
- DEFAULT => -89,
+ DEFAULT => -88,
GOTOS => {
'array_len' => 171
}
@@ -1744,7 +1269,7 @@ sub new {
ACTIONS => {
"}" => 172
},
- DEFAULT => -92,
+ DEFAULT => -91,
GOTOS => {
'optional_base_element' => 174,
'property_list' => 173
@@ -1752,11 +1277,11 @@ sub new {
},
{#State 155
ACTIONS => {
- "," => -85,
+ "," => -84,
"void" => 178,
- ")" => -85
+ ")" => -84
},
- DEFAULT => -92,
+ DEFAULT => -91,
GOTOS => {
'base_element' => 175,
'element_list2' => 177,
@@ -1778,13 +1303,13 @@ sub new {
}
},
{#State 158
- DEFAULT => -82
+ DEFAULT => -81
},
{#State 159
ACTIONS => {
"}" => 182
},
- DEFAULT => -92,
+ DEFAULT => -91,
GOTOS => {
'base_element' => 183,
'property_list' => 176
@@ -1794,10 +1319,10 @@ sub new {
ACTIONS => {
"=" => 184
},
- DEFAULT => -55
+ DEFAULT => -54
},
{#State 161
- DEFAULT => -53
+ DEFAULT => -52
},
{#State 162
ACTIONS => {
@@ -1809,10 +1334,10 @@ sub new {
ACTIONS => {
"," => 187
},
- DEFAULT => -64
+ DEFAULT => -63
},
{#State 164
- DEFAULT => -61
+ DEFAULT => -60
},
{#State 165
ACTIONS => {
@@ -1842,7 +1367,7 @@ sub new {
"." => 82,
">" => 83
},
- DEFAULT => -120
+ DEFAULT => -119
},
{#State 168
ACTIONS => {
@@ -1862,7 +1387,7 @@ sub new {
"." => 82,
">" => 83
},
- DEFAULT => -101
+ DEFAULT => -100
},
{#State 169
ACTIONS => {
@@ -1873,7 +1398,7 @@ sub new {
"{" => 76,
"=" => 79
},
- DEFAULT => -119
+ DEFAULT => -118
},
{#State 170
ACTIONS => {
@@ -1882,7 +1407,7 @@ sub new {
"]" => 190,
'IDENTIFIER' => 22
},
- DEFAULT => -102,
+ DEFAULT => -101,
GOTOS => {
'identifier' => 45,
'anytext' => 191,
@@ -1896,13 +1421,13 @@ sub new {
}
},
{#State 172
- DEFAULT => -76
+ DEFAULT => -75
},
{#State 173
ACTIONS => {
"[" => 17
},
- DEFAULT => -92,
+ DEFAULT => -91,
GOTOS => {
'base_or_empty' => 193,
'base_element' => 194,
@@ -1911,10 +1436,10 @@ sub new {
}
},
{#State 174
- DEFAULT => -75
+ DEFAULT => -74
},
{#State 175
- DEFAULT => -87
+ DEFAULT => -86
},
{#State 176
ACTIONS => {
@@ -1928,7 +1453,6 @@ sub new {
"[" => 17,
"struct" => 61
},
- DEFAULT => -43,
GOTOS => {
'existingtype' => 99,
'bitmap' => 65,
@@ -1948,7 +1472,7 @@ sub new {
}
},
{#State 178
- DEFAULT => -86
+ DEFAULT => -85
},
{#State 179
DEFAULT => -28
@@ -1964,7 +1488,7 @@ sub new {
'TEXT' => 13,
'IDENTIFIER' => 22
},
- DEFAULT => -102,
+ DEFAULT => -101,
GOTOS => {
'identifier' => 45,
'anytext' => 201,
@@ -1973,7 +1497,7 @@ sub new {
}
},
{#State 182
- DEFAULT => -66
+ DEFAULT => -65
},
{#State 183
ACTIONS => {
@@ -1986,7 +1510,7 @@ sub new {
'TEXT' => 13,
'IDENTIFIER' => 22
},
- DEFAULT => -102,
+ DEFAULT => -101,
GOTOS => {
'identifier' => 45,
'anytext' => 203,
@@ -1995,7 +1519,7 @@ sub new {
}
},
{#State 185
- DEFAULT => -49
+ DEFAULT => -48
},
{#State 186
ACTIONS => {
@@ -2021,7 +1545,7 @@ sub new {
'TEXT' => 13,
'IDENTIFIER' => 22
},
- DEFAULT => -102,
+ DEFAULT => -101,
GOTOS => {
'identifier' => 45,
'anytext' => 206,
@@ -2030,13 +1554,13 @@ sub new {
}
},
{#State 189
- DEFAULT => -57
+ DEFAULT => -56
},
{#State 190
ACTIONS => {
"[" => 170
},
- DEFAULT => -89,
+ DEFAULT => -88,
GOTOS => {
'array_len' => 207
}
@@ -2065,7 +1589,7 @@ sub new {
DEFAULT => -35
},
{#State 193
- DEFAULT => -73
+ DEFAULT => -72
},
{#State 194
ACTIONS => {
@@ -2073,7 +1597,7 @@ sub new {
}
},
{#State 195
- DEFAULT => -72
+ DEFAULT => -71
},
{#State 196
ACTIONS => {
@@ -2088,7 +1612,6 @@ sub new {
"[" => 17,
"struct" => 61
},
- DEFAULT => -43,
GOTOS => {
'existingtype' => 99,
'bitmap' => 65,
@@ -2102,13 +1625,13 @@ sub new {
}
},
{#State 197
- DEFAULT => -81,
+ DEFAULT => -80,
GOTOS => {
'pointers' => 211
}
},
{#State 198
- DEFAULT => -92,
+ DEFAULT => -91,
GOTOS => {
'base_element' => 212,
'property_list' => 176
@@ -2125,7 +1648,7 @@ sub new {
'TEXT' => 13,
'IDENTIFIER' => 22
},
- DEFAULT => -102,
+ DEFAULT => -101,
GOTOS => {
'identifier' => 45,
'anytext' => 214,
@@ -2154,7 +1677,7 @@ sub new {
}
},
{#State 202
- DEFAULT => -84
+ DEFAULT => -83
},
{#State 203
ACTIONS => {
@@ -2174,13 +1697,13 @@ sub new {
"." => 82,
">" => 83
},
- DEFAULT => -56
+ DEFAULT => -55
},
{#State 204
- DEFAULT => -54
+ DEFAULT => -53
},
{#State 205
- DEFAULT => -62
+ DEFAULT => -61
},
{#State 206
ACTIONS => {
@@ -2200,25 +1723,25 @@ sub new {
"." => 82,
">" => 83
},
- DEFAULT => -65
+ DEFAULT => -64
},
{#State 207
- DEFAULT => -90
+ DEFAULT => -89
},
{#State 208
ACTIONS => {
"[" => 170
},
- DEFAULT => -89,
+ DEFAULT => -88,
GOTOS => {
'array_len' => 216
}
},
{#State 209
- DEFAULT => -71
+ DEFAULT => -70
},
{#State 210
- DEFAULT => -70
+ DEFAULT => -69
},
{#State 211
ACTIONS => {
@@ -2230,7 +1753,7 @@ sub new {
}
},
{#State 212
- DEFAULT => -88
+ DEFAULT => -87
},
{#State 213
DEFAULT => -27
@@ -2259,13 +1782,13 @@ sub new {
DEFAULT => -25
},
{#State 216
- DEFAULT => -91
+ DEFAULT => -90
},
{#State 217
ACTIONS => {
"[" => 170
},
- DEFAULT => -89,
+ DEFAULT => -88,
GOTOS => {
'array_len' => 219
}
@@ -2274,7 +1797,7 @@ sub new {
DEFAULT => -26
},
{#State 219
- DEFAULT => -80
+ DEFAULT => -79
}
],
yyrules =>
@@ -2322,7 +1845,7 @@ sub
{{
"TYPE" => "IMPORT",
"PATHS" => $_[2],
- "FILE" => $_[0]->YYData->{INPUT_FILENAME},
+ "FILE" => $_[0]->YYData->{FILE},
"LINE" => $_[0]->YYData->{LINE}
}}
],
@@ -2333,7 +1856,7 @@ sub
{{
"TYPE" => "INCLUDE",
"PATHS" => $_[2],
- "FILE" => $_[0]->YYData->{INPUT_FILENAME},
+ "FILE" => $_[0]->YYData->{FILE},
"LINE" => $_[0]->YYData->{LINE}
}}
],
@@ -2344,7 +1867,7 @@ sub
{{
"TYPE" => "IMPORTLIB",
"PATHS" => $_[2],
- "FILE" => $_[0]->YYData->{INPUT_FILENAME},
+ "FILE" => $_[0]->YYData->{FILE},
"LINE" => $_[0]->YYData->{LINE}
}}
],
@@ -2369,7 +1892,7 @@ sub
"PROPERTIES" => $_[1],
"NAME" => $_[3],
"DATA" => $_[5],
- "FILE" => $_[0]->YYData->{INPUT_FILENAME},
+ "FILE" => $_[0]->YYData->{FILE},
"LINE" => $_[0]->YYData->{LINE},
}}
],
@@ -2392,7 +1915,7 @@ sub
"NAME" => $_[3],
"BASE" => $_[4],
"DATA" => $_[6],
- "FILE" => $_[0]->YYData->{INPUT_FILENAME},
+ "FILE" => $_[0]->YYData->{FILE},
"LINE" => $_[0]->YYData->{LINE},
}}
],
@@ -2442,7 +1965,7 @@ sub
"POINTERS" => $_[3],
"NAME" => $_[4],
"VALUE" => $_[6],
- "FILE" => $_[0]->YYData->{INPUT_FILENAME},
+ "FILE" => $_[0]->YYData->{FILE},
"LINE" => $_[0]->YYData->{LINE},
}}
],
@@ -2457,7 +1980,7 @@ sub
"NAME" => $_[4],
"ARRAY_LEN" => $_[5],
"VALUE" => $_[7],
- "FILE" => $_[0]->YYData->{INPUT_FILENAME},
+ "FILE" => $_[0]->YYData->{FILE},
"LINE" => $_[0]->YYData->{LINE},
}}
],
@@ -2471,7 +1994,7 @@ sub
"RETURN_TYPE" => $_[2],
"PROPERTIES" => $_[1],
"ELEMENTS" => $_[5],
- "FILE" => $_[0]->YYData->{INPUT_FILENAME},
+ "FILE" => $_[0]->YYData->{FILE},
"LINE" => $_[0]->YYData->{LINE},
}}
],
@@ -2484,7 +2007,7 @@ sub
"PROPERTIES" => $_[2],
"NAME" => $_[4],
"DATA" => $_[3],
- "FILE" => $_[0]->YYData->{INPUT_FILENAME},
+ "FILE" => $_[0]->YYData->{FILE},
"LINE" => $_[0]->YYData->{LINE},
}}
],
@@ -2531,7 +2054,7 @@ sub
"NAME" => $_[4],
"DATA" => $_[3],
"ARRAY_LEN" => $_[5],
- "FILE" => $_[0]->YYData->{INPUT_FILENAME},
+ "FILE" => $_[0]->YYData->{FILE},
"LINE" => $_[0]->YYData->{LINE},
}}
],
@@ -2560,42 +2083,39 @@ sub
'sign', 1, undef
],
[#Rule 43
- 'existingtype', 0, undef
- ],
- [#Rule 44
'existingtype', 2,
sub
#line 182 "pidl/idl.yp"
-{ "$_[1] $_[2]" }
+{ ($_[1]?$_[1]:"signed") ." $_[2]" }
],
- [#Rule 45
+ [#Rule 44
'existingtype', 1, undef
],
- [#Rule 46
+ [#Rule 45
'type', 1, undef
],
- [#Rule 47
+ [#Rule 46
'type', 1, undef
],
- [#Rule 48
+ [#Rule 47
'type', 1,
sub
#line 186 "pidl/idl.yp"
{ "void" }
],
- [#Rule 49
+ [#Rule 48
'enum_body', 3,
sub
#line 188 "pidl/idl.yp"
{ $_[2] }
],
- [#Rule 50
+ [#Rule 49
'opt_enum_body', 0, undef
],
- [#Rule 51
+ [#Rule 50
'opt_enum_body', 1, undef
],
- [#Rule 52
+ [#Rule 51
'enum', 3,
sub
#line 191 "pidl/idl.yp"
@@ -2605,40 +2125,40 @@ sub
"ELEMENTS" => $_[3]
}}
],
- [#Rule 53
+ [#Rule 52
'enum_elements', 1,
sub
#line 199 "pidl/idl.yp"
{ [ $_[1] ] }
],
- [#Rule 54
+ [#Rule 53
'enum_elements', 3,
sub
#line 200 "pidl/idl.yp"
{ push(@{$_[1]}, $_[3]); $_[1] }
],
- [#Rule 55
+ [#Rule 54
'enum_element', 1, undef
],
- [#Rule 56
+ [#Rule 55
'enum_element', 3,
sub
#line 204 "pidl/idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 57
+ [#Rule 56
'bitmap_body', 3,
sub
#line 207 "pidl/idl.yp"
{ $_[2] }
],
- [#Rule 58
+ [#Rule 57
'opt_bitmap_body', 0, undef
],
- [#Rule 59
+ [#Rule 58
'opt_bitmap_body', 1, undef
],
- [#Rule 60
+ [#Rule 59
'bitmap', 3,
sub
#line 210 "pidl/idl.yp"
@@ -2648,43 +2168,43 @@ sub
"ELEMENTS" => $_[3]
}}
],
- [#Rule 61
+ [#Rule 60
'bitmap_elements', 1,
sub
#line 218 "pidl/idl.yp"
{ [ $_[1] ] }
],
- [#Rule 62
+ [#Rule 61
'bitmap_elements', 3,
sub
#line 219 "pidl/idl.yp"
{ push(@{$_[1]}, $_[3]); $_[1] }
],
- [#Rule 63
+ [#Rule 62
'opt_bitmap_elements', 0, undef
],
- [#Rule 64
+ [#Rule 63
'opt_bitmap_elements', 1, undef
],
- [#Rule 65
+ [#Rule 64
'bitmap_element', 3,
sub
#line 224 "pidl/idl.yp"
{ "$_[1] ( $_[3] )" }
],
- [#Rule 66
+ [#Rule 65
'struct_body', 3,
sub
#line 227 "pidl/idl.yp"
{ $_[2] }
],
- [#Rule 67
+ [#Rule 66
'opt_struct_body', 0, undef
],
- [#Rule 68
+ [#Rule 67
'opt_struct_body', 1, undef
],
- [#Rule 69
+ [#Rule 68
'struct', 3,
sub
#line 231 "pidl/idl.yp"
@@ -2694,7 +2214,7 @@ sub
"ELEMENTS" => $_[3]
}}
],
- [#Rule 70
+ [#Rule 69
'empty_element', 2,
sub
#line 239 "pidl/idl.yp"
@@ -2704,44 +2224,44 @@ sub
"PROPERTIES" => $_[1],
"POINTERS" => 0,
"ARRAY_LEN" => [],
- "FILE" => $_[0]->YYData->{INPUT_FILENAME},
+ "FILE" => $_[0]->YYData->{FILE},
"LINE" => $_[0]->YYData->{LINE},
}}
],
- [#Rule 71
+ [#Rule 70
'base_or_empty', 2, undef
],
- [#Rule 72
+ [#Rule 71
'base_or_empty', 1, undef
],
- [#Rule 73
+ [#Rule 72
'optional_base_element', 2,
sub
#line 253 "pidl/idl.yp"
{ $_[2]->{PROPERTIES} = FlattenHash([$_[1],$_[2]->{PROPERTIES}]); $_[2] }
],
- [#Rule 74
+ [#Rule 73
'union_elements', 0, undef
],
- [#Rule 75
+ [#Rule 74
'union_elements', 2,
sub
#line 258 "pidl/idl.yp"
{ push(@{$_[1]}, $_[2]); $_[1] }
],
- [#Rule 76
+ [#Rule 75
'union_body', 3,
sub
#line 261 "pidl/idl.yp"
{ $_[2] }
],
- [#Rule 77
+ [#Rule 76
'opt_union_body', 0, undef
],
- [#Rule 78
+ [#Rule 77
'opt_union_body', 1, undef
],
- [#Rule 79
+ [#Rule 78
'union', 3,
sub
#line 265 "pidl/idl.yp"
@@ -2751,7 +2271,7 @@ sub
"ELEMENTS" => $_[3]
}}
],
- [#Rule 80
+ [#Rule 79
'base_element', 5,
sub
#line 273 "pidl/idl.yp"
@@ -2761,121 +2281,124 @@ sub
"PROPERTIES" => $_[1],
"POINTERS" => $_[3],
"ARRAY_LEN" => $_[5],
- "FILE" => $_[0]->YYData->{INPUT_FILENAME},
+ "FILE" => $_[0]->YYData->{FILE},
"LINE" => $_[0]->YYData->{LINE},
}}
],
- [#Rule 81
+ [#Rule 80
'pointers', 0,
sub
#line 287 "pidl/idl.yp"
{ 0 }
],
- [#Rule 82
+ [#Rule 81
'pointers', 2,
sub
#line 288 "pidl/idl.yp"
{ $_[1]+1 }
],
- [#Rule 83
+ [#Rule 82
'element_list1', 0, undef
],
- [#Rule 84
+ [#Rule 83
'element_list1', 3,
sub
#line 293 "pidl/idl.yp"
{ push(@{$_[1]}, $_[2]); $_[1] }
],
- [#Rule 85
+ [#Rule 84
'element_list2', 0, undef
],
- [#Rule 86
+ [#Rule 85
'element_list2', 1, undef
],
- [#Rule 87
+ [#Rule 86
'element_list2', 1,
sub
#line 299 "pidl/idl.yp"
{ [ $_[1] ] }
],
- [#Rule 88
+ [#Rule 87
'element_list2', 3,
sub
#line 300 "pidl/idl.yp"
{ push(@{$_[1]}, $_[3]); $_[1] }
],
- [#Rule 89
+ [#Rule 88
'array_len', 0, undef
],
- [#Rule 90
+ [#Rule 89
'array_len', 3,
sub
#line 305 "pidl/idl.yp"
{ push(@{$_[3]}, "*"); $_[3] }
],
- [#Rule 91
+ [#Rule 90
'array_len', 4,
sub
#line 306 "pidl/idl.yp"
{ push(@{$_[4]}, "$_[2]"); $_[4] }
],
- [#Rule 92
+ [#Rule 91
'property_list', 0, undef
],
- [#Rule 93
+ [#Rule 92
'property_list', 4,
sub
#line 312 "pidl/idl.yp"
{ FlattenHash([$_[1],$_[3]]); }
],
- [#Rule 94
+ [#Rule 93
'properties', 1,
sub
#line 315 "pidl/idl.yp"
{ $_[1] }
],
- [#Rule 95
+ [#Rule 94
'properties', 3,
sub
#line 316 "pidl/idl.yp"
{ FlattenHash([$_[1], $_[3]]); }
],
- [#Rule 96
+ [#Rule 95
'property', 1,
sub
#line 319 "pidl/idl.yp"
{{ "$_[1]" => "1" }}
],
- [#Rule 97
+ [#Rule 96
'property', 4,
sub
#line 320 "pidl/idl.yp"
{{ "$_[1]" => "$_[3]" }}
],
- [#Rule 98
+ [#Rule 97
'listtext', 1, undef
],
- [#Rule 99
+ [#Rule 98
'listtext', 3,
sub
#line 325 "pidl/idl.yp"
{ "$_[1] $_[3]" }
],
- [#Rule 100
+ [#Rule 99
'commalisttext', 1, undef
],
- [#Rule 101
+ [#Rule 100
'commalisttext', 3,
sub
#line 330 "pidl/idl.yp"
{ "$_[1],$_[3]" }
],
- [#Rule 102
+ [#Rule 101
'anytext', 0,
sub
#line 334 "pidl/idl.yp"
{ "" }
],
+ [#Rule 102
+ 'anytext', 1, undef
+ ],
[#Rule 103
'anytext', 1, undef
],
@@ -2883,120 +2406,117 @@ sub
'anytext', 1, undef
],
[#Rule 105
- 'anytext', 1, undef
- ],
- [#Rule 106
'anytext', 3,
sub
#line 336 "pidl/idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 107
+ [#Rule 106
'anytext', 3,
sub
#line 337 "pidl/idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 108
+ [#Rule 107
'anytext', 3,
sub
#line 338 "pidl/idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 109
+ [#Rule 108
'anytext', 3,
sub
#line 339 "pidl/idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 110
+ [#Rule 109
'anytext', 3,
sub
#line 340 "pidl/idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 111
+ [#Rule 110
'anytext', 3,
sub
#line 341 "pidl/idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 112
+ [#Rule 111
'anytext', 3,
sub
#line 342 "pidl/idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 113
+ [#Rule 112
'anytext', 3,
sub
#line 343 "pidl/idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 114
+ [#Rule 113
'anytext', 3,
sub
#line 344 "pidl/idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 115
+ [#Rule 114
'anytext', 3,
sub
#line 345 "pidl/idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 116
+ [#Rule 115
'anytext', 3,
sub
#line 346 "pidl/idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 117
+ [#Rule 116
'anytext', 3,
sub
#line 347 "pidl/idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 118
+ [#Rule 117
'anytext', 3,
sub
#line 348 "pidl/idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 119
+ [#Rule 118
'anytext', 5,
sub
#line 349 "pidl/idl.yp"
{ "$_[1]$_[2]$_[3]$_[4]$_[5]" }
],
- [#Rule 120
+ [#Rule 119
'anytext', 5,
sub
#line 350 "pidl/idl.yp"
{ "$_[1]$_[2]$_[3]$_[4]$_[5]" }
],
- [#Rule 121
+ [#Rule 120
'identifier', 1, undef
],
- [#Rule 122
+ [#Rule 121
'optional_identifier', 1, undef
],
- [#Rule 123
+ [#Rule 122
'optional_identifier', 0, undef
],
- [#Rule 124
+ [#Rule 123
'constant', 1, undef
],
- [#Rule 125
+ [#Rule 124
'text', 1,
sub
#line 364 "pidl/idl.yp"
{ "\"$_[1]\"" }
],
- [#Rule 126
+ [#Rule 125
'optional_semicolon', 0, undef
],
- [#Rule 127
+ [#Rule 126
'optional_semicolon', 1, undef
]
],
@@ -3007,6 +2527,8 @@ sub
#line 375 "pidl/idl.yp"
+use Parse::Pidl qw(error);
+
#####################################################################
# flatten an array of hashes into a single hash
sub FlattenHash($)
@@ -3053,15 +2575,13 @@ sub CleanData($)
sub _Error {
if (exists $_[0]->YYData->{ERRMSG}) {
- print $_[0]->YYData->{ERRMSG};
+ error($_[0]->YYData, $_[0]->YYData->{ERRMSG});
delete $_[0]->YYData->{ERRMSG};
return;
};
- my $line = $_[0]->YYData->{LINE};
my $last_token = $_[0]->YYData->{LAST_TOKEN};
- my $file = $_[0]->YYData->{INPUT_FILENAME};
- print "$file:$line: Syntax error near '$last_token'\n";
+ error($_[0]->YYData, "Syntax error near '$last_token'");
}
sub _Lexer($)
@@ -3077,12 +2597,12 @@ again:
if (/^\#/) {
if (s/^\# (\d+) \"(.*?)\"( \d+|)//) {
$parser->YYData->{LINE} = $1-1;
- $parser->YYData->{INPUT_FILENAME} = $2;
+ $parser->YYData->{FILE} = $2;
goto again;
}
if (s/^\#line (\d+) \"(.*?)\"( \d+|)//) {
$parser->YYData->{LINE} = $1-1;
- $parser->YYData->{INPUT_FILENAME} = $2;
+ $parser->YYData->{FILE} = $2;
goto again;
}
if (s/^(\#.*)$//m) {
@@ -3124,7 +2644,7 @@ sub parse_string
my $self = new Parse::Pidl::IDL;
- $self->YYData->{INPUT_FILENAME} = $filename;
+ $self->YYData->{FILE} = $filename;
$self->YYData->{INPUT} = $data;
$self->YYData->{LINE} = 0;
$self->YYData->{LAST_TOKEN} = "NONE";
diff --git a/tools/pidl/lib/Parse/Pidl/NDR.pm b/tools/pidl/lib/Parse/Pidl/NDR.pm
index 9670e05744..2ba8461e4a 100644
--- a/tools/pidl/lib/Parse/Pidl/NDR.pm
+++ b/tools/pidl/lib/Parse/Pidl/NDR.pm
@@ -35,8 +35,10 @@ use vars qw($VERSION);
$VERSION = '0.01';
@ISA = qw(Exporter);
@EXPORT = qw(GetPrevLevel GetNextLevel ContainsDeferred ContainsString);
+@EXPORT_OK = qw(GetElementLevelTable ParseElement ValidElement);
use strict;
+use Parse::Pidl qw(warning fatal);
use Parse::Pidl::Typelist qw(hasType getType expandAlias);
use Parse::Pidl::Util qw(has_property property_matches);
@@ -70,20 +72,6 @@ my $scalar_alignment = {
'ipv4address' => 4
};
-sub nonfatal($$)
-{
- my ($e,$s) = @_;
- warn ("$e->{FILE}:$e->{LINE}: warning: $s\n");
-}
-
-#####################################################################
-# signal a fatal validation error
-sub fatal($$)
-{
- my ($pos,$s) = @_;
- die("$pos->{FILE}:$pos->{LINE}:$s\n");
-}
-
sub GetElementLevelTable($)
{
my $e = shift;
@@ -113,7 +101,7 @@ sub GetElementLevelTable($)
if (has_property($e, "string")) { $needptrs++; }
if ($#bracket_array >= 0) { $needptrs = 0; }
- nonfatal($e, "[out] argument `$e->{NAME}' not a pointer") if ($needptrs > $e->{POINTERS});
+ warning($e, "[out] argument `$e->{NAME}' not a pointer") if ($needptrs > $e->{POINTERS});
}
# Parse the [][][][] style array stuff
@@ -181,7 +169,7 @@ sub GetElementLevelTable($)
LEVEL => $level
});
- nonfatal($e, "top-level \[out\] pointer `$e->{NAME}' is not a \[ref\] pointer")
+ warning($e, "top-level \[out\] pointer `$e->{NAME}' is not a \[ref\] pointer")
if ($i == 1 and pointer_type($e) ne "ref" and
$e->{PARENT}->{TYPE} eq "FUNCTION" and
not has_property($e, "in"));
@@ -256,15 +244,15 @@ sub GetElementLevelTable($)
}
if (scalar(@size_is) > 0) {
- nonfatal($e, "size_is() on non-array element");
+ warning($e, "size_is() on non-array element");
}
if (scalar(@length_is) > 0) {
- nonfatal($e, "length_is() on non-array element");
+ warning($e, "length_is() on non-array element");
}
if (has_property($e, "string")) {
- nonfatal($e, "string() attribute on non-array element");
+ warning($e, "string() attribute on non-array element");
}
push (@$order, {
@@ -608,7 +596,7 @@ sub ParseInterface($)
if (not has_property($idl, "pointer_default_top")) {
$idl->{PROPERTIES}->{pointer_default_top} = "ref";
} else {
- nonfatal($idl, "pointer_default_top() is a pidl extension and should not be used");
+ warning($idl, "pointer_default_top() is a pidl extension and should not be used");
}
foreach my $d (@{$idl->{DATA}}) {
@@ -850,10 +838,10 @@ sub ValidProperties($$)
return unless defined $e->{PROPERTIES};
foreach my $key (keys %{$e->{PROPERTIES}}) {
- fatal($e, el_name($e) . ": unknown property '$key'\n")
+ warning($e, el_name($e) . ": unknown property '$key'")
unless defined($property_list{$key});
- fatal($e, el_name($e) . ": property '$key' not allowed on '$t'\n")
+ fatal($e, el_name($e) . ": property '$key' not allowed on '$t'")
unless grep($t, @{$property_list{$key}});
}
}
@@ -909,12 +897,11 @@ sub ValidElement($)
}
if ($t1 ne $t2) {
- nonfatal($e, el_name($e) . ": switch_is() is of type $e2->{TYPE} ($t2), while discriminator type for union $type->{NAME} is $discriminator_type ($t1)");
+ warning($e, el_name($e) . ": switch_is() is of type $e2->{TYPE} ($t2), while discriminator type for union $type->{NAME} is $discriminator_type ($t1)");
}
}
}
-
if (has_property($e, "subcontext") and has_property($e, "represent_as")) {
fatal($e, el_name($e) . " : subcontext() and represent_as() can not be used on the same element");
}
@@ -931,6 +918,10 @@ sub ValidElement($)
fatal($e, el_name($e) . " : represent_as() and value() can not be used on the same element");
}
+ if (has_property($e, "subcontext")) {
+ warning($e, "subcontext() is deprecated. Use represent_as() or transmit_as() instead");
+ }
+
if (defined (has_property($e, "subcontext_size")) and not defined(has_property($e, "subcontext"))) {
fatal($e, el_name($e) . " : subcontext_size() on non-subcontext element");
}
@@ -979,12 +970,12 @@ sub ValidUnion($)
if (defined($e->{PROPERTIES}->{default}) and
defined($e->{PROPERTIES}->{case})) {
- fatal $e, "Union member $e->{NAME} can not have both default and case properties!\n";
+ fatal($e, "Union member $e->{NAME} can not have both default and case properties!");
}
unless (defined ($e->{PROPERTIES}->{default}) or
defined ($e->{PROPERTIES}->{case})) {
- fatal $e, "Union member $e->{NAME} must have default or case property\n";
+ fatal($e, "Union member $e->{NAME} must have default or case property");
}
if (has_property($e, "ref")) {
@@ -1029,7 +1020,7 @@ sub ValidFunction($)
foreach my $e (@{$fn->{ELEMENTS}}) {
$e->{PARENT} = $fn;
if (has_property($e, "ref") && !$e->{POINTERS}) {
- fatal $e, "[ref] variables must be pointers ($fn->{NAME}/$e->{NAME})\n";
+ fatal($e, "[ref] variables must be pointers ($fn->{NAME}/$e->{NAME})");
}
ValidElement($e);
}
@@ -1043,7 +1034,7 @@ sub ValidInterface($)
my($data) = $interface->{DATA};
if (has_property($interface, "helper")) {
- nonfatal $interface, "helper() is pidl-specific and deprecated. Use `include' instead";
+ warning($interface, "helper() is pidl-specific and deprecated. Use `include' instead");
}
ValidProperties($interface,"INTERFACE");
@@ -1051,19 +1042,19 @@ sub ValidInterface($)
if (has_property($interface, "pointer_default")) {
if (not grep (/$interface->{PROPERTIES}->{pointer_default}/,
("ref", "unique", "ptr"))) {
- fatal $interface, "Unknown default pointer type `$interface->{PROPERTIES}->{pointer_default}'";
+ fatal($interface, "Unknown default pointer type `$interface->{PROPERTIES}->{pointer_default}'");
}
}
if (has_property($interface, "object")) {
if (has_property($interface, "version") &&
$interface->{PROPERTIES}->{version} != 0) {
- fatal $interface, "Object interfaces must have version 0.0 ($interface->{NAME})\n";
+ fatal($interface, "Object interfaces must have version 0.0 ($interface->{NAME})");
}
if (!defined($interface->{BASE}) &&
not ($interface->{NAME} eq "IUnknown")) {
- fatal $interface, "Object interfaces must all derive from IUnknown ($interface->{NAME})\n";
+ fatal($interface, "Object interfaces must all derive from IUnknown ($interface->{NAME})");
}
}
@@ -1086,7 +1077,7 @@ sub Validate($)
($x->{TYPE} eq "INTERFACE") &&
ValidInterface($x);
($x->{TYPE} eq "IMPORTLIB") &&
- nonfatal($x, "importlib() not supported");
+ warning($x, "importlib() not supported");
}
}
diff --git a/tools/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm b/tools/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
index 6cfab753e9..ade2711d85 100644
--- a/tools/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
+++ b/tools/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
@@ -7,10 +7,11 @@
package Parse::Pidl::Samba3::ClientNDR;
use strict;
+use Parse::Pidl qw(fatal warning);
use Parse::Pidl::Typelist qw(hasType getType mapType scalar_is_reference);
-use Parse::Pidl::Util qw(has_property ParseExpr is_constant);
+use Parse::Pidl::Util qw(has_property is_constant);
use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel ContainsDeferred);
-use Parse::Pidl::Samba4 qw(DeclLong_cli IsUniqueOut);
+use Parse::Pidl::Samba4 qw(DeclLong);
use vars qw($VERSION);
$VERSION = '0.01';
@@ -22,8 +23,6 @@ sub indent() { $tabs.="\t"; }
sub deindent() { $tabs = substr($tabs, 1); }
sub pidl($) { $res .= $tabs.(shift)."\n"; }
sub pidl_hdr($) { $res_hdr .= (shift)."\n"; }
-sub fatal($$) { my ($e,$s) = @_; die("$e->{ORIGINAL}->{FILE}:$e->{ORIGINAL}->{LINE}: $s\n"); }
-sub warning($$) { my ($e,$s) = @_; warn("$e->{ORIGINAL}->{FILE}:$e->{ORIGINAL}->{LINE}: $s\n"); }
sub fn_declare($) { my ($n) = @_; pidl $n; pidl_hdr "$n;"; }
sub ParseFunction($$)
@@ -36,7 +35,7 @@ sub ParseFunction($$)
my $ufn = "DCERPC_".uc($fn->{NAME});
foreach (@{$fn->{ELEMENTS}}) {
- $defargs .= ", " . DeclLong_cli($_);
+ $defargs .= ", " . DeclLong($_);
}
fn_declare "NTSTATUS rpccli_$fn->{NAME}(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx$defargs)";
pidl "{";
@@ -48,12 +47,7 @@ sub ParseFunction($$)
foreach (@{$fn->{ELEMENTS}}) {
if (grep(/in/, @{$_->{DIRECTION}})) {
- if ( IsUniqueOut($_) ) {
- pidl "r.in.$_->{NAME} = *$_->{NAME};";
- }
- else {
pidl "r.in.$_->{NAME} = $_->{NAME};";
- }
}
}
@@ -84,8 +78,12 @@ sub ParseFunction($$)
fatal($e, "[out] argument is not a pointer or array") if ($e->{LEVELS}[0]->{TYPE} ne "POINTER" and $e->{LEVELS}[0]->{TYPE} ne "ARRAY");
- if ( IsUniqueOut($e) ) {
- pidl "*$e->{NAME} = r.out.$e->{NAME};";
+ if ( ($e->{LEVELS}[0]->{TYPE} eq "POINTER") && ($e->{LEVELS}[0]->{POINTER_TYPE} eq "unique") ) {
+ pidl "if ( $e->{NAME} ) {";
+ indent;
+ pidl "*$e->{NAME} = *r.out.$e->{NAME};";
+ deindent;
+ pidl "}";
} else {
pidl "*$e->{NAME} = *r.out.$e->{NAME};";
}
diff --git a/tools/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm b/tools/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm
index a7c81e4e2b..52e384814d 100644
--- a/tools/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm
+++ b/tools/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm
@@ -7,9 +7,10 @@
package Parse::Pidl::Samba3::ServerNDR;
use strict;
-use Parse::Pidl::Typelist qw(hasType getType mapType scalar_is_reference);
-use Parse::Pidl::Util qw(has_property ParseExpr is_constant);
-use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel ContainsDeferred);
+use Parse::Pidl qw(warning fatal);
+use Parse::Pidl::Typelist qw(mapType scalar_is_reference);
+use Parse::Pidl::Util qw(ParseExpr has_property is_constant);
+use Parse::Pidl::NDR qw(GetNextLevel);
use Parse::Pidl::Samba4 qw(DeclLong);
use vars qw($VERSION);
@@ -22,25 +23,61 @@ sub indent() { $tabs.="\t"; }
sub deindent() { $tabs = substr($tabs, 1); }
sub pidl($) { $res .= $tabs.(shift)."\n"; }
sub pidl_hdr($) { $res_hdr .= (shift)."\n"; }
-sub fatal($$) { my ($e,$s) = @_; die("$e->{ORIGINAL}->{FILE}:$e->{ORIGINAL}->{LINE}: $s\n"); }
-sub warning($$) { my ($e,$s) = @_; warn("$e->{ORIGINAL}->{FILE}:$e->{ORIGINAL}->{LINE}: $s\n"); }
sub fn_declare($) { my ($n) = @_; pidl $n; pidl_hdr "$n;"; }
+sub DeclLevel($$)
+{
+ sub DeclLevel($$);
+ my ($e, $l) = @_;
+
+ my $ret = "";
+
+ if (has_property($e, "charset")) {
+ $ret.="const char";
+ } else {
+ $ret.=mapType($e->{TYPE});
+ }
+
+ my $numstar = $e->{ORIGINAL}->{POINTERS};
+ if ($numstar >= 1) {
+ $numstar-- if scalar_is_reference($e->{TYPE});
+ }
+ foreach (@{$e->{ORIGINAL}->{ARRAY_LEN}})
+ {
+ next if is_constant($_) and
+ not has_property($e, "charset");
+ $numstar++;
+ }
+ $numstar -= $l;
+ die ("Too few pointers") if $numstar < 0;
+ if ($numstar > 0)
+ {
+ $ret.=" ";
+ $ret.="*" foreach (1..$numstar);
+ }
+
+ return $ret;
+}
+
sub AllocOutVar($$$$)
{
my ($e, $mem_ctx, $name, $env) = @_;
my $l = $e->{LEVELS}[0];
+ my $nl = $l;
if ($l->{TYPE} eq "POINTER") {
- $l = GetNextLevel($e, $l);
+ $nl = GetNextLevel($e, $l);
}
if ($l->{TYPE} eq "ARRAY") {
- my $size = ParseExpr($l->{SIZE_IS}, $env);
- pidl "$name = talloc_zero_size($mem_ctx, sizeof(*$name) * $size);";
+ my $size = ParseExpr($l->{SIZE_IS}, $env, $e);
+ pidl "$name = talloc_zero_array($mem_ctx, " . DeclLevel($e, 1) . ", $size);";
+ } elsif ($l->{TYPE} eq "POINTER" and $nl->{TYPE} eq "ARRAY") {
+ my $size = ParseExpr($nl->{SIZE_IS}, $env, $e);
+ pidl "$name = talloc_zero_array($mem_ctx, " . DeclLevel($e, 1) . ", $size);";
} else {
- pidl "$name = talloc_zero_size($mem_ctx, sizeof(*$name));";
+ pidl "$name = talloc_zero($mem_ctx, " . DeclLevel($e, 1) . ");";
}
pidl "if ($name == NULL) {";
@@ -96,19 +133,16 @@ sub ParseFunction($$)
pidl "ZERO_STRUCT(r.out);" if ($hasout);
- my $proto = "_$fn->{NAME}(pipes_struct *p";
- my $ret = "_$fn->{NAME}(p";
+ my $proto = "_$fn->{NAME}(pipes_struct *p, struct $fn->{NAME} *r";
+ my $ret = "_$fn->{NAME}(p, &r";
foreach (@{$fn->{ELEMENTS}}) {
my @dir = @{$_->{DIRECTION}};
if (grep(/in/, @dir) and grep(/out/, @dir)) {
pidl "r.out.$_->{NAME} = r.in.$_->{NAME};";
- } elsif (grep(/out/, @dir)) {
+ } elsif (grep(/out/, @dir) and not
+ has_property($_, "represent_as")) {
AllocOutVar($_, "mem_ctx", "r.out.$_->{NAME}", \%env);
}
- if (grep(/in/, @dir)) { $ret .= ", r.in.$_->{NAME}"; }
- else { $ret .= ", r.out.$_->{NAME}"; }
-
- $proto .= ", " . DeclLong($_);
}
$ret .= ")";
$proto .= ");";
diff --git a/tools/pidl/lib/Parse/Pidl/Samba4.pm b/tools/pidl/lib/Parse/Pidl/Samba4.pm
index e11bd6a5ff..4ef2daa591 100644
--- a/tools/pidl/lib/Parse/Pidl/Samba4.pm
+++ b/tools/pidl/lib/Parse/Pidl/Samba4.pm
@@ -7,7 +7,7 @@ package Parse::Pidl::Samba4;
require Exporter;
@ISA = qw(Exporter);
-@EXPORT = qw(is_intree choose_header DeclLong DeclLong_cli IsUniqueOut);
+@EXPORT = qw(is_intree choose_header DeclLong);
use Parse::Pidl::Util qw(has_property is_constant);
use Parse::Pidl::Typelist qw(mapType scalar_is_reference);
@@ -32,19 +32,9 @@ sub choose_header($$)
return "#include <$out>";
}
-sub IsUniqueOut($)
-{
- my ($e) = shift;
-
- return grep(/out/, @{$e->{DIRECTION}}) &&
- ((($e->{LEVELS}[0]->{TYPE} eq "POINTER") &&
- ($e->{LEVELS}[0]->{POINTER_TYPE} eq "unique")) ||
- ($e->{LEVELS}[0]->{TYPE} eq "ARRAY"));
-}
-
-sub DeclLong_int($$)
+sub DeclLong($)
{
- my($element,$cli) = @_;
+ my($element) = shift;
my $ret = "";
if (has_property($element, "represent_as")) {
@@ -67,9 +57,6 @@ sub DeclLong_int($$)
not has_property($element, "charset");
$numstar++;
}
- if ($cli && IsUniqueOut($element)) {
- $numstar++;
- }
$ret.="*" foreach (1..$numstar);
}
$ret.=$element->{NAME};
@@ -81,14 +68,4 @@ sub DeclLong_int($$)
return $ret;
}
-sub DeclLong($)
-{
- return DeclLong_int($_, 0);
-}
-
-sub DeclLong_cli($)
-{
- return DeclLong_int($_, 1);
-}
-
1;
diff --git a/tools/pidl/lib/Parse/Pidl/Samba4/EJS.pm b/tools/pidl/lib/Parse/Pidl/Samba4/EJS.pm
index 960f610cd9..1ce22d5180 100644
--- a/tools/pidl/lib/Parse/Pidl/Samba4/EJS.pm
+++ b/tools/pidl/lib/Parse/Pidl/Samba4/EJS.pm
@@ -153,7 +153,8 @@ sub EjsPullScalar($$$$$)
my $pl = Parse::Pidl::NDR::GetPrevLevel($e, $l);
$var = get_pointer_to($var);
# have to handle strings specially :(
- if ($e->{TYPE} eq "string" && $pl && $pl->{TYPE} eq "POINTER") {
+ if (Parse::Pidl::Typelist::scalar_is_reference($e->{TYPE})
+ and (defined($pl) and $pl->{TYPE} eq "POINTER")) {
$var = get_pointer_to($var);
}
pidl "NDR_CHECK(ejs_pull_$e->{TYPE}(ejs, v, $name, $var));";
@@ -186,7 +187,11 @@ sub EjsPullPointer($$$$$)
sub EjsPullString($$$$$)
{
my ($e, $l, $var, $name, $env) = @_;
+ my $pl = Parse::Pidl::NDR::GetPrevLevel($e, $l);
$var = get_pointer_to($var);
+ if (defined($pl) and $pl->{TYPE} eq "POINTER") {
+ $var = get_pointer_to($var);
+ }
pidl "NDR_CHECK(ejs_pull_string(ejs, v, $name, $var));";
}
@@ -197,8 +202,8 @@ sub EjsPullArray($$$$$)
{
my ($e, $l, $var, $name, $env) = @_;
my $nl = Parse::Pidl::NDR::GetNextLevel($e, $l);
- my $length = Parse::Pidl::Util::ParseExpr($l->{LENGTH_IS}, $env);
- my $size = Parse::Pidl::Util::ParseExpr($l->{SIZE_IS}, $env);
+ my $length = Parse::Pidl::Util::ParseExpr($l->{LENGTH_IS}, $env, $e);
+ my $size = Parse::Pidl::Util::ParseExpr($l->{SIZE_IS}, $env, $e);
my $pl = Parse::Pidl::NDR::GetPrevLevel($e, $l);
if ($pl && $pl->{TYPE} eq "POINTER") {
$var = get_pointer_to($var);
@@ -237,7 +242,7 @@ sub EjsPullArray($$$$$)
sub EjsPullSwitch($$$$$)
{
my ($e, $l, $var, $name, $env) = @_;
- my $switch_var = Parse::Pidl::Util::ParseExpr($l->{SWITCH_IS}, $env);
+ my $switch_var = Parse::Pidl::Util::ParseExpr($l->{SWITCH_IS}, $env, $e);
pidl "ejs_set_switch(ejs, $switch_var);";
EjsPullElement($e, Parse::Pidl::NDR::GetNextLevel($e, $l), $var, $name, $env);
}
@@ -247,14 +252,14 @@ sub EjsPullSwitch($$$$$)
sub EjsPullElement($$$$$)
{
my ($e, $l, $var, $name, $env) = @_;
- if (has_property($e, "charset")) {
+ if (($l->{TYPE} eq "POINTER")) {
+ EjsPullPointer($e, $l, $var, $name, $env);
+ } elsif (has_property($e, "charset")) {
EjsPullString($e, $l, $var, $name, $env);
} elsif ($l->{TYPE} eq "ARRAY") {
EjsPullArray($e, $l, $var, $name, $env);
} elsif ($l->{TYPE} eq "DATA") {
EjsPullScalar($e, $l, $var, $name, $env);
- } elsif (($l->{TYPE} eq "POINTER")) {
- EjsPullPointer($e, $l, $var, $name, $env);
} elsif (($l->{TYPE} eq "SWITCH")) {
EjsPullSwitch($e, $l, $var, $name, $env);
} else {
@@ -269,7 +274,7 @@ sub EjsPullElementTop($$)
my $e = shift;
my $env = shift;
my $l = $e->{LEVELS}[0];
- my $var = Parse::Pidl::Util::ParseExpr($e->{NAME}, $env);
+ my $var = Parse::Pidl::Util::ParseExpr($e->{NAME}, $env, $e);
my $name = "\"$e->{NAME}\"";
EjsPullElement($e, $l, $var, $name, $env);
}
@@ -445,7 +450,9 @@ sub EjsPushScalar($$$$$)
my ($e, $l, $var, $name, $env) = @_;
# have to handle strings specially :(
my $pl = Parse::Pidl::NDR::GetPrevLevel($e, $l);
- if ($e->{TYPE} ne "string" || ($pl && $pl->{TYPE} eq "POINTER")) {
+
+ if ((not Parse::Pidl::Typelist::scalar_is_reference($e->{TYPE}))
+ or (defined($pl) and $pl->{TYPE} eq "POINTER")) {
$var = get_pointer_to($var);
}
pidl "NDR_CHECK(ejs_push_$e->{TYPE}(ejs, v, $name, $var));";
@@ -456,6 +463,10 @@ sub EjsPushScalar($$$$$)
sub EjsPushString($$$$$)
{
my ($e, $l, $var, $name, $env) = @_;
+ my $pl = Parse::Pidl::NDR::GetPrevLevel($e, $l);
+ if (defined($pl) and $pl->{TYPE} eq "POINTER") {
+ $var = get_pointer_to($var);
+ }
pidl "NDR_CHECK(ejs_push_string(ejs, v, $name, $var));";
}
@@ -485,7 +496,7 @@ sub EjsPushPointer($$$$$)
sub EjsPushSwitch($$$$$)
{
my ($e, $l, $var, $name, $env) = @_;
- my $switch_var = Parse::Pidl::Util::ParseExpr($l->{SWITCH_IS}, $env);
+ my $switch_var = Parse::Pidl::Util::ParseExpr($l->{SWITCH_IS}, $env, $e);
pidl "ejs_set_switch(ejs, $switch_var);";
EjsPushElement($e, Parse::Pidl::NDR::GetNextLevel($e, $l), $var, $name, $env);
}
@@ -497,7 +508,7 @@ sub EjsPushArray($$$$$)
{
my ($e, $l, $var, $name, $env) = @_;
my $nl = Parse::Pidl::NDR::GetNextLevel($e, $l);
- my $length = Parse::Pidl::Util::ParseExpr($l->{LENGTH_IS}, $env);
+ my $length = Parse::Pidl::Util::ParseExpr($l->{LENGTH_IS}, $env, $e);
my $pl = Parse::Pidl::NDR::GetPrevLevel($e, $l);
if ($pl && $pl->{TYPE} eq "POINTER") {
$var = get_pointer_to($var);
@@ -528,14 +539,14 @@ sub EjsPushArray($$$$$)
sub EjsPushElement($$$$$)
{
my ($e, $l, $var, $name, $env) = @_;
- if (has_property($e, "charset")) {
+ if (($l->{TYPE} eq "POINTER")) {
+ EjsPushPointer($e, $l, $var, $name, $env);
+ } elsif (has_property($e, "charset")) {
EjsPushString($e, $l, $var, $name, $env);
} elsif ($l->{TYPE} eq "ARRAY") {
EjsPushArray($e, $l, $var, $name, $env);
} elsif ($l->{TYPE} eq "DATA") {
EjsPushScalar($e, $l, $var, $name, $env);
- } elsif (($l->{TYPE} eq "POINTER")) {
- EjsPushPointer($e, $l, $var, $name, $env);
} elsif (($l->{TYPE} eq "SWITCH")) {
EjsPushSwitch($e, $l, $var, $name, $env);
} else {
@@ -550,7 +561,7 @@ sub EjsPushElementTop($$)
my $e = shift;
my $env = shift;
my $l = $e->{LEVELS}[0];
- my $var = Parse::Pidl::Util::ParseExpr($e->{NAME}, $env);
+ my $var = Parse::Pidl::Util::ParseExpr($e->{NAME}, $env, $e);
my $name = "\"$e->{NAME}\"";
EjsPushElement($e, $l, $var, $name, $env);
}
diff --git a/tools/pidl/lib/Parse/Pidl/Samba4/Header.pm b/tools/pidl/lib/Parse/Pidl/Samba4/Header.pm
index da7d39a238..96f695d1cd 100644
--- a/tools/pidl/lib/Parse/Pidl/Samba4/Header.pm
+++ b/tools/pidl/lib/Parse/Pidl/Samba4/Header.pm
@@ -118,8 +118,8 @@ sub HeaderEnum($$)
my($enum,$name) = @_;
my $first = 1;
- if (not Parse::Pidl::Util::useUintEnums()) {
- pidl "enum $name {\n";
+ pidl "#ifndef USE_UINT_ENUMS\n";
+ pidl "enum $name {\n";
$tab_depth++;
foreach my $e (@{$enum->{ELEMENTS}}) {
unless ($first) { pidl ",\n"; }
@@ -129,9 +129,9 @@ sub HeaderEnum($$)
}
pidl "\n";
$tab_depth--;
- pidl "}";
- } else {
- my $count = 0;
+ pidl "};\n";
+ pidl "#else\n";
+ my $count = 0;
pidl "enum $name { __donnot_use_enum_$name=0x7FFFFFFF};\n";
my $with_val = 0;
my $without_val = 0;
@@ -154,8 +154,8 @@ sub HeaderEnum($$)
}
pidl "#define $name ( $value )\n";
}
+ pidl "#endif\n";
pidl "\n";
- }
}
#####################################################################
@@ -220,7 +220,8 @@ sub HeaderTypedef($)
{
my($typedef) = shift;
HeaderType($typedef, $typedef->{DATA}, $typedef->{NAME});
- pidl ";\n\n" unless ($typedef->{DATA}->{TYPE} eq "BITMAP");
+ pidl ";\n\n" unless ($typedef->{DATA}->{TYPE} eq "BITMAP" or
+ $typedef->{DATA}->{TYPE} eq "ENUM");
}
#####################################################################
diff --git a/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index f104ffbad8..1e199ba62b 100644
--- a/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -10,12 +10,14 @@ package Parse::Pidl::Samba4::NDR::Parser;
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(is_charset_array);
+@EXPORT_OK = qw(check_null_pointer);
use strict;
use Parse::Pidl::Typelist qw(hasType getType mapType);
-use Parse::Pidl::Util qw(has_property ParseExpr print_uuid);
+use Parse::Pidl::Util qw(has_property ParseExpr ParseExprExt print_uuid);
use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel ContainsDeferred);
use Parse::Pidl::Samba4 qw(is_intree choose_header);
+use Parse::Pidl qw(warning);
use vars qw($VERSION);
$VERSION = '0.01';
@@ -165,29 +167,6 @@ sub deindent()
}
#####################################################################
-# check that a variable we get from ParseExpr isn't a null pointer
-sub check_null_pointer($)
-{
- my $size = shift;
- if ($size =~ /^\*/) {
- my $size2 = substr($size, 1);
- pidl "if ($size2 == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;";
- }
-}
-
-#####################################################################
-# check that a variable we get from ParseExpr isn't a null pointer,
-# putting the check at the end of the structure/function
-sub check_null_pointer_deferred($)
-{
- my $size = shift;
- if ($size =~ /^\*/) {
- my $size2 = substr($size, 1);
- defer "if ($size2 == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;";
- }
-}
-
-#####################################################################
# declare a function public or static, depending on its attributes
sub fn_declare($$$)
{
@@ -257,7 +236,7 @@ sub EnvSubstituteValue($$)
foreach my $e (@{$s->{ELEMENTS}}) {
next unless (my $v = has_property($e, "value"));
- $env->{$e->{NAME}} = ParseExpr($v, $env);
+ $env->{$e->{NAME}} = ParseExpr($v, $env, $e);
}
return $env;
@@ -309,8 +288,8 @@ sub ParseArrayPushHeader($$$$$)
$size = $length = "ndr_string_length($var_name, sizeof(*$var_name))";
}
} else {
- $size = ParseExpr($l->{SIZE_IS}, $env);
- $length = ParseExpr($l->{LENGTH_IS}, $env);
+ $size = ParseExpr($l->{SIZE_IS}, $env, $e);
+ $length = ParseExpr($l->{LENGTH_IS}, $env, $e);
}
if ((!$l->{IS_SURROUNDING}) and $l->{IS_CONFORMANT}) {
@@ -325,6 +304,106 @@ sub ParseArrayPushHeader($$$$$)
return $length;
}
+sub check_fully_dereferenced($$)
+{
+ my ($element, $env) = @_;
+
+ return sub ($) {
+ my $origvar = shift;
+ my $check = 0;
+
+ # Figure out the number of pointers in $ptr
+ my $expandedvar = $origvar;
+ $expandedvar =~ s/^(\**)//;
+ my $ptr = $1;
+
+ my $var = undef;
+ foreach (keys %$env) {
+ if ($env->{$_} eq $expandedvar) {
+ $var = $_;
+ last;
+ }
+ }
+
+ return($origvar) unless (defined($var));
+ my $e;
+ foreach (@{$element->{PARENT}->{ELEMENTS}}) {
+ if ($_->{NAME} eq $var) {
+ $e = $_;
+ last;
+ }
+ }
+
+ $e or die("Environment doesn't match siblings");
+
+ # See if pointer at pointer level $level
+ # needs to be checked.
+ my $nump = 0;
+ foreach (@{$e->{LEVELS}}) {
+ if ($_->{TYPE} eq "POINTER") {
+ $nump = $_->{POINTER_INDEX}+1;
+ }
+ }
+ warning($element->{ORIGINAL}, "Got pointer for `$e->{NAME}', expected fully derefenced variable") if ($nump > length($ptr));
+ return ($origvar);
+ }
+}
+
+sub check_null_pointer($$$$)
+{
+ my ($element, $env, $print_fn, $return) = @_;
+
+ return sub ($) {
+ my $expandedvar = shift;
+ my $check = 0;
+
+ # Figure out the number of pointers in $ptr
+ $expandedvar =~ s/^(\**)//;
+ my $ptr = $1;
+
+ my $var = undef;
+ foreach (keys %$env) {
+ if ($env->{$_} eq $expandedvar) {
+ $var = $_;
+ last;
+ }
+ }
+
+ if (defined($var)) {
+ my $e;
+ # lookup ptr in $e
+ foreach (@{$element->{PARENT}->{ELEMENTS}}) {
+ if ($_->{NAME} eq $var) {
+ $e = $_;
+ last;
+ }
+ }
+
+ $e or die("Environment doesn't match siblings");
+
+ # See if pointer at pointer level $level
+ # needs to be checked.
+ foreach my $l (@{$e->{LEVELS}}) {
+ if ($l->{TYPE} eq "POINTER" and
+ $l->{POINTER_INDEX} == length($ptr)) {
+ # No need to check ref pointers
+ $check = ($l->{POINTER_TYPE} ne "ref");
+ last;
+ }
+
+ if ($l->{TYPE} eq "DATA") {
+ warning($element, "too much dereferences for `$var'");
+ }
+ }
+ } else {
+ warning($element, "unknown dereferenced expression `$expandedvar'");
+ $check = 1;
+ }
+
+ $print_fn->("if ($ptr$expandedvar == NULL) $return") if $check;
+ }
+}
+
#####################################################################
# parse an array - pull side
sub ParseArrayPullHeader($$$$$)
@@ -339,21 +418,19 @@ sub ParseArrayPullHeader($$$$$)
} elsif ($l->{IS_ZERO_TERMINATED}) { # Noheader arrays
$length = $size = "ndr_get_string_size($ndr, sizeof(*$var_name))";
} else {
- $length = $size = ParseExpr($l->{SIZE_IS}, $env);
+ $length = $size = ParseExprExt($l->{SIZE_IS}, $env, $e->{ORIGINAL},
+ check_null_pointer($e, $env, \&pidl, "return NT_STATUS_INVALID_PARAMETER_MIX;"), check_fully_dereferenced($e, $env));
}
if ((!$l->{IS_SURROUNDING}) and $l->{IS_CONFORMANT}) {
pidl "NDR_CHECK(ndr_pull_array_size(ndr, " . get_pointer_to($var_name) . "));";
}
-
if ($l->{IS_VARYING}) {
pidl "NDR_CHECK(ndr_pull_array_length($ndr, " . get_pointer_to($var_name) . "));";
$length = "ndr_get_array_length($ndr, " . get_pointer_to($var_name) .")";
}
- check_null_pointer($length);
-
if ($length ne $size) {
pidl "if ($length > $size) {";
indent;
@@ -363,20 +440,18 @@ sub ParseArrayPullHeader($$$$$)
}
if ($l->{IS_CONFORMANT} and not $l->{IS_ZERO_TERMINATED}) {
- my $size = ParseExpr($l->{SIZE_IS}, $env);
defer "if ($var_name) {";
defer_indent;
- check_null_pointer_deferred($size);
+ my $size = ParseExprExt($l->{SIZE_IS}, $env, $e->{ORIGINAL}, check_null_pointer($e, $env, \&defer, "return NT_STATUS_INVALID_PARAMETER_MIX;"), check_fully_dereferenced($e, $env));
defer "NDR_CHECK(ndr_check_array_size(ndr, (void*)" . get_pointer_to($var_name) . ", $size));";
defer_deindent;
defer "}";
}
if ($l->{IS_VARYING} and not $l->{IS_ZERO_TERMINATED}) {
- my $length = ParseExpr($l->{LENGTH_IS}, $env);
defer "if ($var_name) {";
defer_indent;
- check_null_pointer_deferred($length);
+ my $length = ParseExprExt($l->{LENGTH_IS}, $env, $e->{ORIGINAL}, check_null_pointer($e, $env, \&defer, "return NT_STATUS_INVALID_PARAMETER_MIX;"), check_fully_dereferenced($e, $env));
defer "NDR_CHECK(ndr_check_array_length(ndr, (void*)" . get_pointer_to($var_name) . ", $length));";
defer_deindent;
defer "}"
@@ -391,29 +466,26 @@ sub ParseArrayPullHeader($$$$$)
sub compression_alg($$)
{
- my ($e,$l) = @_;
- my $compression = $l->{COMPRESSION};
- my ($alg, $clen, $dlen) = split(/ /, $compression);
+ my ($e, $l) = @_;
+ my ($alg, $clen, $dlen) = split(/ /, $l->{COMPRESSION});
return $alg;
}
sub compression_clen($$$)
{
- my ($e,$l,$env) = @_;
- my $compression = $l->{COMPRESSION};
- my ($alg, $clen, $dlen) = split(/ /, $compression);
+ my ($e, $l, $env) = @_;
+ my ($alg, $clen, $dlen) = split(/ /, $l->{COMPRESSION});
- return ParseExpr($clen, $env);
+ return ParseExpr($clen, $env, $e->{ORIGINAL});
}
sub compression_dlen($$$)
{
my ($e,$l,$env) = @_;
- my $compression = $l->{COMPRESSION};
- my ($alg, $clen, $dlen) = split(/ /, $compression);
+ my ($alg, $clen, $dlen) = split(/ /, $l->{COMPRESSION});
- return ParseExpr($dlen, $env);
+ return ParseExpr($dlen, $env, $e->{ORIGINAL});
}
sub ParseCompressionPushStart($$$$)
@@ -474,7 +546,7 @@ sub ParseSubcontextPushStart($$$$)
{
my ($e,$l,$ndr,$env) = @_;
my $subndr = "_ndr_$e->{NAME}";
- my $subcontext_size = ParseExpr($l->{SUBCONTEXT_SIZE},$env);
+ my $subcontext_size = ParseExpr($l->{SUBCONTEXT_SIZE}, $env, $e->{ORIGINAL});
pidl "{";
indent;
@@ -492,7 +564,7 @@ sub ParseSubcontextPushEnd($$$$)
{
my ($e,$l,$ndr,$env) = @_;
my $subndr = "_ndr_$e->{NAME}";
- my $subcontext_size = ParseExpr($l->{SUBCONTEXT_SIZE},$env);
+ my $subcontext_size = ParseExpr($l->{SUBCONTEXT_SIZE}, $env, $e->{ORIGINAL});
if (defined $l->{COMPRESSION}) {
ParseCompressionPushEnd($e, $l, $subndr, $env);
@@ -507,7 +579,7 @@ sub ParseSubcontextPullStart($$$$)
{
my ($e,$l,$ndr,$env) = @_;
my $subndr = "_ndr_$e->{NAME}";
- my $subcontext_size = ParseExpr($l->{SUBCONTEXT_SIZE},$env);
+ my $subcontext_size = ParseExpr($l->{SUBCONTEXT_SIZE}, $env, $e->{ORIGINAL});
pidl "{";
indent;
@@ -525,7 +597,7 @@ sub ParseSubcontextPullEnd($$$$)
{
my ($e,$l,$ndr,$env) = @_;
my $subndr = "_ndr_$e->{NAME}";
- my $subcontext_size = ParseExpr($l->{SUBCONTEXT_SIZE},$env);
+ my $subcontext_size = ParseExpr($l->{SUBCONTEXT_SIZE}, $env, $e->{ORIGINAL});
if (defined $l->{COMPRESSION}) {
ParseCompressionPullEnd($e, $l, $subndr, $env);
@@ -590,7 +662,7 @@ sub ParseElementPushLevel
}
} elsif ($l->{TYPE} eq "ARRAY" and not has_fast_array($e,$l) and
not is_charset_array($e, $l)) {
- my $length = ParseExpr($l->{LENGTH_IS}, $env);
+ my $length = ParseExpr($l->{LENGTH_IS}, $env, $e->{ORIGINAL});
my $counter = "cntr_$e->{NAME}_$l->{LEVEL_INDEX}";
$var_name = $var_name . "[$counter]";
@@ -641,7 +713,7 @@ sub ParseElementPush($$$$$$)
start_flags($e);
if (my $value = has_property($e, "value")) {
- $var_name = ParseExpr($value, $env);
+ $var_name = ParseExpr($value, $env, $e->{ORIGINAL});
}
ParseElementPushLevel($e, $e->{LEVELS}[0], $ndr, $var_name, $env, $primitives, $deferred);
@@ -661,7 +733,7 @@ sub ParsePtrPush($$$)
my ($e,$l,$var_name) = @_;
if ($l->{POINTER_TYPE} eq "ref") {
- check_null_pointer(get_value_of($var_name));
+ pidl "if ($var_name == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;";
if ($l->{LEVEL} eq "EMBEDDED") {
pidl "NDR_CHECK(ndr_push_ref_ptr(ndr));";
}
@@ -680,7 +752,7 @@ sub ParsePtrPush($$$)
# print scalars in a structure element
sub ParseElementPrint($$$)
{
- my($e,$var_name,$env) = @_;
+ my($e, $var_name, $env) = @_;
return if (has_property($e, "noprint"));
@@ -692,7 +764,7 @@ sub ParseElementPrint($$$)
$var_name = append_prefix($e, $var_name);
if (my $value = has_property($e, "value")) {
- $var_name = "(ndr->flags & LIBNDR_PRINT_SET_VALUES)?" . ParseExpr($value,$env) . ":$var_name";
+ $var_name = "(ndr->flags & LIBNDR_PRINT_SET_VALUES)?" . ParseExpr($value,$env, $e->{ORIGINAL}) . ":$var_name";
}
foreach my $l (@{$e->{LEVELS}}) {
@@ -714,7 +786,8 @@ sub ParseElementPrint($$$)
if ($l->{IS_ZERO_TERMINATED}) {
$length = "ndr_string_length($var_name, sizeof(*$var_name))";
} else {
- $length = ParseExpr($l->{LENGTH_IS}, $env);
+ $length = ParseExprExt($l->{LENGTH_IS}, $env, $e->{ORIGINAL},
+ check_null_pointer($e, $env, \&pidl, "return;"), check_fully_dereferenced($e, $env));
}
if (is_charset_array($e,$l)) {
@@ -744,7 +817,8 @@ sub ParseElementPrint($$$)
}
pidl "ndr_print_$l->{DATA_TYPE}(ndr, \"$e->{NAME}\", $var_name);";
} elsif ($l->{TYPE} eq "SWITCH") {
- my $switch_var = ParseExpr($l->{SWITCH_IS}, $env);
+ my $switch_var = ParseExprExt($l->{SWITCH_IS}, $env, $e->{ORIGINAL},
+ check_null_pointer($e, $env, \&pidl, "return;"), check_fully_dereferenced($e, $env));
pidl "ndr_print_set_switch_value(ndr, " . get_pointer_to($var_name) . ", $switch_var);";
}
}
@@ -774,9 +848,8 @@ sub ParseElementPrint($$$)
sub ParseSwitchPull($$$$$$)
{
my($e,$l,$ndr,$var_name,$ndr_flags,$env) = @_;
- my $switch_var = ParseExpr($l->{SWITCH_IS}, $env);
-
- check_null_pointer($switch_var);
+ my $switch_var = ParseExprExt($l->{SWITCH_IS}, $env, $e->{ORIGINAL},
+ check_null_pointer($e, $env, \&pidl, "return NT_STATUS_INVALID_PARAMETER_MIX;"), check_fully_dereferenced($e, $env));
$var_name = get_pointer_to($var_name);
pidl "NDR_CHECK(ndr_pull_set_switch_value($ndr, $var_name, $switch_var));";
@@ -787,9 +860,9 @@ sub ParseSwitchPull($$$$$$)
sub ParseSwitchPush($$$$$$)
{
my($e,$l,$ndr,$var_name,$ndr_flags,$env) = @_;
- my $switch_var = ParseExpr($l->{SWITCH_IS}, $env);
+ my $switch_var = ParseExprExt($l->{SWITCH_IS}, $env, $e->{ORIGINAL},
+ check_null_pointer($e, $env, \&pidl, "return NT_STATUS_INVALID_PARAMETER_MIX;"), check_fully_dereferenced($e, $env));
- check_null_pointer($switch_var);
$var_name = get_pointer_to($var_name);
pidl "NDR_CHECK(ndr_push_set_switch_value($ndr, $var_name, $switch_var));";
}
@@ -854,9 +927,7 @@ sub CalcNdrFlags($$$)
sub ParseMemCtxPullStart($$$)
{
- my $e = shift;
- my $l = shift;
- my $ptr_name = shift;
+ my ($e, $l, $ptr_name) = @_;
my $mem_r_ctx = "_mem_save_$e->{NAME}_$l->{LEVEL_INDEX}";
my $mem_c_ctx = $ptr_name;
@@ -970,10 +1041,10 @@ sub ParseElementPullLevel
}
}
- ParseMemCtxPullStart($e,$l, $var_name);
+ ParseMemCtxPullStart($e, $l, $var_name);
$var_name = get_value_of($var_name);
- ParseElementPullLevel($e,GetNextLevel($e,$l), $ndr, $var_name, $env, 1, 1);
+ ParseElementPullLevel($e, GetNextLevel($e,$l), $ndr, $var_name, $env, 1, 1);
ParseMemCtxPullEnd($e,$l);
@@ -986,13 +1057,13 @@ sub ParseElementPullLevel
}
} elsif ($l->{TYPE} eq "ARRAY" and
not has_fast_array($e,$l) and not is_charset_array($e, $l)) {
- my $length = ParseExpr($l->{LENGTH_IS}, $env);
+ my $length = ParseExpr($l->{LENGTH_IS}, $env, $e->{ORIGINAL});
my $counter = "cntr_$e->{NAME}_$l->{LEVEL_INDEX}";
my $array_name = $var_name;
$var_name = $var_name . "[$counter]";
- ParseMemCtxPullStart($e,$l, $array_name);
+ ParseMemCtxPullStart($e, $l, $array_name);
if (($primitives and not $l->{IS_DEFERRED}) or ($deferred and $l->{IS_DEFERRED})) {
my $nl = GetNextLevel($e,$l);
@@ -1016,10 +1087,10 @@ sub ParseElementPullLevel
pidl "}";
}
- ParseMemCtxPullEnd($e,$l);
+ ParseMemCtxPullEnd($e, $l);
} elsif ($l->{TYPE} eq "SWITCH") {
- ParseElementPullLevel($e,GetNextLevel($e,$l), $ndr, $var_name, $env, $primitives, $deferred);
+ ParseElementPullLevel($e, GetNextLevel($e,$l), $ndr, $var_name, $env, $primitives, $deferred);
}
}
@@ -1155,7 +1226,7 @@ sub ParseStructPush($$)
$size = "ndr_string_length(r->$e->{NAME}, sizeof(*r->$e->{NAME}))";
}
} else {
- $size = ParseExpr($e->{LEVELS}[0]->{SIZE_IS}, $env);
+ $size = ParseExpr($e->{LEVELS}[0]->{SIZE_IS}, $env, $e->{ORIGINAL});
}
pidl "NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, $size));";
@@ -2012,9 +2083,8 @@ sub AllocateArrayLevel($$$$$)
{
my ($e,$l,$ndr,$env,$size) = @_;
- my $var = ParseExpr($e->{NAME}, $env);
+ my $var = ParseExpr($e->{NAME}, $env, $e->{ORIGINAL});
- check_null_pointer($size);
my $pl = GetPrevLevel($e, $l);
if (defined($pl) and
$pl->{TYPE} eq "POINTER" and
@@ -2025,7 +2095,7 @@ sub AllocateArrayLevel($$$$$)
pidl "}";
if (grep(/in/,@{$e->{DIRECTION}}) and
grep(/out/,@{$e->{DIRECTION}})) {
- pidl "memcpy(r->out.$e->{NAME},r->in.$e->{NAME},$size * sizeof(*r->in.$e->{NAME}));";
+ pidl "memcpy(r->out.$e->{NAME}, r->in.$e->{NAME}, $size * sizeof(*r->in.$e->{NAME}));";
}
return;
}
@@ -2093,8 +2163,8 @@ sub ParseFunctionPull($)
and $e->{LEVELS}[1]->{IS_ZERO_TERMINATED});
if ($e->{LEVELS}[1]->{TYPE} eq "ARRAY") {
- my $size = ParseExpr($e->{LEVELS}[1]->{SIZE_IS}, $env);
- check_null_pointer($size);
+ my $size = ParseExprExt($e->{LEVELS}[1]->{SIZE_IS}, $env, $e->{ORIGINAL}, check_null_pointer($e, $env, \&pidl, "return NT_STATUS_INVALID_PARAMETER_MIX;"),
+ check_fully_dereferenced($e, $env));
pidl "NDR_PULL_ALLOC_N(ndr, r->out.$e->{NAME}, $size);";
diff --git a/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm b/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm
index abc3b786b9..bd58342189 100644
--- a/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm
+++ b/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm
@@ -35,9 +35,9 @@ sub gen_dispatch_switch($)
pidl "\t\t\tNDR_PRINT_FUNCTION_DEBUG($fn->{NAME}, NDR_IN, r2);\n";
pidl "\t\t}\n";
if ($fn->{RETURN_TYPE} && $fn->{RETURN_TYPE} ne "void") {
- pidl "\t\tr2->out.result = $fn->{NAME}(dce_call, mem_ctx, r2);\n";
+ pidl "\t\tr2->out.result = dcesrv_$fn->{NAME}(dce_call, mem_ctx, r2);\n";
} else {
- pidl "\t\t$fn->{NAME}(dce_call, mem_ctx, r2);\n";
+ pidl "\t\tdcesrv_$fn->{NAME}(dce_call, mem_ctx, r2);\n";
}
pidl "\t\tif (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {\n";
pidl "\t\t\tDEBUG(5,(\"function $fn->{NAME} will reply async\\n\"));\n";
@@ -186,7 +186,7 @@ static NTSTATUS $name\__op_ndr_push(struct dcesrv_call_state *dce_call, TALLOC_C
return NT_STATUS_OK;
}
-static const struct dcesrv_interface $name\_interface = {
+const struct dcesrv_interface dcesrv\_$name\_interface = {
.name = \"$name\",
.syntax_id = {".print_uuid($uuid).",$if_version},
.bind = $name\__op_bind,
@@ -217,7 +217,7 @@ static NTSTATUS $name\__op_init_server(struct dcesrv_context *dce_ctx, const str
NTSTATUS ret;
const char *name = dcerpc_table_$name.endpoints->names[i];
- ret = dcesrv_interface_register(dce_ctx, name, &$name\_interface, NULL);
+ ret = dcesrv_interface_register(dce_ctx, name, &dcesrv_$name\_interface, NULL);
if (!NT_STATUS_IS_OK(ret)) {
DEBUG(1,(\"$name\_op_init_server: failed to register endpoint \'%s\'\\n\",name));
return ret;
@@ -229,9 +229,9 @@ static NTSTATUS $name\__op_init_server(struct dcesrv_context *dce_ctx, const str
static BOOL $name\__op_interface_by_uuid(struct dcesrv_interface *iface, const struct GUID *uuid, uint32_t if_version)
{
- if ($name\_interface.syntax_id.if_version == if_version &&
- GUID_equal(\&$name\_interface.syntax_id.uuid, uuid)) {
- memcpy(iface,&$name\_interface, sizeof(*iface));
+ if (dcesrv_$name\_interface.syntax_id.if_version == if_version &&
+ GUID_equal(\&dcesrv\_$name\_interface.syntax_id.uuid, uuid)) {
+ memcpy(iface,&dcesrv\_$name\_interface, sizeof(*iface));
return True;
}
@@ -240,8 +240,8 @@ static BOOL $name\__op_interface_by_uuid(struct dcesrv_interface *iface, const s
static BOOL $name\__op_interface_by_name(struct dcesrv_interface *iface, const char *name)
{
- if (strcmp($name\_interface.name, name)==0) {
- memcpy(iface,&$name\_interface, sizeof(*iface));
+ if (strcmp(dcesrv_$name\_interface.name, name)==0) {
+ memcpy(iface, &dcesrv_$name\_interface, sizeof(*iface));
return True;
}
diff --git a/tools/pidl/lib/Parse/Pidl/Samba4/TDR.pm b/tools/pidl/lib/Parse/Pidl/Samba4/TDR.pm
index 592961dee2..a3e8d3470b 100644
--- a/tools/pidl/lib/Parse/Pidl/Samba4/TDR.pm
+++ b/tools/pidl/lib/Parse/Pidl/Samba4/TDR.pm
@@ -4,6 +4,7 @@
# released under the GNU GPL
package Parse::Pidl::Samba4::TDR;
+use Parse::Pidl qw(fatal);
use Parse::Pidl::Util qw(has_property ParseExpr is_constant);
use Parse::Pidl::Samba4 qw(is_intree choose_header);
@@ -20,7 +21,6 @@ sub indent() { $tabs.="\t"; }
sub deindent() { $tabs = substr($tabs, 1); }
sub pidl($) { $ret .= $tabs.(shift)."\n"; }
sub pidl_hdr($) { $ret_hdr .= (shift)."\n"; }
-sub fatal($$) { my ($e,$s) = @_; die("$e->{FILE}:$e->{LINE}: $s\n"); }
sub typearg($) {
my $t = shift;
return(", const char *name") if ($t eq "print");
@@ -72,7 +72,7 @@ sub ParserElement($$$)
if (has_property($e, "charset")) {
fatal($e,"charset() on non-array element") unless (defined($e->{ARRAY_LEN}) and scalar(@{$e->{ARRAY_LEN}}) > 0);
- my $len = ParseExpr(@{$e->{ARRAY_LEN}}[0], $env);
+ my $len = ParseExpr(@{$e->{ARRAY_LEN}}[0], $env, $e);
if ($len eq "*") { $len = "-1"; }
$name = ", mem_ctx" if ($t eq "pull");
pidl "TDR_CHECK(tdr_$t\_charset(tdr$name, &v->$e->{NAME}, $len, sizeof($e->{TYPE}_t), CH_$e->{PROPERTIES}->{charset}));";
@@ -80,11 +80,11 @@ sub ParserElement($$$)
}
if (has_property($e, "switch_is")) {
- $switch = ", " . ParseExpr($e->{PROPERTIES}->{switch_is}, $env);
+ $switch = ", " . ParseExpr($e->{PROPERTIES}->{switch_is}, $env, $e);
}
if (defined($e->{ARRAY_LEN}) and scalar(@{$e->{ARRAY_LEN}}) > 0) {
- my $len = ParseExpr($e->{ARRAY_LEN}[0], $env);
+ my $len = ParseExpr($e->{ARRAY_LEN}[0], $env, $e);
if ($t eq "pull" and not is_constant($len)) {
pidl "TDR_ALLOC(mem_ctx, v->$e->{NAME}, $len);";
@@ -101,7 +101,7 @@ sub ParserElement($$$)
}
if (has_property($e, "value") && $t eq "push") {
- pidl "v->$e->{NAME} = ".ParseExpr($e->{PROPERTIES}->{value}, $env).";";
+ pidl "v->$e->{NAME} = ".ParseExpr($e->{PROPERTIES}->{value}, $env, $e).";";
}
pidl "TDR_CHECK(tdr_$t\_$e->{TYPE}(tdr$name$switch, &v->$e->{NAME}$array));";
diff --git a/tools/pidl/lib/Parse/Pidl/Samba4/Template.pm b/tools/pidl/lib/Parse/Pidl/Samba4/Template.pm
index 111ae28123..f953d0f2fe 100644
--- a/tools/pidl/lib/Parse/Pidl/Samba4/Template.pm
+++ b/tools/pidl/lib/Parse/Pidl/Samba4/Template.pm
@@ -58,7 +58,7 @@ sub Template($)
/*
$fname
*/
-static $d->{RETURN_TYPE} $fname(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
+static $d->{RETURN_TYPE} dcesrv_$fname(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
struct $fname *r)
{
";
diff --git a/tools/pidl/lib/Parse/Pidl/Util.pm b/tools/pidl/lib/Parse/Pidl/Util.pm
index ff615a21ba..00185fbef7 100644
--- a/tools/pidl/lib/Parse/Pidl/Util.pm
+++ b/tools/pidl/lib/Parse/Pidl/Util.pm
@@ -6,12 +6,15 @@ package Parse::Pidl::Util;
require Exporter;
@ISA = qw(Exporter);
-@EXPORT = qw(has_property property_matches ParseExpr is_constant make_str print_uuid);
+@EXPORT = qw(has_property property_matches ParseExpr ParseExprExt is_constant make_str print_uuid MyDumper);
use vars qw($VERSION);
$VERSION = '0.01';
use strict;
+use Parse::Pidl::Expr;
+use Parse::Pidl qw(error);
+
#####################################################################
# a dumper wrapper to prevent dependence on the Data::Dumper module
# unless we actually need it
@@ -26,12 +29,9 @@ sub MyDumper($)
# see if a pidl property list contains a given property
sub has_property($$)
{
- my($e) = shift;
- my($p) = shift;
+ my($e, $p) = @_;
- if (!defined $e->{PROPERTIES}) {
- return undef;
- }
+ return undef if (not defined($e->{PROPERTIES}));
return $e->{PROPERTIES}->{$p};
}
@@ -40,9 +40,7 @@ sub has_property($$)
# see if a pidl property matches a value
sub property_matches($$$)
{
- my($e) = shift;
- my($p) = shift;
- my($v) = shift;
+ my($e,$p,$v) = @_;
if (!defined has_property($e, $p)) {
return undef;
@@ -59,9 +57,8 @@ sub property_matches($$$)
sub is_constant($)
{
my $s = shift;
- if (defined $s && $s =~ /^\d/) {
- return 1;
- }
+ return 1 if (defined $s && $s =~ /^\d+$/);
+ return 1 if (defined $s && $s =~ /^0x[0-9A-Fa-f]+$/);
return 0;
}
@@ -72,7 +69,7 @@ sub make_str($)
if (substr($str, 0, 1) eq "\"") {
return $str;
}
- return "\"" . $str . "\"";
+ return "\"$str\"";
}
sub print_uuid($)
@@ -80,6 +77,7 @@ sub print_uuid($)
my ($uuid) = @_;
$uuid =~ s/"//g;
my ($time_low,$time_mid,$time_hi,$clock_seq,$node) = split /-/, $uuid;
+ return undef if not defined($node);
my @clock_seq = $clock_seq =~ /(..)/g;
my @node = $node =~ /(..)/g;
@@ -89,35 +87,38 @@ sub print_uuid($)
"{".join(',', map {"0x$_"} @node)."}}";
}
-# a hack to build on platforms that don't like negative enum values
-my $useUintEnums = 0;
-sub setUseUintEnums($)
-{
- $useUintEnums = shift;
-}
-sub useUintEnums()
+sub ParseExpr($$$)
{
- return $useUintEnums;
+ my($expr, $varlist, $e) = @_;
+
+ die("Undefined value in ParseExpr") if not defined($expr);
+
+ my $x = new Parse::Pidl::Expr();
+
+ return $x->Run($expr, sub { my $x = shift; error($e, $x); },
+ # Lookup fn
+ sub { my $x = shift;
+ return($varlist->{$x}) if (defined($varlist->{$x}));
+ return $x;
+ },
+ undef, undef);
}
-sub ParseExpr($$)
+sub ParseExprExt($$$$$)
{
- my($expr,$varlist) = @_;
+ my($expr, $varlist, $e, $deref, $use) = @_;
die("Undefined value in ParseExpr") if not defined($expr);
- my @tokens = split /((?:[A-Za-z_])(?:(?:(?:[A-Za-z0-9_.])|(?:->))+))/, $expr;
- my $ret = "";
-
- foreach my $t (@tokens) {
- if (defined($varlist->{$t})) {
- $ret .= $varlist->{$t};
- } else {
- $ret .= $t;
- }
- }
-
- return $ret;
+ my $x = new Parse::Pidl::Expr();
+
+ return $x->Run($expr, sub { my $x = shift; error($e, $x); },
+ # Lookup fn
+ sub { my $x = shift;
+ return($varlist->{$x}) if (defined($varlist->{$x}));
+ return $x;
+ },
+ $deref, $use);
}
1;
diff --git a/tools/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm b/tools/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm
index 163b3053f4..4ad60319a6 100644
--- a/tools/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm
+++ b/tools/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm
@@ -100,6 +100,7 @@ $VERSION = '0.01';
use strict;
+use Parse::Pidl qw(fatal warning error);
use Parse::Pidl::Util qw(has_property);
sub handle_type($$$$$$$$$$)
@@ -107,20 +108,20 @@ sub handle_type($$$$$$$$$$)
my ($pos,$data,$name,$dissectorname,$ft_type,$base_type,$mask,$valsstring,$alignment) = @_;
unless(defined($alignment)) {
- print "$pos: error incomplete TYPE command\n";
+ error($pos, "incomplete TYPE command");
return;
}
unless ($dissectorname =~ /.*dissect_.*/) {
- print "$pos: warning: dissector name does not contain `dissect'\n";
+ warning($pos, "dissector name does not contain `dissect'");
}
unless(valid_ft_type($ft_type)) {
- print "$pos: warning: invalid FT_TYPE `$ft_type'\n";
+ warning($pos, "invalid FT_TYPE `$ft_type'");
}
unless (valid_base_type($base_type)) {
- print "$pos: warning: invalid BASE_TYPE `$base_type'\n";
+ warning($pos, "invalid BASE_TYPE `$base_type'");
}
$data->{types}->{$name} = {
@@ -141,7 +142,7 @@ sub handle_tfs($$$$$)
my ($pos,$data,$hf,$trues,$falses) = @_;
unless(defined($falses)) {
- print "$pos: error: incomplete TFS command\n";
+ error($pos, "incomplete TFS command");
return;
}
@@ -156,7 +157,7 @@ sub handle_hf_rename($$$$)
my ($pos,$data,$old,$new) = @_;
unless(defined($new)) {
- print "$pos: error: incomplete HF_RENAME command\n";
+ error($pos, "incomplete HF_RENAME command");
return;
}
@@ -173,7 +174,7 @@ sub handle_param_value($$$$)
my ($pos,$data,$dissector_name,$value) = @_;
unless(defined($value)) {
- print "$pos: error: incomplete PARAM_VALUE command\n";
+ error($pos, "incomplete PARAM_VALUE command");
return;
}
@@ -204,16 +205,16 @@ sub handle_hf_field($$$$$$$$$$)
my ($pos,$data,$index,$name,$filter,$ft_type,$base_type,$valsstring,$mask,$blurb) = @_;
unless(defined($blurb)) {
- print "$pos: error: incomplete HF_FIELD command\n";
+ error($pos, "incomplete HF_FIELD command");
return;
}
unless(valid_ft_type($ft_type)) {
- print "$pos: warning: invalid FT_TYPE `$ft_type'\n";
+ warning($pos, "invalid FT_TYPE `$ft_type'");
}
unless(valid_base_type($base_type)) {
- print "$pos: warning: invalid BASE_TYPE `$base_type'\n";
+ warning($pos, "invalid BASE_TYPE `$base_type'");
}
$data->{header_fields}->{$index} = {
@@ -284,7 +285,7 @@ sub handle_import
my $dissectorname = shift @_;
unless(defined($dissectorname)) {
- print "$pos: error: no dissectorname specified\n";
+ error($pos, "no dissectorname specified");
return;
}
@@ -346,12 +347,14 @@ sub ReadConformance($$)
shift @fields;
+ my $pos = { FILE => $f, LINE => $ln };
+
if (not defined($field_handlers{$cmd})) {
- print "$f:$ln: warning: Unknown command `$cmd'\n";
+ warning($pos, "Unknown command `$cmd'");
next;
}
- $field_handlers{$cmd}("$f:$ln", $data, @fields);
+ $field_handlers{$cmd}($pos, $data, @fields);
}
close(IN);
diff --git a/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm b/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm
index 14b922353a..9415c16652 100644
--- a/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm
+++ b/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm
@@ -17,8 +17,9 @@ Parse::Pidl::Wireshark::NDR - Parser generator for Wireshark
package Parse::Pidl::Wireshark::NDR;
use strict;
+use Parse::Pidl qw(error);
use Parse::Pidl::Typelist qw(getType);
-use Parse::Pidl::Util qw(has_property ParseExpr property_matches make_str);
+use Parse::Pidl::Util qw(has_property property_matches make_str);
use Parse::Pidl::NDR qw(ContainsString GetNextLevel);
use Parse::Pidl::Dump qw(DumpTypedef DumpFunction);
use Parse::Pidl::Wireshark::Conformance qw(ReadConformance);
@@ -27,12 +28,6 @@ use File::Basename;
use vars qw($VERSION);
$VERSION = '0.01';
-sub error($$)
-{
- my ($e,$t) = @_;
- print "$e->{FILE}:$e->{LINE}: $t\n";
-}
-
my @ett;
my %hf_used = ();
@@ -441,10 +436,10 @@ sub Function($$$)
} elsif ($type->{DATA}->{TYPE} eq "SCALAR") {
pidl_code "g$fn->{RETURN_TYPE} status;\n";
} else {
- print "$fn->{FILE}:$fn->{LINE}: error: return type `$fn->{RETURN_TYPE}' not yet supported\n";
+ error($fn, "return type `$fn->{RETURN_TYPE}' not yet supported");
}
} else {
- print "$fn->{FILE}:$fn->{LINE}: error: unknown return type `$fn->{RETURN_TYPE}'\n";
+ error($fn, "unknown return type `$fn->{RETURN_TYPE}'");
}
foreach (@{$fn->{ELEMENTS}}) {
@@ -828,7 +823,7 @@ sub Initialize($)
header_fields=> {}
};
- ReadConformance($cnf_file, $conformance) or print "Warning: No conformance file `$cnf_file'\n";
+ ReadConformance($cnf_file, $conformance) or print STDERR "warning: No conformance file `$cnf_file'\n";
foreach my $bytes (qw(1 2 4 8)) {
my $bits = $bytes * 8;
@@ -1054,43 +1049,43 @@ sub CheckUsed($)
my $conformance = shift;
foreach (values %{$conformance->{header_fields}}) {
if (not defined($hf_used{$_->{INDEX}})) {
- print "$_->{POS}: warning: hf field `$_->{INDEX}' not used\n";
+ warning($_->{POS}, "hf field `$_->{INDEX}' not used");
}
}
foreach (values %{$conformance->{hf_renames}}) {
if (not $_->{USED}) {
- print "$_->{POS}: warning: hf field `$_->{OLDNAME}' not used\n";
+ warning($_->{POS}, "hf field `$_->{OLDNAME}' not used");
}
}
foreach (values %{$conformance->{dissectorparams}}) {
if (not $_->{USED}) {
- print "$_->{POS}: warning: dissector param never used\n";
+ warning($_->{POS}, "dissector param never used");
}
}
foreach (values %{$conformance->{imports}}) {
if (not $_->{USED}) {
- print "$_->{POS}: warning: import never used\n";
+ warning($_->{POS}, "import never used");
}
}
foreach (values %{$conformance->{types}}) {
if (not $_->{USED} and defined($_->{POS})) {
- print "$_->{POS}: warning: type never used\n";
+ warning($_->{POS}, "type never used");
}
}
foreach (values %{$conformance->{fielddescription}}) {
if (not $_->{USED}) {
- print "$_->{POS}: warning: description never used\n";
+ warning($_->{POS}, "description never used");
}
}
foreach (values %{$conformance->{tfs}}) {
if (not $_->{USED}) {
- print "$_->{POS}: warning: True/False description never used\n";
+ warning($_->{POS}, "True/False description never used");
}
}
}
diff --git a/tools/pidl/lib/Parse/Yapp/Driver.pm b/tools/pidl/lib/Parse/Yapp/Driver.pm
new file mode 100644
index 0000000000..d0dcbf54eb
--- /dev/null
+++ b/tools/pidl/lib/Parse/Yapp/Driver.pm
@@ -0,0 +1,471 @@
+#
+# Module Parse::Yapp::Driver
+#
+# This module is part of the Parse::Yapp package available on your
+# nearest CPAN
+#
+# Any use of this module in a standalone parser make the included
+# text under the same copyright as the Parse::Yapp module itself.
+#
+# This notice should remain unchanged.
+#
+# (c) Copyright 1998-2001 Francois Desarmenien, all rights reserved.
+# (see the pod text in Parse::Yapp module for use and distribution rights)
+#
+
+package Parse::Yapp::Driver;
+
+require 5.004;
+
+use strict;
+
+use vars qw ( $VERSION $COMPATIBLE $FILENAME );
+
+$VERSION = '1.05';
+$COMPATIBLE = '0.07';
+$FILENAME=__FILE__;
+
+use Carp;
+
+#Known parameters, all starting with YY (leading YY will be discarded)
+my(%params)=(YYLEX => 'CODE', 'YYERROR' => 'CODE', YYVERSION => '',
+ YYRULES => 'ARRAY', YYSTATES => 'ARRAY', YYDEBUG => '');
+#Mandatory parameters
+my(@params)=('LEX','RULES','STATES');
+
+sub new {
+ my($class)=shift;
+ my($errst,$nberr,$token,$value,$check,$dotpos);
+ my($self)={ ERROR => \&_Error,
+ ERRST => \$errst,
+ NBERR => \$nberr,
+ TOKEN => \$token,
+ VALUE => \$value,
+ DOTPOS => \$dotpos,
+ STACK => [],
+ DEBUG => 0,
+ CHECK => \$check };
+
+ _CheckParams( [], \%params, \@_, $self );
+
+ exists($$self{VERSION})
+ and $$self{VERSION} < $COMPATIBLE
+ and croak "Yapp driver version $VERSION ".
+ "incompatible with version $$self{VERSION}:\n".
+ "Please recompile parser module.";
+
+ ref($class)
+ and $class=ref($class);
+
+ bless($self,$class);
+}
+
+sub YYParse {
+ my($self)=shift;
+ my($retval);
+
+ _CheckParams( \@params, \%params, \@_, $self );
+
+ if($$self{DEBUG}) {
+ _DBLoad();
+ $retval = eval '$self->_DBParse()';#Do not create stab entry on compile
+ $@ and die $@;
+ }
+ else {
+ $retval = $self->_Parse();
+ }
+ $retval
+}
+
+sub YYData {
+ my($self)=shift;
+
+ exists($$self{USER})
+ or $$self{USER}={};
+
+ $$self{USER};
+
+}
+
+sub YYErrok {
+ my($self)=shift;
+
+ ${$$self{ERRST}}=0;
+ undef;
+}
+
+sub YYNberr {
+ my($self)=shift;
+
+ ${$$self{NBERR}};
+}
+
+sub YYRecovering {
+ my($self)=shift;
+
+ ${$$self{ERRST}} != 0;
+}
+
+sub YYAbort {
+ my($self)=shift;
+
+ ${$$self{CHECK}}='ABORT';
+ undef;
+}
+
+sub YYAccept {
+ my($self)=shift;
+
+ ${$$self{CHECK}}='ACCEPT';
+ undef;
+}
+
+sub YYError {
+ my($self)=shift;
+
+ ${$$self{CHECK}}='ERROR';
+ undef;
+}
+
+sub YYSemval {
+ my($self)=shift;
+ my($index)= $_[0] - ${$$self{DOTPOS}} - 1;
+
+ $index < 0
+ and -$index <= @{$$self{STACK}}
+ and return $$self{STACK}[$index][1];
+
+ undef; #Invalid index
+}
+
+sub YYCurtok {
+ my($self)=shift;
+
+ @_
+ and ${$$self{TOKEN}}=$_[0];
+ ${$$self{TOKEN}};
+}
+
+sub YYCurval {
+ my($self)=shift;
+
+ @_
+ and ${$$self{VALUE}}=$_[0];
+ ${$$self{VALUE}};
+}
+
+sub YYExpect {
+ my($self)=shift;
+
+ keys %{$self->{STATES}[$self->{STACK}[-1][0]]{ACTIONS}}
+}
+
+sub YYLexer {
+ my($self)=shift;
+
+ $$self{LEX};
+}
+
+
+#################
+# Private stuff #
+#################
+
+
+sub _CheckParams {
+ my($mandatory,$checklist,$inarray,$outhash)=@_;
+ my($prm,$value);
+ my($prmlst)={};
+
+ while(($prm,$value)=splice(@$inarray,0,2)) {
+ $prm=uc($prm);
+ exists($$checklist{$prm})
+ or croak("Unknow parameter '$prm'");
+ ref($value) eq $$checklist{$prm}
+ or croak("Invalid value for parameter '$prm'");
+ $prm=unpack('@2A*',$prm);
+ $$outhash{$prm}=$value;
+ }
+ for (@$mandatory) {
+ exists($$outhash{$_})
+ or croak("Missing mandatory parameter '".lc($_)."'");
+ }
+}
+
+sub _Error {
+ print "Parse error.\n";
+}
+
+sub _DBLoad {
+ {
+ no strict 'refs';
+
+ exists(${__PACKAGE__.'::'}{_DBParse})#Already loaded ?
+ and return;
+ }
+ my($fname)=__FILE__;
+ my(@drv);
+ open(DRV,"<$fname") or die "Report this as a BUG: Cannot open $fname";
+ while(<DRV>) {
+ /^\s*sub\s+_Parse\s*{\s*$/ .. /^\s*}\s*#\s*_Parse\s*$/
+ and do {
+ s/^#DBG>//;
+ push(@drv,$_);
+ }
+ }
+ close(DRV);
+
+ $drv[0]=~s/_P/_DBP/;
+ eval join('',@drv);
+}
+
+#Note that for loading debugging version of the driver,
+#this file will be parsed from 'sub _Parse' up to '}#_Parse' inclusive.
+#So, DO NOT remove comment at end of sub !!!
+sub _Parse {
+ my($self)=shift;
+
+ my($rules,$states,$lex,$error)
+ = @$self{ 'RULES', 'STATES', 'LEX', 'ERROR' };
+ my($errstatus,$nberror,$token,$value,$stack,$check,$dotpos)
+ = @$self{ 'ERRST', 'NBERR', 'TOKEN', 'VALUE', 'STACK', 'CHECK', 'DOTPOS' };
+
+#DBG> my($debug)=$$self{DEBUG};
+#DBG> my($dbgerror)=0;
+
+#DBG> my($ShowCurToken) = sub {
+#DBG> my($tok)='>';
+#DBG> for (split('',$$token)) {
+#DBG> $tok.= (ord($_) < 32 or ord($_) > 126)
+#DBG> ? sprintf('<%02X>',ord($_))
+#DBG> : $_;
+#DBG> }
+#DBG> $tok.='<';
+#DBG> };
+
+ $$errstatus=0;
+ $$nberror=0;
+ ($$token,$$value)=(undef,undef);
+ @$stack=( [ 0, undef ] );
+ $$check='';
+
+ while(1) {
+ my($actions,$act,$stateno);
+
+ $stateno=$$stack[-1][0];
+ $actions=$$states[$stateno];
+
+#DBG> print STDERR ('-' x 40),"\n";
+#DBG> $debug & 0x2
+#DBG> and print STDERR "In state $stateno:\n";
+#DBG> $debug & 0x08
+#DBG> and print STDERR "Stack:[".
+#DBG> join(',',map { $$_[0] } @$stack).
+#DBG> "]\n";
+
+
+ if (exists($$actions{ACTIONS})) {
+
+ defined($$token)
+ or do {
+ ($$token,$$value)=&$lex($self);
+#DBG> $debug & 0x01
+#DBG> and print STDERR "Need token. Got ".&$ShowCurToken."\n";
+ };
+
+ $act= exists($$actions{ACTIONS}{$$token})
+ ? $$actions{ACTIONS}{$$token}
+ : exists($$actions{DEFAULT})
+ ? $$actions{DEFAULT}
+ : undef;
+ }
+ else {
+ $act=$$actions{DEFAULT};
+#DBG> $debug & 0x01
+#DBG> and print STDERR "Don't need token.\n";
+ }
+
+ defined($act)
+ and do {
+
+ $act > 0
+ and do { #shift
+
+#DBG> $debug & 0x04
+#DBG> and print STDERR "Shift and go to state $act.\n";
+
+ $$errstatus
+ and do {
+ --$$errstatus;
+
+#DBG> $debug & 0x10
+#DBG> and $dbgerror
+#DBG> and $$errstatus == 0
+#DBG> and do {
+#DBG> print STDERR "**End of Error recovery.\n";
+#DBG> $dbgerror=0;
+#DBG> };
+ };
+
+
+ push(@$stack,[ $act, $$value ]);
+
+ $$token ne '' #Don't eat the eof
+ and $$token=$$value=undef;
+ next;
+ };
+
+ #reduce
+ my($lhs,$len,$code,@sempar,$semval);
+ ($lhs,$len,$code)=@{$$rules[-$act]};
+
+#DBG> $debug & 0x04
+#DBG> and $act
+#DBG> and print STDERR "Reduce using rule ".-$act." ($lhs,$len): ";
+
+ $act
+ or $self->YYAccept();
+
+ $$dotpos=$len;
+
+ unpack('A1',$lhs) eq '@' #In line rule
+ and do {
+ $lhs =~ /^\@[0-9]+\-([0-9]+)$/
+ or die "In line rule name '$lhs' ill formed: ".
+ "report it as a BUG.\n";
+ $$dotpos = $1;
+ };
+
+ @sempar = $$dotpos
+ ? map { $$_[1] } @$stack[ -$$dotpos .. -1 ]
+ : ();
+
+ $semval = $code ? &$code( $self, @sempar )
+ : @sempar ? $sempar[0] : undef;
+
+ splice(@$stack,-$len,$len);
+
+ $$check eq 'ACCEPT'
+ and do {
+
+#DBG> $debug & 0x04
+#DBG> and print STDERR "Accept.\n";
+
+ return($semval);
+ };
+
+ $$check eq 'ABORT'
+ and do {
+
+#DBG> $debug & 0x04
+#DBG> and print STDERR "Abort.\n";
+
+ return(undef);
+
+ };
+
+#DBG> $debug & 0x04
+#DBG> and print STDERR "Back to state $$stack[-1][0], then ";
+
+ $$check eq 'ERROR'
+ or do {
+#DBG> $debug & 0x04
+#DBG> and print STDERR
+#DBG> "go to state $$states[$$stack[-1][0]]{GOTOS}{$lhs}.\n";
+
+#DBG> $debug & 0x10
+#DBG> and $dbgerror
+#DBG> and $$errstatus == 0
+#DBG> and do {
+#DBG> print STDERR "**End of Error recovery.\n";
+#DBG> $dbgerror=0;
+#DBG> };
+
+ push(@$stack,
+ [ $$states[$$stack[-1][0]]{GOTOS}{$lhs}, $semval ]);
+ $$check='';
+ next;
+ };
+
+#DBG> $debug & 0x04
+#DBG> and print STDERR "Forced Error recovery.\n";
+
+ $$check='';
+
+ };
+
+ #Error
+ $$errstatus
+ or do {
+
+ $$errstatus = 1;
+ &$error($self);
+ $$errstatus # if 0, then YYErrok has been called
+ or next; # so continue parsing
+
+#DBG> $debug & 0x10
+#DBG> and do {
+#DBG> print STDERR "**Entering Error recovery.\n";
+#DBG> ++$dbgerror;
+#DBG> };
+
+ ++$$nberror;
+
+ };
+
+ $$errstatus == 3 #The next token is not valid: discard it
+ and do {
+ $$token eq '' # End of input: no hope
+ and do {
+#DBG> $debug & 0x10
+#DBG> and print STDERR "**At eof: aborting.\n";
+ return(undef);
+ };
+
+#DBG> $debug & 0x10
+#DBG> and print STDERR "**Dicard invalid token ".&$ShowCurToken.".\n";
+
+ $$token=$$value=undef;
+ };
+
+ $$errstatus=3;
+
+ while( @$stack
+ and ( not exists($$states[$$stack[-1][0]]{ACTIONS})
+ or not exists($$states[$$stack[-1][0]]{ACTIONS}{error})
+ or $$states[$$stack[-1][0]]{ACTIONS}{error} <= 0)) {
+
+#DBG> $debug & 0x10
+#DBG> and print STDERR "**Pop state $$stack[-1][0].\n";
+
+ pop(@$stack);
+ }
+
+ @$stack
+ or do {
+
+#DBG> $debug & 0x10
+#DBG> and print STDERR "**No state left on stack: aborting.\n";
+
+ return(undef);
+ };
+
+ #shift the error token
+
+#DBG> $debug & 0x10
+#DBG> and print STDERR "**Shift \$error token and go to state ".
+#DBG> $$states[$$stack[-1][0]]{ACTIONS}{error}.
+#DBG> ".\n";
+
+ push(@$stack, [ $$states[$$stack[-1][0]]{ACTIONS}{error}, undef ]);
+
+ }
+
+ #never reached
+ croak("Error in driver logic. Please, report it as a BUG");
+
+}#_Parse
+#DO NOT remove comment
+
+1;
+
diff --git a/tools/pidl/pidl b/tools/pidl/pidl
index 8084213e5d..0bd841a5ff 100755
--- a/tools/pidl/pidl
+++ b/tools/pidl/pidl
@@ -4,7 +4,7 @@
# package to parse IDL files and generate code for
# rpc functions in Samba
# Copyright tridge@samba.org 2000-2003
-# Copyright jelmer@samba.org 2005
+# Copyright jelmer@samba.org 2005-2007
# released under the GNU GPL
=pod
@@ -17,7 +17,7 @@ pidl - An IDL compiler written in Perl
pidl --help
-pidl [--outputdir[=OUTNAME]] [--includedir DIR...] [--parse-idl-tree] [--dump-idl-tree] [--dump-ndr-tree] [--header[=OUTPUT]] [--ejs[=OUTPUT]] [--swig[=OUTPUT]] [--uint-enums] [--ndr-parser[=OUTPUT]] [--client] [--server] [--dcom-proxy] [--com-header] [--warn-compat] [--quiet] [--verbose] [--template] [--ws-parser[=OUTPUT]] [--diff] [--dump-idl] [--tdr-parser[=OUTPUT]] [--samba3-ndr-client[=OUTPUT]] [--samba3-ndr-server[=OUTPUT]] [<idlfile>.idl]...
+pidl [--outputdir[=OUTNAME]] [--includedir DIR...] [--parse-idl-tree] [--dump-idl-tree] [--dump-ndr-tree] [--header[=OUTPUT]] [--ejs[=OUTPUT]] [--swig[=OUTPUT]] [--ndr-parser[=OUTPUT]] [--client] [--server] [--dcom-proxy] [--com-header] [--warn-compat] [--quiet] [--verbose] [--template] [--ws-parser[=OUTPUT]] [--diff] [--dump-idl] [--tdr-parser[=OUTPUT]] [--samba3-ndr-client[=OUTPUT]] [--samba3-ndr-server[=OUTPUT]] [<idlfile>.idl]...
=head1 DESCRIPTION
@@ -319,6 +319,9 @@ Specifies that a size of I<length>
bytes should be read, followed by a blob of that size,
which will be parsed as NDR.
+subcontext() is deprecated now, and should not be used in new code.
+Instead, use represent_as() or transmit_as().
+
=item flag
Specify boolean options, mostly used for
@@ -391,7 +394,7 @@ pidl README by Andrew Tridgell.
use strict;
-use FindBin qw($RealBin);
+use FindBin qw($RealBin $Script);
use lib "$RealBin";
use lib "$RealBin/lib";
use Getopt::Long;
@@ -451,7 +454,6 @@ my($opt_parse_idl_tree) = 0;
my($opt_dump_idl_tree);
my($opt_dump_ndr_tree);
my($opt_dump_idl) = 0;
-my($opt_uint_enums) = 0;
my($opt_diff) = 0;
my($opt_header);
my($opt_samba3_header);
@@ -482,7 +484,7 @@ print "perl IDL parser and code generator
Copyright (C) Andrew Tridgell <tridge\@samba.org>
Copyright (C) Jelmer Vernooij <jelmer\@samba.org>
-Usage: pidl [options] [--] <idlfile> [<idlfile>...]
+Usage: $Script [options] [--] <idlfile> [<idlfile>...]
Generic Options:
--help this help page
@@ -501,7 +503,6 @@ Debugging:
Samba 4 output:
--header[=OUTFILE] create generic header file [BASENAME.h]
- --uint-enums don't use C enums, instead use uint* types
--ndr-parser[=OUTFILE] create a C NDR parser [ndr_BASENAME.c]
--client[=OUTFILE] create a C NDR client [ndr_BASENAME_c.c]
--tdr-parser[=OUTFILE] create a C TDR parser [tdr_BASENAME.c]
@@ -532,7 +533,6 @@ my $result = GetOptions (
'dump-idl-tree:s' => \$opt_dump_idl_tree,
'parse-idl-tree' => \$opt_parse_idl_tree,
'dump-ndr-tree:s' => \$opt_dump_ndr_tree,
- 'uint-enums' => \$opt_uint_enums,
'samba3-ndr-client:s' => \$opt_samba3_ndr_client,
'samba3-ndr-server:s' => \$opt_samba3_ndr_server,
'header:s' => \$opt_header,
@@ -590,10 +590,6 @@ sub process_file($)
SaveStructure($pidl_file, $pidl) or die "Failed to save $pidl_file\n";
}
- if ($opt_uint_enums) {
- Parse::Pidl::Util::setUseUintEnums(1);
- }
-
if ($opt_dump_idl) {
require Parse::Pidl::Dump;
print Parse::Pidl::Dump($pidl);
@@ -606,7 +602,6 @@ sub process_file($)
unlink($tempfile);
}
-
my $comh_filename = ($opt_com_header or "$outputdir/com_$basename.h");
if (defined($opt_com_header)) {
require Parse::Pidl::Samba4::COM::Header;
@@ -770,7 +765,7 @@ $dcom
}
if (scalar(@ARGV) == 0) {
- print "pidl: no input files\n";
+ print "$Script: no input files\n";
exit(1);
}
diff --git a/tools/pidl/tests/Util.pm b/tools/pidl/tests/Util.pm
index 83651e6073..a406b868e1 100644
--- a/tools/pidl/tests/Util.pm
+++ b/tools/pidl/tests/Util.pm
@@ -6,10 +6,36 @@ package Util;
require Exporter;
@ISA = qw(Exporter);
-@EXPORT_OK = qw(test_samba4_ndr);
+@EXPORT = qw(test_samba4_ndr test_warnings test_errors);
use strict;
+use FindBin qw($RealBin);
+use lib "$RealBin/../lib";
+
+use Parse::Pidl;
+my $warnings = "";
+undef &Parse::Pidl::warning;
+*Parse::Pidl::warning = sub {
+ my ($e, $l) = @_;
+ if (defined($e)) {
+ $warnings .= "$e->{FILE}:$e->{LINE}: $l\n";
+ } else {
+ $warnings .= "$l\n";
+ }
+};
+
+my $errors = "";
+undef &Parse::Pidl::error;
+*Parse::Pidl::error = sub {
+ my ($e, $l) = @_;
+ if (defined($e)) {
+ $errors .= "$e->{FILE}:$e->{LINE}: $l\n";
+ } else {
+ $errors .= "$l\n";
+ }
+};
+
use Test::More;
use Parse::Pidl::IDL;
use Parse::Pidl::NDR;
@@ -43,12 +69,30 @@ SKIP: {
if (defined($test_data_prefix)) {
$outfile = "$test_data_prefix/test-$name";
} else {
- $outfile = "test-$name";
+ $outfile = "./test-$name";
+ }
+
+ my $cflags = $ENV{CFLAGS};
+ unless (defined($cflags)) {
+ $cflags = "";
+ }
+
+ my $ldflags = $ENV{LDFLAGS};
+ unless (defined($ldflags)) {
+ $ldflags = "";
+ }
+
+ my $cc = $ENV{CC};
+ unless (defined($cc)) {
+ $cc = "cc";
}
- my $cflags = `pkg-config --libs --cflags ndr`;
+ my $flags = `pkg-config --libs --cflags ndr samba-config`;
- open CC, "|cc -x c - -o $outfile $cflags";
+ my $cmd = "$cc $cflags -x c - -o $outfile $flags $ldflags";
+ $cmd =~ s/\n//g;
+ print "$cmd\n";
+ open CC, "|$cmd";
print CC "#define uint_t unsigned int\n";
print CC "#define _GNU_SOURCE\n";
print CC "#include <stdint.h>\n";
@@ -74,7 +118,7 @@ SKIP: {
ok(-f $outfile, "($name) compile");
- my $ret = system("./$outfile", ()) >> 8;
+ my $ret = system($outfile, ()) >> 8;
print "# return code: $ret\n" if ($ret != 0);
ok($ret == 0, "($name) run");
@@ -84,4 +128,24 @@ SKIP: {
}
}
+sub test_warnings($$)
+{
+ my ($exp, $code) = @_;
+
+ $warnings = "";
+
+ $code->();
+
+ is($warnings, $exp);
+}
+
+sub test_errors($$)
+{
+ my ($exp, $code) = @_;
+ $errors = "";
+ $code->();
+
+ is($errors, $exp);
+}
+
1;
diff --git a/tools/pidl/tests/ndr.pl b/tools/pidl/tests/ndr.pl
new file mode 100755
index 0000000000..da22949c6d
--- /dev/null
+++ b/tools/pidl/tests/ndr.pl
@@ -0,0 +1,191 @@
+#!/usr/bin/perl
+# (C) 2007 Jelmer Vernooij <jelmer@samba.org>
+# Published under the GNU General Public License
+use strict;
+use warnings;
+
+use Test::More tests => 10;
+use FindBin qw($RealBin);
+use lib "$RealBin";
+use Util;
+use Parse::Pidl::Util qw(MyDumper);
+use Parse::Pidl::NDR qw(GetElementLevelTable ParseElement);
+
+# Case 1
+
+my $e = {
+ 'FILE' => 'foo.idl',
+ 'NAME' => 'v',
+ 'PROPERTIES' => {},
+ 'POINTERS' => 0,
+ 'TYPE' => 'uint8',
+ 'PARENT' => { TYPE => 'STRUCT' },
+ 'LINE' => 42 };
+
+is_deeply(GetElementLevelTable($e), [
+ {
+ 'IS_DEFERRED' => 0,
+ 'LEVEL_INDEX' => 0,
+ 'DATA_TYPE' => 'uint8',
+ 'CONVERT_FROM' => undef,
+ 'CONTAINS_DEFERRED' => 0,
+ 'TYPE' => 'DATA',
+ 'IS_SURROUNDING' => 0,
+ 'CONVERT_TO' => undef
+ }
+]);
+
+my $ne = ParseElement($e);
+is($ne->{ORIGINAL}, $e);
+is($ne->{NAME}, "v");
+is($ne->{ALIGN}, 1);
+is($ne->{TYPE}, "uint8");
+is_deeply($ne->{LEVELS}, [
+ {
+ 'IS_DEFERRED' => 0,
+ 'LEVEL_INDEX' => 0,
+ 'DATA_TYPE' => 'uint8',
+ 'CONVERT_FROM' => undef,
+ 'CONTAINS_DEFERRED' => 0,
+ 'TYPE' => 'DATA',
+ 'IS_SURROUNDING' => 0,
+ 'CONVERT_TO' => undef
+ }
+]);
+
+# Case 2 : pointers
+#
+$e = {
+ 'FILE' => 'foo.idl',
+ 'NAME' => 'v',
+ 'PROPERTIES' => {"unique" => 1},
+ 'POINTERS' => 1,
+ 'PARENT' => { TYPE => 'STRUCT' },
+ 'TYPE' => 'uint8',
+ 'LINE' => 42 };
+
+is_deeply(GetElementLevelTable($e), [
+ {
+ LEVEL_INDEX => 0,
+ IS_DEFERRED => 0,
+ TYPE => 'POINTER',
+ POINTER_TYPE => "unique",
+ POINTER_INDEX => 0,
+ LEVEL => 'EMBEDDED'
+ },
+ {
+ 'IS_DEFERRED' => 1,
+ 'LEVEL_INDEX' => 1,
+ 'DATA_TYPE' => 'uint8',
+ 'CONVERT_FROM' => undef,
+ 'CONTAINS_DEFERRED' => 0,
+ 'TYPE' => 'DATA',
+ 'IS_SURROUNDING' => 0,
+ 'CONVERT_TO' => undef
+ }
+]);
+
+# Case 3 : double pointers
+#
+$e = {
+ 'FILE' => 'foo.idl',
+ 'NAME' => 'v',
+ 'PROPERTIES' => {"unique" => 1},
+ 'POINTERS' => 2,
+ 'TYPE' => 'uint8',
+ 'PARENT' => { TYPE => 'STRUCT' },
+ 'LINE' => 42 };
+
+is_deeply(GetElementLevelTable($e), [
+ {
+ LEVEL_INDEX => 0,
+ IS_DEFERRED => 0,
+ TYPE => 'POINTER',
+ POINTER_TYPE => "unique",
+ POINTER_INDEX => 0,
+ LEVEL => 'EMBEDDED'
+ },
+ {
+ LEVEL_INDEX => 1,
+ IS_DEFERRED => 1,
+ TYPE => 'POINTER',
+ POINTER_TYPE => "unique",
+ POINTER_INDEX => 1,
+ LEVEL => 'EMBEDDED'
+ },
+ {
+ 'IS_DEFERRED' => 1,
+ 'LEVEL_INDEX' => 2,
+ 'DATA_TYPE' => 'uint8',
+ 'CONVERT_FROM' => undef,
+ 'CONTAINS_DEFERRED' => 0,
+ 'TYPE' => 'DATA',
+ 'IS_SURROUNDING' => 0,
+ 'CONVERT_TO' => undef
+ }
+]);
+
+# Case 3 : ref pointers
+#
+$e = {
+ 'FILE' => 'foo.idl',
+ 'NAME' => 'v',
+ 'PROPERTIES' => {"ref" => 1},
+ 'POINTERS' => 1,
+ 'TYPE' => 'uint8',
+ 'PARENT' => { TYPE => 'STRUCT' },
+ 'LINE' => 42 };
+
+is_deeply(GetElementLevelTable($e), [
+ {
+ LEVEL_INDEX => 0,
+ IS_DEFERRED => 0,
+ TYPE => 'POINTER',
+ POINTER_TYPE => "ref",
+ POINTER_INDEX => 0,
+ LEVEL => 'EMBEDDED'
+ },
+ {
+ 'IS_DEFERRED' => 1,
+ 'LEVEL_INDEX' => 1,
+ 'DATA_TYPE' => 'uint8',
+ 'CONVERT_FROM' => undef,
+ 'CONTAINS_DEFERRED' => 0,
+ 'TYPE' => 'DATA',
+ 'IS_SURROUNDING' => 0,
+ 'CONVERT_TO' => undef
+ }
+]);
+
+
+# Case 4 : top-level ref pointers
+#
+$e = {
+ 'FILE' => 'foo.idl',
+ 'NAME' => 'v',
+ 'PROPERTIES' => {"ref" => 1},
+ 'POINTERS' => 1,
+ 'TYPE' => 'uint8',
+ 'PARENT' => { TYPE => 'FUNCTION' },
+ 'LINE' => 42 };
+
+is_deeply(GetElementLevelTable($e), [
+ {
+ LEVEL_INDEX => 0,
+ IS_DEFERRED => 0,
+ TYPE => 'POINTER',
+ POINTER_TYPE => "ref",
+ POINTER_INDEX => 0,
+ LEVEL => 'TOP'
+ },
+ {
+ 'IS_DEFERRED' => 0,
+ 'LEVEL_INDEX' => 1,
+ 'DATA_TYPE' => 'uint8',
+ 'CONVERT_FROM' => undef,
+ 'CONTAINS_DEFERRED' => 0,
+ 'TYPE' => 'DATA',
+ 'IS_SURROUNDING' => 0,
+ 'CONVERT_TO' => undef
+ }
+]);
diff --git a/tools/pidl/tests/ndr_align.pl b/tools/pidl/tests/ndr_align.pl
index 26f41377e7..405b74597c 100755
--- a/tools/pidl/tests/ndr_align.pl
+++ b/tools/pidl/tests/ndr_align.pl
@@ -5,7 +5,6 @@ use strict;
use Test::More tests => 5 * 8;
use FindBin qw($RealBin);
-use lib "$RealBin/../lib";
use lib "$RealBin";
use Util qw(test_samba4_ndr);
@@ -17,7 +16,7 @@ test_samba4_ndr('align-uint8-uint16',
} bla;
',
'
- struct ndr_push *ndr = ndr_push_init();
+ struct ndr_push *ndr = ndr_push_init_ctx(NULL);
struct bla r;
uint8_t expected[] = { 0x0D, 0x00, 0xef, 0xbe };
DATA_BLOB expected_blob = { expected, 4 };
@@ -42,7 +41,7 @@ test_samba4_ndr('align-uint8-uint32',
} bla;
',
'
- struct ndr_push *ndr = ndr_push_init();
+ struct ndr_push *ndr = ndr_push_init_ctx(NULL);
struct bla r;
uint8_t expected[] = { 0x0D, 0x00, 0x00, 0x00, 0xef, 0xbe, 0xef, 0xbe };
DATA_BLOB expected_blob = { expected, 8 };
@@ -68,7 +67,7 @@ test_samba4_ndr('align-uint8-hyper',
} bla;
',
'
- struct ndr_push *ndr = ndr_push_init();
+ struct ndr_push *ndr = ndr_push_init_ctx(NULL);
struct bla r;
uint8_t expected[] = { 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xef, 0xbe, 0xef, 0xbe, 0xef, 0xbe, 0xef, 0xbe };
@@ -94,7 +93,7 @@ test_samba4_ndr('noalignflag-uint8-uint16',
} bla;
',
'
- struct ndr_push *ndr = ndr_push_init();
+ struct ndr_push *ndr = ndr_push_init_ctx(NULL);
struct bla r;
uint8_t expected[] = { 0x0D, 0xef, 0xbe };
DATA_BLOB expected_blob = { expected, 3 };
@@ -122,7 +121,7 @@ test_samba4_ndr('align-blob-align2',
} blie;
',
'
- struct ndr_push *ndr = ndr_push_init();
+ struct ndr_push *ndr = ndr_push_init_ctx(NULL);
struct blie r;
uint8_t data[] = { 0x01, 0x02 };
uint8_t expected[] = { 0x0D, 0x00, 0x0E };
diff --git a/tools/pidl/tests/ndr_alloc.pl b/tools/pidl/tests/ndr_alloc.pl
index 039826e4ea..61df1c3548 100755
--- a/tools/pidl/tests/ndr_alloc.pl
+++ b/tools/pidl/tests/ndr_alloc.pl
@@ -5,7 +5,6 @@ use strict;
use Test::More tests => 5 * 8;
use FindBin qw($RealBin);
-use lib "$RealBin/../lib";
use lib "$RealBin";
use Util qw(test_samba4_ndr);
diff --git a/tools/pidl/tests/ndr_array.pl b/tools/pidl/tests/ndr_array.pl
index b28070536e..27f42cd391 100755
--- a/tools/pidl/tests/ndr_array.pl
+++ b/tools/pidl/tests/ndr_array.pl
@@ -6,7 +6,6 @@ use strict;
use Test::More tests => 8;
use FindBin qw($RealBin);
-use lib "$RealBin/../lib";
use lib "$RealBin";
use Util qw(test_samba4_ndr);
diff --git a/tools/pidl/tests/ndr_compat.pl b/tools/pidl/tests/ndr_compat.pl
new file mode 100755
index 0000000000..735d929e27
--- /dev/null
+++ b/tools/pidl/tests/ndr_compat.pl
@@ -0,0 +1,27 @@
+#!/usr/bin/perl
+# (C) 2007 Jelmer Vernooij <jelmer@samba.org>
+# Published under the GNU General Public License
+use strict;
+
+use Test::More tests => 3;
+use FindBin qw($RealBin);
+use lib "$RealBin";
+use Util;
+use Parse::Pidl;
+use Parse::Pidl::IDL;
+
+sub parse_idl($)
+{
+ my $idl = shift;
+ my $pidl = Parse::Pidl::IDL::parse_string("interface echo { $idl }; ", "nofile");
+ Parse::Pidl::NDR::Parse($pidl);
+}
+
+test_warnings("", sub {parse_idl("void x();"); });
+test_warnings("nofile:0: top-level [out] pointer `x' is not a [ref] pointer\n", sub {parse_idl("void x([out,unique] int *x);"); });
+
+test_warnings("nofile:0: pointer_default_top() is a pidl extension and should not be used\n", sub {
+ my $pidl = Parse::Pidl::IDL::parse_string("[pointer_default_top(unique)] interface echo { void x(); }; ", "nofile");
+ Parse::Pidl::NDR::Parse($pidl);
+});
+
diff --git a/tools/pidl/tests/ndr_deprecations.pl b/tools/pidl/tests/ndr_deprecations.pl
new file mode 100755
index 0000000000..89738e42f6
--- /dev/null
+++ b/tools/pidl/tests/ndr_deprecations.pl
@@ -0,0 +1,28 @@
+#!/usr/bin/perl
+# (C) 2007 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);
+use Parse::Pidl::NDR qw(ValidElement);
+
+# Case 1
+
+my $e = {
+ 'FILE' => 'foo.idl',
+ 'NAME' => 'v',
+ 'PROPERTIES' => {"subcontext" => 1},
+ 'POINTERS' => 0,
+ 'TYPE' => 'uint8',
+ 'PARENT' => { TYPE => 'STRUCT' },
+ 'LINE' => 42 };
+
+test_warnings("foo.idl:42: subcontext() is deprecated. Use represent_as() or transmit_as() instead\n",
+ sub { ValidElement($e); });
+
+
diff --git a/tools/pidl/tests/ndr_fullptr.pl b/tools/pidl/tests/ndr_fullptr.pl
index 569f0060a3..482edcf030 100755
--- a/tools/pidl/tests/ndr_fullptr.pl
+++ b/tools/pidl/tests/ndr_fullptr.pl
@@ -6,10 +6,12 @@ use strict;
use Test::More tests => 1 * 8;
use FindBin qw($RealBin);
-use lib "$RealBin/../lib";
use lib "$RealBin";
use Util qw(test_samba4_ndr);
+SKIP: {
+ skip "full pointers not supported yet", 8;
+
test_samba4_ndr("fullptr-push-dup",
'
[public] uint16 echo_TestFull([in,ptr] uint32 *x, [in,ptr] uint32 *y);
@@ -39,3 +41,4 @@ test_samba4_ndr("fullptr-push-dup",
return 3;
}
');
+}
diff --git a/tools/pidl/tests/ndr_refptr.pl b/tools/pidl/tests/ndr_refptr.pl
index 6940586f01..4a56e3ca38 100755
--- a/tools/pidl/tests/ndr_refptr.pl
+++ b/tools/pidl/tests/ndr_refptr.pl
@@ -7,7 +7,6 @@ use strict;
use Test::More tests => 22 * 8;
use FindBin qw($RealBin);
-use lib "$RealBin/../lib";
use lib "$RealBin";
use Util qw(test_samba4_ndr);
@@ -19,7 +18,7 @@ test_samba4_ndr("noptr-push",
[public] uint16 echo_TestRef([in] xstruct foo);
',
'
- struct ndr_push *ndr = ndr_push_init();
+ struct ndr_push *ndr = ndr_push_init_ctx(NULL);
uint16_t v = 13;
struct echo_TestRef r;
r.in.foo.x = v;
@@ -49,7 +48,7 @@ test_samba4_ndr("ptr-embedded-push",
',
'
uint16_t v = 13;
- struct ndr_push *ndr = ndr_push_init();
+ struct ndr_push *ndr = ndr_push_init_ctx(NULL);
struct echo_TestRef r;
r.in.foo.x = &v;
@@ -75,7 +74,7 @@ test_samba4_ndr("ptr-embedded-push-null",
[public] uint16 echo_TestRef([in] xstruct foo);
',
'
- struct ndr_push *ndr = ndr_push_init();
+ struct ndr_push *ndr = ndr_push_init_ctx(NULL);
struct echo_TestRef r;
r.in.foo.x = NULL;
@@ -100,7 +99,7 @@ test_samba4_ndr("refptr-embedded-push",
',
'
uint16_t v = 13;
- struct ndr_push *ndr = ndr_push_init();
+ struct ndr_push *ndr = ndr_push_init_ctx(NULL);
struct echo_TestRef r;
r.in.foo.x = &v;
@@ -127,7 +126,7 @@ test_samba4_ndr("refptr-embedded-push-null",
[public] uint16 echo_TestRef([in] xstruct foo);
',
'
- struct ndr_push *ndr = ndr_push_init();
+ struct ndr_push *ndr = ndr_push_init_ctx(NULL);
struct echo_TestRef r;
r.in.foo.x = NULL;
@@ -145,7 +144,7 @@ test_samba4_ndr("ptr-top-push",
[public] uint16 echo_TestRef([in] xstruct *foo);
',
'
- struct ndr_push *ndr = ndr_push_init();
+ struct ndr_push *ndr = ndr_push_init_ctx(NULL);
struct echo_TestRef r;
struct xstruct s;
s.x = 13;
@@ -170,7 +169,7 @@ test_samba4_ndr("ptr-top-push-null",
[public] uint16 echo_TestRef([in] xstruct *foo);
',
'
- struct ndr_push *ndr = ndr_push_init();
+ struct ndr_push *ndr = ndr_push_init_ctx(NULL);
struct echo_TestRef r;
r.in.foo = NULL;
@@ -190,7 +189,7 @@ test_samba4_ndr("refptr-top-push",
[public] uint16 echo_TestRef([in,ref] xstruct *foo);
',
'
- struct ndr_push *ndr = ndr_push_init();
+ struct ndr_push *ndr = ndr_push_init_ctx(NULL);
struct echo_TestRef r;
struct xstruct s;
s.x = 13;
@@ -215,7 +214,7 @@ test_samba4_ndr("refptr-top-push-null",
[public] uint16 echo_TestRef([in,ref] xstruct *foo);
',
'
- struct ndr_push *ndr = ndr_push_init();
+ struct ndr_push *ndr = ndr_push_init_ctx(NULL);
struct echo_TestRef r;
r.in.foo = NULL;
@@ -234,7 +233,7 @@ test_samba4_ndr("uniqueptr-top-push",
[public] uint16 echo_TestRef([in,unique] xstruct *foo);
',
'
- struct ndr_push *ndr = ndr_push_init();
+ struct ndr_push *ndr = ndr_push_init_ctx(NULL);
struct echo_TestRef r;
struct xstruct s;
s.x = 13;
@@ -262,7 +261,7 @@ test_samba4_ndr("uniqueptr-top-push-null",
[public] uint16 echo_TestRef([in,unique] xstruct *foo);
',
'
- struct ndr_push *ndr = ndr_push_init();
+ struct ndr_push *ndr = ndr_push_init_ctx(NULL);
struct echo_TestRef r;
r.in.foo = NULL;
@@ -382,7 +381,7 @@ test_samba4_ndr("ptr-top-push-double",
'
[public] void echo_TestRef([in] uint16 **foo);
',
-' struct ndr_push *ndr = ndr_push_init();
+' struct ndr_push *ndr = ndr_push_init_ctx(NULL);
struct echo_TestRef r;
uint16_t v = 13;
uint16_t *pv = &v;
@@ -409,7 +408,7 @@ test_samba4_ndr("ptr-top-push-double-sndnull",
'
[public] void echo_TestRef([in] uint16 **foo);
',
-' struct ndr_push *ndr = ndr_push_init();
+' struct ndr_push *ndr = ndr_push_init_ctx(NULL);
struct echo_TestRef r;
uint16_t *pv = NULL;
r.in.foo = &pv;
@@ -430,7 +429,7 @@ test_samba4_ndr("ptr-top-push-double-fstnull",
'
[public] void echo_TestRef([in] uint16 **foo);
',
-' struct ndr_push *ndr = ndr_push_init();
+' struct ndr_push *ndr = ndr_push_init_ctx(NULL);
struct echo_TestRef r;
r.in.foo = NULL;
@@ -446,7 +445,7 @@ test_samba4_ndr("refptr-top-push-double",
'
[public] void echo_TestRef([in,ref] uint16 **foo);
',
-' struct ndr_push *ndr = ndr_push_init();
+' struct ndr_push *ndr = ndr_push_init_ctx(NULL);
struct echo_TestRef r;
uint16_t v = 13;
uint16_t *pv = &v;
@@ -474,7 +473,7 @@ test_samba4_ndr("refptr-top-push-double-sndnull",
'
[public] void echo_TestRef([in,ref] uint16 **foo);
',
-' struct ndr_push *ndr = ndr_push_init();
+' struct ndr_push *ndr = ndr_push_init_ctx(NULL);
struct echo_TestRef r;
uint16_t *pv = NULL;
r.in.foo = &pv;
@@ -495,7 +494,7 @@ test_samba4_ndr("refptr-top-push-double-fstnull",
'
[public] void echo_TestRef([in,ref] uint16 **foo);
',
-' struct ndr_push *ndr = ndr_push_init();
+' struct ndr_push *ndr = ndr_push_init_ctx(NULL);
struct echo_TestRef r;
r.in.foo = NULL;
@@ -512,7 +511,7 @@ test_samba4_ndr("ignore-ptr",
'
[public] void echo_TestRef([in,ignore] uint16 *foo, [in] uint16 *bar);
',
-' struct ndr_push *ndr = ndr_push_init();
+' struct ndr_push *ndr = ndr_push_init_ctx(NULL);
struct echo_TestRef r;
uint16_t v = 10;
r.in.foo = &v;
diff --git a/tools/pidl/tests/ndr_represent.pl b/tools/pidl/tests/ndr_represent.pl
index 93764451cf..52cd06f817 100644
--- a/tools/pidl/tests/ndr_represent.pl
+++ b/tools/pidl/tests/ndr_represent.pl
@@ -3,9 +3,8 @@
# (C) 2006 Jelmer Vernooij. Published under the GNU GPL
use strict;
-use Test::More tests => 1 * 8;
+use Test::More tests => 2 * 8;
use FindBin qw($RealBin);
-use lib "$RealBin/../lib";
use lib "$RealBin";
use Util qw(test_samba4_ndr);
@@ -41,3 +40,37 @@ NTSTATUS ndr_uint32_to_uint8(uint32_t from, uint8_t *to)
}
'
);
+
+test_samba4_ndr('transmit_as-simple',
+'
+ void bla([in,transmit_as(uint32)] uint8 x);
+',
+'
+ uint8_t expected[] = { 0x0D };
+ DATA_BLOB in_blob = { expected, 1 };
+ struct ndr_pull *ndr = ndr_pull_init_blob(&in_blob, NULL);
+ struct bla r;
+
+ if (NT_STATUS_IS_ERR(ndr_pull_bla(ndr, NDR_SCALARS|NDR_BUFFERS, &r)))
+ return 1;
+
+ if (r.in.x != 13)
+ return 2;
+',
+'
+#include <libcli/util/nterr.h>
+
+NTSTATUS ndr_uint8_to_uint32(uint8_t from, uint32_t *to)
+{
+ *to = from;
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_uint32_to_uint8(uint32_t from, uint8_t *to)
+{
+ *to = from;
+ return NT_STATUS_OK;
+}
+'
+);
+
diff --git a/tools/pidl/tests/ndr_simple.pl b/tools/pidl/tests/ndr_simple.pl
index 9535ee1fae..02803ceea9 100755
--- a/tools/pidl/tests/ndr_simple.pl
+++ b/tools/pidl/tests/ndr_simple.pl
@@ -6,7 +6,6 @@ use strict;
use Test::More tests => 8;
use FindBin qw($RealBin);
-use lib "$RealBin/../lib";
use lib "$RealBin";
use Util qw(test_samba4_ndr);
diff --git a/tools/pidl/tests/ndr_string.pl b/tools/pidl/tests/ndr_string.pl
index 9a09261996..23d94be640 100755
--- a/tools/pidl/tests/ndr_string.pl
+++ b/tools/pidl/tests/ndr_string.pl
@@ -6,7 +6,6 @@ use strict;
use Test::More tests => 3 * 8;
use FindBin qw($RealBin);
-use lib "$RealBin/../lib";
use lib "$RealBin";
use Util qw(test_samba4_ndr);
@@ -54,9 +53,12 @@ test_samba4_ndr("string-ascii-pull",
return 4;
');
+SKIP: {
+ skip "doesn't seem to work yet", 8;
+
test_samba4_ndr("string-out",
'
- [public] void TestString([out,string] uint8 **data);
+ [public] void TestString([out,string,charset(UNIX)] uint8 **data);
',
'
uint8_t data[] = { 0x03, 0x00, 0x00, 0x00,
@@ -77,8 +79,9 @@ test_samba4_ndr("string-out",
return 3;
if (strncmp(r.out.data, "foo", 3) != 0)
- return 3;
+ return 4;
if (r.out.data[4] != 0)
- return 4;
+ return 5;
');
+}
diff --git a/tools/pidl/tests/ndr_tagtype.pl b/tools/pidl/tests/ndr_tagtype.pl
index dcdbc22494..a7f7d0490a 100755
--- a/tools/pidl/tests/ndr_tagtype.pl
+++ b/tools/pidl/tests/ndr_tagtype.pl
@@ -5,7 +5,6 @@ use strict;
use Test::More tests => 1 * 8;
use FindBin qw($RealBin);
-use lib "$RealBin/../lib";
use lib "$RealBin";
use Util qw(test_samba4_ndr);
@@ -19,7 +18,7 @@ test_samba4_ndr('struct-notypedef',
};
',
'
- struct ndr_push *ndr = ndr_push_init();
+ struct ndr_push *ndr = ndr_push_init_ctx(NULL);
struct bla r;
uint8_t expected[] = { 0x0D };
DATA_BLOB expected_blob = { expected, 1 };
diff --git a/tools/pidl/tests/parse_idl.pl b/tools/pidl/tests/parse_idl.pl
index ebdb8ae58a..859c2b4e46 100755
--- a/tools/pidl/tests/parse_idl.pl
+++ b/tools/pidl/tests/parse_idl.pl
@@ -4,9 +4,10 @@
# Published under the GNU General Public License
use strict;
-use Test::More tests => 59;
+use Test::More tests => 59 * 2;
use FindBin qw($RealBin);
-use lib "$RealBin/../lib";
+use lib "$RealBin";
+use Util qw(test_errors);
use Parse::Pidl::IDL;
use Parse::Pidl::NDR;
@@ -14,35 +15,40 @@ sub testok($$)
{
my ($name, $data) = @_;
- my $pidl = Parse::Pidl::IDL::parse_string($data, "<$name>");
-
- ok (defined($pidl), $name);
- return $pidl
+ test_errors("", sub {
+ my $pidl = Parse::Pidl::IDL::parse_string($data, "<$name>");
+ ok (defined($pidl), $name);
+ });
}
-sub testfail($$)
+sub testfail($$$)
{
- my ($name, $data) = @_;
+ my ($name, $data, $error) = @_;
- my $pidl = Parse::Pidl::IDL::parse_string($data, "<$name>");
+ test_errors($error, sub {
+ my $pidl = Parse::Pidl::IDL::parse_string($data, "<$name>");
- ok ((not defined $pidl), $name);
+ ok ((not defined $pidl), $name);
+ });
}
-testfail "unknowntag", "bla test {};";
+testfail "unknowntag", "bla test {};",
+ "<unknowntag>:0: Syntax error near 'bla'\n";
testok "test1", "interface test { void Test(); }; ";
testok "voidtest", "interface test { int Testx(void); }; ";
-testfail "voidtest", "interface test { Test(); }; ";
+testfail "voidtest", "interface test { Test(); }; ",
+ "<voidtest>:0: Syntax error near '('\n";
testok "argtest", "interface test { int Test(int a, long b, uint32 c); }; ";
testok "array1", "interface test { int Test(int a[]); };";
testok "array2", "interface test { int Test(int a[2]); };";
testok "array3", "interface test { int Test(int a[b]); };";
-testfail "array4", "interface test { int Test(int[] a); };";
+testfail "array4", "interface test { int Test(int[] a); };",
+ "<array4>:0: Syntax error near '['\n";
testok "ptr1", "interface test { int Test(int *a); };";
testok "ptr2", "interface test { int Test(int **a); };";
testok "ptr3", "interface test { int Test(int ***a); };";
-testfail "empty1", "interface test { };";
-testfail "empty2", "";
+testfail "empty1", "interface test { };", "<empty1>:0: Syntax error near '}'\n";
+testfail "empty2", "", "";
testok "attr1", "[uuid(\"myuuid\"),attr] interface test { int Test(int ***a); };";
testok "attr2", "interface test { [public] int Test(); };";
testok "attr3", "[attr1] [attr2] interface test { [public] int Test(); };";
@@ -51,22 +57,28 @@ testok "multif", "interface test { int test1(); }; interface test2 { int test2()
testok "tdstruct1", "interface test { typedef struct { } foo; };";
testok "tdstruct2", "interface test { typedef struct { int a; } foo; };";
testok "tdstruct3", "interface test { typedef struct { int a; int b; } foo; };";
-testfail "tdstruct4", "interface test { typedef struct { int a, int b; } foo; };";
+testfail "tdstruct4", "interface test { typedef struct { int a, int b; } foo; };",
+ "<tdstruct4>:0: Syntax error near ','\n";
testok "struct1", "interface test { struct x { }; };";
testok "struct2", "interface test { struct x { int a; }; };";
testok "struct3", "interface test { struct x { int a; int b; }; };";
-testfail "struct4", "interface test { struct x { int a, int b; }; };";
-testfail "struct5", "interface test { struct { int a; } x; };";
+testfail "struct4", "interface test { struct x { int a, int b; }; };",
+ "<struct4>:0: Syntax error near ','\n";
+testfail "struct5", "interface test { struct { int a; } x; };",
+ "<struct5>:0: Syntax error near 'x'\n";
testok "tdunion1", "interface test { typedef union { } a; };";
testok "tdunion2", "interface test { typedef union { int a; } a; };";
testok "union1", "interface test { union a { }; };";
testok "union2", "interface test { union x { int a; }; };";
-testfail "union3", "interface test { union { int a; } x; };";
+testfail "union3", "interface test { union { int a; } x; };",
+ "<union3>:0: Syntax error near 'x'\n";
testok "typedef1", "interface test { typedef int a; };";
-testfail "typedef2", "interface test { typedef x; };";
+testfail "typedef2", "interface test { typedef x; };",
+ "<typedef2>:0: Syntax error near ';'\n";
testok "tdenum1", "interface test { typedef enum { A=1, B=2, C} a; };";
testok "enum1", "interface test { enum a { A=1, B=2, C}; };";
-testfail "enum2", "interface test { enum { A=1, B=2, C} a; };";
+testfail "enum2", "interface test { enum { A=1, B=2, C} a; };",
+ "<enum2>:0: Syntax error near 'a'\n";
testok "nested1", "interface test { struct x { struct { int a; } z; }; };";
testok "nested2", "interface test { struct x { struct y { int a; } z; }; };";
testok "bitmap1", "interface test { bitmap x { a=1 }; };";
@@ -82,9 +94,12 @@ testok "emptyenumdecl", "interface test { enum x; };";
testok "emptytdstructdecl", "interface test { typedef struct x y; };";
testok "import", "import \"foo.idl\";";
testok "include", "include \"foo.h\";";
-testfail "import-noquotes", "import foo.idl;";
-testfail "include-noquotes", "include foo.idl;";
+testfail "import-noquotes", "import foo.idl;",
+ "<import-noquotes>:0: Syntax error near 'foo'\n";
+testfail "include-noquotes", "include foo.idl;",
+ "<include-noquotes>:0: Syntax error near 'foo'\n";
testok "importlib", "importlib \"foo.idl\";";
-testfail "import-nosemicolon", "import \"foo.idl\"";
+testfail "import-nosemicolon", "import \"foo.idl\"",
+ "<import-nosemicolon>:0: Syntax error near 'foo.idl'\n";
testok "import-multiple", "import \"foo.idl\", \"bar.idl\";";
testok "include-multiple", "include \"foo.idl\", \"bar.idl\";";
diff --git a/tools/pidl/tests/samba-ndr.pl b/tools/pidl/tests/samba-ndr.pl
new file mode 100755
index 0000000000..a3e94bd8b5
--- /dev/null
+++ b/tools/pidl/tests/samba-ndr.pl
@@ -0,0 +1,135 @@
+#!/usr/bin/perl
+# (C) 2007 Jelmer Vernooij <jelmer@samba.org>
+# Published under the GNU General Public License
+use strict;
+use warnings;
+
+use Test::More tests => 10;
+use FindBin qw($RealBin);
+use lib "$RealBin";
+use Util;
+use Parse::Pidl::Util qw(MyDumper);
+use Parse::Pidl::Samba4::NDR::Parser qw(check_null_pointer);
+
+my $output;
+sub print_fn($) { my $x = shift; $output.=$x; }
+
+# Test case 1: Simple unique pointer dereference
+
+$output = "";
+my $fn = check_null_pointer({
+ PARENT => {
+ ELEMENTS => [
+ {
+ NAME => "bla",
+ LEVELS => [
+ { TYPE => "POINTER",
+ POINTER_INDEX => 0,
+ POINTER_TYPE => "unique" },
+ { TYPE => "DATA" }
+ ],
+ },
+ ]
+ }
+}, { bla => "r->in.bla" }, \&print_fn, "return;");
+
+
+test_warnings("", sub { $fn->("r->in.bla"); });
+
+is($output, "if (r->in.bla == NULL) return;");
+
+# Test case 2: Simple ref pointer dereference
+
+$output = "";
+$fn = check_null_pointer({
+ PARENT => {
+ ELEMENTS => [
+ {
+ NAME => "bla",
+ LEVELS => [
+ { TYPE => "POINTER",
+ POINTER_INDEX => 0,
+ POINTER_TYPE => "ref" },
+ { TYPE => "DATA" }
+ ],
+ },
+ ]
+ }
+}, { bla => "r->in.bla" }, \&print_fn, undef);
+
+test_warnings("", sub { $fn->("r->in.bla"); });
+
+is($output, "");
+
+# Test case 3: Illegal dereference
+
+$output = "";
+$fn = check_null_pointer({
+ FILE => "nofile",
+ LINE => 1,
+ PARENT => {
+ ELEMENTS => [
+ {
+ NAME => "bla",
+ LEVELS => [
+ { TYPE => "DATA" }
+ ],
+ },
+ ]
+ }
+}, { bla => "r->in.bla" }, \&print_fn, undef);
+
+test_warnings("nofile:1: too much dereferences for `bla'\n",
+ sub { $fn->("r->in.bla"); });
+
+is($output, "");
+
+# Test case 4: Double pointer dereference
+
+$output = "";
+$fn = check_null_pointer({
+ PARENT => {
+ ELEMENTS => [
+ {
+ NAME => "bla",
+ LEVELS => [
+ { TYPE => "POINTER",
+ POINTER_INDEX => 0,
+ POINTER_TYPE => "unique" },
+ { TYPE => "POINTER",
+ POINTER_INDEX => 1,
+ POINTER_TYPE => "unique" },
+ { TYPE => "DATA" }
+ ],
+ },
+ ]
+ }
+}, { bla => "r->in.bla" }, \&print_fn, "return;");
+
+test_warnings("",
+ sub { $fn->("*r->in.bla"); });
+
+is($output, "if (*r->in.bla == NULL) return;");
+
+# Test case 5: Unknown variable
+
+$output = "";
+$fn = check_null_pointer({
+ FILE => "nofile",
+ LINE => 2,
+ PARENT => {
+ ELEMENTS => [
+ {
+ NAME => "bla",
+ LEVELS => [
+ { TYPE => "DATA" }
+ ],
+ },
+ ]
+ }
+}, { }, \&print_fn, "return;");
+
+test_warnings("nofile:2: unknown dereferenced expression `r->in.bla'\n",
+ sub { $fn->("r->in.bla"); });
+
+is($output, "if (r->in.bla == NULL) return;");
diff --git a/tools/pidl/tests/test_util.pl b/tools/pidl/tests/test_util.pl
new file mode 100755
index 0000000000..2d59f6283b
--- /dev/null
+++ b/tools/pidl/tests/test_util.pl
@@ -0,0 +1,21 @@
+#!/usr/bin/perl
+# (C) 2007 Jelmer Vernooij <jelmer@samba.org>
+# Published under the GNU General Public License
+use strict;
+
+use Test::More tests => 6;
+use FindBin qw($RealBin);
+use lib "$RealBin";
+use Util qw(test_warnings test_errors);
+use Parse::Pidl qw(warning error);
+
+test_warnings("", sub {});
+
+test_warnings("x:1: msg\n", sub { warning({FILE => "x", LINE => 1}, "msg"); });
+test_warnings("", sub {});
+
+test_errors("", sub {});
+
+test_errors("x:1: msg\n", sub { error({FILE => "x", LINE => 1}, "msg"); });
+test_errors("", sub {});
+
diff --git a/tools/pidl/tests/util.pl b/tools/pidl/tests/util.pl
new file mode 100755
index 0000000000..ba2f7b7b49
--- /dev/null
+++ b/tools/pidl/tests/util.pl
@@ -0,0 +1,112 @@
+#!/usr/bin/perl
+# (C) 2007 Jelmer Vernooij <jelmer@samba.org>
+# Published under the GNU General Public License
+use strict;
+use warnings;
+
+use Test::More tests => 70;
+use FindBin qw($RealBin);
+use lib "$RealBin";
+use Util;
+use Parse::Pidl qw(error);
+use Parse::Pidl::Util;
+
+# has_property()
+is(undef, has_property({}, "foo"));
+is(undef, has_property({PROPERTIES => {}}, "foo"));
+is("data", has_property({PROPERTIES => {foo => "data"}}, "foo"));
+is(undef, has_property({PROPERTIES => {foo => undef}}, "foo"));
+
+# is_constant()
+ok(is_constant("2"));
+ok(is_constant("256"));
+ok(is_constant("0x400"));
+ok(is_constant("0x4BC"));
+ok(not is_constant("0x4BGC"));
+ok(not is_constant("str"));
+ok(not is_constant("2 * expr"));
+
+# make_str()
+is("\"bla\"", make_str("bla"));
+is("\"bla\"", make_str("\"bla\""));
+is("\"\"bla\"\"", make_str("\"\"bla\"\""));
+is("\"bla\"\"", make_str("bla\""));
+is("\"foo\"bar\"", make_str("foo\"bar"));
+
+# print_uuid()
+is(undef, print_uuid("invalid"));
+is("{0x12345778,0x1234,0xabcd,{0xef,0x00},{0x01,0x23,0x45,0x67,0x89,0xac}}",
+ print_uuid("12345778-1234-abcd-ef00-0123456789ac"));
+is("{0x12345778,0x1234,0xabcd,{0xef,0x00},{0x01,0x23,0x45,0x67,0x89,0xac}}",
+ print_uuid("\"12345778-1234-abcd-ef00-0123456789ac\""));
+
+# property_matches()
+# missing property
+ok(not property_matches({PROPERTIES => {}}, "x", "data"));
+# data not matching
+ok(not property_matches({PROPERTIES => {x => "bar"}}, "x", "data"));
+# data matching exactly
+ok(property_matches({PROPERTIES => {x => "data"}}, "x", "data"));
+# regex matching
+ok(property_matches({PROPERTIES => {x => "data"}}, "x", "^([dat]+)\$"));
+
+# ParseExpr()
+is(undef, ParseExpr("", {}, undef));
+is("a", ParseExpr("a", {"b" => "2"}, undef));
+is("2", ParseExpr("a", {"a" => "2"}, undef));
+is("2 * 2", ParseExpr("a*a", {"a" => "2"}, undef));
+is("r->length + r->length",
+ ParseExpr("length+length", {"length" => "r->length"}, undef));
+is("2 / 2 * (r->length)",
+ ParseExpr("constant/constant*(len)", {"constant" => "2",
+ "len" => "r->length"}, undef));
+is("2 + 2 - r->length",
+ ParseExpr("constant+constant-len", {"constant" => "2",
+ "len" => "r->length"}, undef));
+is("*r->length", ParseExpr("*len", { "len" => "r->length"}, undef));
+is("**r->length", ParseExpr("**len", { "len" => "r->length"}, undef));
+is("r->length & 2", ParseExpr("len&2", { "len" => "r->length"}, undef));
+is("&r->length", ParseExpr("&len", { "len" => "r->length"}, undef));
+is("calc()", ParseExpr("calc()", { "foo" => "2"}, undef));
+is("calc(2 * 2)", ParseExpr("calc(foo * 2)", { "foo" => "2"}, undef));
+is("strlen(\"data\")", ParseExpr("strlen(foo)", { "foo" => "\"data\""}, undef));
+is("strlen(\"data\", 4)", ParseExpr("strlen(foo, 4)", { "foo" => "\"data\""}, undef));
+is("foo / bar", ParseExpr("foo / bar", { "bla" => "\"data\""}, undef));
+is("r->length % 2", ParseExpr("len%2", { "len" => "r->length"}, undef));
+is("r->length == 2", ParseExpr("len==2", { "len" => "r->length"}, undef));
+is("r->length != 2", ParseExpr("len!=2", { "len" => "r->length"}, undef));
+is("pr->length", ParseExpr("pr->length", { "p" => "r"}, undef));
+is("r->length", ParseExpr("p->length", { "p" => "r"}, undef));
+is("_foo / bla32", ParseExpr("_foo / bla32", { "bla" => "\"data\""}, undef));
+is("foo.bar.blah", ParseExpr("foo.blah", { "foo" => "foo.bar"}, undef));
+is("\"bla\"", ParseExpr("\"bla\"", {}, undef));
+is("1 << 2", ParseExpr("1 << 2", {}, undef));
+is("1 >> 2", ParseExpr("1 >> 2", {}, undef));
+is("0x200", ParseExpr("0x200", {}, undef));
+is("2?3:0", ParseExpr("2?3:0", {}, undef));
+is("~0", ParseExpr("~0", {}, undef));
+is("b->a->a", ParseExpr("a->a->a", {"a" => "b"}, undef));
+is("b.a.a", ParseExpr("a.a.a", {"a" => "b"}, undef));
+
+test_errors("nofile:0: Parse error in `~' near `~'\n", sub {
+ is(undef, ParseExpr("~", {}, {FILE => "nofile", LINE => 0})); });
+
+test_errors("nofile:0: Got pointer, expected integer\n", sub {
+ is(undef, ParseExprExt("foo", {}, {FILE => "nofile", LINE => 0},
+ undef, sub { my $x = shift;
+ error({FILE => "nofile", LINE => 0},
+ "Got pointer, expected integer");
+ return undef; }))});
+
+is("b.a.a", ParseExpr("b.a.a", {"a" => "b"}, undef));
+is("((rr_type) == NBT_QTYPE_NETBIOS)", ParseExpr("((rr_type)==NBT_QTYPE_NETBIOS)", {}, undef));
+is("talloc_check_name", ParseExpr("talloc_check_name", {}, undef));
+is("talloc_check_name()", ParseExpr("talloc_check_name()", {}, undef));
+is("talloc_check_name(ndr)", ParseExpr("talloc_check_name(ndr)", {}, undef));
+is("talloc_check_name(ndr, 1)", ParseExpr("talloc_check_name(ndr,1)", {}, undef));
+is("talloc_check_name(ndr, \"struct ndr_push\")", ParseExpr("talloc_check_name(ndr,\"struct ndr_push\")", {}, undef));
+is("((rr_type) == NBT_QTYPE_NETBIOS) && talloc_check_name(ndr, \"struct ndr_push\")", ParseExpr("((rr_type)==NBT_QTYPE_NETBIOS)&&talloc_check_name(ndr,\"struct ndr_push\")", {}, undef));
+is("(rdata).data.length", ParseExpr("(rdata).data.length", {}, undef));
+is("((rdata).data.length == 2)", ParseExpr("((rdata).data.length==2)", {}, undef));
+is("((rdata).data.length == 2)?0:rr_type", ParseExpr("((rdata).data.length==2)?0:rr_type", {}, undef));
+is("((((rr_type) == NBT_QTYPE_NETBIOS) && talloc_check_name(ndr, \"struct ndr_push\") && ((rdata).data.length == 2))?0:rr_type)", ParseExpr("((((rr_type)==NBT_QTYPE_NETBIOS)&&talloc_check_name(ndr,\"struct ndr_push\")&&((rdata).data.length==2))?0:rr_type)", {}, undef));