diff options
author | Jörg Mayer <jmayer@loplof.de> | 2007-03-07 07:55:00 +0000 |
---|---|---|
committer | Jörg Mayer <jmayer@loplof.de> | 2007-03-07 07:55:00 +0000 |
commit | d4ead590a1a398f2df3814ad863a62e682bcdae8 (patch) | |
tree | 73e004960163e872ca161612ceed955ba67b950f /tools | |
parent | 83ee2dbcfa8c3b635dadcb9d7d903e4001f532a9 (diff) |
Update from samba tree revision 21565 to 21739
============================ Samba log start ============
------------------------------------------------------------------------
r21567 | jelmer | 2007-02-27 21:35:56 +0100 (Tue, 27 Feb 2007) | 1 line
Changed paths:
M /branches/SAMBA_4_0
M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Wireshark/NDR.pm
M /branches/SAMBA_4_0/source/pidl/tests/wireshark-ndr.pl
Add some more wireshark tests.
------------------------------------------------------------------------
r21568 | jelmer | 2007-02-27 22:37:31 +0100 (Tue, 27 Feb 2007) | 1 line
Changed paths:
M /branches/SAMBA_4_0
M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Wireshark/NDR.pm
M /branches/SAMBA_4_0/source/pidl/tests/wireshark-ndr.pl
More tests.
------------------------------------------------------------------------
r21572 | jelmer | 2007-02-28 00:47:07 +0100 (Wed, 28 Feb 2007) | 1 line
Changed paths:
M /branches/SAMBA_4_0
M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/NDR.pm
M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Typelist.pm
M /branches/SAMBA_4_0/source/pidl/tests/ndr.pl
M /branches/SAMBA_4_0/source/pidl/tests/ndr_tagtype.pl
M /branches/SAMBA_4_0/source/pidl/tests/typelist.pl
More work towards supporting tagged types.
------------------------------------------------------------------------
r21573 | jelmer | 2007-02-28 01:19:57 +0100 (Wed, 28 Feb 2007) | 1 line
Changed paths:
M /branches/SAMBA_4_0
M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/NDR.pm
M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Typelist.pm
M /branches/SAMBA_4_0/source/pidl/tests/ndr.pl
M /branches/SAMBA_4_0/source/pidl/tests/typelist.pl
Remove more code that assumed all types are typedefs.
------------------------------------------------------------------------
r21574 | jelmer | 2007-02-28 01:28:14 +0100 (Wed, 28 Feb 2007) | 1 line
Changed paths:
M /branches/SAMBA_4_0
M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/NDR.pm
M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Typelist.pm
M /branches/SAMBA_4_0/source/pidl/tests/ndr.pl
Fix handling of DECLARE.
------------------------------------------------------------------------
r21575 | jelmer | 2007-02-28 01:35:21 +0100 (Wed, 28 Feb 2007) | 1 line
Changed paths:
M /branches/SAMBA_4_0
M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Typelist.pm
M /branches/SAMBA_4_0/source/pidl/tests/typelist.pl
Fix handling of is_scalar() for declares.
------------------------------------------------------------------------
r21578 | jelmer | 2007-02-28 02:51:37 +0100 (Wed, 28 Feb 2007) | 1 line
Changed paths:
M /branches/SAMBA_4_0
M /branches/SAMBA_4_0/source/pidl/README
M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
M /branches/SAMBA_4_0/source/pidl/tests/ndr_tagtype.pl
M /branches/SAMBA_4_0/source/pidl/tests/samba-ndr.pl
Use utility function for naming pull/push/print functions.
------------------------------------------------------------------------
r21579 | jelmer | 2007-02-28 03:01:58 +0100 (Wed, 28 Feb 2007) | 1 line
Changed paths:
M /branches/SAMBA_4_0
M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/EJS.pm
M /branches/SAMBA_4_0/source/pidl/tests/samba-ejs.pl
Use utility function to determine function names in ejs code.
------------------------------------------------------------------------
r21584 | jelmer | 2007-02-28 14:25:53 +0100 (Wed, 28 Feb 2007) | 6 lines
Changed paths:
M /branches/SAMBA_4_0
M /branches/SAMBA_4_0/source/librpc/idl/echo.idl
M /branches/SAMBA_4_0/source/pidl/README
M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/NDR.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/Header.pm
M /branches/SAMBA_4_0/source/pidl/tests/header.pl
M /branches/SAMBA_4_0/source/pidl/tests/ndr.pl
M /branches/SAMBA_4_0/source/pidl/tests/typelist.pl
Support for tagged types has landed!
It's now possible to use "struct foo" without a typedef in IDL files.
echo_info4 is the first type that's been converted.
------------------------------------------------------------------------
r21586 | jelmer | 2007-02-28 15:56:46 +0100 (Wed, 28 Feb 2007) | 1 line
Changed paths:
M /branches/SAMBA_4_0
M /branches/SAMBA_4_0/source/pidl/MANIFEST
update manifest
------------------------------------------------------------------------
r21654 | jelmer | 2007-03-02 15:05:52 +0100 (Fri, 02 Mar 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/tests/samba-ndr.pl
Add simple test for print functions.
------------------------------------------------------------------------
r21656 | jelmer | 2007-03-02 15:53:09 +0100 (Fri, 02 Mar 2007) | 1 line
Changed paths:
M /branches/SAMBA_4_0
A /branches/SAMBA_4_0/source/lib/registry/tests
A /branches/SAMBA_4_0/source/lib/registry/tests/generic.c (from /branches/SAMBA_4_0/source/torture/local/registry.c:21654)
A /branches/SAMBA_4_0/source/lib/socket/testsuite.c (from /branches/SAMBA_4_0/source/torture/local/socket.c:21654)
A /branches/SAMBA_4_0/source/lib/tdr/testsuite.c (from /branches/SAMBA_4_0/source/torture/local/tdr.c:21654)
A /branches/SAMBA_4_0/source/lib/util/tests
A /branches/SAMBA_4_0/source/lib/util/tests/file.c (from /branches/SAMBA_4_0/source/torture/local/util_file.c:21654)
A /branches/SAMBA_4_0/source/lib/util/tests/idtree.c (from /branches/SAMBA_4_0/source/torture/local/idtree.c:21654)
A /branches/SAMBA_4_0/source/lib/util/tests/strlist.c (from /branches/SAMBA_4_0/source/torture/local/util_strlist.c:21654)
A /branches/SAMBA_4_0/source/librpc/tests
A /branches/SAMBA_4_0/source/librpc/tests/binding_string.c (from /branches/SAMBA_4_0/source/torture/local/binding_string.c:21654)
M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
D /branches/SAMBA_4_0/source/torture/local/binding_string.c
M /branches/SAMBA_4_0/source/torture/local/config.mk
D /branches/SAMBA_4_0/source/torture/local/idtree.c
D /branches/SAMBA_4_0/source/torture/local/registry.c
D /branches/SAMBA_4_0/source/torture/local/socket.c
D /branches/SAMBA_4_0/source/torture/local/tdr.c
D /branches/SAMBA_4_0/source/torture/local/util_file.c
D /branches/SAMBA_4_0/source/torture/local/util_strlist.c
Move tests a bit closer to the things they test, should make syncing with samba3 easier.
------------------------------------------------------------------------
r21681 | jelmer | 2007-03-04 15:16:52 +0100 (Sun, 04 Mar 2007) | 5 lines
Changed paths:
M /branches/SAMBA_4_0
M /branches/SAMBA_4_0/source/pidl/TODO
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/lib/Parse/Pidl/NDR.pm
M /branches/SAMBA_4_0/source/pidl/tests/header.pl
M /branches/SAMBA_4_0/source/pidl/tests/parse_idl.pl
Fix bug in the parsing code that parsed "struct foo;" the same as
"struct foo {};".
Reported by one of the OpenChange folks, thanks!
------------------------------------------------------------------------
r21682 | jelmer | 2007-03-04 15:31:18 +0100 (Sun, 04 Mar 2007) | 1 line
Changed paths:
M /branches/SAMBA_4_0
M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/NDR.pm
Remove accidently committed debug command.
------------------------------------------------------------------------
r21690 | jelmer | 2007-03-05 01:03:44 +0100 (Mon, 05 Mar 2007) | 1 line
Changed paths:
M /branches/SAMBA_4_0
M /branches/SAMBA_4_0/source/pidl/tests/header.pl
M /branches/SAMBA_4_0/source/pidl/tests/parse_idl.pl
Test use of typedef /and/ struct name
------------------------------------------------------------------------
------------------------------------------------------------------------
============================ Samba log end ==============
svn path=/trunk/; revision=20992
Diffstat (limited to 'tools')
-rw-r--r-- | tools/pidl/MANIFEST | 12 | ||||
-rw-r--r-- | tools/pidl/README | 2 | ||||
-rw-r--r-- | tools/pidl/TODO | 13 | ||||
-rw-r--r-- | tools/pidl/idl.yp | 17 | ||||
-rw-r--r-- | tools/pidl/lib/Parse/Pidl/IDL.pm | 2340 | ||||
-rw-r--r-- | tools/pidl/lib/Parse/Pidl/NDR.pm | 34 | ||||
-rw-r--r-- | tools/pidl/lib/Parse/Pidl/Samba4/EJS.pm | 86 | ||||
-rw-r--r-- | tools/pidl/lib/Parse/Pidl/Samba4/Header.pm | 22 | ||||
-rw-r--r-- | tools/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm | 76 | ||||
-rw-r--r-- | tools/pidl/lib/Parse/Pidl/Typelist.pm | 27 | ||||
-rw-r--r-- | tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm | 18 | ||||
-rwxr-xr-x | tools/pidl/tests/header.pl | 17 | ||||
-rwxr-xr-x | tools/pidl/tests/ndr.pl | 28 | ||||
-rwxr-xr-x | tools/pidl/tests/ndr_tagtype.pl | 43 | ||||
-rwxr-xr-x | tools/pidl/tests/parse_idl.pl | 17 | ||||
-rwxr-xr-x | tools/pidl/tests/samba-ejs.pl | 9 | ||||
-rwxr-xr-x | tools/pidl/tests/samba-ndr.pl | 64 | ||||
-rwxr-xr-x | tools/pidl/tests/typelist.pl | 30 | ||||
-rwxr-xr-x | tools/pidl/tests/wireshark-ndr.pl | 208 |
19 files changed, 1704 insertions, 1359 deletions
diff --git a/tools/pidl/MANIFEST b/tools/pidl/MANIFEST index f51afe2a48..7f30c3ab54 100644 --- a/tools/pidl/MANIFEST +++ b/tools/pidl/MANIFEST @@ -15,19 +15,12 @@ tests/ndr_represent.pl tests/ndr_compat.pl tests/ndr_fullptr.pl tests/ndr_tagtype.pl -lib/Parse/Pidl/Samba3/Client.pm +tests/header.pl lib/Parse/Pidl/Samba3/ClientNDR.pm -lib/Parse/Pidl/Samba3/Header.pm -lib/Parse/Pidl/Samba3/Parser.pm -lib/Parse/Pidl/Samba3/Server.pm -lib/Parse/Pidl/Samba3/Template.pm -lib/Parse/Pidl/Samba3/Types.pm +lib/Parse/Pidl/Samba3/ServerNDR.pm lib/Parse/Pidl/Samba4/NDR/Server.pm lib/Parse/Pidl/Samba4/NDR/Parser.pm lib/Parse/Pidl/Samba4/NDR/Client.pm -lib/Parse/Pidl/Samba4/COM/Header.pm -lib/Parse/Pidl/Samba4/COM/Stub.pm -lib/Parse/Pidl/Samba4/COM/Proxy.pm lib/Parse/Pidl/Samba4/Header.pm lib/Parse/Pidl/Samba4/SWIG.pm lib/Parse/Pidl/Samba4/TDR.pm @@ -40,7 +33,6 @@ lib/Parse/Pidl/Typelist.pm lib/Parse/Pidl/Dump.pm lib/Parse/Pidl/Compat.pm lib/Parse/Pidl/Util.pm -lib/Parse/Pidl/ODL.pm lib/Parse/Pidl/NDR.pm lib/Parse/Pidl.pm Makefile.PL diff --git a/tools/pidl/README b/tools/pidl/README index f29e274192..5bf7752da9 100644 --- a/tools/pidl/README +++ b/tools/pidl/README @@ -4,7 +4,7 @@ This directory contains the source code of the pidl (Perl IDL) compiler for Samba 4. The main sources for pidl are available by Subversion on -svn+ssh://svnanon.samba.org/samba/branches/SAMBA_4_0/source/pidl +svn://svnanon.samba.org/samba/branches/SAMBA_4_0/source/pidl Pidl works by building a parse tree from a .pidl file (a simple dump of it's internal parse tree) or a .idl file diff --git a/tools/pidl/TODO b/tools/pidl/TODO index 859b3d5317..487d51d11e 100644 --- a/tools/pidl/TODO +++ b/tools/pidl/TODO @@ -1,5 +1,3 @@ -- allow [public] on typedefs only - - EJS output backend shouldn't use the NDR levels stuff but instead as the "C levels" and NDR levels don't necessarily match. @@ -8,14 +6,19 @@ - compatibility mode for generating MIDL-readable data: - strip out pidl-specific properties +- remove declare in favor of typedef +- make bitmap an optional attribute on enum - support nested elements - - support typedefs properly - - improve represent_as(): allow it to be used for arrays and other complex - types +- support typedefs properly (e.g. allow "typedef void **bla;") +- make typedefs generate real typedefs +- improve represent_as(): allow it to be used for arrays and other complex + types - --explain-ndr option that dumps out parse tree ? - seperate tables for NDR and DCE/RPC + - maybe no tables for NDR at all? we only need them for ndrdump + and that can use dlsym() - allow data structures outside of interfaces diff --git a/tools/pidl/idl.yp b/tools/pidl/idl.yp index 3ca02c3872..e7d1ce7898 100644 --- a/tools/pidl/idl.yp +++ b/tools/pidl/idl.yp @@ -66,23 +66,17 @@ interface_names: | interface_names 'interface' identifier ';' { push(@{$_[1]}, $_[2]); $_[1] } ; -interface: property_list 'interface' identifier base_interface '{' definitions '}' optional_semicolon +interface: property_list 'interface' identifier '{' definitions '}' optional_semicolon {{ "TYPE" => "INTERFACE", "PROPERTIES" => $_[1], "NAME" => $_[3], - "BASE" => $_[4], - "DATA" => $_[6], + "DATA" => $_[5], "FILE" => $_[0]->YYData->{FILE}, "LINE" => $_[0]->YYData->{LINE}, }} ; -base_interface: - #empty - | ':' identifier { $_[2] } -; - definitions: definition { [ $_[1] ] } | definitions definition { push(@{$_[1]}, $_[2]); $_[1] } @@ -293,7 +287,7 @@ pointers: ; element_list1: - #empty + { [] } | element_list1 base_element ';' { push(@{$_[1]}, $_[2]); $_[1] } ; @@ -407,10 +401,6 @@ sub CleanData($) if (ref($v) eq "ARRAY") { foreach my $i (0 .. $#{$v}) { CleanData($v->[$i]); - if (ref($v->[$i]) eq "ARRAY" && $#{$v->[$i]}==-1) { - $v->[$i] = undef; - next; - } } # this removes any undefined elements from the array @{$v} = grep { defined $_ } @{$v}; @@ -418,7 +408,6 @@ sub CleanData($) foreach my $x (keys %{$v}) { CleanData($v->{$x}); if (!defined $v->{$x}) { delete($v->{$x}); next; } - if (ref($v->{$x}) eq "ARRAY" && $#{$v->{$x}}==-1) { delete($v->{$x}); next; } } } return $v; diff --git a/tools/pidl/lib/Parse/Pidl/IDL.pm b/tools/pidl/lib/Parse/Pidl/IDL.pm index e547b2caa8..36c83c5922 100644 --- a/tools/pidl/lib/Parse/Pidl/IDL.pm +++ b/tools/pidl/lib/Parse/Pidl/IDL.pm @@ -37,7 +37,7 @@ sub new { "import" => 6, "include" => 11 }, - DEFAULT => -91, + DEFAULT => -89, GOTOS => { 'importlib' => 9, 'interface' => 8, @@ -106,7 +106,7 @@ sub new { } }, {#State 13 - DEFAULT => -124 + DEFAULT => -122 }, {#State 14 DEFAULT => -10 @@ -161,7 +161,7 @@ sub new { } }, {#State 22 - DEFAULT => -120 + DEFAULT => -118 }, {#State 23 ACTIONS => { @@ -170,27 +170,23 @@ sub new { }, {#State 24 ACTIONS => { - ":" => 32 - }, - DEFAULT => -16, - GOTOS => { - 'base_interface' => 33 + "{" => 32 } }, {#State 25 ACTIONS => { - "," => 34, - "]" => 35 + "," => 33, + "]" => 34 } }, {#State 26 ACTIONS => { - "(" => 36 + "(" => 35 }, - DEFAULT => -95 + DEFAULT => -93 }, {#State 27 - DEFAULT => -93 + DEFAULT => -91 }, {#State 28 DEFAULT => -7 @@ -204,1588 +200,1572 @@ sub new { {#State 31 DEFAULT => -13, GOTOS => { - 'interface_names' => 37 + 'interface_names' => 36 } }, {#State 32 ACTIONS => { - 'IDENTIFIER' => 22 + "declare" => 44, + "const" => 48 }, + DEFAULT => -89, GOTOS => { - 'identifier' => 38 + 'typedecl' => 37, + 'function' => 38, + 'definitions' => 40, + 'bitmap' => 39, + 'definition' => 43, + 'property_list' => 42, + 'usertype' => 41, + 'const' => 47, + 'declare' => 46, + 'struct' => 45, + 'typedef' => 50, + 'enum' => 49, + 'union' => 51 } }, {#State 33 ACTIONS => { - "{" => 39 - } - }, - {#State 34 - ACTIONS => { 'IDENTIFIER' => 22 }, GOTOS => { 'identifier' => 26, - 'property' => 40 + 'property' => 52 } }, - {#State 35 - DEFAULT => -92 + {#State 34 + DEFAULT => -90 }, - {#State 36 + {#State 35 ACTIONS => { - 'CONSTANT' => 44, + 'CONSTANT' => 56, 'TEXT' => 13, 'IDENTIFIER' => 22 }, - DEFAULT => -101, + DEFAULT => -99, GOTOS => { - 'identifier' => 45, - 'text' => 46, - 'listtext' => 42, - 'anytext' => 41, - 'constant' => 43 + 'identifier' => 57, + 'text' => 58, + 'listtext' => 54, + 'anytext' => 53, + 'constant' => 55 } }, - {#State 37 + {#State 36 ACTIONS => { - "}" => 47, - "interface" => 48 + "}" => 59, + "interface" => 60 } }, + {#State 37 + DEFAULT => -22 + }, {#State 38 - DEFAULT => -17 + DEFAULT => -18 }, {#State 39 + DEFAULT => -37 + }, + {#State 40 ACTIONS => { - "declare" => 56, - "const" => 60 + "}" => 61, + "declare" => 44, + "const" => 48 }, - DEFAULT => -91, + DEFAULT => -89, GOTOS => { - 'typedecl' => 49, - 'function' => 50, - 'definitions' => 52, - 'bitmap' => 51, - 'definition' => 55, - 'property_list' => 54, - 'usertype' => 53, - 'const' => 59, - 'declare' => 58, - 'struct' => 57, - 'typedef' => 62, - 'enum' => 61, - 'union' => 63 + 'typedecl' => 37, + 'function' => 38, + 'bitmap' => 39, + 'definition' => 62, + 'property_list' => 42, + 'usertype' => 41, + 'const' => 47, + 'struct' => 45, + 'declare' => 46, + 'typedef' => 50, + 'enum' => 49, + 'union' => 51 } }, - {#State 40 - DEFAULT => -94 - }, {#State 41 ACTIONS => { - "-" => 65, - ":" => 64, - "<" => 67, - "+" => 69, - "~" => 68, - "*" => 76, - "?" => 66, - "{" => 70, - "&" => 71, - "/" => 72, - "=" => 73, - "(" => 74, - "|" => 75, - "." => 77, - ">" => 78 - }, - DEFAULT => -97 + ";" => 63 + } }, {#State 42 ACTIONS => { - "," => 79, - ")" => 80 + "typedef" => 64, + 'IDENTIFIER' => 22, + "signed" => 72, + "union" => 65, + "enum" => 74, + "bitmap" => 75, + 'void' => 66, + "unsigned" => 76, + "[" => 17, + "struct" => 71 + }, + GOTOS => { + 'existingtype' => 73, + 'bitmap' => 39, + 'usertype' => 68, + 'property_list' => 67, + 'identifier' => 69, + 'struct' => 45, + 'enum' => 49, + 'type' => 77, + 'union' => 51, + 'sign' => 70 } }, {#State 43 - DEFAULT => -103 + DEFAULT => -16 }, {#State 44 - DEFAULT => -123 + DEFAULT => -89, + GOTOS => { + 'property_list' => 78 + } }, {#State 45 - DEFAULT => -102 + DEFAULT => -34 }, {#State 46 - DEFAULT => -104 + DEFAULT => -21 }, {#State 47 - ACTIONS => { - ";" => 82 - }, - DEFAULT => -125, - GOTOS => { - 'optional_semicolon' => 81 - } + DEFAULT => -19 }, {#State 48 ACTIONS => { 'IDENTIFIER' => 22 }, GOTOS => { - 'identifier' => 83 + 'identifier' => 79 } }, {#State 49 - DEFAULT => -24 + DEFAULT => -36 }, {#State 50 DEFAULT => -20 }, {#State 51 - DEFAULT => -39 + DEFAULT => -35 }, {#State 52 - ACTIONS => { - "}" => 84, - "declare" => 56, - "const" => 60 - }, - DEFAULT => -91, - GOTOS => { - 'typedecl' => 49, - 'function' => 50, - 'bitmap' => 51, - 'definition' => 85, - 'property_list' => 54, - 'usertype' => 53, - 'const' => 59, - 'struct' => 57, - 'declare' => 58, - 'typedef' => 62, - 'enum' => 61, - 'union' => 63 - } + DEFAULT => -92 }, {#State 53 ACTIONS => { - ";" => 86 - } + "-" => 81, + ":" => 80, + "<" => 82, + "+" => 84, + "~" => 83, + "*" => 85, + "?" => 86, + "{" => 87, + "&" => 88, + "/" => 89, + "=" => 90, + "(" => 91, + "|" => 92, + "." => 93, + ">" => 94 + }, + DEFAULT => -95 }, {#State 54 ACTIONS => { - "typedef" => 87, - 'IDENTIFIER' => 22, - "signed" => 95, - "union" => 88, - "enum" => 97, - "bitmap" => 98, - 'void' => 89, - "unsigned" => 99, - "[" => 17, - "struct" => 94 - }, - GOTOS => { - 'existingtype' => 96, - 'bitmap' => 51, - 'usertype' => 91, - 'property_list' => 90, - 'identifier' => 92, - 'struct' => 57, - 'enum' => 61, - 'type' => 100, - 'union' => 63, - 'sign' => 93 + "," => 95, + ")" => 96 } }, {#State 55 - DEFAULT => -18 + DEFAULT => -101 }, {#State 56 - DEFAULT => -91, - GOTOS => { - 'property_list' => 101 - } + DEFAULT => -121 }, {#State 57 - DEFAULT => -36 + DEFAULT => -100 }, {#State 58 - DEFAULT => -23 + DEFAULT => -102 }, {#State 59 - DEFAULT => -21 + ACTIONS => { + ";" => 97 + }, + DEFAULT => -123, + GOTOS => { + 'optional_semicolon' => 98 + } }, {#State 60 ACTIONS => { 'IDENTIFIER' => 22 }, GOTOS => { - 'identifier' => 102 + 'identifier' => 99 } }, {#State 61 - DEFAULT => -38 + ACTIONS => { + ";" => 97 + }, + DEFAULT => -123, + GOTOS => { + 'optional_semicolon' => 100 + } }, {#State 62 - DEFAULT => -22 + DEFAULT => -17 }, {#State 63 - DEFAULT => -37 + DEFAULT => -38 }, {#State 64 ACTIONS => { - 'CONSTANT' => 44, - 'TEXT' => 13, - 'IDENTIFIER' => 22 + 'IDENTIFIER' => 22, + "signed" => 72, + 'void' => 66, + "unsigned" => 76 }, - DEFAULT => -101, + DEFAULT => -89, GOTOS => { - 'identifier' => 45, - 'anytext' => 103, - 'text' => 46, - 'constant' => 43 + 'existingtype' => 73, + 'bitmap' => 39, + 'usertype' => 68, + 'property_list' => 67, + 'identifier' => 69, + 'struct' => 45, + 'enum' => 49, + 'type' => 101, + 'union' => 51, + 'sign' => 70 } }, {#State 65 ACTIONS => { - 'CONSTANT' => 44, - 'TEXT' => 13, - 'IDENTIFIER' => 22 + 'IDENTIFIER' => 102 }, - DEFAULT => -101, + DEFAULT => -120, GOTOS => { - 'identifier' => 45, - 'anytext' => 104, - 'text' => 46, - 'constant' => 43 + 'optional_identifier' => 103 } }, {#State 66 + DEFAULT => -45 + }, + {#State 67 + ACTIONS => { + "union" => 65, + "enum" => 74, + "bitmap" => 75, + "[" => 17, + "struct" => 71 + } + }, + {#State 68 + DEFAULT => -43 + }, + {#State 69 + DEFAULT => -42 + }, + {#State 70 ACTIONS => { - 'CONSTANT' => 44, - 'TEXT' => 13, 'IDENTIFIER' => 22 }, - DEFAULT => -101, GOTOS => { - 'identifier' => 45, - 'anytext' => 105, - 'text' => 46, - 'constant' => 43 + 'identifier' => 104 } }, - {#State 67 + {#State 71 ACTIONS => { - 'CONSTANT' => 44, - 'TEXT' => 13, - 'IDENTIFIER' => 22 + 'IDENTIFIER' => 102 }, - DEFAULT => -101, + DEFAULT => -120, GOTOS => { - 'identifier' => 45, - 'anytext' => 106, - 'text' => 46, - 'constant' => 43 + 'optional_identifier' => 105 } }, - {#State 68 + {#State 72 + DEFAULT => -39 + }, + {#State 73 + DEFAULT => -44 + }, + {#State 74 ACTIONS => { - 'CONSTANT' => 44, - 'TEXT' => 13, - 'IDENTIFIER' => 22 + 'IDENTIFIER' => 102 }, - DEFAULT => -101, + DEFAULT => -120, GOTOS => { - 'identifier' => 45, - 'anytext' => 107, - 'text' => 46, - 'constant' => 43 + 'optional_identifier' => 106 } }, - {#State 69 + {#State 75 ACTIONS => { - 'CONSTANT' => 44, - 'TEXT' => 13, - 'IDENTIFIER' => 22 + 'IDENTIFIER' => 102 }, - DEFAULT => -101, + DEFAULT => -120, GOTOS => { - 'identifier' => 45, - 'anytext' => 108, - 'text' => 46, - 'constant' => 43 + 'optional_identifier' => 107 } }, - {#State 70 + {#State 76 + DEFAULT => -40 + }, + {#State 77 ACTIONS => { - 'CONSTANT' => 44, - 'TEXT' => 13, 'IDENTIFIER' => 22 }, - DEFAULT => -101, GOTOS => { - 'identifier' => 45, - 'anytext' => 109, - 'text' => 46, - 'constant' => 43, - 'commalisttext' => 110 + 'identifier' => 108 } }, - {#State 71 + {#State 78 ACTIONS => { - 'CONSTANT' => 44, - 'TEXT' => 13, - 'IDENTIFIER' => 22 + "union" => 109, + "enum" => 114, + "bitmap" => 115, + "[" => 17 }, - DEFAULT => -101, GOTOS => { - 'identifier' => 45, - 'anytext' => 111, - 'text' => 46, - 'constant' => 43 + 'decl_enum' => 110, + 'decl_bitmap' => 111, + 'decl_type' => 113, + 'decl_union' => 112 } }, - {#State 72 + {#State 79 + DEFAULT => -78, + GOTOS => { + 'pointers' => 116 + } + }, + {#State 80 ACTIONS => { - 'CONSTANT' => 44, + 'CONSTANT' => 56, 'TEXT' => 13, 'IDENTIFIER' => 22 }, - DEFAULT => -101, + DEFAULT => -99, GOTOS => { - 'identifier' => 45, - 'anytext' => 112, - 'text' => 46, - 'constant' => 43 + 'identifier' => 57, + 'anytext' => 117, + 'text' => 58, + 'constant' => 55 } }, - {#State 73 + {#State 81 ACTIONS => { - 'CONSTANT' => 44, + 'CONSTANT' => 56, 'TEXT' => 13, 'IDENTIFIER' => 22 }, - DEFAULT => -101, + DEFAULT => -99, GOTOS => { - 'identifier' => 45, - 'anytext' => 113, - 'text' => 46, - 'constant' => 43 + 'identifier' => 57, + 'anytext' => 118, + 'text' => 58, + 'constant' => 55 } }, - {#State 74 + {#State 82 ACTIONS => { - 'CONSTANT' => 44, + 'CONSTANT' => 56, 'TEXT' => 13, 'IDENTIFIER' => 22 }, - DEFAULT => -101, + DEFAULT => -99, GOTOS => { - 'identifier' => 45, - 'anytext' => 109, - 'text' => 46, - 'constant' => 43, - 'commalisttext' => 114 + 'identifier' => 57, + 'anytext' => 119, + 'text' => 58, + 'constant' => 55 } }, - {#State 75 + {#State 83 ACTIONS => { - 'CONSTANT' => 44, + 'CONSTANT' => 56, 'TEXT' => 13, 'IDENTIFIER' => 22 }, - DEFAULT => -101, + DEFAULT => -99, GOTOS => { - 'identifier' => 45, - 'anytext' => 115, - 'text' => 46, - 'constant' => 43 + 'identifier' => 57, + 'anytext' => 120, + 'text' => 58, + 'constant' => 55 } }, - {#State 76 + {#State 84 ACTIONS => { - 'CONSTANT' => 44, + 'CONSTANT' => 56, 'TEXT' => 13, 'IDENTIFIER' => 22 }, - DEFAULT => -101, + DEFAULT => -99, GOTOS => { - 'identifier' => 45, - 'anytext' => 116, - 'text' => 46, - 'constant' => 43 + 'identifier' => 57, + 'anytext' => 121, + 'text' => 58, + 'constant' => 55 } }, - {#State 77 + {#State 85 ACTIONS => { - 'CONSTANT' => 44, + 'CONSTANT' => 56, 'TEXT' => 13, 'IDENTIFIER' => 22 }, - DEFAULT => -101, + DEFAULT => -99, GOTOS => { - 'identifier' => 45, - 'anytext' => 117, - 'text' => 46, - 'constant' => 43 + 'identifier' => 57, + 'anytext' => 122, + 'text' => 58, + 'constant' => 55 } }, - {#State 78 + {#State 86 ACTIONS => { - 'CONSTANT' => 44, + 'CONSTANT' => 56, 'TEXT' => 13, 'IDENTIFIER' => 22 }, - DEFAULT => -101, + DEFAULT => -99, GOTOS => { - 'identifier' => 45, - 'anytext' => 118, - 'text' => 46, - 'constant' => 43 + 'identifier' => 57, + 'anytext' => 123, + 'text' => 58, + 'constant' => 55 } }, - {#State 79 + {#State 87 ACTIONS => { - 'CONSTANT' => 44, + 'CONSTANT' => 56, 'TEXT' => 13, 'IDENTIFIER' => 22 }, - DEFAULT => -101, + DEFAULT => -99, GOTOS => { - 'identifier' => 45, - 'anytext' => 119, - 'text' => 46, - 'constant' => 43 + 'identifier' => 57, + 'anytext' => 124, + 'text' => 58, + 'constant' => 55, + 'commalisttext' => 125 } }, - {#State 80 - DEFAULT => -96 - }, - {#State 81 - DEFAULT => -12 - }, - {#State 82 - DEFAULT => -126 - }, - {#State 83 + {#State 88 ACTIONS => { - ";" => 120 + 'CONSTANT' => 56, + 'TEXT' => 13, + 'IDENTIFIER' => 22 + }, + DEFAULT => -99, + GOTOS => { + 'identifier' => 57, + 'anytext' => 126, + 'text' => 58, + 'constant' => 55 } }, - {#State 84 + {#State 89 ACTIONS => { - ";" => 82 + 'CONSTANT' => 56, + 'TEXT' => 13, + 'IDENTIFIER' => 22 }, - DEFAULT => -125, + DEFAULT => -99, GOTOS => { - 'optional_semicolon' => 121 + 'identifier' => 57, + 'anytext' => 127, + 'text' => 58, + 'constant' => 55 } }, - {#State 85 - DEFAULT => -19 - }, - {#State 86 - DEFAULT => -40 - }, - {#State 87 + {#State 90 ACTIONS => { - 'IDENTIFIER' => 22, - "signed" => 95, - 'void' => 89, - "unsigned" => 99 + 'CONSTANT' => 56, + 'TEXT' => 13, + 'IDENTIFIER' => 22 }, - DEFAULT => -91, + DEFAULT => -99, GOTOS => { - 'existingtype' => 96, - 'bitmap' => 51, - 'usertype' => 91, - 'property_list' => 90, - 'identifier' => 92, - 'struct' => 57, - 'enum' => 61, - 'type' => 122, - 'union' => 63, - 'sign' => 93 + 'identifier' => 57, + 'anytext' => 128, + 'text' => 58, + 'constant' => 55 } }, - {#State 88 + {#State 91 ACTIONS => { - 'IDENTIFIER' => 123 + 'CONSTANT' => 56, + 'TEXT' => 13, + 'IDENTIFIER' => 22 }, - DEFAULT => -122, + DEFAULT => -99, GOTOS => { - 'optional_identifier' => 124 + 'identifier' => 57, + 'anytext' => 124, + 'text' => 58, + 'constant' => 55, + 'commalisttext' => 129 } }, - {#State 89 - DEFAULT => -47 - }, - {#State 90 + {#State 92 ACTIONS => { - "union" => 88, - "enum" => 97, - "bitmap" => 98, - "[" => 17, - "struct" => 94 + 'CONSTANT' => 56, + 'TEXT' => 13, + 'IDENTIFIER' => 22 + }, + DEFAULT => -99, + GOTOS => { + 'identifier' => 57, + 'anytext' => 130, + 'text' => 58, + 'constant' => 55 } }, - {#State 91 - DEFAULT => -45 - }, - {#State 92 - DEFAULT => -44 - }, {#State 93 ACTIONS => { + 'CONSTANT' => 56, + 'TEXT' => 13, 'IDENTIFIER' => 22 }, + DEFAULT => -99, GOTOS => { - 'identifier' => 125 + 'identifier' => 57, + 'anytext' => 131, + 'text' => 58, + 'constant' => 55 } }, {#State 94 ACTIONS => { - 'IDENTIFIER' => 123 + 'CONSTANT' => 56, + 'TEXT' => 13, + 'IDENTIFIER' => 22 }, - DEFAULT => -122, + DEFAULT => -99, GOTOS => { - 'optional_identifier' => 126 + 'identifier' => 57, + 'anytext' => 132, + 'text' => 58, + 'constant' => 55 } }, {#State 95 - DEFAULT => -41 - }, - {#State 96 - DEFAULT => -46 - }, - {#State 97 ACTIONS => { - 'IDENTIFIER' => 123 + 'CONSTANT' => 56, + 'TEXT' => 13, + 'IDENTIFIER' => 22 }, - DEFAULT => -122, + DEFAULT => -99, GOTOS => { - 'optional_identifier' => 127 + 'identifier' => 57, + 'anytext' => 133, + 'text' => 58, + 'constant' => 55 } }, + {#State 96 + DEFAULT => -94 + }, + {#State 97 + DEFAULT => -124 + }, {#State 98 - ACTIONS => { - 'IDENTIFIER' => 123 - }, - DEFAULT => -122, - GOTOS => { - 'optional_identifier' => 128 - } + DEFAULT => -12 }, {#State 99 - DEFAULT => -42 - }, - {#State 100 ACTIONS => { - 'IDENTIFIER' => 22 - }, - GOTOS => { - 'identifier' => 129 + ";" => 134 } }, + {#State 100 + DEFAULT => -15 + }, {#State 101 ACTIONS => { - "union" => 130, - "enum" => 135, - "bitmap" => 136, - "[" => 17 + 'IDENTIFIER' => 22 }, GOTOS => { - 'decl_enum' => 131, - 'decl_bitmap' => 132, - 'decl_type' => 134, - 'decl_union' => 133 + 'identifier' => 135 } }, {#State 102 - DEFAULT => -80, - GOTOS => { - 'pointers' => 137 - } + DEFAULT => -119 }, {#State 103 ACTIONS => { - "-" => 65, - ":" => 64, - "<" => 67, - "+" => 69, - "~" => 68, - "*" => 76, - "?" => 66, - "{" => 70, - "&" => 71, - "/" => 72, - "=" => 73, - "(" => 74, - "|" => 75, - "." => 77, - ">" => 78 + "{" => 137 }, - DEFAULT => -114 + DEFAULT => -74, + GOTOS => { + 'union_body' => 138, + 'opt_union_body' => 136 + } }, {#State 104 - ACTIONS => { - ":" => 64, - "<" => 67, - "~" => 68, - "?" => 66, - "{" => 70, - "=" => 73 - }, - DEFAULT => -105 + DEFAULT => -41 }, {#State 105 ACTIONS => { - "-" => 65, - ":" => 64, - "<" => 67, - "+" => 69, - "~" => 68, - "*" => 76, - "?" => 66, - "{" => 70, - "&" => 71, - "/" => 72, - "=" => 73, - "(" => 74, - "|" => 75, - "." => 77, - ">" => 78 + "{" => 140 }, - DEFAULT => -113 + DEFAULT => -64, + GOTOS => { + 'struct_body' => 139, + 'opt_struct_body' => 141 + } }, {#State 106 ACTIONS => { - "-" => 65, - ":" => 64, - "<" => 67, - "+" => 69, - "~" => 68, - "*" => 76, - "?" => 66, - "{" => 70, - "&" => 71, - "/" => 72, - "=" => 73, - "(" => 74, - "|" => 75, - "." => 77, - ">" => 78 + "{" => 142 }, - DEFAULT => -109 + DEFAULT => -47, + GOTOS => { + 'opt_enum_body' => 144, + 'enum_body' => 143 + } }, {#State 107 ACTIONS => { - "-" => 65, - ":" => 64, - "<" => 67, - "+" => 69, - "~" => 68, - "*" => 76, - "?" => 66, - "{" => 70, - "&" => 71, - "/" => 72, - "=" => 73, - "(" => 74, - "|" => 75, - "." => 77, - ">" => 78 + "{" => 146 }, - DEFAULT => -117 + DEFAULT => -55, + GOTOS => { + 'bitmap_body' => 147, + 'opt_bitmap_body' => 145 + } }, {#State 108 ACTIONS => { - ":" => 64, - "<" => 67, - "~" => 68, - "?" => 66, - "{" => 70, - "=" => 73 - }, - DEFAULT => -116 + "(" => 148 + } }, {#State 109 - ACTIONS => { - "-" => 65, - ":" => 64, - "<" => 67, - "+" => 69, - "~" => 68, - "*" => 76, - "?" => 66, - "{" => 70, - "&" => 71, - "/" => 72, - "=" => 73, - "(" => 74, - "|" => 75, - "." => 77, - ">" => 78 - }, - DEFAULT => -99 + DEFAULT => -32 }, {#State 110 - ACTIONS => { - "}" => 138, - "," => 139 - } + DEFAULT => -27 }, {#State 111 - ACTIONS => { - ":" => 64, - "<" => 67, - "~" => 68, - "?" => 66, - "{" => 70, - "=" => 73 - }, - DEFAULT => -111 + DEFAULT => -28 }, {#State 112 - ACTIONS => { - ":" => 64, - "<" => 67, - "~" => 68, - "?" => 66, - "{" => 70, - "=" => 73 - }, - DEFAULT => -112 + DEFAULT => -29 }, {#State 113 ACTIONS => { - "-" => 65, - ":" => 64, - "<" => 67, - "+" => 69, - "~" => 68, - "*" => 76, - "?" => 66, - "{" => 70, - "&" => 71, - "/" => 72, - "=" => 73, - "(" => 74, - "|" => 75, - "." => 77, - ">" => 78 + 'IDENTIFIER' => 22 }, - DEFAULT => -115 + GOTOS => { + 'identifier' => 149 + } }, {#State 114 - ACTIONS => { - "," => 139, - ")" => 140 - } + DEFAULT => -30 }, {#State 115 - ACTIONS => { - ":" => 64, - "<" => 67, - "~" => 68, - "?" => 66, - "{" => 70, - "=" => 73 - }, - DEFAULT => -110 + DEFAULT => -31 }, {#State 116 ACTIONS => { - ":" => 64, - "<" => 67, - "~" => 68, - "?" => 66, - "{" => 70, - "=" => 73 + 'IDENTIFIER' => 22, + "*" => 151 }, - DEFAULT => -107 + GOTOS => { + 'identifier' => 150 + } }, {#State 117 ACTIONS => { - ":" => 64, - "<" => 67, - "~" => 68, - "?" => 66, - "{" => 70, - "=" => 73 + "-" => 81, + ":" => 80, + "<" => 82, + "+" => 84, + "~" => 83, + "*" => 85, + "?" => 86, + "{" => 87, + "&" => 88, + "/" => 89, + "=" => 90, + "(" => 91, + "|" => 92, + "." => 93, + ">" => 94 }, - DEFAULT => -106 + DEFAULT => -112 }, {#State 118 ACTIONS => { - ":" => 64, - "<" => 67, - "~" => 68, - "?" => 66, - "{" => 70, - "=" => 73 + ":" => 80, + "<" => 82, + "~" => 83, + "?" => 86, + "{" => 87, + "=" => 90 }, - DEFAULT => -108 + DEFAULT => -103 }, {#State 119 ACTIONS => { - "-" => 65, - ":" => 64, - "<" => 67, - "+" => 69, - "~" => 68, - "*" => 76, - "?" => 66, - "{" => 70, - "&" => 71, - "/" => 72, - "=" => 73, - "(" => 74, - "|" => 75, - "." => 77, - ">" => 78 + "-" => 81, + ":" => 80, + "<" => 82, + "+" => 84, + "~" => 83, + "*" => 85, + "?" => 86, + "{" => 87, + "&" => 88, + "/" => 89, + "=" => 90, + "(" => 91, + "|" => 92, + "." => 93, + ">" => 94 }, - DEFAULT => -98 + DEFAULT => -107 }, {#State 120 - DEFAULT => -14 + ACTIONS => { + "-" => 81, + ":" => 80, + "<" => 82, + "+" => 84, + "~" => 83, + "*" => 85, + "?" => 86, + "{" => 87, + "&" => 88, + "/" => 89, + "=" => 90, + "(" => 91, + "|" => 92, + "." => 93, + ">" => 94 + }, + DEFAULT => -115 }, {#State 121 - DEFAULT => -15 + ACTIONS => { + ":" => 80, + "<" => 82, + "~" => 83, + "?" => 86, + "{" => 87, + "=" => 90 + }, + DEFAULT => -114 }, {#State 122 ACTIONS => { - 'IDENTIFIER' => 22 + ":" => 80, + "<" => 82, + "~" => 83, + "?" => 86, + "{" => 87, + "=" => 90 }, - GOTOS => { - 'identifier' => 141 - } + DEFAULT => -105 }, {#State 123 - DEFAULT => -121 + ACTIONS => { + "-" => 81, + ":" => 80, + "<" => 82, + "+" => 84, + "~" => 83, + "*" => 85, + "?" => 86, + "{" => 87, + "&" => 88, + "/" => 89, + "=" => 90, + "(" => 91, + "|" => 92, + "." => 93, + ">" => 94 + }, + DEFAULT => -111 }, {#State 124 ACTIONS => { - "{" => 143 + "-" => 81, + ":" => 80, + "<" => 82, + "+" => 84, + "~" => 83, + "*" => 85, + "?" => 86, + "{" => 87, + "&" => 88, + "/" => 89, + "=" => 90, + "(" => 91, + "|" => 92, + "." => 93, + ">" => 94 }, - DEFAULT => -76, - GOTOS => { - 'union_body' => 144, - 'opt_union_body' => 142 - } + DEFAULT => -97 }, {#State 125 - DEFAULT => -43 + ACTIONS => { + "}" => 152, + "," => 153 + } }, {#State 126 ACTIONS => { - "{" => 146 + ":" => 80, + "<" => 82, + "~" => 83, + "?" => 86, + "{" => 87, + "=" => 90 }, - DEFAULT => -66, - GOTOS => { - 'struct_body' => 145, - 'opt_struct_body' => 147 - } + DEFAULT => -109 }, {#State 127 ACTIONS => { - "{" => 148 + ":" => 80, + "<" => 82, + "~" => 83, + "?" => 86, + "{" => 87, + "=" => 90 }, - DEFAULT => -49, - GOTOS => { - 'opt_enum_body' => 150, - 'enum_body' => 149 - } + DEFAULT => -110 }, {#State 128 ACTIONS => { - "{" => 152 + "-" => 81, + ":" => 80, + "<" => 82, + "+" => 84, + "~" => 83, + "*" => 85, + "?" => 86, + "{" => 87, + "&" => 88, + "/" => 89, + "=" => 90, + "(" => 91, + "|" => 92, + "." => 93, + ">" => 94 }, - DEFAULT => -57, - GOTOS => { - 'bitmap_body' => 153, - 'opt_bitmap_body' => 151 - } + DEFAULT => -113 }, {#State 129 ACTIONS => { - "(" => 154 + "," => 153, + ")" => 154 } }, {#State 130 - DEFAULT => -34 + ACTIONS => { + ":" => 80, + "<" => 82, + "~" => 83, + "?" => 86, + "{" => 87, + "=" => 90 + }, + DEFAULT => -108 }, {#State 131 - DEFAULT => -29 + ACTIONS => { + ":" => 80, + "<" => 82, + "~" => 83, + "?" => 86, + "{" => 87, + "=" => 90 + }, + DEFAULT => -104 }, {#State 132 - DEFAULT => -30 + ACTIONS => { + ":" => 80, + "<" => 82, + "~" => 83, + "?" => 86, + "{" => 87, + "=" => 90 + }, + DEFAULT => -106 }, {#State 133 - DEFAULT => -31 + ACTIONS => { + "-" => 81, + ":" => 80, + "<" => 82, + "+" => 84, + "~" => 83, + "*" => 85, + "?" => 86, + "{" => 87, + "&" => 88, + "/" => 89, + "=" => 90, + "(" => 91, + "|" => 92, + "." => 93, + ">" => 94 + }, + DEFAULT => -96 }, {#State 134 + DEFAULT => -14 + }, + {#State 135 ACTIONS => { - 'IDENTIFIER' => 22 + "[" => 155 }, + DEFAULT => -86, GOTOS => { - 'identifier' => 155 + 'array_len' => 156 } }, - {#State 135 - DEFAULT => -32 - }, {#State 136 - DEFAULT => -33 + DEFAULT => -76 }, {#State 137 - ACTIONS => { - 'IDENTIFIER' => 22, - "*" => 157 - }, + DEFAULT => -71, GOTOS => { - 'identifier' => 156 + 'union_elements' => 157 } }, {#State 138 - ACTIONS => { - 'CONSTANT' => 44, - 'TEXT' => 13, - 'IDENTIFIER' => 22 - }, - DEFAULT => -101, - GOTOS => { - 'identifier' => 45, - 'anytext' => 158, - 'text' => 46, - 'constant' => 43 - } + DEFAULT => -75 }, {#State 139 - ACTIONS => { - 'CONSTANT' => 44, - 'TEXT' => 13, - 'IDENTIFIER' => 22 - }, - DEFAULT => -101, - GOTOS => { - 'identifier' => 45, - 'anytext' => 159, - 'text' => 46, - 'constant' => 43 - } + DEFAULT => -65 }, {#State 140 - ACTIONS => { - 'CONSTANT' => 44, - 'TEXT' => 13, - 'IDENTIFIER' => 22 - }, - DEFAULT => -101, + DEFAULT => -80, GOTOS => { - 'identifier' => 45, - 'anytext' => 160, - 'text' => 46, - 'constant' => 43 + 'element_list1' => 158 } }, {#State 141 + DEFAULT => -66 + }, + {#State 142 ACTIONS => { - "[" => 161 + 'IDENTIFIER' => 22 }, - DEFAULT => -88, GOTOS => { - 'array_len' => 162 + 'identifier' => 159, + 'enum_element' => 160, + 'enum_elements' => 161 } }, - {#State 142 - DEFAULT => -78 - }, {#State 143 - DEFAULT => -73, - GOTOS => { - 'union_elements' => 163 - } + DEFAULT => -48 }, {#State 144 - DEFAULT => -77 + DEFAULT => -49 }, {#State 145 - DEFAULT => -67 + DEFAULT => -57 }, {#State 146 - DEFAULT => -82, + ACTIONS => { + 'IDENTIFIER' => 22 + }, + DEFAULT => -60, GOTOS => { - 'element_list1' => 164 + 'identifier' => 164, + 'bitmap_element' => 163, + 'bitmap_elements' => 162, + 'opt_bitmap_elements' => 165 } }, {#State 147 - DEFAULT => -68 + DEFAULT => -56 }, {#State 148 ACTIONS => { - 'IDENTIFIER' => 22 + "," => -82, + "void" => 169, + ")" => -82 }, + DEFAULT => -89, GOTOS => { - 'identifier' => 165, - 'enum_element' => 166, - 'enum_elements' => 167 + 'base_element' => 166, + 'element_list2' => 168, + 'property_list' => 167 } }, {#State 149 - DEFAULT => -50 + ACTIONS => { + ";" => 170 + } }, {#State 150 - DEFAULT => -51 + ACTIONS => { + "[" => 155, + "=" => 172 + }, + GOTOS => { + 'array_len' => 171 + } }, {#State 151 - DEFAULT => -59 + DEFAULT => -79 }, {#State 152 ACTIONS => { + 'CONSTANT' => 56, + 'TEXT' => 13, 'IDENTIFIER' => 22 }, - DEFAULT => -62, + DEFAULT => -99, GOTOS => { - 'identifier' => 170, - 'bitmap_element' => 169, - 'bitmap_elements' => 168, - 'opt_bitmap_elements' => 171 + 'identifier' => 57, + 'anytext' => 173, + 'text' => 58, + 'constant' => 55 } }, {#State 153 - DEFAULT => -58 + ACTIONS => { + 'CONSTANT' => 56, + 'TEXT' => 13, + 'IDENTIFIER' => 22 + }, + DEFAULT => -99, + GOTOS => { + 'identifier' => 57, + 'anytext' => 174, + 'text' => 58, + 'constant' => 55 + } }, {#State 154 ACTIONS => { - "," => -84, - "void" => 175, - ")" => -84 + 'CONSTANT' => 56, + 'TEXT' => 13, + 'IDENTIFIER' => 22 }, - DEFAULT => -91, + DEFAULT => -99, GOTOS => { - 'base_element' => 172, - 'element_list2' => 174, - 'property_list' => 173 + 'identifier' => 57, + 'anytext' => 175, + 'text' => 58, + 'constant' => 55 } }, {#State 155 ACTIONS => { - ";" => 176 + 'CONSTANT' => 56, + 'TEXT' => 13, + "]" => 176, + 'IDENTIFIER' => 22 + }, + DEFAULT => -99, + GOTOS => { + 'identifier' => 57, + 'anytext' => 177, + 'text' => 58, + 'constant' => 55 } }, {#State 156 ACTIONS => { - "[" => 161, - "=" => 178 - }, - GOTOS => { - 'array_len' => 177 + ";" => 178 } }, {#State 157 - DEFAULT => -81 + ACTIONS => { + "}" => 179 + }, + DEFAULT => -89, + GOTOS => { + 'optional_base_element' => 181, + 'property_list' => 180 + } }, {#State 158 ACTIONS => { - "-" => 65, - ":" => 64, - "<" => 67, - "+" => 69, - "~" => 68, - "*" => 76, - "?" => 66, - "{" => 70, - "&" => 71, - "/" => 72, - "=" => 73, - "(" => 74, - "|" => 75, - "." => 77, - ">" => 78 + "}" => 182 }, - DEFAULT => -119 + DEFAULT => -89, + GOTOS => { + 'base_element' => 183, + 'property_list' => 167 + } }, {#State 159 ACTIONS => { - "-" => 65, - ":" => 64, - "<" => 67, - "+" => 69, - "~" => 68, - "*" => 76, - "?" => 66, - "{" => 70, - "&" => 71, - "/" => 72, - "=" => 73, - "(" => 74, - "|" => 75, - "." => 77, - ">" => 78 + "=" => 184 }, - DEFAULT => -100 + DEFAULT => -52 }, {#State 160 - ACTIONS => { - ":" => 64, - "<" => 67, - "~" => 68, - "?" => 66, - "{" => 70, - "=" => 73 - }, - DEFAULT => -118 + DEFAULT => -50 }, {#State 161 ACTIONS => { - 'CONSTANT' => 44, - 'TEXT' => 13, - "]" => 179, - 'IDENTIFIER' => 22 - }, - DEFAULT => -101, - GOTOS => { - 'identifier' => 45, - 'anytext' => 180, - 'text' => 46, - 'constant' => 43 + "}" => 185, + "," => 186 } }, {#State 162 ACTIONS => { - ";" => 181 - } + "," => 187 + }, + DEFAULT => -61 }, {#State 163 - ACTIONS => { - "}" => 182 - }, - DEFAULT => -91, - GOTOS => { - 'optional_base_element' => 184, - 'property_list' => 183 - } + DEFAULT => -58 }, {#State 164 ACTIONS => { - "}" => 185 - }, - DEFAULT => -91, - GOTOS => { - 'base_element' => 186, - 'property_list' => 173 + "=" => 188 } }, {#State 165 ACTIONS => { - "=" => 187 - }, - DEFAULT => -54 + "}" => 189 + } }, {#State 166 - DEFAULT => -52 + DEFAULT => -84 }, {#State 167 ACTIONS => { - "}" => 188, - "," => 189 + 'IDENTIFIER' => 22, + "signed" => 72, + 'void' => 66, + "unsigned" => 76, + "[" => 17 + }, + DEFAULT => -89, + GOTOS => { + 'existingtype' => 73, + 'bitmap' => 39, + 'usertype' => 68, + 'property_list' => 67, + 'identifier' => 69, + 'struct' => 45, + 'enum' => 49, + 'type' => 190, + 'union' => 51, + 'sign' => 70 } }, {#State 168 ACTIONS => { - "," => 190 - }, - DEFAULT => -63 + "," => 191, + ")" => 192 + } }, {#State 169 - DEFAULT => -60 + DEFAULT => -83 }, {#State 170 - ACTIONS => { - "=" => 191 - } + DEFAULT => -26 }, {#State 171 ACTIONS => { - "}" => 192 + "=" => 193 } }, {#State 172 - DEFAULT => -86 - }, - {#State 173 ACTIONS => { - 'IDENTIFIER' => 22, - "signed" => 95, - 'void' => 89, - "unsigned" => 99, - "[" => 17 + 'CONSTANT' => 56, + 'TEXT' => 13, + 'IDENTIFIER' => 22 }, - DEFAULT => -91, + DEFAULT => -99, GOTOS => { - 'existingtype' => 96, - 'bitmap' => 51, - 'usertype' => 91, - 'property_list' => 90, - 'identifier' => 92, - 'struct' => 57, - 'enum' => 61, - 'type' => 193, - 'union' => 63, - 'sign' => 93 + 'identifier' => 57, + 'anytext' => 194, + 'text' => 58, + 'constant' => 55 } }, - {#State 174 + {#State 173 ACTIONS => { - "," => 194, - ")" => 195 - } - }, - {#State 175 - DEFAULT => -85 - }, - {#State 176 - DEFAULT => -28 + "-" => 81, + ":" => 80, + "<" => 82, + "+" => 84, + "~" => 83, + "*" => 85, + "?" => 86, + "{" => 87, + "&" => 88, + "/" => 89, + "=" => 90, + "(" => 91, + "|" => 92, + "." => 93, + ">" => 94 + }, + DEFAULT => -117 }, - {#State 177 + {#State 174 ACTIONS => { - "=" => 196 - } + "-" => 81, + ":" => 80, + "<" => 82, + "+" => 84, + "~" => 83, + "*" => 85, + "?" => 86, + "{" => 87, + "&" => 88, + "/" => 89, + "=" => 90, + "(" => 91, + "|" => 92, + "." => 93, + ">" => 94 + }, + DEFAULT => -98 }, - {#State 178 + {#State 175 ACTIONS => { - 'CONSTANT' => 44, - 'TEXT' => 13, - 'IDENTIFIER' => 22 + ":" => 80, + "<" => 82, + "~" => 83, + "?" => 86, + "{" => 87, + "=" => 90 }, - DEFAULT => -101, - GOTOS => { - 'identifier' => 45, - 'anytext' => 197, - 'text' => 46, - 'constant' => 43 - } + DEFAULT => -116 }, - {#State 179 + {#State 176 ACTIONS => { - "[" => 161 + "[" => 155 }, - DEFAULT => -88, + DEFAULT => -86, GOTOS => { - 'array_len' => 198 + 'array_len' => 195 } }, - {#State 180 + {#State 177 ACTIONS => { - "-" => 65, - ":" => 64, - "?" => 66, - "<" => 67, - "+" => 69, - "~" => 68, - "&" => 71, - "{" => 70, - "/" => 72, - "=" => 73, - "|" => 75, - "(" => 74, - "*" => 76, - "." => 77, - "]" => 199, - ">" => 78 + "-" => 81, + ":" => 80, + "?" => 86, + "<" => 82, + "+" => 84, + "~" => 83, + "&" => 88, + "{" => 87, + "/" => 89, + "=" => 90, + "|" => 92, + "(" => 91, + "*" => 85, + "." => 93, + "]" => 196, + ">" => 94 } }, - {#State 181 - DEFAULT => -35 + {#State 178 + DEFAULT => -33 }, - {#State 182 - DEFAULT => -75 + {#State 179 + DEFAULT => -73 }, - {#State 183 + {#State 180 ACTIONS => { "[" => 17 }, - DEFAULT => -91, + DEFAULT => -89, GOTOS => { - 'base_or_empty' => 200, - 'base_element' => 201, - 'empty_element' => 202, - 'property_list' => 203 + 'base_or_empty' => 197, + 'base_element' => 198, + 'empty_element' => 199, + 'property_list' => 200 } }, - {#State 184 - DEFAULT => -74 + {#State 181 + DEFAULT => -72 }, - {#State 185 - DEFAULT => -65 + {#State 182 + DEFAULT => -63 }, - {#State 186 + {#State 183 ACTIONS => { - ";" => 204 + ";" => 201 } }, - {#State 187 + {#State 184 ACTIONS => { - 'CONSTANT' => 44, + 'CONSTANT' => 56, 'TEXT' => 13, 'IDENTIFIER' => 22 }, - DEFAULT => -101, + DEFAULT => -99, GOTOS => { - 'identifier' => 45, - 'anytext' => 205, - 'text' => 46, - 'constant' => 43 + 'identifier' => 57, + 'anytext' => 202, + 'text' => 58, + 'constant' => 55 } }, - {#State 188 - DEFAULT => -48 + {#State 185 + DEFAULT => -46 }, - {#State 189 + {#State 186 ACTIONS => { 'IDENTIFIER' => 22 }, GOTOS => { - 'identifier' => 165, - 'enum_element' => 206 + 'identifier' => 159, + 'enum_element' => 203 } }, - {#State 190 + {#State 187 ACTIONS => { 'IDENTIFIER' => 22 }, GOTOS => { - 'identifier' => 170, - 'bitmap_element' => 207 + 'identifier' => 164, + 'bitmap_element' => 204 } }, - {#State 191 + {#State 188 ACTIONS => { - 'CONSTANT' => 44, + 'CONSTANT' => 56, 'TEXT' => 13, 'IDENTIFIER' => 22 }, - DEFAULT => -101, + DEFAULT => -99, GOTOS => { - 'identifier' => 45, - 'anytext' => 208, - 'text' => 46, - 'constant' => 43 + 'identifier' => 57, + 'anytext' => 205, + 'text' => 58, + 'constant' => 55 } }, - {#State 192 - DEFAULT => -56 + {#State 189 + DEFAULT => -54 }, - {#State 193 - DEFAULT => -80, + {#State 190 + DEFAULT => -78, GOTOS => { - 'pointers' => 209 + 'pointers' => 206 } }, - {#State 194 - DEFAULT => -91, + {#State 191 + DEFAULT => -89, GOTOS => { - 'base_element' => 210, - 'property_list' => 173 + 'base_element' => 207, + 'property_list' => 167 } }, - {#State 195 + {#State 192 ACTIONS => { - ";" => 211 + ";" => 208 } }, - {#State 196 + {#State 193 ACTIONS => { - 'CONSTANT' => 44, + 'CONSTANT' => 56, 'TEXT' => 13, 'IDENTIFIER' => 22 }, - DEFAULT => -101, + DEFAULT => -99, GOTOS => { - 'identifier' => 45, - 'anytext' => 212, - 'text' => 46, - 'constant' => 43 + 'identifier' => 57, + 'anytext' => 209, + 'text' => 58, + 'constant' => 55 } }, - {#State 197 + {#State 194 ACTIONS => { - "-" => 65, - ":" => 64, - "?" => 66, - "<" => 67, - ";" => 213, - "+" => 69, - "~" => 68, - "&" => 71, - "{" => 70, - "/" => 72, - "=" => 73, - "|" => 75, - "(" => 74, - "*" => 76, - "." => 77, - ">" => 78 + "-" => 81, + ":" => 80, + "?" => 86, + "<" => 82, + ";" => 210, + "+" => 84, + "~" => 83, + "&" => 88, + "{" => 87, + "/" => 89, + "=" => 90, + "|" => 92, + "(" => 91, + "*" => 85, + "." => 93, + ">" => 94 } }, - {#State 198 - DEFAULT => -89 + {#State 195 + DEFAULT => -87 }, - {#State 199 + {#State 196 ACTIONS => { - "[" => 161 + "[" => 155 }, - DEFAULT => -88, + DEFAULT => -86, GOTOS => { - 'array_len' => 214 + 'array_len' => 211 } }, - {#State 200 - DEFAULT => -72 + {#State 197 + DEFAULT => -70 }, - {#State 201 + {#State 198 ACTIONS => { - ";" => 215 + ";" => 212 } }, - {#State 202 - DEFAULT => -71 + {#State 199 + DEFAULT => -69 }, - {#State 203 + {#State 200 ACTIONS => { 'IDENTIFIER' => 22, - "signed" => 95, - ";" => 216, - 'void' => 89, - "unsigned" => 99, + "signed" => 72, + ";" => 213, + 'void' => 66, + "unsigned" => 76, "[" => 17 }, - DEFAULT => -91, + DEFAULT => -89, GOTOS => { - 'existingtype' => 96, - 'bitmap' => 51, - 'usertype' => 91, - 'property_list' => 90, - 'identifier' => 92, - 'struct' => 57, - 'enum' => 61, - 'type' => 193, - 'union' => 63, - 'sign' => 93 + 'existingtype' => 73, + 'bitmap' => 39, + 'usertype' => 68, + 'property_list' => 67, + 'identifier' => 69, + 'struct' => 45, + 'enum' => 49, + 'type' => 190, + 'union' => 51, + 'sign' => 70 } }, + {#State 201 + DEFAULT => -81 + }, + {#State 202 + ACTIONS => { + "-" => 81, + ":" => 80, + "<" => 82, + "+" => 84, + "~" => 83, + "*" => 85, + "?" => 86, + "{" => 87, + "&" => 88, + "/" => 89, + "=" => 90, + "(" => 91, + "|" => 92, + "." => 93, + ">" => 94 + }, + DEFAULT => -53 + }, + {#State 203 + DEFAULT => -51 + }, {#State 204 - DEFAULT => -83 + DEFAULT => -59 }, {#State 205 ACTIONS => { - "-" => 65, - ":" => 64, - "<" => 67, - "+" => 69, - "~" => 68, - "*" => 76, - "?" => 66, - "{" => 70, - "&" => 71, - "/" => 72, - "=" => 73, - "(" => 74, - "|" => 75, - "." => 77, - ">" => 78 - }, - DEFAULT => -55 + "-" => 81, + ":" => 80, + "<" => 82, + "+" => 84, + "~" => 83, + "*" => 85, + "?" => 86, + "{" => 87, + "&" => 88, + "/" => 89, + "=" => 90, + "(" => 91, + "|" => 92, + "." => 93, + ">" => 94 + }, + DEFAULT => -62 }, {#State 206 - DEFAULT => -53 + ACTIONS => { + 'IDENTIFIER' => 22, + "*" => 151 + }, + GOTOS => { + 'identifier' => 214 + } }, {#State 207 - DEFAULT => -61 + DEFAULT => -85 }, {#State 208 - ACTIONS => { - "-" => 65, - ":" => 64, - "<" => 67, - "+" => 69, - "~" => 68, - "*" => 76, - "?" => 66, - "{" => 70, - "&" => 71, - "/" => 72, - "=" => 73, - "(" => 74, - "|" => 75, - "." => 77, - ">" => 78 - }, - DEFAULT => -64 + DEFAULT => -25 }, {#State 209 ACTIONS => { - 'IDENTIFIER' => 22, - "*" => 157 - }, - GOTOS => { - 'identifier' => 217 + "-" => 81, + ":" => 80, + "?" => 86, + "<" => 82, + ";" => 215, + "+" => 84, + "~" => 83, + "&" => 88, + "{" => 87, + "/" => 89, + "=" => 90, + "|" => 92, + "(" => 91, + "*" => 85, + "." => 93, + ">" => 94 } }, {#State 210 - DEFAULT => -87 + DEFAULT => -23 }, {#State 211 - DEFAULT => -27 + DEFAULT => -88 }, {#State 212 - ACTIONS => { - "-" => 65, - ":" => 64, - "?" => 66, - "<" => 67, - ";" => 218, - "+" => 69, - "~" => 68, - "&" => 71, - "{" => 70, - "/" => 72, - "=" => 73, - "|" => 75, - "(" => 74, - "*" => 76, - "." => 77, - ">" => 78 - } + DEFAULT => -68 }, {#State 213 - DEFAULT => -25 + DEFAULT => -67 }, {#State 214 - DEFAULT => -90 - }, - {#State 215 - DEFAULT => -70 - }, - {#State 216 - DEFAULT => -69 - }, - {#State 217 ACTIONS => { - "[" => 161 + "[" => 155 }, - DEFAULT => -88, + DEFAULT => -86, GOTOS => { - 'array_len' => 219 + 'array_len' => 216 } }, - {#State 218 - DEFAULT => -26 + {#State 215 + DEFAULT => -24 }, - {#State 219 - DEFAULT => -79 + {#State 216 + DEFAULT => -77 } ], yyrules => @@ -1894,59 +1874,49 @@ sub { push(@{$_[1]}, $_[2]); $_[1] } ], [#Rule 15 - 'interface', 8, + 'interface', 7, sub #line 70 "idl.yp" {{ "TYPE" => "INTERFACE", "PROPERTIES" => $_[1], "NAME" => $_[3], - "BASE" => $_[4], - "DATA" => $_[6], + "DATA" => $_[5], "FILE" => $_[0]->YYData->{FILE}, "LINE" => $_[0]->YYData->{LINE}, }} ], [#Rule 16 - 'base_interface', 0, undef - ], - [#Rule 17 - 'base_interface', 2, -sub -#line 83 "idl.yp" -{ $_[2] } - ], - [#Rule 18 'definitions', 1, sub -#line 87 "idl.yp" +#line 81 "idl.yp" { [ $_[1] ] } ], - [#Rule 19 + [#Rule 17 'definitions', 2, sub -#line 88 "idl.yp" +#line 82 "idl.yp" { push(@{$_[1]}, $_[2]); $_[1] } ], - [#Rule 20 + [#Rule 18 'definition', 1, undef ], - [#Rule 21 + [#Rule 19 'definition', 1, undef ], - [#Rule 22 + [#Rule 20 'definition', 1, undef ], - [#Rule 23 + [#Rule 21 'definition', 1, undef ], - [#Rule 24 + [#Rule 22 'definition', 1, undef ], - [#Rule 25 + [#Rule 23 'const', 7, sub -#line 96 "idl.yp" +#line 90 "idl.yp" {{ "TYPE" => "CONST", "DTYPE" => $_[2], @@ -1957,10 +1927,10 @@ sub "LINE" => $_[0]->YYData->{LINE}, }} ], - [#Rule 26 + [#Rule 24 'const', 8, sub -#line 106 "idl.yp" +#line 100 "idl.yp" {{ "TYPE" => "CONST", "DTYPE" => $_[2], @@ -1972,10 +1942,10 @@ sub "LINE" => $_[0]->YYData->{LINE}, }} ], - [#Rule 27 + [#Rule 25 'function', 7, sub -#line 120 "idl.yp" +#line 114 "idl.yp" {{ "TYPE" => "FUNCTION", "NAME" => $_[3], @@ -1986,10 +1956,10 @@ sub "LINE" => $_[0]->YYData->{LINE}, }} ], - [#Rule 28 + [#Rule 26 'declare', 5, sub -#line 132 "idl.yp" +#line 126 "idl.yp" {{ "TYPE" => "DECLARE", "PROPERTIES" => $_[2], @@ -1999,43 +1969,43 @@ sub "LINE" => $_[0]->YYData->{LINE}, }} ], - [#Rule 29 + [#Rule 27 'decl_type', 1, undef ], - [#Rule 30 + [#Rule 28 'decl_type', 1, undef ], - [#Rule 31 + [#Rule 29 'decl_type', 1, undef ], - [#Rule 32 + [#Rule 30 'decl_enum', 1, sub -#line 146 "idl.yp" +#line 140 "idl.yp" {{ "TYPE" => "ENUM" }} ], - [#Rule 33 + [#Rule 31 'decl_bitmap', 1, sub -#line 152 "idl.yp" +#line 146 "idl.yp" {{ "TYPE" => "BITMAP" }} ], - [#Rule 34 + [#Rule 32 'decl_union', 1, sub -#line 158 "idl.yp" +#line 152 "idl.yp" {{ "TYPE" => "UNION" }} ], - [#Rule 35 + [#Rule 33 'typedef', 6, sub -#line 164 "idl.yp" +#line 158 "idl.yp" {{ "TYPE" => "TYPEDEF", "PROPERTIES" => $_[1], @@ -2046,67 +2016,67 @@ sub "LINE" => $_[0]->YYData->{LINE}, }} ], - [#Rule 36 + [#Rule 34 'usertype', 1, undef ], - [#Rule 37 + [#Rule 35 'usertype', 1, undef ], - [#Rule 38 + [#Rule 36 'usertype', 1, undef ], - [#Rule 39 + [#Rule 37 'usertype', 1, undef ], - [#Rule 40 + [#Rule 38 'typedecl', 2, sub -#line 177 "idl.yp" +#line 171 "idl.yp" { $_[1] } ], - [#Rule 41 + [#Rule 39 'sign', 1, undef ], - [#Rule 42 + [#Rule 40 'sign', 1, undef ], - [#Rule 43 + [#Rule 41 'existingtype', 2, sub -#line 182 "idl.yp" +#line 176 "idl.yp" { ($_[1]?$_[1]:"signed") ." $_[2]" } ], - [#Rule 44 + [#Rule 42 'existingtype', 1, undef ], - [#Rule 45 + [#Rule 43 'type', 1, undef ], - [#Rule 46 + [#Rule 44 'type', 1, undef ], - [#Rule 47 + [#Rule 45 'type', 1, sub -#line 186 "idl.yp" +#line 180 "idl.yp" { "void" } ], - [#Rule 48 + [#Rule 46 'enum_body', 3, sub -#line 188 "idl.yp" +#line 182 "idl.yp" { $_[2] } ], - [#Rule 49 + [#Rule 47 'opt_enum_body', 0, undef ], - [#Rule 50 + [#Rule 48 'opt_enum_body', 1, undef ], - [#Rule 51 + [#Rule 49 'enum', 4, sub -#line 191 "idl.yp" +#line 185 "idl.yp" {{ "TYPE" => "ENUM", "PROPERTIES" => $_[1], @@ -2114,43 +2084,43 @@ sub "ELEMENTS" => $_[4] }} ], - [#Rule 52 + [#Rule 50 'enum_elements', 1, sub -#line 200 "idl.yp" +#line 194 "idl.yp" { [ $_[1] ] } ], - [#Rule 53 + [#Rule 51 'enum_elements', 3, sub -#line 201 "idl.yp" +#line 195 "idl.yp" { push(@{$_[1]}, $_[3]); $_[1] } ], - [#Rule 54 + [#Rule 52 'enum_element', 1, undef ], - [#Rule 55 + [#Rule 53 'enum_element', 3, sub -#line 205 "idl.yp" +#line 199 "idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 56 + [#Rule 54 'bitmap_body', 3, sub -#line 208 "idl.yp" +#line 202 "idl.yp" { $_[2] } ], - [#Rule 57 + [#Rule 55 'opt_bitmap_body', 0, undef ], - [#Rule 58 + [#Rule 56 'opt_bitmap_body', 1, undef ], - [#Rule 59 + [#Rule 57 'bitmap', 4, sub -#line 211 "idl.yp" +#line 205 "idl.yp" {{ "TYPE" => "BITMAP", "PROPERTIES" => $_[1], @@ -2158,46 +2128,46 @@ sub "ELEMENTS" => $_[4] }} ], - [#Rule 60 + [#Rule 58 'bitmap_elements', 1, sub -#line 220 "idl.yp" +#line 214 "idl.yp" { [ $_[1] ] } ], - [#Rule 61 + [#Rule 59 'bitmap_elements', 3, sub -#line 221 "idl.yp" +#line 215 "idl.yp" { push(@{$_[1]}, $_[3]); $_[1] } ], - [#Rule 62 + [#Rule 60 'opt_bitmap_elements', 0, undef ], - [#Rule 63 + [#Rule 61 'opt_bitmap_elements', 1, undef ], - [#Rule 64 + [#Rule 62 'bitmap_element', 3, sub -#line 226 "idl.yp" +#line 220 "idl.yp" { "$_[1] ( $_[3] )" } ], - [#Rule 65 + [#Rule 63 'struct_body', 3, sub -#line 229 "idl.yp" +#line 223 "idl.yp" { $_[2] } ], - [#Rule 66 + [#Rule 64 'opt_struct_body', 0, undef ], - [#Rule 67 + [#Rule 65 'opt_struct_body', 1, undef ], - [#Rule 68 + [#Rule 66 'struct', 4, sub -#line 233 "idl.yp" +#line 227 "idl.yp" {{ "TYPE" => "STRUCT", "PROPERTIES" => $_[1], @@ -2205,10 +2175,10 @@ sub "ELEMENTS" => $_[4] }} ], - [#Rule 69 + [#Rule 67 'empty_element', 2, sub -#line 242 "idl.yp" +#line 236 "idl.yp" {{ "NAME" => "", "TYPE" => "EMPTY", @@ -2219,43 +2189,43 @@ sub "LINE" => $_[0]->YYData->{LINE}, }} ], - [#Rule 70 + [#Rule 68 'base_or_empty', 2, undef ], - [#Rule 71 + [#Rule 69 'base_or_empty', 1, undef ], - [#Rule 72 + [#Rule 70 'optional_base_element', 2, sub -#line 256 "idl.yp" +#line 250 "idl.yp" { $_[2]->{PROPERTIES} = FlattenHash([$_[1],$_[2]->{PROPERTIES}]); $_[2] } ], - [#Rule 73 + [#Rule 71 'union_elements', 0, undef ], - [#Rule 74 + [#Rule 72 'union_elements', 2, sub -#line 261 "idl.yp" +#line 255 "idl.yp" { push(@{$_[1]}, $_[2]); $_[1] } ], - [#Rule 75 + [#Rule 73 'union_body', 3, sub -#line 264 "idl.yp" +#line 258 "idl.yp" { $_[2] } ], - [#Rule 76 + [#Rule 74 'opt_union_body', 0, undef ], - [#Rule 77 + [#Rule 75 'opt_union_body', 1, undef ], - [#Rule 78 + [#Rule 76 'union', 4, sub -#line 268 "idl.yp" +#line 262 "idl.yp" {{ "TYPE" => "UNION", "PROPERTIES" => $_[1], @@ -2263,10 +2233,10 @@ sub "ELEMENTS" => $_[4] }} ], - [#Rule 79 + [#Rule 77 'base_element', 5, sub -#line 277 "idl.yp" +#line 271 "idl.yp" {{ "NAME" => $_[4], "TYPE" => $_[2], @@ -2277,238 +2247,241 @@ sub "LINE" => $_[0]->YYData->{LINE}, }} ], - [#Rule 80 + [#Rule 78 'pointers', 0, sub -#line 291 "idl.yp" +#line 285 "idl.yp" { 0 } ], - [#Rule 81 + [#Rule 79 'pointers', 2, sub -#line 292 "idl.yp" +#line 286 "idl.yp" { $_[1]+1 } ], - [#Rule 82 - 'element_list1', 0, undef + [#Rule 80 + 'element_list1', 0, +sub +#line 290 "idl.yp" +{ [] } ], - [#Rule 83 + [#Rule 81 'element_list1', 3, sub -#line 297 "idl.yp" +#line 291 "idl.yp" { push(@{$_[1]}, $_[2]); $_[1] } ], - [#Rule 84 + [#Rule 82 'element_list2', 0, undef ], - [#Rule 85 + [#Rule 83 'element_list2', 1, undef ], - [#Rule 86 + [#Rule 84 'element_list2', 1, sub -#line 303 "idl.yp" +#line 297 "idl.yp" { [ $_[1] ] } ], - [#Rule 87 + [#Rule 85 'element_list2', 3, sub -#line 304 "idl.yp" +#line 298 "idl.yp" { push(@{$_[1]}, $_[3]); $_[1] } ], - [#Rule 88 + [#Rule 86 'array_len', 0, undef ], - [#Rule 89 + [#Rule 87 'array_len', 3, sub -#line 309 "idl.yp" +#line 303 "idl.yp" { push(@{$_[3]}, "*"); $_[3] } ], - [#Rule 90 + [#Rule 88 'array_len', 4, sub -#line 310 "idl.yp" +#line 304 "idl.yp" { push(@{$_[4]}, "$_[2]"); $_[4] } ], - [#Rule 91 + [#Rule 89 'property_list', 0, undef ], - [#Rule 92 + [#Rule 90 'property_list', 4, sub -#line 316 "idl.yp" +#line 310 "idl.yp" { FlattenHash([$_[1],$_[3]]); } ], - [#Rule 93 + [#Rule 91 'properties', 1, sub -#line 319 "idl.yp" +#line 313 "idl.yp" { $_[1] } ], - [#Rule 94 + [#Rule 92 'properties', 3, sub -#line 320 "idl.yp" +#line 314 "idl.yp" { FlattenHash([$_[1], $_[3]]); } ], - [#Rule 95 + [#Rule 93 'property', 1, sub -#line 323 "idl.yp" +#line 317 "idl.yp" {{ "$_[1]" => "1" }} ], - [#Rule 96 + [#Rule 94 'property', 4, sub -#line 324 "idl.yp" +#line 318 "idl.yp" {{ "$_[1]" => "$_[3]" }} ], - [#Rule 97 + [#Rule 95 'listtext', 1, undef ], - [#Rule 98 + [#Rule 96 'listtext', 3, sub -#line 329 "idl.yp" +#line 323 "idl.yp" { "$_[1] $_[3]" } ], - [#Rule 99 + [#Rule 97 'commalisttext', 1, undef ], - [#Rule 100 + [#Rule 98 'commalisttext', 3, sub -#line 334 "idl.yp" +#line 328 "idl.yp" { "$_[1],$_[3]" } ], - [#Rule 101 + [#Rule 99 'anytext', 0, sub -#line 338 "idl.yp" +#line 332 "idl.yp" { "" } ], + [#Rule 100 + 'anytext', 1, undef + ], + [#Rule 101 + 'anytext', 1, undef + ], [#Rule 102 'anytext', 1, undef ], [#Rule 103 - 'anytext', 1, undef + 'anytext', 3, +sub +#line 334 "idl.yp" +{ "$_[1]$_[2]$_[3]" } ], [#Rule 104 - 'anytext', 1, undef + 'anytext', 3, +sub +#line 335 "idl.yp" +{ "$_[1]$_[2]$_[3]" } ], [#Rule 105 'anytext', 3, sub -#line 340 "idl.yp" +#line 336 "idl.yp" { "$_[1]$_[2]$_[3]" } ], [#Rule 106 'anytext', 3, sub -#line 341 "idl.yp" +#line 337 "idl.yp" { "$_[1]$_[2]$_[3]" } ], [#Rule 107 'anytext', 3, sub -#line 342 "idl.yp" +#line 338 "idl.yp" { "$_[1]$_[2]$_[3]" } ], [#Rule 108 'anytext', 3, sub -#line 343 "idl.yp" +#line 339 "idl.yp" { "$_[1]$_[2]$_[3]" } ], [#Rule 109 'anytext', 3, sub -#line 344 "idl.yp" +#line 340 "idl.yp" { "$_[1]$_[2]$_[3]" } ], [#Rule 110 'anytext', 3, sub -#line 345 "idl.yp" +#line 341 "idl.yp" { "$_[1]$_[2]$_[3]" } ], [#Rule 111 'anytext', 3, sub -#line 346 "idl.yp" +#line 342 "idl.yp" { "$_[1]$_[2]$_[3]" } ], [#Rule 112 'anytext', 3, sub -#line 347 "idl.yp" +#line 343 "idl.yp" { "$_[1]$_[2]$_[3]" } ], [#Rule 113 'anytext', 3, sub -#line 348 "idl.yp" +#line 344 "idl.yp" { "$_[1]$_[2]$_[3]" } ], [#Rule 114 'anytext', 3, sub -#line 349 "idl.yp" +#line 345 "idl.yp" { "$_[1]$_[2]$_[3]" } ], [#Rule 115 'anytext', 3, sub -#line 350 "idl.yp" +#line 346 "idl.yp" { "$_[1]$_[2]$_[3]" } ], [#Rule 116 - 'anytext', 3, -sub -#line 351 "idl.yp" -{ "$_[1]$_[2]$_[3]" } - ], - [#Rule 117 - 'anytext', 3, -sub -#line 352 "idl.yp" -{ "$_[1]$_[2]$_[3]" } - ], - [#Rule 118 'anytext', 5, sub -#line 353 "idl.yp" +#line 347 "idl.yp" { "$_[1]$_[2]$_[3]$_[4]$_[5]" } ], - [#Rule 119 + [#Rule 117 'anytext', 5, sub -#line 354 "idl.yp" +#line 348 "idl.yp" { "$_[1]$_[2]$_[3]$_[4]$_[5]" } ], - [#Rule 120 + [#Rule 118 'identifier', 1, undef ], - [#Rule 121 + [#Rule 119 'optional_identifier', 1, undef ], - [#Rule 122 + [#Rule 120 'optional_identifier', 0, undef ], - [#Rule 123 + [#Rule 121 'constant', 1, undef ], - [#Rule 124 + [#Rule 122 'text', 1, sub -#line 368 "idl.yp" +#line 362 "idl.yp" { "\"$_[1]\"" } ], - [#Rule 125 + [#Rule 123 'optional_semicolon', 0, undef ], - [#Rule 126 + [#Rule 124 'optional_semicolon', 1, undef ] ], @@ -2516,7 +2489,7 @@ sub bless($self,$class); } -#line 379 "idl.yp" +#line 373 "idl.yp" use Parse::Pidl qw(error); @@ -2548,10 +2521,6 @@ sub CleanData($) if (ref($v) eq "ARRAY") { foreach my $i (0 .. $#{$v}) { CleanData($v->[$i]); - if (ref($v->[$i]) eq "ARRAY" && $#{$v->[$i]}==-1) { - $v->[$i] = undef; - next; - } } # this removes any undefined elements from the array @{$v} = grep { defined $_ } @{$v}; @@ -2559,7 +2528,6 @@ sub CleanData($) foreach my $x (keys %{$v}) { CleanData($v->{$x}); if (!defined $v->{$x}) { delete($v->{$x}); next; } - if (ref($v->{$x}) eq "ARRAY" && $#{$v->{$x}}==-1) { delete($v->{$x}); next; } } } return $v; diff --git a/tools/pidl/lib/Parse/Pidl/NDR.pm b/tools/pidl/lib/Parse/Pidl/NDR.pm index 7322856cdd..1d7ca16707 100644 --- a/tools/pidl/lib/Parse/Pidl/NDR.pm +++ b/tools/pidl/lib/Parse/Pidl/NDR.pm @@ -35,7 +35,7 @@ use vars qw($VERSION); $VERSION = '0.01'; @ISA = qw(Exporter); @EXPORT = qw(GetPrevLevel GetNextLevel ContainsDeferred ContainsString); -@EXPORT_OK = qw(GetElementLevelTable ParseElement ValidElement); +@EXPORT_OK = qw(GetElementLevelTable ParseElement ValidElement align_type mapToScalar ParseType); use strict; use Parse::Pidl qw(warning fatal); @@ -271,8 +271,9 @@ sub GetElementLevelTable($) ##################################################################### # see if a type contains any deferred data -sub can_contain_deferred +sub can_contain_deferred($) { + sub can_contain_deferred($); my $e = shift; return 0 if (Parse::Pidl::Typelist::is_scalar($e->{TYPE})); @@ -335,7 +336,11 @@ sub find_largest_alignment($) sub align_type($) { sub align_type($); - my $e = shift; + my ($e) = @_; + + if (ref($e) eq "HASH" and $e->{TYPE} eq "SCALAR") { + return $scalar_alignment->{$e->{NAME}}; + } unless (hasType($e)) { # it must be an external type - all we can do is guess @@ -343,16 +348,16 @@ sub align_type($) return 4; } - my $dt = getType($e)->{DATA}; + my $dt = getType($e); - if ($dt->{TYPE} eq "ENUM") { + if ($dt->{TYPE} eq "TYPEDEF" or $dt->{TYPE} eq "DECLARE") { + return align_type($dt->{DATA}); + } elsif ($dt->{TYPE} eq "ENUM") { return align_type(Parse::Pidl::Typelist::enum_type_fn($dt)); } elsif ($dt->{TYPE} eq "BITMAP") { return align_type(Parse::Pidl::Typelist::bitmap_type_fn($dt)); } elsif (($dt->{TYPE} eq "STRUCT") or ($dt->{TYPE} eq "UNION")) { return find_largest_alignment($dt); - } elsif ($dt->{TYPE} eq "SCALAR") { - return $scalar_alignment->{$dt->{NAME}}; } die("Unknown data type type $dt->{TYPE}"); @@ -495,6 +500,7 @@ sub ParseType($$) my ($d, $pointer_default) = @_; if ($d->{TYPE} eq "STRUCT" or $d->{TYPE} eq "UNION") { + return $d if (not defined($d->{ELEMENTS})); CheckPointerTypes($d, $pointer_default); } @@ -876,17 +882,19 @@ sub ValidProperties($$) sub mapToScalar($) { + sub mapToScalar($); my $t = shift; + return $t->{NAME} if (ref($t) eq "HASH" and $t->{TYPE} eq "SCALAR"); my $ti = getType($t); if (not defined ($ti)) { return undef; - } elsif ($ti->{DATA}->{TYPE} eq "ENUM") { - return Parse::Pidl::Typelist::enum_type_fn($ti->{DATA}); - } elsif ($ti->{DATA}->{TYPE} eq "BITMAP") { - return Parse::Pidl::Typelist::enum_type_fn($ti->{DATA}); - } elsif ($ti->{DATA}->{TYPE} eq "SCALAR") { - return $t; + } elsif ($ti->{TYPE} eq "TYPEDEF") { + return mapToScalar($ti->{DATA}); + } elsif ($ti->{TYPE} eq "ENUM") { + return Parse::Pidl::Typelist::enum_type_fn($ti); + } elsif ($ti->{TYPE} eq "BITMAP") { + return Parse::Pidl::Typelist::bitmap_type_fn($ti); } return undef; diff --git a/tools/pidl/lib/Parse/Pidl/Samba4/EJS.pm b/tools/pidl/lib/Parse/Pidl/Samba4/EJS.pm index 9edd2a4a33..054074297b 100644 --- a/tools/pidl/lib/Parse/Pidl/Samba4/EJS.pm +++ b/tools/pidl/lib/Parse/Pidl/Samba4/EJS.pm @@ -9,7 +9,7 @@ package Parse::Pidl::Samba4::EJS; use Exporter; @ISA = qw(Exporter); @EXPORT_OK = qw(get_pointer_to get_value_of check_null_pointer $res - $res_hdr fn_declare); + $res_hdr fn_declare TypeFunctionName); use strict; use Parse::Pidl::Typelist; @@ -426,14 +426,7 @@ sub EjsPushScalar($$$$$) $var = get_pointer_to($var); } - my $t; - if (ref($e->{TYPE}) eq "HASH") { - $t = "$e->{TYPE}->{TYPE}_$e->{TYPE}->{NAME}"; - } else { - $t = $e->{TYPE}; - } - - pidl "NDR_CHECK(ejs_push_$t(ejs, v, $name, $var));"; + pidl "NDR_CHECK(".TypeFunctionName("ejs_push", $e->{TYPE})."(ejs, v, $name, $var));"; } } @@ -619,21 +612,22 @@ sub EjsTypePushFunction($$) my ($d, $name) = @_; return if (has_property($d, "noejs")); - if ($d->{TYPE} eq "TYPEDEF") { - EjsTypePushFunction($d->{DATA}, $name); - return; - } - - if ($d->{TYPE} eq "STRUCT") { - fn_declare($d, "NTSTATUS ejs_push_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, const struct $name *r)"); - } elsif ($d->{TYPE} eq "UNION") { - fn_declare($d, "NTSTATUS ejs_push_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, const union $name *r)"); - } elsif ($d->{TYPE} eq "ENUM") { - fn_declare($d, "NTSTATUS ejs_push_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, const enum $name *r)"); - } elsif ($d->{TYPE} eq "BITMAP") { - my($type_decl) = Parse::Pidl::Typelist::mapTypeName($d->{BASE_TYPE}); - fn_declare($d, "NTSTATUS ejs_push_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, const $type_decl *r)"); - } + my $var = undef; + my $dt = $d; + if ($dt->{TYPE} eq "TYPEDEF") { + $dt = $dt->{DATA}; + } + if ($dt->{TYPE} eq "STRUCT") { + $var = "const struct $name *r"; + } elsif ($dt->{TYPE} eq "UNION") { + $var = "const union $name *r"; + } elsif ($dt->{TYPE} eq "ENUM") { + $var = "const enum $name *r"; + } elsif ($dt->{TYPE} eq "BITMAP") { + my($type_decl) = Parse::Pidl::Typelist::mapTypeName($dt->{BASE_TYPE}); + $var = "const $type_decl *r"; + } + fn_declare($d, "NTSTATUS ".TypeFunctionName("ejs_push", $d) . "(struct ejs_rpc *ejs, struct MprVar *v, const char *name, $var)"); pidl "{"; indent; EjsTypePush($d, "r"); @@ -644,6 +638,7 @@ sub EjsTypePushFunction($$) sub EjsTypePush($$) { + sub EjsTypePush($$); my ($d, $varname) = @_; if ($d->{TYPE} eq 'STRUCT') { @@ -654,6 +649,8 @@ sub EjsTypePush($$) EjsEnumPush($d, $varname); } elsif ($d->{TYPE} eq 'BITMAP') { EjsBitmapPush($d, $varname); + } elsif ($d->{TYPE} eq 'TYPEDEF') { + EjsTypePush($d->{DATA}, $varname); } else { warn "Unhandled push $varname of type $d->{TYPE}"; } @@ -677,8 +674,7 @@ sub EjsPushFunction($) } if ($d->{RETURN_TYPE}) { - my $t = $d->{RETURN_TYPE}; - pidl "NDR_CHECK(ejs_push_$t(ejs, v, \"result\", &r->out.result));"; + pidl "NDR_CHECK(".TypeFunctionName("ejs_push", $d->{RETURN_TYPE})."(ejs, v, \"result\", &r->out.result));"; } pidl "return NT_STATUS_OK;"; @@ -737,8 +733,8 @@ sub EjsInterface($$) pidl_hdr "\n"; foreach my $d (@{$interface->{TYPES}}) { - ($needed->{"push_$d->{NAME}"}) && EjsTypePushFunction($d, $d->{NAME}); - ($needed->{"pull_$d->{NAME}"}) && EjsTypePullFunction($d, $d->{NAME}); + ($needed->{TypeFunctionName("ejs_push", $d)}) && EjsTypePushFunction($d, $d->{NAME}); + ($needed->{TypeFunctionName("ejs_pull", $d)}) && EjsTypePullFunction($d, $d->{NAME}); } foreach my $d (@{$interface->{FUNCTIONS}}) { @@ -831,16 +827,16 @@ sub NeededFunction($$) { my ($fn,$needed) = @_; - $needed->{"pull_$fn->{NAME}"} = 1; - $needed->{"push_$fn->{NAME}"} = 1; + $needed->{"ejs_pull_$fn->{NAME}"} = 1; + $needed->{"ejs_push_$fn->{NAME}"} = 1; foreach (@{$fn->{ELEMENTS}}) { next if (has_property($_, "subcontext")); #FIXME: Support subcontexts if (grep(/in/, @{$_->{DIRECTION}})) { - $needed->{"pull_$_->{TYPE}"} = 1; + $needed->{TypeFunctionName("ejs_pull", $_->{TYPE})} = 1; } if (grep(/out/, @{$_->{DIRECTION}})) { - $needed->{"push_$_->{TYPE}"} = 1; + $needed->{TypeFunctionName("ejs_push", $_->{TYPE})} = 1; } } } @@ -858,10 +854,8 @@ sub NeededType($$$) foreach (@{$t->{ELEMENTS}}) { next if (has_property($_, "subcontext")); #FIXME: Support subcontexts my $n; - if (ref($_->{TYPE}) eq "HASH" and defined($_->{TYPE}->{NAME})) { - $needed->{"$req\_$_->{TYPE}->{TYPE}_$_->{TYPE}->{NAME}"} = 1; - } elsif (ref($_->{TYPE}) ne "HASH") { - $needed->{$req."_".$_->{TYPE}} = 1; + if (ref($_->{TYPE}) ne "HASH" or defined($_->{TYPE}->{NAME})) { + $needed->{TypeFunctionName("ejs_$req", $_->{TYPE})} = 1; } NeededType($_->{TYPE}, $needed, $req) if (ref($_->{TYPE}) eq "HASH"); } @@ -877,13 +871,25 @@ sub NeededInterface($$) foreach (reverse @{$interface->{TYPES}}) { if (has_property($_, "public")) { - $needed->{"pull_$_->{NAME}"} = not has_property($_, "noejs"); - $needed->{"push_$_->{NAME}"} = not has_property($_, "noejs"); + $needed->{TypeFunctionName("ejs_pull", $_)} = not has_property($_, "noejs"); + $needed->{TypeFunctionName("ejs_push", $_)} = not has_property($_, "noejs"); } - NeededType($_, $needed, "pull") if ($needed->{"pull_$_->{NAME}"}); - NeededType($_, $needed, "push") if ($needed->{"push_$_->{NAME}"}); + NeededType($_, $needed, "pull") if ($needed->{TypeFunctionName("ejs_pull", $_)}); + NeededType($_, $needed, "push") if ($needed->{TypeFunctionName("ejs_push", $_)}); } } +sub TypeFunctionName($$) +{ + my ($prefix, $t) = @_; + + return "$prefix\_$t->{NAME}" if (ref($t) eq "HASH" and + ($t->{TYPE} eq "TYPEDEF" or $t->{TYPE} eq "DECLARE")); + return "$prefix\_$t->{TYPE}_$t->{NAME}" if (ref($t) eq "HASH"); + return "$prefix\_$t"; +} + + + 1; diff --git a/tools/pidl/lib/Parse/Pidl/Samba4/Header.pm b/tools/pidl/lib/Parse/Pidl/Samba4/Header.pm index 11ecc17001..2eddf22b05 100644 --- a/tools/pidl/lib/Parse/Pidl/Samba4/Header.pm +++ b/tools/pidl/lib/Parse/Pidl/Samba4/Header.pm @@ -57,7 +57,11 @@ sub HeaderElement($) if (has_property($element, "represent_as")) { pidl mapTypeName($element->{PROPERTIES}->{represent_as})." "; } else { - HeaderType($element, $element->{TYPE}, ""); + if (ref($element->{TYPE}) eq "HASH") { + HeaderType($element, $element->{TYPE}, $element->{TYPE}->{NAME}); + } else { + HeaderType($element, $element->{TYPE}, ""); + } pidl " "; my $numstar = $element->{POINTERS}; if ($numstar >= 1) { @@ -90,14 +94,14 @@ sub HeaderElement($) sub HeaderStruct($$) { my($struct,$name) = @_; - pidl "struct $name {\n"; + pidl "struct $name"; + return if (not defined($struct->{ELEMENTS})); + pidl " {\n"; $tab_depth++; my $el_count=0; - if (defined $struct->{ELEMENTS}) { - foreach (@{$struct->{ELEMENTS}}) { - HeaderElement($_); - $el_count++; - } + foreach (@{$struct->{ELEMENTS}}) { + HeaderElement($_); + $el_count++; } if ($el_count == 0) { # some compilers can't handle empty structures @@ -174,7 +178,9 @@ sub HeaderUnion($$) my($union,$name) = @_; my %done = (); - pidl "union $name {\n"; + pidl "union $name"; + return if (not defined($union->{ELEMENTS})); + pidl " {\n"; $tab_depth++; foreach my $e (@{$union->{ELEMENTS}}) { if ($e->{TYPE} ne "EMPTY") { diff --git a/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm index e1a19a7d3b..eaf66ea0c3 100644 --- a/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm +++ b/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm @@ -12,7 +12,7 @@ require Exporter; @EXPORT = qw(is_charset_array); @EXPORT_OK = qw(check_null_pointer GenerateFunctionInEnv GenerateFunctionOutEnv EnvSubstituteValue GenerateStructEnv NeededFunction - NeededElement NeededType $res NeededInterface); + NeededElement NeededType $res NeededInterface TypeFunctionName ParseElementPrint); use strict; use Parse::Pidl::Typelist qw(hasType getType mapTypeName); @@ -898,20 +898,14 @@ sub ParseDataPull($$$$$$) defined($l->{DATA_TYPE}->{NAME})) { my $ndr_flags = CalcNdrFlags($l, $primitives, $deferred); - my $t; - if (ref($l->{DATA_TYPE}) eq "HASH") { - $t = "$l->{DATA_TYPE}->{TYPE}_$l->{DATA_TYPE}->{NAME}"; - } else { - $t = $l->{DATA_TYPE}; - } - if (Parse::Pidl::Typelist::scalar_is_reference($t)) { + if (Parse::Pidl::Typelist::scalar_is_reference($l->{DATA_TYPE})) { $var_name = get_pointer_to($var_name); } $var_name = get_pointer_to($var_name); - pidl "NDR_CHECK(ndr_pull_$t($ndr, $ndr_flags, $var_name));"; + pidl "NDR_CHECK(".TypeFunctionName("ndr_pull", $l->{DATA_TYPE})."($ndr, $ndr_flags, $var_name));"; if (my $range = has_property($e, "range")) { $var_name = get_value_of($var_name); @@ -1487,8 +1481,6 @@ sub ParseStructPrint($$$) my $env = GenerateStructEnv($struct, $varname); - EnvSubstituteValue($env, $struct); - DeclareArrayVariables($_) foreach (@{$struct->{ELEMENTS}}); pidl "ndr_print_struct(ndr, name, \"$name\");"; @@ -2055,7 +2047,6 @@ sub ParseFunctionPrint($) pidl "ndr->depth++;"; my $env = GenerateFunctionInEnv($fn); - EnvSubstituteValue($env, $fn); foreach my $e (@{$fn->{ELEMENTS}}) { if (grep(/in/,@{$e->{DIRECTION}})) { @@ -2457,7 +2448,7 @@ sub ParseTypePushFunction($$) my ($e, $varname) = @_; my $args = $typefamily{$e->{TYPE}}->{DECL}->($e, "push", $e->{NAME}, $varname); - fn_declare("push", $e, "NTSTATUS ndr_push_$e->{NAME}(struct ndr_push *ndr, int ndr_flags, $args)") or return; + fn_declare("push", $e, "NTSTATUS ".TypeFunctionName("ndr_push", $e)."(struct ndr_push *ndr, int ndr_flags, $args)") or return; pidl "{"; indent; @@ -2485,7 +2476,7 @@ sub ParseTypePullFunction($$) my $args = $typefamily{$e->{TYPE}}->{DECL}->($e, "pull", $e->{NAME}, $varname); - fn_declare("pull", $e, "NTSTATUS ndr_pull_$e->{NAME}(struct ndr_pull *ndr, int ndr_flags, $args)") or return; + fn_declare("pull", $e, "NTSTATUS ".TypeFunctionName("ndr_pull", $e)."(struct ndr_pull *ndr, int ndr_flags, $args)") or return; pidl "{"; indent; @@ -2508,11 +2499,11 @@ sub ParseTypePrintFunction($$) my ($e, $varname) = @_; my $args = $typefamily{$e->{TYPE}}->{DECL}->($e, "print", $e->{NAME}, $varname); - pidl_hdr "void ndr_print_$e->{NAME}(struct ndr_print *ndr, const char *name, $args);"; + pidl_hdr "void ".TypeFunctionName("ndr_print", $e)."(struct ndr_print *ndr, const char *name, $args);"; return if (has_property($e, "noprint")); - pidl "_PUBLIC_ void ndr_print_$e->{NAME}(struct ndr_print *ndr, const char *name, $args)"; + pidl "_PUBLIC_ void ".TypeFunctionName("ndr_print", $e)."(struct ndr_print *ndr, const char *name, $args)"; pidl "{"; indent; ParseTypePrint($e, $varname); @@ -2558,26 +2549,27 @@ sub ParseInterface($$) # Typedefs foreach my $d (@{$interface->{TYPES}}) { - ($needed->{"push_$d->{NAME}"}) && ParseTypePushFunction($d, "r"); - ($needed->{"pull_$d->{NAME}"}) && ParseTypePullFunction($d, "r"); - ($needed->{"print_$d->{NAME}"}) && ParseTypePrintFunction($d, "r"); + ($needed->{TypeFunctionName("ndr_push", $d)}) && ParseTypePushFunction($d, "r"); + ($needed->{TypeFunctionName("ndr_pull", $d)}) && ParseTypePullFunction($d, "r"); + ($needed->{TypeFunctionName("ndr_print", $d)}) && ParseTypePrintFunction($d, "r"); # Make sure we don't generate a function twice... - $needed->{"push_$d->{NAME}"} = $needed->{"pull_$d->{NAME}"} = - $needed->{"print_$d->{NAME}"} = 0; + $needed->{TypeFunctionName("ndr_push", $d)} = + $needed->{TypeFunctionName("ndr_pull", $d)} = + $needed->{TypeFunctionName("ndr_print", $d)} = 0; ($needed->{"ndr_size_$d->{NAME}"}) && ParseTypeNdrSize($d); } # Functions foreach my $d (@{$interface->{FUNCTIONS}}) { - ($needed->{"push_$d->{NAME}"}) && ParseFunctionPush($d); - ($needed->{"pull_$d->{NAME}"}) && ParseFunctionPull($d); - ($needed->{"print_$d->{NAME}"}) && ParseFunctionPrint($d); + ($needed->{"ndr_push_$d->{NAME}"}) && ParseFunctionPush($d); + ($needed->{"ndr_pull_$d->{NAME}"}) && ParseFunctionPull($d); + ($needed->{"ndr_print_$d->{NAME}"}) && ParseFunctionPrint($d); # Make sure we don't generate a function twice... - $needed->{"push_$d->{NAME}"} = $needed->{"pull_$d->{NAME}"} = - $needed->{"print_$d->{NAME}"} = 0; + $needed->{"ndr_push_$d->{NAME}"} = $needed->{"ndr_pull_$d->{NAME}"} = + $needed->{"ndr_print_$d->{NAME}"} = 0; } FunctionTable($interface); @@ -2670,13 +2662,13 @@ sub NeededElement($$$) my @fn = (); if ($dir eq "print") { - push(@fn, "print_$rt"); + push(@fn, TypeFunctionName("ndr_print", $e->{REPRESENTATION_TYPE})); } elsif ($dir eq "pull") { - push (@fn, "pull_$t"); + push (@fn, TypeFunctionName("ndr_pull", $e->{TYPE})); push (@fn, "ndr_$t\_to_$rt") if ($rt ne $t); } elsif ($dir eq "push") { - push (@fn, "push_$t"); + push (@fn, TypeFunctionName("ndr_push", $e->{TYPE})); push (@fn, "ndr_$rt\_to_$t") if ($rt ne $t); } else { @@ -2693,9 +2685,9 @@ sub NeededElement($$$) sub NeededFunction($$) { my ($fn,$needed) = @_; - $needed->{"pull_$fn->{NAME}"} = 1; - $needed->{"push_$fn->{NAME}"} = 1; - $needed->{"print_$fn->{NAME}"} = 1; + $needed->{"ndr_pull_$fn->{NAME}"} = 1; + $needed->{"ndr_push_$fn->{NAME}"} = 1; + $needed->{"ndr_print_$fn->{NAME}"} = 1; foreach my $e (@{$fn->{ELEMENTS}}) { $e->{PARENT} = $fn; NeededElement($e, $_, $needed) foreach ("pull", "push", "print"); @@ -2729,17 +2721,27 @@ sub NeededInterface($$) NeededFunction($_, $needed) foreach (@{$interface->{FUNCTIONS}}); foreach (reverse @{$interface->{TYPES}}) { if (has_property($_, "public")) { - $needed->{"pull\_$_->{NAME}"} = $needed->{"push\_$_->{NAME}"} = - $needed->{"print\_$_->{NAME}"} = 1; + $needed->{TypeFunctionName("ndr_pull", $_)} = $needed->{TypeFunctionName("ndr_push", $_)} = + $needed->{TypeFunctionName("ndr_print", $_)} = 1; } - NeededType($_, $needed, "pull") if ($needed->{"pull_$_->{NAME}"}); - NeededType($_, $needed, "push") if ($needed->{"push_$_->{NAME}"}); - NeededType($_, $needed, "print") if ($needed->{"print_$_->{NAME}"}); + NeededType($_, $needed, "pull") if ($needed->{TypeFunctionName("ndr_pull", $_)}); + NeededType($_, $needed, "push") if ($needed->{TypeFunctionName("ndr_push", $_)}); + NeededType($_, $needed, "print") if ($needed->{TypeFunctionName("ndr_print", $_)}); if (has_property($_, "gensize")) { $needed->{"ndr_size_$_->{NAME}"} = 1; } } } +sub TypeFunctionName($$) +{ + my ($prefix, $t) = @_; + + return "$prefix\_$t->{NAME}" if (ref($t) eq "HASH" and + ($t->{TYPE} eq "TYPEDEF" or $t->{TYPE} eq "DECLARE")); + return "$prefix\_$t->{TYPE}_$t->{NAME}" if (ref($t) eq "HASH"); + return "$prefix\_$t"; +} + 1; diff --git a/tools/pidl/lib/Parse/Pidl/Typelist.pm b/tools/pidl/lib/Parse/Pidl/Typelist.pm index 55f8390f65..e635411f3c 100644 --- a/tools/pidl/lib/Parse/Pidl/Typelist.pm +++ b/tools/pidl/lib/Parse/Pidl/Typelist.pm @@ -98,33 +98,50 @@ sub addType($) sub getType($) { my $t = shift; + return ($t) if (ref($t) eq "HASH" and not defined($t->{NAME})); return undef if not hasType($t); + return $types{$t->{NAME}} if (ref($t) eq "HASH"); return $types{$t}; } sub typeIs($$) { my ($t,$tt) = @_; - - return 1 if (hasType($t) and getType($t)->{DATA}->{TYPE} eq $tt); + + if (ref($t) eq "HASH") { + return 1 if ($t->{TYPE} eq $tt); + return 0; + } + return 1 if (hasType($t) and getType($t)->{TYPE} eq "TYPEDEF" and + getType($t)->{DATA}->{TYPE} eq $tt); return 0; } sub hasType($) { my $t = shift; + if (ref($t) eq "HASH") { + return 1 if (not defined($t->{NAME})); + return 1 if (defined($types{$t->{NAME}}) and + $types{$t->{NAME}}->{TYPE} eq $t->{TYPE}); + return 0; + } return 1 if defined($types{$t}); return 0; } sub is_scalar($) { + sub is_scalar($); my $type = shift; - return 0 unless(hasType($type)); + return 1 if (ref($type) eq "HASH" and $type->{TYPE} eq "SCALAR"); - if (my $dt = getType($type)->{DATA}->{TYPE}) { - return 1 if ($dt eq "SCALAR" or $dt eq "ENUM" or $dt eq "BITMAP"); + if (my $dt = getType($type)) { + return is_scalar($dt->{DATA}) if ($dt->{TYPE} eq "TYPEDEF" or + $dt->{TYPE} eq "DECLARE"); + return 1 if ($dt->{TYPE} eq "SCALAR" or $dt->{TYPE} eq "ENUM" or + $dt->{TYPE} eq "BITMAP"); } return 0; diff --git a/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm b/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm index db7d2cf241..3c38801fae 100644 --- a/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm +++ b/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm @@ -18,7 +18,7 @@ package Parse::Pidl::Wireshark::NDR; use Exporter; @ISA = qw(Exporter); -@EXPORT_OK = qw(field2name @ett %res PrintIdl StripPrefixes %hf_used RegisterInterfaceHandoff $conformance register_hf_field CheckUsed); +@EXPORT_OK = qw(field2name @ett %res PrintIdl StripPrefixes %hf_used RegisterInterfaceHandoff $conformance register_hf_field CheckUsed ProcessImport ProcessInclude find_type DumpEttList DumpEttDeclaration DumpHfList DumpHfDeclaration DumpFunctionTable register_type register_ett); use strict; use Parse::Pidl qw(error warning); @@ -671,7 +671,7 @@ sub RegisterInterface($) indent; $res{code}.=DumpHfList()."\n"; - $res{code}.="\n".DumpEttList()."\n"; + $res{code}.="\n".DumpEttList(@ett)."\n"; if (defined($x->{UUID})) { # These can be changed to non-pidl_code names if the old dissectors @@ -730,8 +730,9 @@ sub ProcessInclude { my @includes = @_; foreach (@includes) { - pidl_hdr "#include \"$_\"\n"; + pidl_hdr "#include \"$_\""; } + pidl_hdr ""; } sub ProcessImport @@ -741,8 +742,9 @@ sub ProcessImport next if($_ eq "security"); s/\.idl\"$//; s/^\"//; - pidl_hdr "#include \"packet-dcerpc-$_\.h\"\n"; + pidl_hdr "#include \"packet-dcerpc-$_\.h\""; } + pidl_hdr ""; } sub ProcessInterface($) @@ -924,7 +926,7 @@ sub Parse($$$$) ProcessInclude(@{$_->{PATHS}}) if ($_->{TYPE} eq "INCLUDE"); } - $res{ett} = DumpEttDeclaration(); + $res{ett} = DumpEttDeclaration(@ett); $res{hf} = DumpHfDeclaration(); my $parser = $notice; @@ -956,8 +958,9 @@ sub register_ett($) push (@ett, $name); } -sub DumpEttList() +sub DumpEttList { + my @ett = @_; my $res = "\tstatic gint *ett[] = {\n"; foreach (@ett) { $res .= "\t\t&$_,\n"; @@ -966,8 +969,9 @@ sub DumpEttList() return "$res\t};\n"; } -sub DumpEttDeclaration() +sub DumpEttDeclaration { + my @ett = @_; my $res = "\n/* Ett declarations */\n"; foreach (@ett) { $res .= "static gint $_ = -1;\n"; diff --git a/tools/pidl/tests/header.pl b/tools/pidl/tests/header.pl index 3dae33ae6c..331f4dd9fb 100755 --- a/tools/pidl/tests/header.pl +++ b/tools/pidl/tests/header.pl @@ -4,7 +4,7 @@ use strict; use warnings; -use Test::More tests => 10; +use Test::More tests => 15; use FindBin qw($RealBin); use lib "$RealBin"; use Util; @@ -36,3 +36,18 @@ like(parse_idl("interface x { void foo ([in,out] uint32 x); };"), like(parse_idl("interface x { void foo (uint32 x); };"), qr/struct foo.*{.*struct\s+{\s+uint32_t x;\s+} in;\s+struct\s+{\s+uint32_t x;\s+} out;.*};/sm, "fn with no props implies in,out"); like(parse_idl("interface p { struct x { int y; }; };"), qr/struct x.*{.*int32_t y;.*}.*;/sm, "interface member generated properly"); + +like(parse_idl("interface p { struct x { struct y z; }; };"), + qr/struct x.*{.*struct y z;.*}.*;/sm, "tagged type struct member"); + +like(parse_idl("interface p { struct x { union y z; }; };"), + qr/struct x.*{.*union y z;.*}.*;/sm, "tagged type union member"); + +like(parse_idl("interface p { struct x { }; };"), + qr/struct x.*{.*char _empty_;.*}.*;/sm, "empty struct"); + +like(parse_idl("interface p { struct x; };"), + qr/struct x;/sm, "struct declaration"); + +like(parse_idl("interface p { typedef struct x { int p; } x; };"), + qr/struct x.*{.*int32_t p;.*};/sm, "double struct declaration"); diff --git a/tools/pidl/tests/ndr.pl b/tools/pidl/tests/ndr.pl index 26fb6c290b..8245f768e8 100755 --- a/tools/pidl/tests/ndr.pl +++ b/tools/pidl/tests/ndr.pl @@ -4,12 +4,12 @@ use strict; use warnings; -use Test::More tests => 12; +use Test::More tests => 26; use FindBin qw($RealBin); use lib "$RealBin"; use Util; use Parse::Pidl::Util qw(MyDumper); -use Parse::Pidl::NDR qw(GetElementLevelTable ParseElement); +use Parse::Pidl::NDR qw(GetElementLevelTable ParseElement align_type mapToScalar ParseType); # Case 1 @@ -203,3 +203,27 @@ $e = { $ne = ParseElement($e, undef); is($ne->{REPRESENTATION_TYPE}, "uint8"); + +is(align_type("hyper"), 8); +is(align_type("uint32"), 4); +is(align_type("uint16"), 2); +is(align_type("uint8"), 1); +is(align_type({ TYPE => "STRUCT", "NAME" => "bla", + ELEMENTS => [ { TYPE => "uint16" } ] }), 4); +is(align_type({ TYPE => "STRUCT", + ELEMENTS => [ { TYPE => "hyper" } ] }), 8); +is(align_type({ TYPE => "DECLARE", DATA => { + TYPE => "STRUCT", + ELEMENTS => [ { TYPE => "hyper" } ] }}), 8); +is(align_type({ TYPE => "STRUCT", "NAME" => "bla", + ELEMENTS => [ { TYPE => "uint8" } ] }), 4); + +is(mapToScalar("someverymuchnotexistingtype"), undef); +is(mapToScalar("uint32"), "uint32"); +is(mapToScalar({TYPE => "ENUM", PARENT => { PROPERTIES => { enum8bit => 1 } } }), "uint8"); +is(mapToScalar({TYPE => "BITMAP", PROPERTIES => { bitmap64bit => 1 } }), + "hyper"); +is(mapToScalar({TYPE => "TYPEDEF", DATA => {TYPE => "ENUM", PARENT => { PROPERTIES => { enum8bit => 1 } } }}), "uint8"); + +is_deeply(ParseType({TYPE => "STRUCT", NAME => "foo" }, "ref"), + {TYPE => "STRUCT", NAME => "foo" }); diff --git a/tools/pidl/tests/ndr_tagtype.pl b/tools/pidl/tests/ndr_tagtype.pl index 067fa096b4..d7839426d5 100755 --- a/tools/pidl/tests/ndr_tagtype.pl +++ b/tools/pidl/tests/ndr_tagtype.pl @@ -3,7 +3,7 @@ # (C) 2005 Jelmer Vernooij. Published under the GNU GPL use strict; -use Test::More tests => 1 * 8; +use Test::More tests => 3 * 8; use FindBin qw($RealBin); use lib "$RealBin"; use Util qw(test_samba4_ndr); @@ -17,7 +17,46 @@ test_samba4_ndr('struct-notypedef', '[public] struct bla { uint8 x; }; ', DATA_BLOB result_blob; r.x = 13; - if (NT_STATUS_IS_ERR(ndr_push_bla(ndr, NDR_SCALARS|NDR_BUFFERS, &r))) + if (NT_STATUS_IS_ERR(ndr_push_STRUCT_bla(ndr, NDR_SCALARS|NDR_BUFFERS, &r))) + return 1; + + result_blob = ndr_push_blob(ndr); + + if (!data_blob_equal(&result_blob, &expected_blob)) + return 2; +'); + +test_samba4_ndr('struct-notypedef-used', '[public] struct bla { uint8 x; }; + [public] void myfn([in] struct bla r); ', +' + struct ndr_push *ndr = ndr_push_init_ctx(NULL); + struct bla r; + uint8_t expected[] = { 0x0D }; + DATA_BLOB expected_blob = { expected, 1 }; + DATA_BLOB result_blob; + r.x = 13; + + if (NT_STATUS_IS_ERR(ndr_push_myfn(ndr, NDR_IN, &r))) + return 1; + + result_blob = ndr_push_blob(ndr); + + if (!data_blob_equal(&result_blob, &expected_blob)) + return 2; +'); + + +test_samba4_ndr('struct-notypedef-embedded', 'struct bla { uint8 x; }; + [public] struct myfn { struct bla r; }; ', +' + struct ndr_push *ndr = ndr_push_init_ctx(NULL); + struct bla r; + uint8_t expected[] = { 0x0D }; + DATA_BLOB expected_blob = { expected, 1 }; + DATA_BLOB result_blob; + r.x = 13; + + if (NT_STATUS_IS_ERR(ndr_push_STRUCT_myfn(ndr, NDR_IN, &r))) return 1; result_blob = ndr_push_blob(ndr); diff --git a/tools/pidl/tests/parse_idl.pl b/tools/pidl/tests/parse_idl.pl index 265ac7a2bd..b82bd80e54 100755 --- a/tools/pidl/tests/parse_idl.pl +++ b/tools/pidl/tests/parse_idl.pl @@ -4,7 +4,7 @@ # Published under the GNU General Public License use strict; -use Test::More tests => 62 * 2; +use Test::More tests => 64 * 2 + 2; use FindBin qw($RealBin); use lib "$RealBin"; use Util qw(test_errors); @@ -107,3 +107,18 @@ 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\";"; +testok "empty-struct", "interface test { struct foo { }; }"; +testok "typedef-double", "interface test { typedef struct foo { } foo; }"; + +my $x = Parse::Pidl::IDL::parse_string("interface foo { struct x {}; }", "<foo>"); + +is_deeply($x, + [ { 'FILE' => '<foo>', 'NAME' => 'foo', 'DATA' => [ + { 'NAME' => 'x', 'TYPE' => 'STRUCT', ELEMENTS => [] } ], + 'TYPE' => 'INTERFACE', 'LINE' => 0 } ]); + +$x = Parse::Pidl::IDL::parse_string("interface foo { struct x; }", "<foo>"); +is_deeply($x, + [ { 'FILE' => '<foo>', 'NAME' => 'foo', 'DATA' => [ + { 'NAME' => 'x', 'TYPE' => 'STRUCT' } ], + 'TYPE' => 'INTERFACE', 'LINE' => 0 } ]); diff --git a/tools/pidl/tests/samba-ejs.pl b/tools/pidl/tests/samba-ejs.pl index 350cba571c..39fc22329c 100755 --- a/tools/pidl/tests/samba-ejs.pl +++ b/tools/pidl/tests/samba-ejs.pl @@ -4,13 +4,13 @@ use strict; use warnings; -use Test::More tests => 13; +use Test::More tests => 17; use FindBin qw($RealBin); use lib "$RealBin"; use Util; use Parse::Pidl::Util qw(MyDumper); use Parse::Pidl::Samba4::EJS qw(get_pointer_to get_value_of check_null_pointer - $res $res_hdr fn_declare); + $res $res_hdr fn_declare TypeFunctionName); is("&foo", get_pointer_to("foo")); is("&(&foo)", get_pointer_to(get_pointer_to("foo"))); @@ -40,3 +40,8 @@ $res_hdr = ""; fn_declare({ PROPERTIES => {} }, "mybla(int foo)"); is($res, "static mybla(int foo)\n"); is($res_hdr, ""); + +is(TypeFunctionName("ejs_pull", "uint32"), "ejs_pull_uint32"); +is(TypeFunctionName("ejs_pull", {TYPE => "ENUM", NAME => "bar"}), "ejs_pull_ENUM_bar"); +is(TypeFunctionName("ejs_pull", {TYPE => "TYPEDEF", NAME => "bar", DATA => undef}), "ejs_pull_bar"); +is(TypeFunctionName("ejs_push", {TYPE => "STRUCT", NAME => "bar"}), "ejs_push_STRUCT_bar"); diff --git a/tools/pidl/tests/samba-ndr.pl b/tools/pidl/tests/samba-ndr.pl index d956402e64..cf79cd006f 100755 --- a/tools/pidl/tests/samba-ndr.pl +++ b/tools/pidl/tests/samba-ndr.pl @@ -4,7 +4,7 @@ use strict; use warnings; -use Test::More tests => 34; +use Test::More tests => 41; use FindBin qw($RealBin); use lib "$RealBin"; use Util; @@ -12,7 +12,7 @@ use Parse::Pidl::Util qw(MyDumper); use Parse::Pidl::Samba4::NDR::Parser qw(check_null_pointer GenerateFunctionInEnv GenerateFunctionOutEnv GenerateStructEnv EnvSubstituteValue NeededFunction NeededElement NeededType $res - NeededInterface); + NeededInterface TypeFunctionName ParseElementPrint); my $output; sub print_fn($) { my $x = shift; $output.=$x; } @@ -185,28 +185,28 @@ is_deeply($env, { foo => 0, this => "r" }); my $needed = {}; NeededElement({ TYPE => "foo", REPRESENTATION_TYPE => "foo" }, "pull", $needed); -is_deeply($needed, { pull_foo => 1 }); +is_deeply($needed, { ndr_pull_foo => 1 }); # old settings should be kept -$needed = { pull_foo => 0 }; +$needed = { ndr_pull_foo => 0 }; NeededElement({ TYPE => "foo", REPRESENTATION_TYPE => "foo" }, "pull", $needed); -is_deeply($needed, { pull_foo => 0 }); +is_deeply($needed, { ndr_pull_foo => 0 }); # print/pull/push are independent of each other -$needed = { pull_foo => 0 }; +$needed = { ndr_pull_foo => 0 }; NeededElement({ TYPE => "foo", REPRESENTATION_TYPE => "foo" }, "print", $needed); -is_deeply($needed, { pull_foo => 0, print_foo => 1 }); +is_deeply($needed, { ndr_pull_foo => 0, ndr_print_foo => 1 }); $needed = { }; NeededFunction({ NAME => "foo", ELEMENTS => [ { TYPE => "bar", REPRESENTATION_TYPE => "bar" } ] }, $needed); -is_deeply($needed, { pull_foo => 1, print_foo => 1, push_foo => 1, - pull_bar => 1, print_bar => 1, push_bar => 1}); +is_deeply($needed, { ndr_pull_foo => 1, ndr_print_foo => 1, ndr_push_foo => 1, + ndr_pull_bar => 1, ndr_print_bar => 1, ndr_push_bar => 1}); # push/pull/print are always set for functions -$needed = { pull_foo => 0 }; +$needed = { ndr_pull_foo => 0 }; NeededFunction({ NAME => "foo", ELEMENTS => [ { TYPE => "bar", REPRESENTATION_TYPE => "bar" } ] }, $needed); -is_deeply($needed, { pull_foo => 1, print_foo => 1, push_foo => 1, - pull_bar => 1, push_bar => 1, print_bar => 1}); +is_deeply($needed, { ndr_pull_foo => 1, ndr_print_foo => 1, ndr_push_foo => 1, + ndr_pull_bar => 1, ndr_push_bar => 1, ndr_print_bar => 1}); # public structs are always needed $needed = {}; @@ -220,7 +220,7 @@ NeededInterface({ TYPES => [ { PROPERTIES => { public => 1 }, NAME => "bla", TYPE => "TYPEDEF", DATA => { TYPE => "STRUCT", ELEMENTS => [] } } ] }, $needed); -is_deeply($needed, { pull_bla => 1, push_bla => 1, print_bla => 1 }); +is_deeply($needed, { ndr_pull_bla => 1, ndr_push_bla => 1, ndr_print_bla => 1 }); # make sure types for elements are set too $needed = {}; @@ -229,8 +229,8 @@ NeededInterface({ TYPES => [ { PROPERTIES => { public => 1 }, NAME => "bla", DATA => { TYPE => "STRUCT", ELEMENTS => [ { TYPE => "bar", REPRESENTATION_TYPE => "bar" } ] } } ] }, $needed); -is_deeply($needed, { pull_bla => 1, pull_bar => 1, push_bla => 1, push_bar => 1, - print_bla => 1, print_bar => 1}); +is_deeply($needed, { ndr_pull_bla => 1, ndr_pull_bar => 1, ndr_push_bla => 1, ndr_push_bar => 1, + ndr_print_bla => 1, ndr_print_bar => 1}); $needed = {}; NeededInterface({ TYPES => [ { PROPERTIES => { gensize => 1}, NAME => "bla", @@ -241,13 +241,13 @@ NeededInterface({ TYPES => [ { PROPERTIES => { gensize => 1}, NAME => "bla", is_deeply($needed, { ndr_size_bla => 1 }); # make sure types for elements are set too -$needed = { pull_bla => 1 }; +$needed = { ndr_pull_bla => 1 }; NeededType({ NAME => "bla", TYPE => "TYPEDEF", DATA => { TYPE => "STRUCT", ELEMENTS => [ { TYPE => "bar", REPRESENTATION_TYPE => "bar" } ] } }, $needed, "pull"); -is_deeply($needed, { pull_bla => 1, pull_bar => 1 }); +is_deeply($needed, { ndr_pull_bla => 1, ndr_pull_bar => 1 }); $needed = {}; NeededInterface({ TYPES => [ { PROPERTIES => { public => 1}, @@ -255,8 +255,9 @@ NeededInterface({ TYPES => [ { PROPERTIES => { public => 1}, TYPE => "TYPEDEF", DATA => { TYPE => "STRUCT", ELEMENTS => [ { TYPE => "bar", REPRESENTATION_TYPE => "rep" } ] } } ] }, $needed); -is_deeply($needed, { pull_bla => 1, push_bla => 1, print_bla => 1, print_rep => 1, - pull_bar => 1, push_bar => 1, +is_deeply($needed, { ndr_pull_bla => 1, ndr_push_bla => 1, ndr_print_bla => 1, + ndr_print_rep => 1, + ndr_pull_bar => 1, ndr_push_bar => 1, ndr_bar_to_rep => 1, ndr_rep_to_bar => 1}); $res = ""; @@ -297,3 +298,28 @@ is($res, "if (ndr_flags & NDR_SCALARS) { if (ndr_flags & NDR_BUFFERS) { } "); + +is(TypeFunctionName("ndr_pull", "uint32"), "ndr_pull_uint32"); +is(TypeFunctionName("ndr_pull", {TYPE => "ENUM", NAME => "bar"}), "ndr_pull_ENUM_bar"); +is(TypeFunctionName("ndr_pull", {TYPE => "TYPEDEF", NAME => "bar", DATA => undef}), "ndr_pull_bar"); +is(TypeFunctionName("ndr_push", {TYPE => "STRUCT", NAME => "bar"}), "ndr_push_STRUCT_bar"); + +# check noprint works +$res = ""; +ParseElementPrint({ NAME => "x", TYPE => "rt", REPRESENTATION_TYPE => "rt", + PROPERTIES => { noprint => 1}, + LEVELS => [ { TYPE => "DATA", DATA_TYPE => "rt"} ]}, "var", { "x" => "r->foobar" } ); +is($res, ""); + +$res = ""; +ParseElementPrint({ NAME => "x", TYPE => "rt", REPRESENTATION_TYPE => "rt", + PROPERTIES => {}, + LEVELS => [ { TYPE => "DATA", DATA_TYPE => "rt" }]}, "var", { "x" => "r->foobar" } ); +is($res, "ndr_print_rt(ndr, \"x\", &var);\n"); + +# make sure that a print function for an element with value() set works +$res = ""; +ParseElementPrint({ NAME => "x", TYPE => "uint32", REPRESENTATION_TYPE => "uint32", + PROPERTIES => { value => "23" }, + LEVELS => [ { TYPE => "DATA", DATA_TYPE => "uint32"} ]}, "var", { "x" => "r->foobar" } ); +is($res, "ndr_print_uint32(ndr, \"x\", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?23:var);\n"); diff --git a/tools/pidl/tests/typelist.pl b/tools/pidl/tests/typelist.pl index 5c1a7ddd21..c5c409a525 100755 --- a/tools/pidl/tests/typelist.pl +++ b/tools/pidl/tests/typelist.pl @@ -4,7 +4,7 @@ use strict; use warnings; -use Test::More tests => 33; +use Test::More tests => 53; use FindBin qw($RealBin); use lib "$RealBin"; use Util; @@ -22,21 +22,45 @@ is("uint32_t", mapScalarType("uint32")); is("void", mapScalarType("void")); is("uint64_t", mapScalarType("hyper")); -my $x = { TYPE => "ENUM", NAME => "foo" }; +my $x = { TYPE => "ENUM", NAME => "foo", EXTRADATA => 1 }; addType($x); -is($x, getType("foo")); +is_deeply($x, getType("foo")); is(undef, getType("bloebla")); +is_deeply(getType({ TYPE => "STRUCT" }), { TYPE => "STRUCT" }); +is_deeply(getType({ TYPE => "ENUM", NAME => "foo" }), $x); +is_deeply(getType("uint16"), { + NAME => "uint16", + TYPE => "TYPEDEF", + DATA => { NAME => "uint16", TYPE => "SCALAR" }}); is(0, typeIs("someUnknownType", "ENUM")); +is(0, typeIs("foo", "ENUM")); +addType({NAME => "mytypedef", TYPE => "TYPEDEF", DATA => { TYPE => "ENUM" }}); +is(1, typeIs("mytypedef", "ENUM")); +is(0, typeIs("mytypedef", "BITMAP")); +is(1, typeIs({ TYPE => "ENUM"}, "ENUM")); +is(0, typeIs({ TYPE => "BITMAP"}, "ENUM")); +is(1, typeIs("uint32", "SCALAR")); +is(0, typeIs("uint32", "ENUM")); is(1, hasType("foo")); is(0, hasType("nonexistant")); +is(0, hasType({TYPE => "ENUM", NAME => "someUnknownType"})); +is(1, hasType({TYPE => "ENUM", NAME => "foo"})); +is(1, hasType({TYPE => "ENUM"})); +is(1, hasType({TYPE => "STRUCT"})); is(1, is_scalar("uint32")); is(0, is_scalar("nonexistant")); +is(1, is_scalar({TYPE => "ENUM"})); +is(0, is_scalar({TYPE => "STRUCT"})); +is(1, is_scalar({TYPE => "TYPEDEF", DATA => {TYPE => "ENUM" }})); +is(1, is_scalar("mytypedef")); +is(1, is_scalar({TYPE => "DECLARE", DATA => {TYPE => "ENUM" }})); is(1, scalar_is_reference("string")); is(0, scalar_is_reference("uint32")); +is(0, scalar_is_reference({TYPE => "STRUCT", NAME => "echo_foobar"})); is("uint8", enum_type_fn({TYPE => "ENUM", PARENT=>{PROPERTIES => {enum8bit => 1}}})); is("uint32", enum_type_fn({TYPE => "ENUM", PARENT=>{PROPERTIES => {v1_enum => 1}}})); diff --git a/tools/pidl/tests/wireshark-ndr.pl b/tools/pidl/tests/wireshark-ndr.pl index a216f59d97..40e22d958c 100755 --- a/tools/pidl/tests/wireshark-ndr.pl +++ b/tools/pidl/tests/wireshark-ndr.pl @@ -5,12 +5,12 @@ use strict; use warnings; -use Test::More tests => 13; +use Test::More tests => 40; use FindBin qw($RealBin); use lib "$RealBin"; use Util; use Parse::Pidl::Util qw(MyDumper); -use Parse::Pidl::Wireshark::NDR qw(field2name %res PrintIdl StripPrefixes %hf_used RegisterInterfaceHandoff $conformance register_hf_field CheckUsed); +use Parse::Pidl::Wireshark::NDR qw(field2name %res PrintIdl StripPrefixes %hf_used RegisterInterfaceHandoff $conformance register_hf_field CheckUsed ProcessImport ProcessInclude find_type DumpEttList DumpEttDeclaration DumpHfList DumpHfDeclaration DumpFunctionTable register_type @ett register_ett); is("Access Mask", field2name("access_mask")); is("Accessmask", field2name("AccessMask")); @@ -45,7 +45,8 @@ is($res{code}, 'void proto_reg_handoff_dcerpc_bla(void) is($hf_used{hf_bla_opnum}, 1); $conformance = {}; -register_hf_field("hf_bla_idx", "bla", "my.filter", "FT_UINT32", "BASE_HEX", "NULL", 0xF, undef); +is("hf_bla_idx", + register_hf_field("hf_bla_idx", "bla", "my.filter", "FT_UINT32", "BASE_HEX", "NULL", 0xF, undef)); is_deeply($conformance, { header_fields => { "hf_bla_idx" => { @@ -63,6 +64,61 @@ is_deeply($conformance, { fielddescription => {} }); +$conformance = { fielddescription => { hf_bla_idx => { DESCRIPTION => "Some Description" }}}; +is("hf_bla_idx", + register_hf_field("hf_bla_idx", "bla", "my.filter", "FT_UINT32", "BASE_HEX", "NULL", 0xF, undef)); +is_deeply($conformance, { + fielddescription => { + hf_bla_idx => { + DESCRIPTION => "Some Description", + USED => 1 + } + }, + header_fields => { + "hf_bla_idx" => { + INDEX => "hf_bla_idx", + NAME => "bla", + FILTER => "my.filter", + BASE_TYPE => "BASE_HEX", + FT_TYPE => "FT_UINT32", + VALSSTRING => "NULL", + BLURB => "Some Description", + MASK => 0xF + } + }, + hf_renames => {}, +}); + +$conformance = { fielddescription => { hf_bla_idx => { DESCRIPTION => "Some Description" }}}; +is("hf_bla_idx", + register_hf_field("hf_bla_idx", "bla", "my.filter", "FT_UINT32", "BASE_HEX", "NULL", 0xF, + "Actual Description")); +is_deeply($conformance, { + fielddescription => { + hf_bla_idx => { DESCRIPTION => "Some Description" } + }, + header_fields => { + "hf_bla_idx" => { + INDEX => "hf_bla_idx", + NAME => "bla", + FILTER => "my.filter", + BASE_TYPE => "BASE_HEX", + FT_TYPE => "FT_UINT32", + VALSSTRING => "NULL", + BLURB => "Actual Description", + MASK => 0xF + } + }, + hf_renames => {}, +}); + + + +$conformance = { hf_renames => { "hf_bla_idx" => { NEWNAME => "hf_bloe_idx" } } }; +register_hf_field("hf_bla_idx", "bla", "my.filter", "FT_UINT32", "BASE_HEX", "NULL", 0xF, undef); +is_deeply($conformance, { + hf_renames => { hf_bla_idx => { USED => 1, NEWNAME => "hf_bloe_idx" } } }); + %hf_used = ( hf_bla => 1 ); test_warnings("", sub { CheckUsed({ header_fields => { foo => { INDEX => "hf_bla" }}})}); @@ -70,3 +126,149 @@ test_warnings("", sub { %hf_used = ( ); test_warnings("hf field `hf_bla' not used\n", sub { CheckUsed({ header_fields => { foo => { INDEX => "hf_bla" }}})}); + +test_warnings("hf field `hf_id' not used\n", + sub { CheckUsed({ + hf_renames => { + hf_id => { + OLDNAME => "hf_id", + NEWNAME => "hf_newid", + USED => 0 + } + } +}); } ); + +test_warnings("dissector param never used\n", + sub { CheckUsed({ + dissectorparams => { + dissect_foo => { + PARAM => 42, + USED => 0 + } + } +}); } ); + +test_warnings("description never used\n", + sub { CheckUsed({ + fielddescription => { + hf_bla => { + USED => 0 + } + } +}); } ); + +test_warnings("import never used\n", + sub { CheckUsed({ + imports => { + bla => { + USED => 0 + } + } +}); } ); + +test_warnings("nofile:1: type never used\n", + sub { CheckUsed({ + types => { + bla => { + USED => 0, + POS => { FILE => "nofile", LINE => 1 } + } + } +}); } ); + +test_warnings("True/False description never used\n", + sub { CheckUsed({ + tfs => { + hf_bloe => { + USED => 0 + } + } +}); } ); + +$res{hdr} = ""; +ProcessImport("security", "bla"); +is($res{hdr}, "#include \"packet-dcerpc-bla.h\"\n\n"); + +$res{hdr} = ""; +ProcessImport("\"bla.idl\"", "\"foo.idl\""); +is($res{hdr}, "#include \"packet-dcerpc-bla.h\"\n" . + "#include \"packet-dcerpc-foo.h\"\n\n"); + +$res{hdr} = ""; +ProcessInclude("foo.h", "bla.h", "bar.h"); +is($res{hdr}, "#include \"foo.h\"\n" . + "#include \"bla.h\"\n" . + "#include \"bar.h\"\n\n"); + +$conformance = {types => { bla => "brainslug" } }; +is("brainslug", find_type("bla")); + +is(DumpEttList("ett_t1", "ett_bla"), + "\tstatic gint *ett[] = {\n" . + "\t\t&ett_t1,\n" . + "\t\t&ett_bla,\n" . + "\t};\n"); + +is(DumpEttList(), "\tstatic gint *ett[] = {\n\t};\n"); +is(DumpEttList("bla"), "\tstatic gint *ett[] = {\n\t\t&bla,\n\t};\n"); + +is(DumpEttDeclaration("void", "zoid"), + "\n/* Ett declarations */\n" . + "static gint void = -1;\n" . + "static gint zoid = -1;\n" . + "\n"); + +is(DumpEttDeclaration(), "\n/* Ett declarations */\n\n"); + +$conformance = { + header_fields => { + hf_bla => { INDEX => "hf_bla", NAME => "Bla", FILTER => "bla.field", FT_TYPE => "FT_UINT32", BASE_TYPE => "BASE_DEC", VALSSTRING => "NULL", MASK => 0xFF, BLURB => "NULL" } + } +}; + +is(DumpHfList(), "\tstatic hf_register_info hf[] = { + { &hf_bla, + { \"Bla\", \"bla.field\", FT_UINT32, BASE_DEC, NULL, 255, \"NULL\", HFILL }}, + }; +"); + +is(DumpHfDeclaration(), " +/* Header field declarations */ +static gint hf_bla = -1; + +"); + +is(DumpFunctionTable({ + NAME => "someif", + FUNCTIONS => [ { NAME => "fn1", OPNUM => 3 }, { NAME => "someif_fn2", OPNUM => 2 } ] }), +'static dcerpc_sub_dissector someif_dissectors[] = { + { 3, "fn1", + someif_dissect_fn1_request, someif_dissect_fn1_response}, + { 2, "fn2", + someif_dissect_fn2_request, someif_dissect_fn2_response}, + { 0, NULL, NULL, NULL } +}; +'); + +$conformance = {}; +register_type("bla_type", "dissect_bla", "FT_UINT32", "BASE_HEX", 0xFF, "NULL", 4); +is_deeply($conformance, { + types => { + bla_type => { + NAME => "bla_type", + DISSECTOR_NAME => "dissect_bla", + FT_TYPE => "FT_UINT32", + BASE_TYPE => "BASE_HEX", + MASK => 255, + VALSSTRING => "NULL", + ALIGNMENT => 4 + } + } + } +); + +@ett = (); +register_ett("name"); +is_deeply(\@ett, ["name"]); +register_ett("leela"); +is_deeply(\@ett, ["name", "leela"]); |