diff options
author | Jörg Mayer <jmayer@loplof.de> | 2005-12-26 00:47:24 +0000 |
---|---|---|
committer | Jörg Mayer <jmayer@loplof.de> | 2005-12-26 00:47:24 +0000 |
commit | 2eb39a1bdceb86496275eb08e6d4b2c231170e0b (patch) | |
tree | 25260b209000c9930b09dd312bc669b40145bde2 /tools/pidl/lib | |
parent | 6ea1842885cd7965b7dba3864ac6a08c6ebcb1f7 (diff) | |
download | wireshark-2eb39a1bdceb86496275eb08e6d4b2c231170e0b.tar.gz |
Update from samba tree revision 12430 to 12487
============================ Samba log start ============
------------------------------------------------------------------------
r12462 | jelmer | 2005-12-24 22:57:51 +0100 (Sat, 24 Dec 2005) | 2 lines
Hide oo magic from callers of the parser
------------------------------------------------------------------------
r12463 | jelmer | 2005-12-24 23:11:44 +0100 (Sat, 24 Dec 2005) | 2 lines
Rename 'Samba' namespace to 'Samba4'
------------------------------------------------------------------------
r12464 | jelmer | 2005-12-25 00:32:50 +0100 (Sun, 25 Dec 2005) | 4 lines
Add simple IDL parsing tests for pidl using the standard perl
testing framework (Test::Simple, distributed with perl itself).
Run these tests from 'make test'
------------------------------------------------------------------------
r12465 | jelmer | 2005-12-25 02:33:35 +0100 (Sun, 25 Dec 2005) | 3 lines
Merge Parse::Pidl::Samba4::NDR::Header into
Parse::Pidl::Samba4::NDR::Parser.
Small optimization to avoid including NDR headers multiple times
------------------------------------------------------------------------
r12470 | jelmer | 2005-12-25 04:04:13 +0100 (Sun, 25 Dec 2005) | 3 lines
Add helper module for pidl tests
Convert other pidl tests to use Test::More and run them from 'make test'
------------------------------------------------------------------------
r12480 | jelmer | 2005-12-25 15:11:59 +0100 (Sun, 25 Dec 2005) | 2 lines
Extend testsuite
------------------------------------------------------------------------
r12481 | jelmer | 2005-12-25 15:59:21 +0100 (Sun, 25 Dec 2005) | 4 lines
Move parser-specific utility functions to idl.yp, remove some unused
functions
Allow the use of non-typedef structs and unions when declaring
variables. Allow the
use of the 'signed' and 'unsigned' qualifiers for integer types
------------------------------------------------------------------------
r12482 | jelmer | 2005-12-25 15:59:39 +0100 (Sun, 25 Dec 2005) | 2 lines
Add some more tests
------------------------------------------------------------------------
r12483 | jelmer | 2005-12-25 16:19:55 +0100 (Sun, 25 Dec 2005) | 2 lines
Remove --tdr-header option (merged into --tdr-parser)
------------------------------------------------------------------------
r12484 | jelmer | 2005-12-25 18:12:52 +0100 (Sun, 25 Dec 2005) | 2 lines
Initial work on supporting non-typedeffed types
------------------------------------------------------------------------
============================ Samba log end ==============
svn path=/trunk/; revision=16896
Diffstat (limited to 'tools/pidl/lib')
-rw-r--r-- | tools/pidl/lib/Parse/Pidl/Ethereal/NDR.pm | 2 | ||||
-rw-r--r-- | tools/pidl/lib/Parse/Pidl/IDL.pm | 1093 | ||||
-rw-r--r-- | tools/pidl/lib/Parse/Pidl/NDR.pm | 95 | ||||
-rw-r--r-- | tools/pidl/lib/Parse/Pidl/Samba/NDR/Header.pm | 169 | ||||
-rw-r--r-- | tools/pidl/lib/Parse/Pidl/Samba3/Header.pm | 2 | ||||
-rw-r--r-- | tools/pidl/lib/Parse/Pidl/Samba3/Parser.pm | 2 | ||||
-rw-r--r-- | tools/pidl/lib/Parse/Pidl/Samba3/Types.pm | 2 | ||||
-rw-r--r-- | tools/pidl/lib/Parse/Pidl/Samba4/COM/Header.pm (renamed from tools/pidl/lib/Parse/Pidl/Samba/COM/Header.pm) | 2 | ||||
-rw-r--r-- | tools/pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm (renamed from tools/pidl/lib/Parse/Pidl/Samba/COM/Proxy.pm) | 6 | ||||
-rw-r--r-- | tools/pidl/lib/Parse/Pidl/Samba4/COM/Stub.pm (renamed from tools/pidl/lib/Parse/Pidl/Samba/COM/Stub.pm) | 2 | ||||
-rw-r--r-- | tools/pidl/lib/Parse/Pidl/Samba4/EJS.pm (renamed from tools/pidl/lib/Parse/Pidl/Samba/EJS.pm) | 6 | ||||
-rw-r--r-- | tools/pidl/lib/Parse/Pidl/Samba4/EJSHeader.pm (renamed from tools/pidl/lib/Parse/Pidl/Samba/EJSHeader.pm) | 6 | ||||
-rw-r--r-- | tools/pidl/lib/Parse/Pidl/Samba4/Header.pm (renamed from tools/pidl/lib/Parse/Pidl/Samba/Header.pm) | 17 | ||||
-rw-r--r-- | tools/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm (renamed from tools/pidl/lib/Parse/Pidl/Samba/NDR/Client.pm) | 2 | ||||
-rw-r--r-- | tools/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm (renamed from tools/pidl/lib/Parse/Pidl/Samba/NDR/Parser.pm) | 150 | ||||
-rw-r--r-- | tools/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm (renamed from tools/pidl/lib/Parse/Pidl/Samba/NDR/Server.pm) | 2 | ||||
-rw-r--r-- | tools/pidl/lib/Parse/Pidl/Samba4/SWIG.pm (renamed from tools/pidl/lib/Parse/Pidl/Samba/SWIG.pm) | 2 | ||||
-rw-r--r-- | tools/pidl/lib/Parse/Pidl/Samba4/TDR.pm (renamed from tools/pidl/lib/Parse/Pidl/Samba/TDR.pm) | 81 | ||||
-rw-r--r-- | tools/pidl/lib/Parse/Pidl/Samba4/Template.pm (renamed from tools/pidl/lib/Parse/Pidl/Samba/Template.pm) | 2 | ||||
-rw-r--r-- | tools/pidl/lib/Parse/Pidl/Test.pm | 171 | ||||
-rw-r--r-- | tools/pidl/lib/Parse/Pidl/Util.pm | 42 |
21 files changed, 849 insertions, 1007 deletions
diff --git a/tools/pidl/lib/Parse/Pidl/Ethereal/NDR.pm b/tools/pidl/lib/Parse/Pidl/Ethereal/NDR.pm index b400d1ade0..0b81536795 100644 --- a/tools/pidl/lib/Parse/Pidl/Ethereal/NDR.pm +++ b/tools/pidl/lib/Parse/Pidl/Ethereal/NDR.pm @@ -112,7 +112,7 @@ sub Interface($) { my($interface) = @_; Const($_,$interface->{NAME}) foreach (@{$interface->{CONSTS}}); - Typedef($_,$interface->{NAME}) foreach (@{$interface->{TYPEDEFS}}); + Typedef($_,$interface->{NAME}) foreach (@{$interface->{TYPES}}); Function($_,$interface->{NAME}) foreach (@{$interface->{FUNCTIONS}}); } diff --git a/tools/pidl/lib/Parse/Pidl/IDL.pm b/tools/pidl/lib/Parse/Pidl/IDL.pm index 59a9aef76a..60439b8601 100644 --- a/tools/pidl/lib/Parse/Pidl/IDL.pm +++ b/tools/pidl/lib/Parse/Pidl/IDL.pm @@ -509,7 +509,7 @@ sub new { ACTIONS => { '' => 2 }, - DEFAULT => -63, + DEFAULT => -80, GOTOS => { 'interface' => 3, 'coclass' => 4, @@ -559,7 +559,7 @@ sub new { } }, {#State 9 - DEFAULT => -92 + DEFAULT => -109 }, {#State 10 ACTIONS => { @@ -570,10 +570,10 @@ sub new { ACTIONS => { "(" => 16 }, - DEFAULT => -67 + DEFAULT => -84 }, {#State 12 - DEFAULT => -65 + DEFAULT => -82 }, {#State 13 ACTIONS => { @@ -602,7 +602,7 @@ sub new { 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -73, + DEFAULT => -90, GOTOS => { 'identifier' => 23, 'listtext' => 26, @@ -621,7 +621,7 @@ sub new { } }, {#State 18 - DEFAULT => -64 + DEFAULT => -81 }, {#State 19 ACTIONS => { @@ -643,13 +643,13 @@ sub new { } }, {#State 22 - DEFAULT => -96 + DEFAULT => -113 }, {#State 23 - DEFAULT => -74 + DEFAULT => -91 }, {#State 24 - DEFAULT => -76 + DEFAULT => -93 }, {#State 25 ACTIONS => { @@ -669,7 +669,7 @@ sub new { "." => 47, ">" => 48 }, - DEFAULT => -69 + DEFAULT => -86 }, {#State 26 ACTIONS => { @@ -678,13 +678,13 @@ sub new { } }, {#State 27 - DEFAULT => -75 + DEFAULT => -92 }, {#State 28 - DEFAULT => -95 + DEFAULT => -112 }, {#State 29 - DEFAULT => -66 + DEFAULT => -83 }, {#State 30 DEFAULT => -9 @@ -699,7 +699,7 @@ sub new { "const" => 60, "struct" => 63 }, - DEFAULT => -63, + DEFAULT => -80, GOTOS => { 'typedecl' => 64, 'function' => 53, @@ -720,7 +720,7 @@ sub new { ACTIONS => { ";" => 71 }, - DEFAULT => -97, + DEFAULT => -114, GOTOS => { 'optional_semicolon' => 72 } @@ -739,7 +739,7 @@ sub new { 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -73, + DEFAULT => -90, GOTOS => { 'identifier' => 23, 'anytext' => 74, @@ -753,7 +753,7 @@ sub new { 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -73, + DEFAULT => -90, GOTOS => { 'identifier' => 23, 'anytext' => 75, @@ -767,7 +767,7 @@ sub new { 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -73, + DEFAULT => -90, GOTOS => { 'identifier' => 23, 'anytext' => 76, @@ -781,7 +781,7 @@ sub new { 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -73, + DEFAULT => -90, GOTOS => { 'identifier' => 23, 'anytext' => 77, @@ -795,7 +795,7 @@ sub new { 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -73, + DEFAULT => -90, GOTOS => { 'identifier' => 23, 'anytext' => 78, @@ -809,7 +809,7 @@ sub new { 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -73, + DEFAULT => -90, GOTOS => { 'identifier' => 23, 'anytext' => 79, @@ -823,7 +823,7 @@ sub new { 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -73, + DEFAULT => -90, GOTOS => { 'identifier' => 23, 'anytext' => 80, @@ -838,7 +838,7 @@ sub new { 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -73, + DEFAULT => -90, GOTOS => { 'identifier' => 23, 'anytext' => 82, @@ -852,7 +852,7 @@ sub new { 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -73, + DEFAULT => -90, GOTOS => { 'identifier' => 23, 'anytext' => 83, @@ -866,7 +866,7 @@ sub new { 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -73, + DEFAULT => -90, GOTOS => { 'identifier' => 23, 'anytext' => 84, @@ -880,7 +880,7 @@ sub new { 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -73, + DEFAULT => -90, GOTOS => { 'identifier' => 23, 'anytext' => 80, @@ -895,7 +895,7 @@ sub new { 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -73, + DEFAULT => -90, GOTOS => { 'identifier' => 23, 'anytext' => 86, @@ -909,7 +909,7 @@ sub new { 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -73, + DEFAULT => -90, GOTOS => { 'identifier' => 23, 'anytext' => 87, @@ -923,7 +923,7 @@ sub new { 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -73, + DEFAULT => -90, GOTOS => { 'identifier' => 23, 'anytext' => 88, @@ -937,7 +937,7 @@ sub new { 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -73, + DEFAULT => -90, GOTOS => { 'identifier' => 23, 'anytext' => 89, @@ -951,7 +951,7 @@ sub new { 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -73, + DEFAULT => -90, GOTOS => { 'identifier' => 23, 'anytext' => 90, @@ -960,10 +960,10 @@ sub new { } }, {#State 50 - DEFAULT => -68 + DEFAULT => -85 }, {#State 51 - DEFAULT => -63, + DEFAULT => -80, GOTOS => { 'property_list' => 91 } @@ -972,7 +972,7 @@ sub new { ACTIONS => { 'IDENTIFIER' => 92 }, - DEFAULT => -94, + DEFAULT => -111, GOTOS => { 'optional_identifier' => 93 } @@ -991,7 +991,7 @@ sub new { "const" => 60, "struct" => 63 }, - DEFAULT => -63, + DEFAULT => -80, GOTOS => { 'typedecl' => 64, 'function' => 53, @@ -1015,30 +1015,34 @@ sub new { {#State 56 ACTIONS => { 'IDENTIFIER' => 9, + "signed" => 102, "union" => 52, "enum" => 65, "bitmap" => 66, - "[" => 7, 'void' => 97, + "unsigned" => 103, + "[" => 7, "struct" => 63 }, GOTOS => { + 'existingtype' => 101, + 'bitmap' => 67, + 'usertype' => 98, 'identifier' => 99, 'struct' => 59, 'enum' => 61, - 'type' => 100, + 'type' => 104, 'union' => 70, - 'bitmap' => 67, - 'usertype' => 98 + 'sign' => 100 } }, {#State 57 DEFAULT => -10 }, {#State 58 - DEFAULT => -63, + DEFAULT => -80, GOTOS => { - 'property_list' => 101 + 'property_list' => 105 } }, {#State 59 @@ -1049,7 +1053,7 @@ sub new { 'IDENTIFIER' => 9 }, GOTOS => { - 'identifier' => 102 + 'identifier' => 106 } }, {#State 61 @@ -1062,9 +1066,9 @@ sub new { ACTIONS => { 'IDENTIFIER' => 92 }, - DEFAULT => -94, + DEFAULT => -111, GOTOS => { - 'optional_identifier' => 103 + 'optional_identifier' => 107 } }, {#State 64 @@ -1074,18 +1078,18 @@ sub new { ACTIONS => { 'IDENTIFIER' => 92 }, - DEFAULT => -94, + DEFAULT => -111, GOTOS => { - 'optional_identifier' => 104 + 'optional_identifier' => 108 } }, {#State 66 ACTIONS => { 'IDENTIFIER' => 92 }, - DEFAULT => -94, + DEFAULT => -111, GOTOS => { - 'optional_identifier' => 105 + 'optional_identifier' => 109 } }, {#State 67 @@ -1101,14 +1105,14 @@ sub new { DEFAULT => -27 }, {#State 71 - DEFAULT => -98 + DEFAULT => -115 }, {#State 72 DEFAULT => -4 }, {#State 73 ACTIONS => { - ";" => 106 + ";" => 110 } }, {#State 74 @@ -1129,7 +1133,7 @@ sub new { "." => 47, ">" => 48 }, - DEFAULT => -86 + DEFAULT => -103 }, {#State 75 ACTIONS => { @@ -1140,7 +1144,7 @@ sub new { "{" => 40, "=" => 43 }, - DEFAULT => -77 + DEFAULT => -94 }, {#State 76 ACTIONS => { @@ -1160,7 +1164,7 @@ sub new { "." => 47, ">" => 48 }, - DEFAULT => -85 + DEFAULT => -102 }, {#State 77 ACTIONS => { @@ -1180,7 +1184,7 @@ sub new { "." => 47, ">" => 48 }, - DEFAULT => -81 + DEFAULT => -98 }, {#State 78 ACTIONS => { @@ -1200,7 +1204,7 @@ sub new { "." => 47, ">" => 48 }, - DEFAULT => -89 + DEFAULT => -106 }, {#State 79 ACTIONS => { @@ -1211,7 +1215,7 @@ sub new { "{" => 40, "=" => 43 }, - DEFAULT => -88 + DEFAULT => -105 }, {#State 80 ACTIONS => { @@ -1231,12 +1235,12 @@ sub new { "." => 47, ">" => 48 }, - DEFAULT => -71 + DEFAULT => -88 }, {#State 81 ACTIONS => { - "}" => 107, - "," => 108 + "}" => 111, + "," => 112 } }, {#State 82 @@ -1248,7 +1252,7 @@ sub new { "{" => 40, "=" => 43 }, - DEFAULT => -83 + DEFAULT => -100 }, {#State 83 ACTIONS => { @@ -1259,7 +1263,7 @@ sub new { "{" => 40, "=" => 43 }, - DEFAULT => -84 + DEFAULT => -101 }, {#State 84 ACTIONS => { @@ -1279,12 +1283,12 @@ sub new { "." => 47, ">" => 48 }, - DEFAULT => -87 + DEFAULT => -104 }, {#State 85 ACTIONS => { - "," => 108, - ")" => 109 + "," => 112, + ")" => 113 } }, {#State 86 @@ -1296,7 +1300,7 @@ sub new { "{" => 40, "=" => 43 }, - DEFAULT => -82 + DEFAULT => -99 }, {#State 87 ACTIONS => { @@ -1307,7 +1311,7 @@ sub new { "{" => 40, "=" => 43 }, - DEFAULT => -79 + DEFAULT => -96 }, {#State 88 ACTIONS => { @@ -1318,7 +1322,7 @@ sub new { "{" => 40, "=" => 43 }, - DEFAULT => -78 + DEFAULT => -95 }, {#State 89 ACTIONS => { @@ -1329,7 +1333,7 @@ sub new { "{" => 40, "=" => 43 }, - DEFAULT => -80 + DEFAULT => -97 }, {#State 90 ACTIONS => { @@ -1349,43 +1353,52 @@ sub new { "." => 47, ">" => 48 }, - DEFAULT => -70 + DEFAULT => -87 }, {#State 91 ACTIONS => { 'IDENTIFIER' => 9, + "signed" => 102, "union" => 52, "enum" => 65, "bitmap" => 66, - "[" => 7, 'void' => 97, + "unsigned" => 103, + "[" => 7, "struct" => 63 }, GOTOS => { + 'existingtype' => 101, + 'bitmap' => 67, + 'usertype' => 98, 'identifier' => 99, 'struct' => 59, 'enum' => 61, - 'type' => 110, + 'type' => 114, 'union' => 70, - 'bitmap' => 67, - 'usertype' => 98 + 'sign' => 100 } }, {#State 92 - DEFAULT => -93 + DEFAULT => -110 }, {#State 93 ACTIONS => { - "{" => 111 + "{" => 116 + }, + DEFAULT => -65, + GOTOS => { + 'union_body' => 117, + 'opt_union_body' => 115 } }, {#State 94 ACTIONS => { ";" => 71 }, - DEFAULT => -97, + DEFAULT => -114, GOTOS => { - 'optional_semicolon' => 112 + 'optional_semicolon' => 118 } }, {#State 95 @@ -1395,178 +1408,237 @@ sub new { DEFAULT => -30 }, {#State 97 - DEFAULT => -33 + DEFAULT => -38 }, {#State 98 - DEFAULT => -31 + DEFAULT => -36 }, {#State 99 - DEFAULT => -32 + DEFAULT => -35 }, {#State 100 ACTIONS => { 'IDENTIFIER' => 9 }, GOTOS => { - 'identifier' => 113 + 'identifier' => 119 } }, {#State 101 + DEFAULT => -37 + }, + {#State 102 + DEFAULT => -31 + }, + {#State 103 + DEFAULT => -32 + }, + {#State 104 + ACTIONS => { + 'IDENTIFIER' => 9 + }, + GOTOS => { + 'identifier' => 120 + } + }, + {#State 105 ACTIONS => { - "enum" => 117, - "bitmap" => 118, + "enum" => 124, + "bitmap" => 125, "[" => 7 }, GOTOS => { - 'decl_enum' => 114, - 'decl_bitmap' => 115, - 'decl_type' => 116 + 'decl_enum' => 121, + 'decl_bitmap' => 122, + 'decl_type' => 123 } }, - {#State 102 - DEFAULT => -52, + {#State 106 + DEFAULT => -69, GOTOS => { - 'pointers' => 119 + 'pointers' => 126 } }, - {#State 103 + {#State 107 ACTIONS => { - "{" => 120 + "{" => 128 + }, + DEFAULT => -55, + GOTOS => { + 'struct_body' => 127, + 'opt_struct_body' => 129 } }, - {#State 104 + {#State 108 ACTIONS => { - "{" => 121 + "{" => 130 + }, + DEFAULT => -40, + GOTOS => { + 'opt_enum_body' => 132, + 'enum_body' => 131 } }, - {#State 105 + {#State 109 ACTIONS => { - "{" => 122 + "{" => 134 + }, + DEFAULT => -48, + GOTOS => { + 'bitmap_body' => 135, + 'opt_bitmap_body' => 133 } }, - {#State 106 + {#State 110 DEFAULT => -6 }, - {#State 107 + {#State 111 ACTIONS => { 'CONSTANT' => 28, 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -73, + DEFAULT => -90, GOTOS => { 'identifier' => 23, - 'anytext' => 123, + 'anytext' => 136, 'text' => 24, 'constant' => 27 } }, - {#State 108 + {#State 112 ACTIONS => { 'CONSTANT' => 28, 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -73, + DEFAULT => -90, GOTOS => { 'identifier' => 23, - 'anytext' => 124, + 'anytext' => 137, 'text' => 24, 'constant' => 27 } }, - {#State 109 + {#State 113 ACTIONS => { 'CONSTANT' => 28, 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -73, + DEFAULT => -90, GOTOS => { 'identifier' => 23, - 'anytext' => 125, + 'anytext' => 138, 'text' => 24, 'constant' => 27 } }, - {#State 110 + {#State 114 ACTIONS => { 'IDENTIFIER' => 9 }, GOTOS => { - 'identifier' => 126 + 'identifier' => 139 } }, - {#State 111 - DEFAULT => -48, + {#State 115 + DEFAULT => -67 + }, + {#State 116 + DEFAULT => -62, GOTOS => { - 'union_elements' => 127 + 'union_elements' => 140 } }, - {#State 112 + {#State 117 + DEFAULT => -66 + }, + {#State 118 DEFAULT => -7 }, - {#State 113 + {#State 119 + DEFAULT => -34 + }, + {#State 120 ACTIONS => { - "(" => 128 + "(" => 141 } }, - {#State 114 + {#State 121 DEFAULT => -21 }, - {#State 115 + {#State 122 DEFAULT => -22 }, - {#State 116 + {#State 123 ACTIONS => { 'IDENTIFIER' => 9 }, GOTOS => { - 'identifier' => 129 + 'identifier' => 142 } }, - {#State 117 + {#State 124 DEFAULT => -23 }, - {#State 118 + {#State 125 DEFAULT => -24 }, - {#State 119 + {#State 126 ACTIONS => { 'IDENTIFIER' => 9, - "*" => 131 + "*" => 144 }, GOTOS => { - 'identifier' => 130 + 'identifier' => 143 } }, - {#State 120 - DEFAULT => -54, + {#State 127 + DEFAULT => -56 + }, + {#State 128 + DEFAULT => -71, GOTOS => { - 'element_list1' => 132 + 'element_list1' => 145 } }, - {#State 121 + {#State 129 + DEFAULT => -57 + }, + {#State 130 ACTIONS => { 'IDENTIFIER' => 9 }, GOTOS => { - 'identifier' => 133, - 'enum_element' => 134, - 'enum_elements' => 135 + 'identifier' => 146, + 'enum_element' => 147, + 'enum_elements' => 148 } }, - {#State 122 + {#State 131 + DEFAULT => -41 + }, + {#State 132 + DEFAULT => -42 + }, + {#State 133 + DEFAULT => -50 + }, + {#State 134 ACTIONS => { 'IDENTIFIER' => 9 }, GOTOS => { - 'identifier' => 138, - 'bitmap_elements' => 137, - 'bitmap_element' => 136 + 'identifier' => 151, + 'bitmap_elements' => 150, + 'bitmap_element' => 149 } }, - {#State 123 + {#State 135 + DEFAULT => -49 + }, + {#State 136 ACTIONS => { "-" => 35, ":" => 34, @@ -1584,9 +1656,9 @@ sub new { "." => 47, ">" => 48 }, - DEFAULT => -91 + DEFAULT => -108 }, - {#State 124 + {#State 137 ACTIONS => { "-" => 35, ":" => 34, @@ -1604,9 +1676,9 @@ sub new { "." => 47, ">" => 48 }, - DEFAULT => -72 + DEFAULT => -89 }, - {#State 125 + {#State 138 ACTIONS => { ":" => 34, "<" => 37, @@ -1615,258 +1687,263 @@ sub new { "{" => 40, "=" => 43 }, - DEFAULT => -90 + DEFAULT => -107 }, - {#State 126 + {#State 139 ACTIONS => { - "[" => 139 + "[" => 152 }, - DEFAULT => -60, + DEFAULT => -77, GOTOS => { - 'array_len' => 140 + 'array_len' => 153 } }, - {#State 127 + {#State 140 ACTIONS => { - "}" => 141 + "}" => 154 }, - DEFAULT => -63, + DEFAULT => -80, GOTOS => { - 'optional_base_element' => 143, - 'property_list' => 142 + 'optional_base_element' => 156, + 'property_list' => 155 } }, - {#State 128 + {#State 141 ACTIONS => { - "," => -56, - "void" => 147, - ")" => -56 + "," => -73, + "void" => 160, + ")" => -73 }, - DEFAULT => -63, + DEFAULT => -80, GOTOS => { - 'base_element' => 144, - 'element_list2' => 146, - 'property_list' => 145 + 'base_element' => 157, + 'element_list2' => 159, + 'property_list' => 158 } }, - {#State 129 + {#State 142 ACTIONS => { - ";" => 148 + ";" => 161 } }, - {#State 130 + {#State 143 ACTIONS => { - "[" => 139, - "=" => 150 + "[" => 152, + "=" => 163 }, GOTOS => { - 'array_len' => 149 + 'array_len' => 162 } }, - {#State 131 - DEFAULT => -53 + {#State 144 + DEFAULT => -70 }, - {#State 132 + {#State 145 ACTIONS => { - "}" => 151 + "}" => 164 }, - DEFAULT => -63, + DEFAULT => -80, GOTOS => { - 'base_element' => 152, - 'property_list' => 145 + 'base_element' => 165, + 'property_list' => 158 } }, - {#State 133 + {#State 146 ACTIONS => { - "=" => 153 + "=" => 166 }, - DEFAULT => -37 + DEFAULT => -45 }, - {#State 134 - DEFAULT => -35 + {#State 147 + DEFAULT => -43 }, - {#State 135 + {#State 148 ACTIONS => { - "}" => 154, - "," => 155 + "}" => 167, + "," => 168 } }, - {#State 136 - DEFAULT => -40 + {#State 149 + DEFAULT => -51 }, - {#State 137 + {#State 150 ACTIONS => { - "}" => 156, - "," => 157 + "}" => 169, + "," => 170 } }, - {#State 138 + {#State 151 ACTIONS => { - "=" => 158 + "=" => 171 } }, - {#State 139 + {#State 152 ACTIONS => { 'CONSTANT' => 28, 'TEXT' => 22, - "]" => 159, + "]" => 172, 'IDENTIFIER' => 9 }, - DEFAULT => -73, + DEFAULT => -90, GOTOS => { 'identifier' => 23, - 'anytext' => 160, + 'anytext' => 173, 'text' => 24, 'constant' => 27 } }, - {#State 140 + {#State 153 ACTIONS => { - ";" => 161 + ";" => 174 } }, - {#State 141 - DEFAULT => -50 + {#State 154 + DEFAULT => -64 }, - {#State 142 + {#State 155 ACTIONS => { "[" => 7 }, - DEFAULT => -63, + DEFAULT => -80, GOTOS => { - 'base_or_empty' => 162, - 'base_element' => 163, - 'empty_element' => 164, - 'property_list' => 165 + 'base_or_empty' => 175, + 'base_element' => 176, + 'empty_element' => 177, + 'property_list' => 178 } }, - {#State 143 - DEFAULT => -49 + {#State 156 + DEFAULT => -63 }, - {#State 144 - DEFAULT => -58 + {#State 157 + DEFAULT => -75 }, - {#State 145 + {#State 158 ACTIONS => { 'IDENTIFIER' => 9, + "signed" => 102, "union" => 52, "enum" => 65, "bitmap" => 66, - "[" => 7, 'void' => 97, + "unsigned" => 103, + "[" => 7, "struct" => 63 }, + DEFAULT => -33, GOTOS => { + 'existingtype' => 101, + 'bitmap' => 67, + 'usertype' => 98, 'identifier' => 99, 'struct' => 59, 'enum' => 61, - 'type' => 166, + 'type' => 179, 'union' => 70, - 'bitmap' => 67, - 'usertype' => 98 + 'sign' => 100 } }, - {#State 146 + {#State 159 ACTIONS => { - "," => 167, - ")" => 168 + "," => 180, + ")" => 181 } }, - {#State 147 - DEFAULT => -57 + {#State 160 + DEFAULT => -74 }, - {#State 148 + {#State 161 DEFAULT => -20 }, - {#State 149 + {#State 162 ACTIONS => { - "=" => 169 + "=" => 182 } }, - {#State 150 + {#State 163 ACTIONS => { 'CONSTANT' => 28, 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -73, + DEFAULT => -90, GOTOS => { 'identifier' => 23, - 'anytext' => 170, + 'anytext' => 183, 'text' => 24, 'constant' => 27 } }, - {#State 151 - DEFAULT => -43 + {#State 164 + DEFAULT => -54 }, - {#State 152 + {#State 165 ACTIONS => { - ";" => 171 + ";" => 184 } }, - {#State 153 + {#State 166 ACTIONS => { 'CONSTANT' => 28, 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -73, + DEFAULT => -90, GOTOS => { 'identifier' => 23, - 'anytext' => 172, + 'anytext' => 185, 'text' => 24, 'constant' => 27 } }, - {#State 154 - DEFAULT => -34 + {#State 167 + DEFAULT => -39 }, - {#State 155 + {#State 168 ACTIONS => { 'IDENTIFIER' => 9 }, GOTOS => { - 'identifier' => 133, - 'enum_element' => 173 + 'identifier' => 146, + 'enum_element' => 186 } }, - {#State 156 - DEFAULT => -39 + {#State 169 + DEFAULT => -47 }, - {#State 157 + {#State 170 ACTIONS => { 'IDENTIFIER' => 9 }, GOTOS => { - 'identifier' => 138, - 'bitmap_element' => 174 + 'identifier' => 151, + 'bitmap_element' => 187 } }, - {#State 158 + {#State 171 ACTIONS => { 'CONSTANT' => 28, 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -73, + DEFAULT => -90, GOTOS => { 'identifier' => 23, - 'anytext' => 175, + 'anytext' => 188, 'text' => 24, 'constant' => 27 } }, - {#State 159 + {#State 172 ACTIONS => { - "[" => 139 + "[" => 152 }, - DEFAULT => -60, + DEFAULT => -77, GOTOS => { - 'array_len' => 176 + 'array_len' => 189 } }, - {#State 160 + {#State 173 ACTIONS => { "-" => 35, ":" => 34, @@ -1882,84 +1959,89 @@ sub new { "(" => 44, "*" => 46, "." => 47, - "]" => 177, + "]" => 190, ">" => 48 } }, - {#State 161 + {#State 174 DEFAULT => -25 }, - {#State 162 - DEFAULT => -47 + {#State 175 + DEFAULT => -61 }, - {#State 163 + {#State 176 ACTIONS => { - ";" => 178 + ";" => 191 } }, - {#State 164 - DEFAULT => -46 + {#State 177 + DEFAULT => -60 }, - {#State 165 + {#State 178 ACTIONS => { 'IDENTIFIER' => 9, + "signed" => 102, "union" => 52, - ";" => 179, + ";" => 192, "enum" => 65, "bitmap" => 66, 'void' => 97, + "unsigned" => 103, "[" => 7, "struct" => 63 }, + DEFAULT => -33, GOTOS => { + 'existingtype' => 101, + 'bitmap' => 67, + 'usertype' => 98, 'identifier' => 99, 'struct' => 59, 'enum' => 61, - 'type' => 166, + 'type' => 179, 'union' => 70, - 'bitmap' => 67, - 'usertype' => 98 + 'sign' => 100 } }, - {#State 166 - DEFAULT => -52, + {#State 179 + DEFAULT => -69, GOTOS => { - 'pointers' => 180 + 'pointers' => 193 } }, - {#State 167 - DEFAULT => -63, + {#State 180 + DEFAULT => -80, GOTOS => { - 'base_element' => 181, - 'property_list' => 145 + 'base_element' => 194, + 'property_list' => 158 } }, - {#State 168 + {#State 181 ACTIONS => { - ";" => 182 + ";" => 195 } }, - {#State 169 + {#State 182 ACTIONS => { 'CONSTANT' => 28, 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -73, + DEFAULT => -90, GOTOS => { 'identifier' => 23, - 'anytext' => 183, + 'anytext' => 196, 'text' => 24, 'constant' => 27 } }, - {#State 170 + {#State 183 ACTIONS => { "-" => 35, ":" => 34, "?" => 36, "<" => 37, - ";" => 184, + ";" => 197, "+" => 39, "~" => 38, "&" => 41, @@ -1973,10 +2055,10 @@ sub new { ">" => 48 } }, - {#State 171 - DEFAULT => -55 + {#State 184 + DEFAULT => -72 }, - {#State 172 + {#State 185 ACTIONS => { "-" => 35, ":" => 34, @@ -1994,15 +2076,15 @@ sub new { "." => 47, ">" => 48 }, - DEFAULT => -38 + DEFAULT => -46 }, - {#State 173 - DEFAULT => -36 + {#State 186 + DEFAULT => -44 }, - {#State 174 - DEFAULT => -41 + {#State 187 + DEFAULT => -52 }, - {#State 175 + {#State 188 ACTIONS => { "-" => 35, ":" => 34, @@ -2020,48 +2102,48 @@ sub new { "." => 47, ">" => 48 }, - DEFAULT => -42 + DEFAULT => -53 }, - {#State 176 - DEFAULT => -61 + {#State 189 + DEFAULT => -78 }, - {#State 177 + {#State 190 ACTIONS => { - "[" => 139 + "[" => 152 }, - DEFAULT => -60, + DEFAULT => -77, GOTOS => { - 'array_len' => 185 + 'array_len' => 198 } }, - {#State 178 - DEFAULT => -45 + {#State 191 + DEFAULT => -59 }, - {#State 179 - DEFAULT => -44 + {#State 192 + DEFAULT => -58 }, - {#State 180 + {#State 193 ACTIONS => { 'IDENTIFIER' => 9, - "*" => 131 + "*" => 144 }, GOTOS => { - 'identifier' => 186 + 'identifier' => 199 } }, - {#State 181 - DEFAULT => -59 + {#State 194 + DEFAULT => -76 }, - {#State 182 + {#State 195 DEFAULT => -19 }, - {#State 183 + {#State 196 ACTIONS => { "-" => 35, ":" => 34, "?" => 36, "<" => 37, - ";" => 187, + ";" => 200, "+" => 39, "~" => 38, "&" => 41, @@ -2075,26 +2157,26 @@ sub new { ">" => 48 } }, - {#State 184 + {#State 197 DEFAULT => -17 }, - {#State 185 - DEFAULT => -62 + {#State 198 + DEFAULT => -79 }, - {#State 186 + {#State 199 ACTIONS => { - "[" => 139 + "[" => 152 }, - DEFAULT => -60, + DEFAULT => -77, GOTOS => { - 'array_len' => 188 + 'array_len' => 201 } }, - {#State 187 + {#State 200 DEFAULT => -18 }, - {#State 188 - DEFAULT => -51 + {#State 201 + DEFAULT => -68 } ], yyrules => @@ -2108,19 +2190,19 @@ sub new { [#Rule 2 'idl', 2, sub -#line 19 "pidl/idl.yp" +#line 19 "idl.yp" { push(@{$_[1]}, $_[2]); $_[1] } ], [#Rule 3 'idl', 2, sub -#line 20 "pidl/idl.yp" +#line 20 "idl.yp" { push(@{$_[1]}, $_[2]); $_[1] } ], [#Rule 4 'coclass', 7, sub -#line 24 "pidl/idl.yp" +#line 24 "idl.yp" {$_[3] => { "TYPE" => "COCLASS", "PROPERTIES" => $_[1], @@ -2136,13 +2218,13 @@ sub [#Rule 6 'interface_names', 4, sub -#line 36 "pidl/idl.yp" +#line 36 "idl.yp" { push(@{$_[1]}, $_[2]); $_[1] } ], [#Rule 7 'interface', 8, sub -#line 40 "pidl/idl.yp" +#line 40 "idl.yp" {$_[3] => { "TYPE" => "INTERFACE", "PROPERTIES" => $_[1], @@ -2159,19 +2241,19 @@ sub [#Rule 9 'base_interface', 2, sub -#line 53 "pidl/idl.yp" +#line 53 "idl.yp" { $_[2] } ], [#Rule 10 'definitions', 1, sub -#line 57 "pidl/idl.yp" +#line 57 "idl.yp" { [ $_[1] ] } ], [#Rule 11 'definitions', 2, sub -#line 58 "pidl/idl.yp" +#line 58 "idl.yp" { push(@{$_[1]}, $_[2]); $_[1] } ], [#Rule 12 @@ -2192,7 +2274,7 @@ sub [#Rule 17 'const', 7, sub -#line 66 "pidl/idl.yp" +#line 66 "idl.yp" {{ "TYPE" => "CONST", "DTYPE" => $_[2], @@ -2206,7 +2288,7 @@ sub [#Rule 18 'const', 8, sub -#line 76 "pidl/idl.yp" +#line 76 "idl.yp" {{ "TYPE" => "CONST", "DTYPE" => $_[2], @@ -2221,7 +2303,7 @@ sub [#Rule 19 'function', 7, sub -#line 90 "pidl/idl.yp" +#line 90 "idl.yp" {{ "TYPE" => "FUNCTION", "NAME" => $_[3], @@ -2235,7 +2317,7 @@ sub [#Rule 20 'declare', 5, sub -#line 102 "pidl/idl.yp" +#line 102 "idl.yp" {{ "TYPE" => "DECLARE", "PROPERTIES" => $_[2], @@ -2254,7 +2336,7 @@ sub [#Rule 23 'decl_enum', 1, sub -#line 116 "pidl/idl.yp" +#line 116 "idl.yp" {{ "TYPE" => "ENUM" }} @@ -2262,7 +2344,7 @@ sub [#Rule 24 'decl_bitmap', 1, sub -#line 122 "pidl/idl.yp" +#line 122 "idl.yp" {{ "TYPE" => "BITMAP" }} @@ -2270,7 +2352,7 @@ sub [#Rule 25 'typedef', 6, sub -#line 128 "pidl/idl.yp" +#line 128 "idl.yp" {{ "TYPE" => "TYPEDEF", "PROPERTIES" => $_[2], @@ -2296,94 +2378,148 @@ sub [#Rule 30 'typedecl', 2, sub -#line 141 "pidl/idl.yp" +#line 141 "idl.yp" { $_[1] } ], [#Rule 31 - 'type', 1, undef + 'sign', 1, undef ], [#Rule 32 - 'type', 1, undef + 'sign', 1, undef ], [#Rule 33 + 'existingtype', 0, undef + ], + [#Rule 34 + 'existingtype', 2, +sub +#line 146 "idl.yp" +{ "$_[1] $_[2]" } + ], + [#Rule 35 + 'existingtype', 1, undef + ], + [#Rule 36 + 'type', 1, undef + ], + [#Rule 37 + 'type', 1, undef + ], + [#Rule 38 'type', 1, sub -#line 144 "pidl/idl.yp" +#line 150 "idl.yp" { "void" } ], - [#Rule 34 - 'enum', 5, + [#Rule 39 + 'enum_body', 3, +sub +#line 152 "idl.yp" +{ $_[2] } + ], + [#Rule 40 + 'opt_enum_body', 0, undef + ], + [#Rule 41 + 'opt_enum_body', 1, undef + ], + [#Rule 42 + 'enum', 3, sub -#line 148 "pidl/idl.yp" +#line 155 "idl.yp" {{ "TYPE" => "ENUM", "NAME" => $_[2], - "ELEMENTS" => $_[4] + "ELEMENTS" => $_[3] }} ], - [#Rule 35 + [#Rule 43 'enum_elements', 1, sub -#line 156 "pidl/idl.yp" +#line 163 "idl.yp" { [ $_[1] ] } ], - [#Rule 36 + [#Rule 44 'enum_elements', 3, sub -#line 157 "pidl/idl.yp" +#line 164 "idl.yp" { push(@{$_[1]}, $_[3]); $_[1] } ], - [#Rule 37 + [#Rule 45 'enum_element', 1, undef ], - [#Rule 38 + [#Rule 46 'enum_element', 3, sub -#line 161 "pidl/idl.yp" +#line 168 "idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 39 - 'bitmap', 5, + [#Rule 47 + 'bitmap_body', 3, +sub +#line 171 "idl.yp" +{ $_[2] } + ], + [#Rule 48 + 'opt_bitmap_body', 0, undef + ], + [#Rule 49 + 'opt_bitmap_body', 1, undef + ], + [#Rule 50 + 'bitmap', 3, sub -#line 165 "pidl/idl.yp" +#line 174 "idl.yp" {{ "TYPE" => "BITMAP", "NAME" => $_[2], - "ELEMENTS" => $_[4] + "ELEMENTS" => $_[3] }} ], - [#Rule 40 + [#Rule 51 'bitmap_elements', 1, sub -#line 173 "pidl/idl.yp" +#line 182 "idl.yp" { [ $_[1] ] } ], - [#Rule 41 + [#Rule 52 'bitmap_elements', 3, sub -#line 174 "pidl/idl.yp" +#line 183 "idl.yp" { push(@{$_[1]}, $_[3]); $_[1] } ], - [#Rule 42 + [#Rule 53 'bitmap_element', 3, sub -#line 177 "pidl/idl.yp" +#line 186 "idl.yp" { "$_[1] ( $_[3] )" } ], - [#Rule 43 - 'struct', 5, + [#Rule 54 + 'struct_body', 3, sub -#line 181 "pidl/idl.yp" +#line 189 "idl.yp" +{ $_[2] } + ], + [#Rule 55 + 'opt_struct_body', 0, undef + ], + [#Rule 56 + 'opt_struct_body', 1, undef + ], + [#Rule 57 + 'struct', 3, +sub +#line 193 "idl.yp" {{ "TYPE" => "STRUCT", "NAME" => $_[2], - "ELEMENTS" => $_[4] + "ELEMENTS" => $_[3] }} ], - [#Rule 44 + [#Rule 58 'empty_element', 2, sub -#line 189 "pidl/idl.yp" +#line 201 "idl.yp" {{ "NAME" => "", "TYPE" => "EMPTY", @@ -2394,41 +2530,53 @@ sub "LINE" => $_[0]->YYData->{LINE}, }} ], - [#Rule 45 + [#Rule 59 'base_or_empty', 2, undef ], - [#Rule 46 + [#Rule 60 'base_or_empty', 1, undef ], - [#Rule 47 + [#Rule 61 'optional_base_element', 2, sub -#line 203 "pidl/idl.yp" -{ $_[2]->{PROPERTIES} = Parse::Pidl::Util::FlattenHash([$_[1],$_[2]->{PROPERTIES}]); $_[2] } +#line 215 "idl.yp" +{ $_[2]->{PROPERTIES} = FlattenHash([$_[1],$_[2]->{PROPERTIES}]); $_[2] } ], - [#Rule 48 + [#Rule 62 'union_elements', 0, undef ], - [#Rule 49 + [#Rule 63 'union_elements', 2, sub -#line 208 "pidl/idl.yp" +#line 220 "idl.yp" { push(@{$_[1]}, $_[2]); $_[1] } ], - [#Rule 50 - 'union', 5, + [#Rule 64 + 'union_body', 3, +sub +#line 223 "idl.yp" +{ $_[2] } + ], + [#Rule 65 + 'opt_union_body', 0, undef + ], + [#Rule 66 + 'opt_union_body', 1, undef + ], + [#Rule 67 + 'union', 3, sub -#line 212 "pidl/idl.yp" +#line 227 "idl.yp" {{ "TYPE" => "UNION", "NAME" => $_[2], - "ELEMENTS" => $_[4] + "ELEMENTS" => $_[3] }} ], - [#Rule 51 + [#Rule 68 'base_element', 5, sub -#line 220 "pidl/idl.yp" +#line 235 "idl.yp" {{ "NAME" => $_[4], "TYPE" => $_[2], @@ -2439,238 +2587,238 @@ sub "LINE" => $_[0]->YYData->{LINE}, }} ], - [#Rule 52 + [#Rule 69 'pointers', 0, sub -#line 234 "pidl/idl.yp" +#line 249 "idl.yp" { 0 } ], - [#Rule 53 + [#Rule 70 'pointers', 2, sub -#line 235 "pidl/idl.yp" +#line 250 "idl.yp" { $_[1]+1 } ], - [#Rule 54 + [#Rule 71 'element_list1', 0, undef ], - [#Rule 55 + [#Rule 72 'element_list1', 3, sub -#line 240 "pidl/idl.yp" +#line 255 "idl.yp" { push(@{$_[1]}, $_[2]); $_[1] } ], - [#Rule 56 + [#Rule 73 'element_list2', 0, undef ], - [#Rule 57 + [#Rule 74 'element_list2', 1, undef ], - [#Rule 58 + [#Rule 75 'element_list2', 1, sub -#line 246 "pidl/idl.yp" +#line 261 "idl.yp" { [ $_[1] ] } ], - [#Rule 59 + [#Rule 76 'element_list2', 3, sub -#line 247 "pidl/idl.yp" +#line 262 "idl.yp" { push(@{$_[1]}, $_[3]); $_[1] } ], - [#Rule 60 + [#Rule 77 'array_len', 0, undef ], - [#Rule 61 + [#Rule 78 'array_len', 3, sub -#line 252 "pidl/idl.yp" +#line 267 "idl.yp" { push(@{$_[3]}, "*"); $_[3] } ], - [#Rule 62 + [#Rule 79 'array_len', 4, sub -#line 253 "pidl/idl.yp" +#line 268 "idl.yp" { push(@{$_[4]}, "$_[2]"); $_[4] } ], - [#Rule 63 + [#Rule 80 'property_list', 0, undef ], - [#Rule 64 + [#Rule 81 'property_list', 4, sub -#line 259 "pidl/idl.yp" -{ Parse::Pidl::Util::FlattenHash([$_[1],$_[3]]); } +#line 274 "idl.yp" +{ FlattenHash([$_[1],$_[3]]); } ], - [#Rule 65 + [#Rule 82 'properties', 1, sub -#line 262 "pidl/idl.yp" +#line 277 "idl.yp" { $_[1] } ], - [#Rule 66 + [#Rule 83 'properties', 3, sub -#line 263 "pidl/idl.yp" -{ Parse::Pidl::Util::FlattenHash([$_[1], $_[3]]); } +#line 278 "idl.yp" +{ FlattenHash([$_[1], $_[3]]); } ], - [#Rule 67 + [#Rule 84 'property', 1, sub -#line 266 "pidl/idl.yp" +#line 281 "idl.yp" {{ "$_[1]" => "1" }} ], - [#Rule 68 + [#Rule 85 'property', 4, sub -#line 267 "pidl/idl.yp" +#line 282 "idl.yp" {{ "$_[1]" => "$_[3]" }} ], - [#Rule 69 + [#Rule 86 'listtext', 1, undef ], - [#Rule 70 + [#Rule 87 'listtext', 3, sub -#line 272 "pidl/idl.yp" +#line 287 "idl.yp" { "$_[1] $_[3]" } ], - [#Rule 71 + [#Rule 88 'commalisttext', 1, undef ], - [#Rule 72 + [#Rule 89 'commalisttext', 3, sub -#line 277 "pidl/idl.yp" +#line 292 "idl.yp" { "$_[1],$_[3]" } ], - [#Rule 73 + [#Rule 90 'anytext', 0, sub -#line 281 "pidl/idl.yp" +#line 296 "idl.yp" { "" } ], - [#Rule 74 + [#Rule 91 'anytext', 1, undef ], - [#Rule 75 + [#Rule 92 'anytext', 1, undef ], - [#Rule 76 + [#Rule 93 'anytext', 1, undef ], - [#Rule 77 + [#Rule 94 'anytext', 3, sub -#line 283 "pidl/idl.yp" +#line 298 "idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 78 + [#Rule 95 'anytext', 3, sub -#line 284 "pidl/idl.yp" +#line 299 "idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 79 + [#Rule 96 'anytext', 3, sub -#line 285 "pidl/idl.yp" +#line 300 "idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 80 + [#Rule 97 'anytext', 3, sub -#line 286 "pidl/idl.yp" +#line 301 "idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 81 + [#Rule 98 'anytext', 3, sub -#line 287 "pidl/idl.yp" +#line 302 "idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 82 + [#Rule 99 'anytext', 3, sub -#line 288 "pidl/idl.yp" +#line 303 "idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 83 + [#Rule 100 'anytext', 3, sub -#line 289 "pidl/idl.yp" +#line 304 "idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 84 + [#Rule 101 'anytext', 3, sub -#line 290 "pidl/idl.yp" +#line 305 "idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 85 + [#Rule 102 'anytext', 3, sub -#line 291 "pidl/idl.yp" +#line 306 "idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 86 + [#Rule 103 'anytext', 3, sub -#line 292 "pidl/idl.yp" +#line 307 "idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 87 + [#Rule 104 'anytext', 3, sub -#line 293 "pidl/idl.yp" +#line 308 "idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 88 + [#Rule 105 'anytext', 3, sub -#line 294 "pidl/idl.yp" +#line 309 "idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 89 + [#Rule 106 'anytext', 3, sub -#line 295 "pidl/idl.yp" +#line 310 "idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 90 + [#Rule 107 'anytext', 5, sub -#line 296 "pidl/idl.yp" +#line 311 "idl.yp" { "$_[1]$_[2]$_[3]$_[4]$_[5]" } ], - [#Rule 91 + [#Rule 108 'anytext', 5, sub -#line 297 "pidl/idl.yp" +#line 312 "idl.yp" { "$_[1]$_[2]$_[3]$_[4]$_[5]" } ], - [#Rule 92 + [#Rule 109 'identifier', 1, undef ], - [#Rule 93 + [#Rule 110 'optional_identifier', 1, undef ], - [#Rule 94 + [#Rule 111 'optional_identifier', 0, undef ], - [#Rule 95 + [#Rule 112 'constant', 1, undef ], - [#Rule 96 + [#Rule 113 'text', 1, sub -#line 311 "pidl/idl.yp" +#line 326 "idl.yp" { "\"$_[1]\"" } ], - [#Rule 97 + [#Rule 114 'optional_semicolon', 0, undef ], - [#Rule 98 + [#Rule 115 'optional_semicolon', 1, undef ] ], @@ -2678,10 +2826,24 @@ sub bless($self,$class); } -#line 322 "pidl/idl.yp" +#line 337 "idl.yp" + + +##################################################################### +# flatten an array of hashes into a single hash +sub FlattenHash($) +{ + my $a = shift; + my %b; + for my $d (@{$a}) { + for my $k (keys %{$d}) { + $b{$k} = $d->{$k}; + } + } + return \%b; +} -use Parse::Pidl::Util; ##################################################################### # traverse a perl data structure removing any empty arrays or @@ -2690,6 +2852,7 @@ sub CleanData($) { sub CleanData($); my($v) = shift; + return undef if (not defined($v)); if (ref($v) eq "ARRAY") { foreach my $i (0 .. $#{$v}) { CleanData($v->[$i]); @@ -2764,7 +2927,7 @@ again: $parser->YYData->{LAST_TOKEN} = $1; if ($1 =~ /^(coclass|interface|const|typedef|declare|union - |struct|enum|bitmap|void)$/x) { + |struct|enum|bitmap|void|unsigned|signed)$/x) { return $1; } return('IDENTIFIER',$1); @@ -2776,9 +2939,25 @@ again: } } -sub parse_idl($$) +sub parse_string { - my ($self,$filename) = @_; + my ($data,$filename) = @_; + + my $self = new Parse::Pidl::IDL; + + $self->YYData->{INPUT_FILENAME} = $filename; + $self->YYData->{INPUT} = $data; + $self->YYData->{LINE} = 0; + $self->YYData->{LAST_TOKEN} = "NONE"; + + my $idl = $self->YYParse( yylex => \&_Lexer, yyerror => \&_Error ); + + return CleanData($idl); +} + +sub parse_file($) +{ + my ($filename) = @_; my $saved_delim = $/; undef $/; @@ -2789,13 +2968,7 @@ sub parse_idl($$) my $data = `$cpp -D__PIDL__ -xc $filename`; $/ = $saved_delim; - $self->YYData->{INPUT} = $data; - $self->YYData->{LINE} = 0; - $self->YYData->{LAST_TOKEN} = "NONE"; - - my $idl = $self->YYParse( yylex => \&_Lexer, yyerror => \&_Error ); - - return CleanData($idl); + return parse_string($data, $filename); } 1; diff --git a/tools/pidl/lib/Parse/Pidl/NDR.pm b/tools/pidl/lib/Parse/Pidl/NDR.pm index 9ff69f8757..0dd1ab4dd2 100644 --- a/tools/pidl/lib/Parse/Pidl/NDR.pm +++ b/tools/pidl/lib/Parse/Pidl/NDR.pm @@ -13,15 +13,18 @@ Parse::Pidl::NDR - NDR parsing information generator =head1 DESCRIPTION -##################################################################### -# return a table describing the order in which the parts of an element -# should be parsed -# Possible level types: -# - POINTER -# - ARRAY -# - SUBCONTEXT -# - SWITCH -# - DATA +Return a table describing the order in which the parts of an element +should be parsed +Possible level types: + - POINTER + - ARRAY + - SUBCONTEXT + - SWITCH + - DATA + +=head1 AUTHOR + +Jelmer Vernooij <jelmer@samba.org> =cut @@ -327,8 +330,9 @@ sub find_largest_alignment($) ##################################################################### # align a type -sub align_type +sub align_type($) { + sub align_type($); my $e = shift; unless (hasType($e)) { @@ -366,9 +370,9 @@ sub ParseElement($) }; } -sub ParseStruct($) +sub ParseStruct($$) { - my $struct = shift; + my ($ndr,$struct) = @_; my @elements = (); my $surrounding = undef; @@ -402,9 +406,9 @@ sub ParseStruct($) }; } -sub ParseUnion($) +sub ParseUnion($$) { - my $e = shift; + my ($ndr,$e) = @_; my @elements = (); my $switch_type = has_property($e, "switch_type"); unless (defined($switch_type)) { $switch_type = "uint32"; } @@ -441,9 +445,9 @@ sub ParseUnion($) }; } -sub ParseEnum($) +sub ParseEnum($$) { - my $e = shift; + my ($ndr,$e) = @_; return { TYPE => "ENUM", @@ -454,9 +458,9 @@ sub ParseEnum($) }; } -sub ParseBitmap($) +sub ParseBitmap($$) { - my $e = shift; + my ($ndr,$e) = @_; return { TYPE => "BITMAP", @@ -467,26 +471,34 @@ sub ParseBitmap($) }; } -sub ParseTypedef($$) +sub ParseType($$) { - my ($ndr,$d) = @_; - my $data; + my ($ndr, $d) = @_; - if ($d->{DATA}->{TYPE} eq "STRUCT" or $d->{DATA}->{TYPE} eq "UNION") { - CheckPointerTypes($d->{DATA}, $ndr->{PROPERTIES}->{pointer_default}); + if ($d->{TYPE} eq "STRUCT" or $d->{TYPE} eq "UNION") { + CheckPointerTypes($d, $ndr->{PROPERTIES}->{pointer_default}); } - if (defined($d->{PROPERTIES}) && !defined($d->{DATA}->{PROPERTIES})) { - $d->{DATA}->{PROPERTIES} = $d->{PROPERTIES}; - } - - $data = { + my $data = { STRUCT => \&ParseStruct, UNION => \&ParseUnion, ENUM => \&ParseEnum, - BITMAP => \&ParseBitmap - }->{$d->{DATA}->{TYPE}}->($d->{DATA}); + BITMAP => \&ParseBitmap, + TYPEDEF => \&ParseTypedef, + }->{$d->{TYPE}}->($ndr, $d); + + return $data; +} + +sub ParseTypedef($$) +{ + my ($ndr,$d) = @_; + + if (defined($d->{PROPERTIES}) && !defined($d->{DATA}->{PROPERTIES})) { + $d->{DATA}->{PROPERTIES} = $d->{PROPERTIES}; + } + my $data = ParseType($ndr, $d->{DATA}); $data->{ALIGN} = align_type($d->{NAME}); return { @@ -560,7 +572,7 @@ sub CheckPointerTypes($$) sub ParseInterface($) { my $idl = shift; - my @typedefs = (); + my @types = (); my @consts = (); my @functions = (); my @endpoints; @@ -579,20 +591,14 @@ sub ParseInterface($) } foreach my $d (@{$idl->{DATA}}) { - if ($d->{TYPE} eq "TYPEDEF") { - push (@typedefs, ParseTypedef($idl, $d)); - } - if ($d->{TYPE} eq "DECLARE") { push (@declares, $d); - } - - if ($d->{TYPE} eq "FUNCTION") { + } elsif ($d->{TYPE} eq "FUNCTION") { push (@functions, ParseFunction($idl, $d, \$opnum)); - } - - if ($d->{TYPE} eq "CONST") { + } elsif ($d->{TYPE} eq "CONST") { push (@consts, ParseConst($idl, $d)); + } else { + push (@types, ParseType($idl, $d)); } } @@ -617,7 +623,7 @@ sub ParseInterface($) PROPERTIES => $idl->{PROPERTIES}, FUNCTIONS => \@functions, CONSTS => \@consts, - TYPEDEFS => \@typedefs, + TYPES => \@types, DECLARES => \@declares, ENDPOINTS => \@endpoints }; @@ -629,6 +635,11 @@ sub ParseInterface($) sub Parse($) { my $idl = shift; + + return undef unless (defined($idl)); + + Parse::Pidl::NDR::Validate($idl); + my @ndr = (); push(@ndr, ParseInterface($_)) foreach (@{$idl}); diff --git a/tools/pidl/lib/Parse/Pidl/Samba/NDR/Header.pm b/tools/pidl/lib/Parse/Pidl/Samba/NDR/Header.pm deleted file mode 100644 index dd1848152e..0000000000 --- a/tools/pidl/lib/Parse/Pidl/Samba/NDR/Header.pm +++ /dev/null @@ -1,169 +0,0 @@ -################################################### -# create C header files for an IDL structure -# Copyright tridge@samba.org 2000 -# Copyright jelmer@samba.org 2005 -# released under the GNU GPL - -package Parse::Pidl::Samba::NDR::Header; - -use strict; -use Parse::Pidl::Typelist qw(mapType); -use Parse::Pidl::Util qw(has_property is_constant); -use Parse::Pidl::NDR qw(GetNextLevel GetPrevLevel); -use Parse::Pidl::Samba::NDR::Parser; - -use vars qw($VERSION); -$VERSION = '0.01'; - -my($res); -my($tab_depth); - -sub pidl ($) -{ - $res .= shift; -} - -sub tabs() -{ - my $res = ""; - $res .="\t" foreach (1..$tab_depth); - return $res; -} - -##################################################################### -# prototype a typedef -sub HeaderTypedefProto($) -{ - my($d) = shift; - - my $tf = Parse::Pidl::Samba::NDR::Parser::get_typefamily($d->{DATA}{TYPE}); - - if (has_property($d, "gensize")) { - my $size_args = $tf->{SIZE_FN_ARGS}->($d); - pidl "size_t ndr_size_$d->{NAME}($size_args);\n"; - } - - return unless has_property($d, "public"); - - unless (has_property($d, "nopush")) { - pidl "NTSTATUS ndr_push_$d->{NAME}(struct ndr_push *ndr, int ndr_flags, " . $tf->{DECL}->($d, "push") . ");\n"; - } - unless (has_property($d, "nopull")) { - pidl "NTSTATUS ndr_pull_$d->{NAME}(struct ndr_pull *ndr, int ndr_flags, " . $tf->{DECL}->($d, "pull") . ");\n"; - } - unless (has_property($d, "noprint")) { - pidl "void ndr_print_$d->{NAME}(struct ndr_print *ndr, const char *name, " . $tf->{DECL}->($d, "print") . ");\n"; - } -} - -##################################################################### -# output prototypes for a IDL function -sub HeaderFnProto($$) -{ - my ($interface,$fn) = @_; - my $name = $fn->{NAME}; - - pidl "void ndr_print_$name(struct ndr_print *ndr, const char *name, int flags, const struct $name *r);\n"; - - unless (has_property($fn, "noopnum")) { - pidl "NTSTATUS dcerpc_$name(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *r);\n"; - pidl "struct rpc_request *dcerpc_$name\_send(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *r);\n"; - } - - return unless has_property($fn, "public"); - - pidl "NTSTATUS ndr_push_$name(struct ndr_push *ndr, int flags, const struct $name *r);\n"; - pidl "NTSTATUS ndr_pull_$name(struct ndr_pull *ndr, int flags, struct $name *r);\n"; - - pidl "\n"; -} - -##################################################################### -# parse the interface definitions -sub HeaderInterface($) -{ - my($interface) = shift; - - if (defined $interface->{PROPERTIES}->{depends}) { - my @d = split / /, $interface->{PROPERTIES}->{depends}; - foreach my $i (@d) { - pidl "#include \"librpc/gen_ndr/ndr_$i\.h\"\n"; - } - } - - my $count = 0; - - pidl "#ifndef _HEADER_NDR_$interface->{NAME}\n"; - pidl "#define _HEADER_NDR_$interface->{NAME}\n\n"; - - if (defined $interface->{PROPERTIES}->{uuid}) { - my $name = uc $interface->{NAME}; - pidl "#define DCERPC_$name\_UUID " . - Parse::Pidl::Util::make_str(lc($interface->{PROPERTIES}->{uuid})) . "\n"; - - if(!defined $interface->{PROPERTIES}->{version}) { $interface->{PROPERTIES}->{version} = "0.0"; } - pidl "#define DCERPC_$name\_VERSION $interface->{PROPERTIES}->{version}\n"; - - pidl "#define DCERPC_$name\_NAME \"$interface->{NAME}\"\n"; - - if(!defined $interface->{PROPERTIES}->{helpstring}) { $interface->{PROPERTIES}->{helpstring} = "NULL"; } - pidl "#define DCERPC_$name\_HELPSTRING $interface->{PROPERTIES}->{helpstring}\n"; - - pidl "\nextern const struct dcerpc_interface_table dcerpc_table_$interface->{NAME};\n"; - pidl "NTSTATUS dcerpc_server_$interface->{NAME}_init(void);\n\n"; - } - - foreach my $d (@{$interface->{DATA}}) { - next if $d->{TYPE} ne "FUNCTION"; - next if has_property($d, "noopnum"); - next if grep(/$d->{NAME}/,@{$interface->{INHERITED_FUNCTIONS}}); - my $u_name = uc $d->{NAME}; - pidl "#define DCERPC_$u_name ("; - - if (defined($interface->{BASE})) { - pidl "DCERPC_" . uc $interface->{BASE} . "_CALL_COUNT + "; - } - - pidl sprintf("0x%02x", $count) . ")\n"; - $count++; - } - - pidl "\n#define DCERPC_" . uc $interface->{NAME} . "_CALL_COUNT ("; - - if (defined($interface->{BASE})) { - pidl "DCERPC_" . uc $interface->{BASE} . "_CALL_COUNT + "; - } - - pidl "$count)\n\n"; - - foreach my $d (@{$interface->{DATA}}) { - next if ($d->{TYPE} ne "TYPEDEF"); - HeaderTypedefProto($d); - } - - foreach my $d (@{$interface->{DATA}}) { - next if ($d->{TYPE} ne "FUNCTION"); - HeaderFnProto($interface, $d); - } - - pidl "#endif /* _HEADER_NDR_$interface->{NAME} */\n"; -} - -##################################################################### -# parse a parsed IDL into a C header -sub Parse($$) -{ - my($idl,$basename) = @_; - $tab_depth = 0; - - $res = ""; - pidl "/* header auto-generated by pidl */\n"; - pidl "#include \"librpc/gen_ndr/$basename\.h\"\n\n"; - - foreach my $x (@{$idl}) { - ($x->{TYPE} eq "INTERFACE") && HeaderInterface($x); - } - return $res; -} - -1; diff --git a/tools/pidl/lib/Parse/Pidl/Samba3/Header.pm b/tools/pidl/lib/Parse/Pidl/Samba3/Header.pm index b49e64c337..fb02120a42 100644 --- a/tools/pidl/lib/Parse/Pidl/Samba3/Header.pm +++ b/tools/pidl/lib/Parse/Pidl/Samba3/Header.pm @@ -183,7 +183,7 @@ sub ParseInterface($) pidl ""; - foreach (@{$if->{TYPEDEFS}}) { + foreach (@{$if->{TYPES}}) { ParseStruct($if, $_->{DATA}, $_->{NAME}) if ($_->{DATA}->{TYPE} eq "STRUCT"); ParseEnum($if, $_->{DATA}, $_->{NAME}) if ($_->{DATA}->{TYPE} eq "ENUM"); ParseBitmap($if, $_->{DATA}, $_->{NAME}) if ($_->{DATA}->{TYPE} eq "BITMAP"); diff --git a/tools/pidl/lib/Parse/Pidl/Samba3/Parser.pm b/tools/pidl/lib/Parse/Pidl/Samba3/Parser.pm index 9ef8f09dc4..c12f7554e9 100644 --- a/tools/pidl/lib/Parse/Pidl/Samba3/Parser.pm +++ b/tools/pidl/lib/Parse/Pidl/Samba3/Parser.pm @@ -566,7 +566,7 @@ sub ParseInterface($) # Structures first pidl "/* $if->{NAME} structures */"; - foreach (@{$if->{TYPEDEFS}}) { + foreach (@{$if->{TYPES}}) { ParseStruct($if, $_->{DATA}, $_->{NAME}) if ($_->{DATA}->{TYPE} eq "STRUCT"); ParseUnion($if, $_->{DATA}, $_->{NAME}) if ($_->{DATA}->{TYPE} eq "UNION"); } diff --git a/tools/pidl/lib/Parse/Pidl/Samba3/Types.pm b/tools/pidl/lib/Parse/Pidl/Samba3/Types.pm index 3f7e8ae134..d1f1032714 100644 --- a/tools/pidl/lib/Parse/Pidl/Samba3/Types.pm +++ b/tools/pidl/lib/Parse/Pidl/Samba3/Types.pm @@ -350,7 +350,7 @@ sub LoadTypes($) foreach my $if (@{$ndr}) { next unless ($if->{TYPE} eq "INTERFACE"); - foreach my $td (@{$if->{TYPEDEFS}}) { + foreach my $td (@{$if->{TYPES}}) { my $decl = uc("$if->{NAME}_$td->{NAME}"); my $init = sub { diff --git a/tools/pidl/lib/Parse/Pidl/Samba/COM/Header.pm b/tools/pidl/lib/Parse/Pidl/Samba4/COM/Header.pm index 0289a688ba..b9044078ea 100644 --- a/tools/pidl/lib/Parse/Pidl/Samba/COM/Header.pm +++ b/tools/pidl/lib/Parse/Pidl/Samba4/COM/Header.pm @@ -1,7 +1,7 @@ # COM Header generation # (C) 2005 Jelmer Vernooij <jelmer@samba.org> -package Parse::Pidl::Samba::COM::Header; +package Parse::Pidl::Samba4::COM::Header; use Parse::Pidl::Typelist; use Parse::Pidl::Util qw(has_property); diff --git a/tools/pidl/lib/Parse/Pidl/Samba/COM/Proxy.pm b/tools/pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm index ab56d87492..26a1225590 100644 --- a/tools/pidl/lib/Parse/Pidl/Samba/COM/Proxy.pm +++ b/tools/pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm @@ -4,9 +4,9 @@ # Copyright jelmer@samba.org 2003-2005 # released under the GNU GPL -package Parse::Pidl::Samba::COM::Proxy; +package Parse::Pidl::Samba4::COM::Proxy; -use Parse::Pidl::Samba::COM::Header; +use Parse::Pidl::Samba4::COM::Header; use Parse::Pidl::Util qw(has_property); use vars qw($VERSION); @@ -89,7 +89,7 @@ sub ParseFunction($$) my $uname = uc $name; $res.=" -static $fn->{RETURN_TYPE} dcom_proxy_$interface->{NAME}_$name(struct $interface->{NAME} *d, TALLOC_CTX *mem_ctx" . Parse::Pidl::Samba::COM::Header::GetArgumentProtoList($fn) . ") +static $fn->{RETURN_TYPE} dcom_proxy_$interface->{NAME}_$name(struct $interface->{NAME} *d, TALLOC_CTX *mem_ctx" . Parse::Pidl::Samba4::COM::Header::GetArgumentProtoList($fn) . ") { struct dcerpc_pipe *p; NTSTATUS status = dcom_get_pipe(d, &p); diff --git a/tools/pidl/lib/Parse/Pidl/Samba/COM/Stub.pm b/tools/pidl/lib/Parse/Pidl/Samba4/COM/Stub.pm index 17b33a6872..150acbfde9 100644 --- a/tools/pidl/lib/Parse/Pidl/Samba/COM/Stub.pm +++ b/tools/pidl/lib/Parse/Pidl/Samba4/COM/Stub.pm @@ -5,7 +5,7 @@ # Copyright metze@samba.org 2004 # released under the GNU GPL -package Parse::Pidl::Samba::COM::Stub; +package Parse::Pidl::Samba4::COM::Stub; use Parse::Pidl::Util qw(has_property); use strict; diff --git a/tools/pidl/lib/Parse/Pidl/Samba/EJS.pm b/tools/pidl/lib/Parse/Pidl/Samba4/EJS.pm index 1e73696cc1..8c576c44f9 100644 --- a/tools/pidl/lib/Parse/Pidl/Samba/EJS.pm +++ b/tools/pidl/lib/Parse/Pidl/Samba4/EJS.pm @@ -4,7 +4,7 @@ # Copyright Andrew Tridgell 2005 # released under the GNU GPL -package Parse::Pidl::Samba::EJS; +package Parse::Pidl::Samba4::EJS; use strict; use Parse::Pidl::Typelist; @@ -706,7 +706,7 @@ sub EjsInterface($$) %constants = (); - foreach my $d (@{$interface->{TYPEDEFS}}) { + foreach my $d (@{$interface->{TYPES}}) { ($needed->{"push_$d->{NAME}"}) && EjsTypedefPush($d); ($needed->{"pull_$d->{NAME}"}) && EjsTypedefPull($d); } @@ -831,7 +831,7 @@ sub NeededInterface($$) foreach my $d (@{$interface->{FUNCTIONS}}) { NeededFunction($d, $needed); } - foreach my $d (reverse @{$interface->{TYPEDEFS}}) { + foreach my $d (reverse @{$interface->{TYPES}}) { NeededTypedef($d, $needed); } } diff --git a/tools/pidl/lib/Parse/Pidl/Samba/EJSHeader.pm b/tools/pidl/lib/Parse/Pidl/Samba4/EJSHeader.pm index fed717cad0..eae7ddce5f 100644 --- a/tools/pidl/lib/Parse/Pidl/Samba/EJSHeader.pm +++ b/tools/pidl/lib/Parse/Pidl/Samba4/EJSHeader.pm @@ -3,7 +3,7 @@ # Copyright tridge@samba.org 2005 # released under the GNU GPL -package Parse::Pidl::Samba::EJSHeader; +package Parse::Pidl::Samba4::EJSHeader; use strict; use Parse::Pidl::Typelist; @@ -54,9 +54,7 @@ sub HeaderInterface($) pidl "\n"; - foreach my $d (@{$interface->{TYPEDEFS}}) { - HeaderTypedefProto($d); - } + HeaderTypedefProto($_) foreach (@{$interface->{TYPES}}); pidl "\n"; pidl "#endif /* _HEADER_EJS_$interface->{NAME} */\n"; diff --git a/tools/pidl/lib/Parse/Pidl/Samba/Header.pm b/tools/pidl/lib/Parse/Pidl/Samba4/Header.pm index f235a96cb8..46caba731a 100644 --- a/tools/pidl/lib/Parse/Pidl/Samba/Header.pm +++ b/tools/pidl/lib/Parse/Pidl/Samba4/Header.pm @@ -4,7 +4,7 @@ # Copyright jelmer@samba.org 2005 # released under the GNU GPL -package Parse::Pidl::Samba::Header; +package Parse::Pidl::Samba4::Header; use strict; use Parse::Pidl::Typelist qw(mapType); @@ -17,10 +17,7 @@ $VERSION = '0.01'; my($res); my($tab_depth); -sub pidl ($) -{ - $res .= shift; -} +sub pidl($) { $res .= shift; } sub tabs() { @@ -261,7 +258,7 @@ sub HeaderFunctionInOut_needed($$) return undef; } -my %headerstructs = (); +my %headerstructs; ##################################################################### # parse a function @@ -313,8 +310,6 @@ sub HeaderInterface($) { my($interface) = shift; - my $count = 0; - pidl "#ifndef _HEADER_$interface->{NAME}\n"; pidl "#define _HEADER_$interface->{NAME}\n\n"; @@ -337,6 +332,7 @@ sub HeaderInterface($) foreach my $d (@{$interface->{DATA}}) { next if ($d->{TYPE} ne "FUNCTION"); + HeaderFunction($d); } @@ -351,9 +347,10 @@ sub Parse($) $tab_depth = 0; $res = ""; + %headerstructs = (); pidl "/* header auto-generated by pidl */\n\n"; - foreach my $x (@{$idl}) { - ($x->{TYPE} eq "INTERFACE") && HeaderInterface($x); + foreach (@{$idl}) { + ($_->{TYPE} eq "INTERFACE") && HeaderInterface($_); } return $res; } diff --git a/tools/pidl/lib/Parse/Pidl/Samba/NDR/Client.pm b/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm index 3ec19fa158..83f9034c7c 100644 --- a/tools/pidl/lib/Parse/Pidl/Samba/NDR/Client.pm +++ b/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm @@ -3,7 +3,7 @@ # Copyright tridge@samba.org 2003 # released under the GNU GPL -package Parse::Pidl::Samba::NDR::Client; +package Parse::Pidl::Samba4::NDR::Client; use vars qw($VERSION); $VERSION = '0.01'; diff --git a/tools/pidl/lib/Parse/Pidl/Samba/NDR/Parser.pm b/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm index 84f3091586..bb9d32487a 100644 --- a/tools/pidl/lib/Parse/Pidl/Samba/NDR/Parser.pm +++ b/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm @@ -5,7 +5,7 @@ # Copyright jelmer@samba.org 2004-2005 # released under the GNU GPL -package Parse::Pidl::Samba::NDR::Parser; +package Parse::Pidl::Samba4::NDR::Parser; use strict; use Parse::Pidl::Typelist qw(hasType getType mapType); @@ -101,7 +101,7 @@ sub get_value_of($) } } -my $res = ""; +my $res; my $deferred = ""; my $tabs = ""; @@ -117,6 +117,10 @@ sub pidl($) $res .="\n"; } +my $res_hdr; + +sub pidl_hdr ($) { my $d = shift; $res_hdr .= "$d\n"; } + #################################### # defer() is like pidl(), but adds to # a deferred buffer which is then added to the @@ -188,13 +192,17 @@ sub check_null_pointer_void($) } ##################################################################### -# work out is a parse function should be declared static or not -sub fn_prefix($) +# declare a function public or static, depending on its attributes +sub fn_declare($$) { - my $fn = shift; + my ($fn,$decl) = @_; - return "" if (has_property($fn, "public")); - return "static "; + if (has_property($fn, "public")) { + pidl_hdr "$decl;"; + pidl "$decl"; + } else { + pidl "static $decl"; + } } ################################################################### @@ -1821,7 +1829,7 @@ sub ParseTypedefPush($) my($e) = shift; my $args = $typefamily{$e->{DATA}->{TYPE}}->{DECL}->($e,"push"); - pidl fn_prefix($e) . "NTSTATUS ndr_push_$e->{NAME}(struct ndr_push *ndr, int ndr_flags, $args)"; + fn_declare($e, "NTSTATUS ndr_push_$e->{NAME}(struct ndr_push *ndr, int ndr_flags, $args)"); pidl "{"; indent; @@ -1840,7 +1848,7 @@ sub ParseTypedefPull($) my $args = $typefamily{$e->{DATA}->{TYPE}}->{DECL}->($e,"pull"); - pidl fn_prefix($e) . "NTSTATUS ndr_pull_$e->{NAME}(struct ndr_pull *ndr, int ndr_flags, $args)"; + fn_declare($e, "NTSTATUS ndr_pull_$e->{NAME}(struct ndr_pull *ndr, int ndr_flags, $args)"); pidl "{"; indent; @@ -1860,6 +1868,7 @@ sub ParseTypedefPrint($) my $args = $typefamily{$e->{DATA}->{TYPE}}->{DECL}->($e,"print"); pidl "void ndr_print_$e->{NAME}(struct ndr_print *ndr, const char *name, $args)"; + pidl_hdr "void ndr_print_$e->{NAME}(struct ndr_print *ndr, const char *name, $args);"; pidl "{"; indent; $typefamily{$e->{DATA}->{TYPE}}->{PRINT_FN_BODY}->($e->{DATA}, $e->{NAME}); @@ -1877,7 +1886,8 @@ sub ParseTypedefNdrSize($) my $tf = $typefamily{$t->{DATA}->{TYPE}}; my $args = $tf->{SIZE_FN_ARGS}->($t); - pidl "size_t ndr_size_$t->{NAME}($args)"; + fn_declare($t, "size_t ndr_size_$t->{NAME}($args)"); + pidl "{"; indent; $typefamily{$t->{DATA}->{TYPE}}->{SIZE_FN_BODY}->($t); @@ -1895,6 +1905,7 @@ sub ParseFunctionPrint($) return if has_property($fn, "noprint"); pidl "void ndr_print_$fn->{NAME}(struct ndr_print *ndr, const char *name, int flags, const struct $fn->{NAME} *r)"; + pidl_hdr "void ndr_print_$fn->{NAME}(struct ndr_print *ndr, const char *name, int flags, const struct $fn->{NAME} *r);"; pidl "{"; indent; @@ -1958,7 +1969,8 @@ sub ParseFunctionPush($) return if has_property($fn, "nopush"); - pidl fn_prefix($fn) . "NTSTATUS ndr_push_$fn->{NAME}(struct ndr_push *ndr, int flags, const struct $fn->{NAME} *r)"; + fn_declare($fn, "NTSTATUS ndr_push_$fn->{NAME}(struct ndr_push *ndr, int flags, const struct $fn->{NAME} *r)"); + pidl "{"; indent; @@ -2038,7 +2050,7 @@ sub ParseFunctionPull($) return if has_property($fn, "nopull"); # pull function args - pidl fn_prefix($fn) . "NTSTATUS ndr_pull_$fn->{NAME}(struct ndr_pull *ndr, int flags, struct $fn->{NAME} *r)"; + fn_declare($fn, "NTSTATUS ndr_pull_$fn->{NAME}(struct ndr_pull *ndr, int flags, struct $fn->{NAME} *r)"); pidl "{"; indent; @@ -2149,6 +2161,7 @@ sub FunctionTable($) $count = $#{$interface->{FUNCTIONS}}+1; return if ($count == 0); + return unless defined ($interface->{PROPERTIES}->{uuid}); pidl "static const struct dcerpc_interface_call $interface->{NAME}\_calls[] = {"; $count = 0; @@ -2223,13 +2236,84 @@ sub FunctionTable($) } ##################################################################### +# generate prototypes and defines for the interface definitions +# FIXME: these prototypes are for the DCE/RPC client functions, not the +# NDR parser and so do not belong here, technically speaking +sub HeaderInterface($) +{ + my($interface) = shift; + + my $count = 0; + + pidl_hdr "#ifndef _HEADER_RPC_$interface->{NAME}"; + pidl_hdr "#define _HEADER_RPC_$interface->{NAME}"; + + pidl_hdr ""; + + if (defined $interface->{PROPERTIES}->{depends}) { + my @d = split / /, $interface->{PROPERTIES}->{depends}; + foreach my $i (@d) { + pidl_hdr "#include \"librpc/gen_ndr/ndr_$i\.h\""; + } + } + + if (defined $interface->{PROPERTIES}->{uuid}) { + my $name = uc $interface->{NAME}; + pidl_hdr "#define DCERPC_$name\_UUID " . + Parse::Pidl::Util::make_str(lc($interface->{PROPERTIES}->{uuid})); + + if(!defined $interface->{PROPERTIES}->{version}) { $interface->{PROPERTIES}->{version} = "0.0"; } + pidl_hdr "#define DCERPC_$name\_VERSION $interface->{PROPERTIES}->{version}"; + + pidl_hdr "#define DCERPC_$name\_NAME \"$interface->{NAME}\""; + + if(!defined $interface->{PROPERTIES}->{helpstring}) { $interface->{PROPERTIES}->{helpstring} = "NULL"; } + pidl_hdr "#define DCERPC_$name\_HELPSTRING $interface->{PROPERTIES}->{helpstring}"; + + pidl_hdr "extern const struct dcerpc_interface_table dcerpc_table_$interface->{NAME};"; + pidl_hdr "NTSTATUS dcerpc_server_$interface->{NAME}_init(void);"; + } + + foreach (@{$interface->{FUNCTIONS}}) { + next if has_property($_, "noopnum"); + next if grep(/$_->{NAME}/,@{$interface->{INHERITED_FUNCTIONS}}); + my $u_name = uc $_->{NAME}; + + my $val = sprintf("0x%02x", $count); + if (defined($interface->{BASE})) { + $val .= " + DCERPC_" . uc $interface->{BASE} . "_CALL_COUNT"; + } + + pidl_hdr "#define DCERPC_$u_name ($val)"; + + pidl_hdr "NTSTATUS dcerpc_$_->{NAME}(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $_->{NAME} *r);"; + pidl_hdr "struct rpc_request *dcerpc_$_->{NAME}\_send(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $_->{NAME} *r);"; + + pidl_hdr ""; + $count++; + } + + my $val = $count; + + if (defined($interface->{BASE})) { + $val .= " + DCERPC_" . uc $interface->{BASE} . "_CALL_COUNT"; + } + + pidl_hdr "#define DCERPC_" . uc $interface->{NAME} . "_CALL_COUNT ($val)"; + + pidl_hdr "#endif /* _HEADER_RPC_$interface->{NAME} */"; +} + +##################################################################### # parse the interface definitions sub ParseInterface($$) { my($interface,$needed) = @_; + HeaderInterface($interface); + # Typedefs - foreach my $d (@{$interface->{TYPEDEFS}}) { + foreach my $d (@{$interface->{TYPES}}) { ($needed->{"push_$d->{NAME}"}) && ParseTypedefPush($d); ($needed->{"pull_$d->{NAME}"}) && ParseTypedefPull($d); ($needed->{"print_$d->{NAME}"}) && ParseTypedefPrint($d); @@ -2257,10 +2341,8 @@ sub ParseInterface($$) sub RegistrationFunction($$) { - my ($idl,$filename) = @_; + my ($idl,$basename) = @_; - $filename =~ /.*\/ndr_(.*).c/; - my $basename = $1; pidl "NTSTATUS dcerpc_$basename\_init(void)"; pidl "{"; indent; @@ -2271,6 +2353,7 @@ sub RegistrationFunction($$) my $count = ($#{$interface->{FUNCTIONS}}+1); next if ($count == 0); + next unless defined ($interface->{PROPERTIES}->{uuid}); pidl "status = dcerpc_ndr_$interface->{NAME}_init();"; pidl "if (NT_STATUS_IS_ERR(status)) {"; @@ -2288,37 +2371,31 @@ sub RegistrationFunction($$) # parse a parsed IDL structure back into an IDL file sub Parse($$) { - my($ndr,$filename) = @_; + my($ndr,$basename) = @_; $tabs = ""; - my $h_filename = $filename; $res = ""; - if ($h_filename =~ /(.*)\.c/) { - $h_filename = "$1.h"; - } + $res_hdr = ""; + pidl_hdr "/* header auto-generated by pidl */"; + pidl_hdr ""; pidl "/* parser auto-generated by pidl */"; pidl ""; - pidl "#include \"includes.h\""; - pidl "#include \"librpc/gen_ndr/ndr_misc.h\""; - pidl "#include \"librpc/gen_ndr/ndr_dcerpc.h\""; - pidl "#include \"$h_filename\""; - pidl ""; my %needed = (); - foreach my $x (@{$ndr}) { - ($x->{TYPE} eq "INTERFACE") && NeededInterface($x, \%needed); + foreach (@{$ndr}) { + ($_->{TYPE} eq "INTERFACE") && NeededInterface($_, \%needed); } - foreach my $x (@{$ndr}) { - ($x->{TYPE} eq "INTERFACE") && ParseInterface($x, \%needed); + foreach (@{$ndr}) { + ($_->{TYPE} eq "INTERFACE") && ParseInterface($_, \%needed); } - RegistrationFunction($ndr, $filename); + RegistrationFunction($ndr, $basename); - return $res; + return ($res_hdr, $res); } sub NeededFunction($$) @@ -2378,12 +2455,9 @@ sub NeededTypedef($$) sub NeededInterface($$) { my ($interface,$needed) = @_; - foreach my $d (@{$interface->{FUNCTIONS}}) { - NeededFunction($d, $needed); - } - foreach my $d (reverse @{$interface->{TYPEDEFS}}) { - NeededTypedef($d, $needed); - } + NeededFunction($_, $needed) foreach (@{$interface->{FUNCTIONS}}); + NeededTypedef($_, $needed) foreach (reverse @{$interface->{TYPES}}); } 1; + diff --git a/tools/pidl/lib/Parse/Pidl/Samba/NDR/Server.pm b/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm index 1ee497e206..585209b733 100644 --- a/tools/pidl/lib/Parse/Pidl/Samba/NDR/Server.pm +++ b/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm @@ -4,7 +4,7 @@ # Copyright metze@samba.org 2004 # released under the GNU GPL -package Parse::Pidl::Samba::NDR::Server; +package Parse::Pidl::Samba4::NDR::Server; use strict; diff --git a/tools/pidl/lib/Parse/Pidl/Samba/SWIG.pm b/tools/pidl/lib/Parse/Pidl/Samba4/SWIG.pm index 471c3e9927..b6c268edeb 100644 --- a/tools/pidl/lib/Parse/Pidl/Samba/SWIG.pm +++ b/tools/pidl/lib/Parse/Pidl/Samba4/SWIG.pm @@ -3,7 +3,7 @@ # Copyright tpot@samba.org 2004,2005 # released under the GNU GPL -package Parse::Pidl::Samba::SWIG; +package Parse::Pidl::Samba4::SWIG; use vars qw($VERSION); $VERSION = '0.01'; diff --git a/tools/pidl/lib/Parse/Pidl/Samba/TDR.pm b/tools/pidl/lib/Parse/Pidl/Samba4/TDR.pm index 5d3d236e43..789fb7adbe 100644 --- a/tools/pidl/lib/Parse/Pidl/Samba/TDR.pm +++ b/tools/pidl/lib/Parse/Pidl/Samba4/TDR.pm @@ -3,7 +3,7 @@ # Copyright jelmer@samba.org 2005 # released under the GNU GPL -package Parse::Pidl::Samba::TDR; +package Parse::Pidl::Samba4::TDR; use Parse::Pidl::Util qw(has_property ParseExpr is_constant); use vars qw($VERSION); @@ -11,14 +11,15 @@ $VERSION = '0.01'; use strict; -my $ret = ""; +my $ret; +my $ret_hdr; my $tabs = ""; sub indent() { $tabs.="\t"; } sub deindent() { $tabs = substr($tabs, 1); } sub pidl($) { $ret .= $tabs.(shift)."\n"; } +sub pidl_hdr($) { $ret_hdr .= (shift)."\n"; } sub fatal($$) { my ($e,$s) = @_; die("$e->{FILE}:$e->{LINE}: $s\n"); } -sub static($) { my $p = shift; return("static ") unless ($p); return ""; } sub typearg($) { my $t = shift; return(", const char *name") if ($t eq "print"); @@ -26,6 +27,12 @@ sub typearg($) { return(""); } +sub fn_declare($$) +{ + my ($p, $d) = @_; + if ($p) { pidl $d; pidl_hdr "$d;"; } else { pidl "static $d"; } +} + sub ContainsArray($) { my $e = shift; @@ -111,7 +118,7 @@ sub ParserStruct($$$$) { my ($e,$n,$t,$p) = @_; - pidl static($p)."NTSTATUS tdr_$t\_$n (struct tdr_$t *tdr".typearg($t).", struct $n *v)"; + fn_declare($p,,"NTSTATUS tdr_$t\_$n (struct tdr_$t *tdr".typearg($t).", struct $n *v)"); pidl "{"; indent; pidl "int i;" if (ContainsArray($e)); @@ -137,7 +144,7 @@ sub ParserUnion($$$$) { my ($e,$n,$t,$p) = @_; - pidl static($p)."NTSTATUS tdr_$t\_$n(struct tdr_$t *tdr".typearg($t).", int level, union $n *v)"; + fn_declare($p,"NTSTATUS tdr_$t\_$n(struct tdr_$t *tdr".typearg($t).", int level, union $n *v)"); pidl "{"; indent; pidl "int i;" if (ContainsArray($e)); @@ -178,7 +185,7 @@ sub ParserEnum($$$$) my ($e,$n,$t,$p) = @_; my $bt = ($e->{PROPERTIES}->{base_type} or "uint8"); - pidl static($p)."NTSTATUS tdr_$t\_$n (struct tdr_$t *tdr".typearg($t).", enum $n *v)"; + fn_declare($p, "NTSTATUS tdr_$t\_$n (struct tdr_$t *tdr".typearg($t).", enum $n *v)"); pidl "{"; if ($t eq "pull") { pidl "\t$bt\_t r;"; @@ -211,6 +218,9 @@ sub ParserTypedef($$) sub ParserInterface($) { my $x = shift; + + pidl_hdr "#ifndef __TDR_$x->{NAME}_HEADER__"; + pidl_hdr "#define __TDR_$x->{NAME}_HEADER__"; foreach (@{$x->{DATA}}) { next if ($_->{TYPE} ne "TYPEDEF"); @@ -218,63 +228,24 @@ sub ParserInterface($) ParserTypedef($_, "push"); ParserTypedef($_, "print"); } + + pidl_hdr "#endif /* __TDR_$x->{NAME}_HEADER__ */"; } -sub Parser($$) +sub Parser($$$) { - my ($idl,$hdrname) = @_; - $ret = ""; + my ($idl,$hdrname,$baseheader) = @_; + $ret = ""; $ret_hdr = ""; pidl "/* autogenerated by pidl */"; pidl "#include \"includes.h\""; pidl "#include \"$hdrname\""; pidl ""; - foreach (@$idl) { ParserInterface($_) if ($_->{TYPE} eq "INTERFACE"); } - return $ret; -} - -sub HeaderInterface($$) -{ - my ($x,$outputdir) = @_; - - pidl "#ifndef __TDR_$x->{NAME}_HEADER__"; - pidl "#define __TDR_$x->{NAME}_HEADER__"; - - foreach my $e (@{$x->{DATA}}) { - next unless ($e->{TYPE} eq "TYPEDEF"); - next unless has_property($e, "public"); - - my $switch = ""; + pidl_hdr "/* autogenerated by pidl */"; + pidl_hdr "#include \"$baseheader\""; + pidl_hdr ""; - $switch = ", int level" if ($e->{DATA}->{TYPE} eq "UNION"); - - if ($e->{DATA}->{TYPE} eq "BITMAP") { - # FIXME - } else { - my ($n, $d) = ($e->{NAME}, lc($e->{DATA}->{TYPE})); - pidl "NTSTATUS tdr_pull\_$n(struct tdr_pull *tdr, TALLOC_CTX *ctx$switch, $d $n *v);"; - pidl "NTSTATUS tdr_print\_$n(struct tdr_print *tdr, const char *name$switch, $d $n *v);"; - pidl "NTSTATUS tdr_push\_$n(struct tdr_push *tdr$switch, $d $n *v);"; - } - - pidl ""; - } - - pidl "#endif /* __TDR_$x->{NAME}_HEADER__ */"; -} - -sub Header($$$) -{ - my ($idl,$outputdir,$basename) = @_; - $ret = ""; - pidl "/* Generated by pidl */"; - - pidl "#include \"$outputdir/$basename.h\""; - pidl ""; - - foreach (@$idl) { - HeaderInterface($_, $outputdir) if ($_->{TYPE} eq "INTERFACE"); - } - return $ret; + foreach (@$idl) { ParserInterface($_) if ($_->{TYPE} eq "INTERFACE"); } + return ($ret_hdr, $ret); } 1; diff --git a/tools/pidl/lib/Parse/Pidl/Samba/Template.pm b/tools/pidl/lib/Parse/Pidl/Samba4/Template.pm index 52bc2b2d3d..111ae28123 100644 --- a/tools/pidl/lib/Parse/Pidl/Samba/Template.pm +++ b/tools/pidl/lib/Parse/Pidl/Samba4/Template.pm @@ -3,7 +3,7 @@ # Copyright tridge@samba.org 2003 # released under the GNU GPL -package Parse::Pidl::Samba::Template; +package Parse::Pidl::Samba4::Template; use vars qw($VERSION); $VERSION = '0.01'; diff --git a/tools/pidl/lib/Parse/Pidl/Test.pm b/tools/pidl/lib/Parse/Pidl/Test.pm deleted file mode 100644 index 66f5c73595..0000000000 --- a/tools/pidl/lib/Parse/Pidl/Test.pm +++ /dev/null @@ -1,171 +0,0 @@ -# Simple system for running tests against pidl -# (C) 2005 Jelmer Vernooij <jelmer@samba.org> -# Published under the GNU General Public License - -package Parse::Pidl::Test; - -use strict; -use Parse::Pidl::Util; -use Getopt::Long; - -use vars qw($VERSION); -$VERSION = '0.01'; -my $cc = $ENV{CC}; -my @cflags = split / /, $ENV{CFLAGS}; -my @ldflags = split / /, $ENV{LDFLAGS}; - -$cc = "cc" if ($cc eq ""); - -sub generate_cfile($$$) -{ - my ($filename, $fragment, $incfiles) = @_; - - unless (open (OUT, ">$filename")) { - print STDERR "Unable to open $filename\n"; - return -1; - } - print OUT ' -/* This file was autogenerated. All changes made will be lost! */ -#include "include/includes.h" -'; - - foreach (@$incfiles) { - print OUT "#include \"$_\"\n"; - } - - print OUT ' -int main(int argc, char **argv) -{ - TALLOC_CTX *mem_ctx = talloc_init(NULL); - '; - print OUT $fragment; - print OUT "\treturn 0;\n}\n"; - close OUT; - - return 0; -} - -sub generate_idlfile($$) -{ - my ($filename,$fragment) = @_; - - unless (open(OUT, ">$filename")) { - print STDERR "Unable to open $filename\n"; - return -1; - } - - print OUT ' -[uuid("1-2-3-4-5")] interface test_if -{ -'; - print OUT $fragment; - print OUT "\n}\n"; - close OUT; - - return 0; -} - -sub compile_idl($$$) -{ - my ($filename,$idl_path, $idlargs) = @_; - - my @args = @$idlargs; - push (@args, $filename); - - unless (system($idl_path, @args) == 0) { - print STDERR "Error compiling IDL file $filename: $!\n"; - return -1; - } -} - -sub compile_cfile($) -{ - my ($filename) = @_; - - return system($cc, @cflags, '-I.', '-Iinclude', '-c', $filename); -} - -sub link_files($$) -{ - my ($exe_name,$objs) = @_; - - return system($cc, @ldflags, '-Lbin', '-lrpc', '-o', $exe_name, @$objs); -} - -sub test_idl($$$$) -{ - my ($name,$settings,$idl,$c) = @_; - - $| = 1; - - print "Running $name... "; - - my $outputdir = $settings->{OutputDir}; - - my $c_filename = $outputdir."/".$name."_test.c"; - my $idl_filename = $outputdir."/".$name."_idl.idl"; - my $exe_filename = $outputdir."/".$name."_exe"; - - return -1 if (generate_cfile($c_filename, $c, $settings->{IncludeFiles}) == -1); - - return -1 if (generate_idlfile($idl_filename, $idl) == -1); - - return -1 if (compile_idl($idl_filename, $settings->{'IDL-Compiler'}, $settings->{'IDL-Arguments'}) == -1); - - my @srcs = ($c_filename); - push (@srcs, @{$settings->{'ExtraFiles'}}); - - foreach (@srcs) { - next unless /\.c$/; - return -1 if (compile_cfile($_) == -1); - } - - my @objs; - foreach (@srcs) { - if (/\.c$/) { s/\.c$/\.o/g; } - push(@objs, $_); - } - - return -1 if (link_files($exe_filename, \@objs) == -1); - - my $ret = system("./$exe_filename"); - if ($ret != 0) { - $ret = $? >> 8; - print "failed with return value $ret\n"; - return $ret; - } - - unless ($settings->{Keep}) { - unlink(@srcs, @objs, $exe_filename, $idl_filename); - } - - print "Ok\n"; - - return $ret; -} - -sub GetSettings($) -{ - my $settings = { - OutputDir => ".", - 'IDL-Compiler' => "./pidl" - }; - - my %opts = (); - GetOptions('idl-compiler=s' => \$settings->{'IDL-Compiler'}, - 'outputdir=s' => \$settings->{OutputDir}, - 'keep' => \$settings->{Keep}, - 'help' => sub { ShowHelp(); exit 1; } ); - - return %$settings; -} - -sub ShowHelp() -{ - print " --idl-compiler=PATH-TO-PIDL Override path to IDL compiler\n"; - print " --outputdir=OUTPUTDIR Write temporary files to OUTPUTDIR rather then .\n"; - print " --keep Keep intermediate files after running test"; - print " --help Show this help message\n"; -} - -1; diff --git a/tools/pidl/lib/Parse/Pidl/Util.pm b/tools/pidl/lib/Parse/Pidl/Util.pm index fec1301a59..ec6a1420ab 100644 --- a/tools/pidl/lib/Parse/Pidl/Util.pm +++ b/tools/pidl/lib/Parse/Pidl/Util.pm @@ -13,48 +13,6 @@ $VERSION = '0.01'; use strict; ##################################################################### -# flatten an array of arrays into a single array -sub FlattenArray2($) -{ - my $a = shift; - my @b; - for my $d (@{$a}) { - for my $d1 (@{$d}) { - push(@b, $d1); - } - } - return \@b; -} - -##################################################################### -# flatten an array of arrays into a single array -sub FlattenArray($) -{ - my $a = shift; - my @b; - for my $d (@{$a}) { - for my $d1 (@{$d}) { - push(@b, $d1); - } - } - return \@b; -} - -##################################################################### -# flatten an array of hashes into a single hash -sub FlattenHash($) -{ - my $a = shift; - my %b; - for my $d (@{$a}) { - for my $k (keys %{$d}) { - $b{$k} = $d->{$k}; - } - } - return \%b; -} - -##################################################################### # a dumper wrapper to prevent dependence on the Data::Dumper module # unless we actually need it sub MyDumper($) |