diff options
23 files changed, 1862 insertions, 1639 deletions
diff --git a/tools/pidl/idl.yp b/tools/pidl/idl.yp index 9e63a5846a..c372569a75 100644 --- a/tools/pidl/idl.yp +++ b/tools/pidl/idl.yp @@ -21,6 +21,7 @@ idl: | idl import { push(@{$_[1]}, $_[2]); $_[1] } | idl include { push(@{$_[1]}, $_[2]); $_[1] } | idl importlib { push(@{$_[1]}, $_[2]); $_[1] } + | idl cpp_quote { push(@{$_[1]}, $_[2]); $_[1] } ; import: 'import' commalist ';' {{ @@ -77,6 +78,15 @@ interface: property_list 'interface' identifier '{' definitions '}' optional_sem }} ; +cpp_quote: 'cpp_quote' '(' text ')' + {{ + "TYPE" => "CPP_QUOTE", + "FILE" => $_[0]->YYData->{FILE}, + "LINE" => $_[0]->YYData->{LINE}, + "DATA" => $_[3] + }} +; + definitions: definition { [ $_[1] ] } | definitions definition { push(@{$_[1]}, $_[2]); $_[1] } @@ -466,7 +476,7 @@ again: if (s/^([\w_]+)//) { $parser->YYData->{LAST_TOKEN} = $1; if ($1 =~ - /^(coclass|interface|const|typedef|declare|union + /^(coclass|interface|const|typedef|declare|union|cpp_quote |struct|enum|bitmap|void|unsigned|signed|import|include |importlib)$/x) { return $1; diff --git a/tools/pidl/lib/Parse/Pidl/IDL.pm b/tools/pidl/lib/Parse/Pidl/IDL.pm index d1bde8483d..e9155e4e00 100644 --- a/tools/pidl/lib/Parse/Pidl/IDL.pm +++ b/tools/pidl/lib/Parse/Pidl/IDL.pm @@ -33,18 +33,20 @@ sub new { {#State 1 ACTIONS => { '' => 2, - "importlib" => 3, - "import" => 6, - "include" => 11 + "cpp_quote" => 3, + "importlib" => 4, + "import" => 7, + "include" => 13 }, - DEFAULT => -89, + DEFAULT => -91, GOTOS => { - 'importlib' => 9, - 'interface' => 8, - 'include' => 4, - 'coclass' => 10, - 'import' => 7, - 'property_list' => 5 + 'cpp_quote' => 11, + 'importlib' => 10, + 'interface' => 9, + 'include' => 5, + 'coclass' => 12, + 'import' => 8, + 'property_list' => 6 } }, {#State 2 @@ -52,1718 +54,1742 @@ sub new { }, {#State 3 ACTIONS => { - 'TEXT' => 13 + "(" => 14 + } + }, + {#State 4 + ACTIONS => { + 'TEXT' => 16 }, GOTOS => { - 'commalist' => 12, - 'text' => 14 + 'commalist' => 15, + 'text' => 17 } }, - {#State 4 + {#State 5 DEFAULT => -5 }, - {#State 5 + {#State 6 ACTIONS => { - "coclass" => 15, - "[" => 17, - "interface" => 16 + "coclass" => 18, + "[" => 20, + "interface" => 19 } }, - {#State 6 + {#State 7 ACTIONS => { - 'TEXT' => 13 + 'TEXT' => 16 }, GOTOS => { - 'commalist' => 18, - 'text' => 14 + 'commalist' => 21, + 'text' => 17 } }, - {#State 7 - DEFAULT => -4 - }, {#State 8 - DEFAULT => -2 + DEFAULT => -4 }, {#State 9 - DEFAULT => -6 + DEFAULT => -2 }, {#State 10 - DEFAULT => -3 + DEFAULT => -6 }, {#State 11 - ACTIONS => { - 'TEXT' => 13 - }, - GOTOS => { - 'commalist' => 19, - 'text' => 14 - } + DEFAULT => -7 }, {#State 12 - ACTIONS => { - ";" => 20, - "," => 21 - } + DEFAULT => -3 }, {#State 13 - DEFAULT => -122 - }, - {#State 14 - DEFAULT => -10 - }, - {#State 15 ACTIONS => { - 'IDENTIFIER' => 22 + 'TEXT' => 16 }, GOTOS => { - 'identifier' => 23 + 'commalist' => 22, + 'text' => 17 } }, - {#State 16 + {#State 14 ACTIONS => { - 'IDENTIFIER' => 22 + 'TEXT' => 16 }, GOTOS => { - 'identifier' => 24 + 'text' => 23 } }, - {#State 17 + {#State 15 ACTIONS => { - 'IDENTIFIER' => 22 - }, - GOTOS => { - 'identifier' => 26, - 'property' => 27, - 'properties' => 25 + ";" => 24, + "," => 25 } }, + {#State 16 + DEFAULT => -124 + }, + {#State 17 + DEFAULT => -11 + }, {#State 18 ACTIONS => { - ";" => 28, - "," => 21 + 'IDENTIFIER' => 26 + }, + GOTOS => { + 'identifier' => 27 } }, {#State 19 ACTIONS => { - ";" => 29, - "," => 21 + 'IDENTIFIER' => 26 + }, + GOTOS => { + 'identifier' => 28 } }, {#State 20 - DEFAULT => -9 - }, - {#State 21 ACTIONS => { - 'TEXT' => 13 + 'IDENTIFIER' => 26 }, GOTOS => { - 'text' => 30 + 'identifier' => 30, + 'property' => 31, + 'properties' => 29 + } + }, + {#State 21 + ACTIONS => { + ";" => 32, + "," => 25 } }, {#State 22 - DEFAULT => -118 + ACTIONS => { + ";" => 33, + "," => 25 + } }, {#State 23 ACTIONS => { - "{" => 31 + ")" => 34 } }, {#State 24 - ACTIONS => { - "{" => 32 - } + DEFAULT => -10 }, {#State 25 ACTIONS => { - "," => 33, - "]" => 34 + 'TEXT' => 16 + }, + GOTOS => { + 'text' => 35 } }, {#State 26 - ACTIONS => { - "(" => 35 - }, - DEFAULT => -93 + DEFAULT => -120 }, {#State 27 - DEFAULT => -91 + ACTIONS => { + "{" => 36 + } }, {#State 28 - DEFAULT => -7 + ACTIONS => { + "{" => 37 + } }, {#State 29 - DEFAULT => -8 + ACTIONS => { + "," => 38, + "]" => 39 + } }, {#State 30 - DEFAULT => -11 + ACTIONS => { + "(" => 40 + }, + DEFAULT => -95 }, {#State 31 - DEFAULT => -13, - GOTOS => { - 'interface_names' => 36 - } + DEFAULT => -93 }, {#State 32 - ACTIONS => { - "declare" => 44, - "const" => 48 - }, - DEFAULT => -89, - GOTOS => { - '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 - } + DEFAULT => -8 }, {#State 33 - ACTIONS => { - 'IDENTIFIER' => 22 - }, - GOTOS => { - 'identifier' => 26, - 'property' => 52 - } + DEFAULT => -9 }, {#State 34 - DEFAULT => -90 + DEFAULT => -17 }, {#State 35 - ACTIONS => { - 'CONSTANT' => 56, - 'TEXT' => 13, - 'IDENTIFIER' => 22 - }, - DEFAULT => -99, - GOTOS => { - 'identifier' => 57, - 'text' => 58, - 'listtext' => 54, - 'anytext' => 53, - 'constant' => 55 - } + DEFAULT => -12 }, {#State 36 - ACTIONS => { - "}" => 59, - "interface" => 60 + DEFAULT => -14, + GOTOS => { + 'interface_names' => 41 } }, {#State 37 - DEFAULT => -22 + ACTIONS => { + "declare" => 49, + "const" => 53 + }, + DEFAULT => -91, + GOTOS => { + 'typedecl' => 42, + 'function' => 43, + 'definitions' => 45, + 'bitmap' => 44, + 'definition' => 48, + 'property_list' => 47, + 'usertype' => 46, + 'const' => 52, + 'declare' => 51, + 'struct' => 50, + 'typedef' => 55, + 'enum' => 54, + 'union' => 56 + } }, {#State 38 - DEFAULT => -18 + ACTIONS => { + 'IDENTIFIER' => 26 + }, + GOTOS => { + 'identifier' => 30, + 'property' => 57 + } }, {#State 39 - DEFAULT => -37 + DEFAULT => -92 }, {#State 40 ACTIONS => { - "}" => 61, - "declare" => 44, - "const" => 48 + 'CONSTANT' => 61, + 'TEXT' => 16, + 'IDENTIFIER' => 26 }, - DEFAULT => -89, + DEFAULT => -101, GOTOS => { - '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 + 'identifier' => 62, + 'text' => 63, + 'listtext' => 59, + 'anytext' => 58, + 'constant' => 60 } }, {#State 41 ACTIONS => { - ";" => 63 + "}" => 64, + "interface" => 65 } }, {#State 42 - ACTIONS => { - "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 - } + DEFAULT => -24 }, {#State 43 - DEFAULT => -16 + DEFAULT => -20 }, {#State 44 - DEFAULT => -89, - GOTOS => { - 'decl_enum' => 79, - 'decl_bitmap' => 80, - 'decl_type' => 82, - 'decl_union' => 81, - 'property_list' => 78 - } + DEFAULT => -39 }, {#State 45 - DEFAULT => -34 + ACTIONS => { + "}" => 66, + "declare" => 49, + "const" => 53 + }, + DEFAULT => -91, + GOTOS => { + 'typedecl' => 42, + 'function' => 43, + 'bitmap' => 44, + 'definition' => 67, + 'property_list' => 47, + 'usertype' => 46, + 'const' => 52, + 'struct' => 50, + 'declare' => 51, + 'typedef' => 55, + 'enum' => 54, + 'union' => 56 + } }, {#State 46 - DEFAULT => -21 + ACTIONS => { + ";" => 68 + } }, {#State 47 - DEFAULT => -19 - }, - {#State 48 ACTIONS => { - 'IDENTIFIER' => 22 - }, - GOTOS => { - 'identifier' => 83 + "typedef" => 69, + 'IDENTIFIER' => 26, + "signed" => 77, + "union" => 70, + "enum" => 79, + "bitmap" => 80, + 'void' => 71, + "unsigned" => 81, + "[" => 20, + "struct" => 76 + }, + GOTOS => { + 'existingtype' => 78, + 'bitmap' => 44, + 'usertype' => 73, + 'property_list' => 72, + 'identifier' => 74, + 'struct' => 50, + 'enum' => 54, + 'type' => 82, + 'union' => 56, + 'sign' => 75 } }, + {#State 48 + DEFAULT => -18 + }, {#State 49 - DEFAULT => -36 + DEFAULT => -91, + GOTOS => { + 'decl_enum' => 84, + 'decl_bitmap' => 85, + 'decl_type' => 87, + 'decl_union' => 86, + 'property_list' => 83 + } }, {#State 50 - DEFAULT => -20 + DEFAULT => -36 }, {#State 51 - DEFAULT => -35 + DEFAULT => -23 }, {#State 52 - DEFAULT => -92 + DEFAULT => -21 }, {#State 53 ACTIONS => { - "-" => 85, - ":" => 84, - "<" => 86, - "+" => 88, - "~" => 87, - "*" => 89, - "?" => 90, - "{" => 91, - "&" => 92, - "/" => 93, - "=" => 94, - "(" => 95, - "|" => 96, - "." => 97, - ">" => 98 + 'IDENTIFIER' => 26 }, - DEFAULT => -95 + GOTOS => { + 'identifier' => 88 + } }, {#State 54 - ACTIONS => { - "," => 99, - ")" => 100 - } + DEFAULT => -38 }, {#State 55 - DEFAULT => -101 + DEFAULT => -22 }, {#State 56 - DEFAULT => -121 + DEFAULT => -37 }, {#State 57 - DEFAULT => -100 + DEFAULT => -94 }, {#State 58 - DEFAULT => -102 + ACTIONS => { + "-" => 90, + ":" => 89, + "<" => 91, + "+" => 93, + "~" => 92, + "*" => 94, + "?" => 95, + "{" => 96, + "&" => 97, + "/" => 98, + "=" => 99, + "(" => 100, + "|" => 101, + "." => 102, + ">" => 103 + }, + DEFAULT => -97 }, {#State 59 ACTIONS => { - ";" => 101 - }, - DEFAULT => -123, - GOTOS => { - 'optional_semicolon' => 102 + "," => 104, + ")" => 105 } }, {#State 60 - ACTIONS => { - 'IDENTIFIER' => 22 - }, - GOTOS => { - 'identifier' => 103 - } + DEFAULT => -103 }, {#State 61 - ACTIONS => { - ";" => 101 - }, - DEFAULT => -123, - GOTOS => { - 'optional_semicolon' => 104 - } + DEFAULT => -123 }, {#State 62 - DEFAULT => -17 + DEFAULT => -102 }, {#State 63 - DEFAULT => -38 + DEFAULT => -104 }, {#State 64 ACTIONS => { - 'IDENTIFIER' => 22, - "signed" => 72, - 'void' => 66, - "unsigned" => 76 + ";" => 106 }, - DEFAULT => -89, + DEFAULT => -125, GOTOS => { - 'existingtype' => 73, - 'bitmap' => 39, - 'usertype' => 68, - 'property_list' => 67, - 'identifier' => 69, - 'struct' => 45, - 'enum' => 49, - 'type' => 105, - 'union' => 51, - 'sign' => 70 + 'optional_semicolon' => 107 } }, {#State 65 ACTIONS => { - 'IDENTIFIER' => 106 + 'IDENTIFIER' => 26 }, - DEFAULT => -120, GOTOS => { - 'optional_identifier' => 107 + 'identifier' => 108 } }, {#State 66 - DEFAULT => -45 - }, - {#State 67 ACTIONS => { - "union" => 65, - "enum" => 74, - "bitmap" => 75, - "[" => 17, - "struct" => 71 + ";" => 106 + }, + DEFAULT => -125, + GOTOS => { + 'optional_semicolon' => 109 } }, + {#State 67 + DEFAULT => -19 + }, {#State 68 - DEFAULT => -43 + DEFAULT => -40 }, {#State 69 - DEFAULT => -42 - }, - {#State 70 ACTIONS => { - 'IDENTIFIER' => 22 + 'IDENTIFIER' => 26, + "signed" => 77, + 'void' => 71, + "unsigned" => 81 }, + DEFAULT => -91, GOTOS => { - 'identifier' => 108 + 'existingtype' => 78, + 'bitmap' => 44, + 'usertype' => 73, + 'property_list' => 72, + 'identifier' => 74, + 'struct' => 50, + 'enum' => 54, + 'type' => 110, + 'union' => 56, + 'sign' => 75 } }, - {#State 71 + {#State 70 ACTIONS => { - 'IDENTIFIER' => 106 + 'IDENTIFIER' => 111 }, - DEFAULT => -120, + DEFAULT => -122, GOTOS => { - 'optional_identifier' => 109 + 'optional_identifier' => 112 } }, + {#State 71 + DEFAULT => -47 + }, {#State 72 - DEFAULT => -39 + ACTIONS => { + "union" => 70, + "enum" => 79, + "bitmap" => 80, + "[" => 20, + "struct" => 76 + } }, {#State 73 - DEFAULT => -44 + DEFAULT => -45 }, {#State 74 - ACTIONS => { - 'IDENTIFIER' => 106 - }, - DEFAULT => -120, - GOTOS => { - 'optional_identifier' => 110 - } + DEFAULT => -44 }, {#State 75 ACTIONS => { - 'IDENTIFIER' => 106 + 'IDENTIFIER' => 26 }, - DEFAULT => -120, GOTOS => { - 'optional_identifier' => 111 + 'identifier' => 113 } }, {#State 76 - DEFAULT => -40 - }, - {#State 77 ACTIONS => { - 'IDENTIFIER' => 22 + 'IDENTIFIER' => 111 }, + DEFAULT => -122, GOTOS => { - 'identifier' => 112 + 'optional_identifier' => 114 } }, + {#State 77 + DEFAULT => -41 + }, {#State 78 - ACTIONS => { - "union" => 113, - "enum" => 114, - "bitmap" => 115, - "[" => 17 - } + DEFAULT => -46 }, {#State 79 - DEFAULT => -27 + ACTIONS => { + 'IDENTIFIER' => 111 + }, + DEFAULT => -122, + GOTOS => { + 'optional_identifier' => 115 + } }, {#State 80 - DEFAULT => -28 + ACTIONS => { + 'IDENTIFIER' => 111 + }, + DEFAULT => -122, + GOTOS => { + 'optional_identifier' => 116 + } }, {#State 81 - DEFAULT => -29 + DEFAULT => -42 }, {#State 82 ACTIONS => { - 'IDENTIFIER' => 22 + 'IDENTIFIER' => 26 }, GOTOS => { - 'identifier' => 116 + 'identifier' => 117 } }, {#State 83 - DEFAULT => -78, - GOTOS => { - 'pointers' => 117 + ACTIONS => { + "union" => 118, + "enum" => 119, + "bitmap" => 120, + "[" => 20 } }, {#State 84 - ACTIONS => { - 'CONSTANT' => 56, - 'TEXT' => 13, - 'IDENTIFIER' => 22 - }, - DEFAULT => -99, - GOTOS => { - 'identifier' => 57, - 'anytext' => 118, - 'text' => 58, - 'constant' => 55 - } + DEFAULT => -29 }, {#State 85 - ACTIONS => { - 'CONSTANT' => 56, - 'TEXT' => 13, - 'IDENTIFIER' => 22 - }, - DEFAULT => -99, - GOTOS => { - 'identifier' => 57, - 'anytext' => 119, - 'text' => 58, - 'constant' => 55 - } + DEFAULT => -30 }, {#State 86 - ACTIONS => { - 'CONSTANT' => 56, - 'TEXT' => 13, - 'IDENTIFIER' => 22 - }, - DEFAULT => -99, - GOTOS => { - 'identifier' => 57, - 'anytext' => 120, - 'text' => 58, - 'constant' => 55 - } + DEFAULT => -31 }, {#State 87 ACTIONS => { - 'CONSTANT' => 56, - 'TEXT' => 13, - 'IDENTIFIER' => 22 + 'IDENTIFIER' => 26 }, - DEFAULT => -99, GOTOS => { - 'identifier' => 57, - 'anytext' => 121, - 'text' => 58, - 'constant' => 55 + 'identifier' => 121 } }, {#State 88 - ACTIONS => { - 'CONSTANT' => 56, - 'TEXT' => 13, - 'IDENTIFIER' => 22 - }, - DEFAULT => -99, + DEFAULT => -80, GOTOS => { - 'identifier' => 57, - 'anytext' => 122, - 'text' => 58, - 'constant' => 55 + 'pointers' => 122 } }, {#State 89 ACTIONS => { - 'CONSTANT' => 56, - 'TEXT' => 13, - 'IDENTIFIER' => 22 + 'CONSTANT' => 61, + 'TEXT' => 16, + 'IDENTIFIER' => 26 }, - DEFAULT => -99, + DEFAULT => -101, GOTOS => { - 'identifier' => 57, + 'identifier' => 62, 'anytext' => 123, - 'text' => 58, - 'constant' => 55 + 'text' => 63, + 'constant' => 60 } }, {#State 90 ACTIONS => { - 'CONSTANT' => 56, - 'TEXT' => 13, - 'IDENTIFIER' => 22 + 'CONSTANT' => 61, + 'TEXT' => 16, + 'IDENTIFIER' => 26 }, - DEFAULT => -99, + DEFAULT => -101, GOTOS => { - 'identifier' => 57, + 'identifier' => 62, 'anytext' => 124, - 'text' => 58, - 'constant' => 55 + 'text' => 63, + 'constant' => 60 } }, {#State 91 ACTIONS => { - 'CONSTANT' => 56, - 'TEXT' => 13, - 'IDENTIFIER' => 22 + 'CONSTANT' => 61, + 'TEXT' => 16, + 'IDENTIFIER' => 26 }, - DEFAULT => -99, + DEFAULT => -101, GOTOS => { - 'identifier' => 57, + 'identifier' => 62, 'anytext' => 125, - 'text' => 58, - 'constant' => 55, - 'commalisttext' => 126 + 'text' => 63, + 'constant' => 60 } }, {#State 92 ACTIONS => { - 'CONSTANT' => 56, - 'TEXT' => 13, - 'IDENTIFIER' => 22 + 'CONSTANT' => 61, + 'TEXT' => 16, + 'IDENTIFIER' => 26 }, - DEFAULT => -99, + DEFAULT => -101, GOTOS => { - 'identifier' => 57, - 'anytext' => 127, - 'text' => 58, - 'constant' => 55 + 'identifier' => 62, + 'anytext' => 126, + 'text' => 63, + 'constant' => 60 } }, {#State 93 ACTIONS => { - 'CONSTANT' => 56, - 'TEXT' => 13, - 'IDENTIFIER' => 22 + 'CONSTANT' => 61, + 'TEXT' => 16, + 'IDENTIFIER' => 26 }, - DEFAULT => -99, + DEFAULT => -101, GOTOS => { - 'identifier' => 57, - 'anytext' => 128, - 'text' => 58, - 'constant' => 55 + 'identifier' => 62, + 'anytext' => 127, + 'text' => 63, + 'constant' => 60 } }, {#State 94 ACTIONS => { - 'CONSTANT' => 56, - 'TEXT' => 13, - 'IDENTIFIER' => 22 + 'CONSTANT' => 61, + 'TEXT' => 16, + 'IDENTIFIER' => 26 }, - DEFAULT => -99, + DEFAULT => -101, GOTOS => { - 'identifier' => 57, - 'anytext' => 129, - 'text' => 58, - 'constant' => 55 + 'identifier' => 62, + 'anytext' => 128, + 'text' => 63, + 'constant' => 60 } }, {#State 95 ACTIONS => { - 'CONSTANT' => 56, - 'TEXT' => 13, - 'IDENTIFIER' => 22 + 'CONSTANT' => 61, + 'TEXT' => 16, + 'IDENTIFIER' => 26 }, - DEFAULT => -99, + DEFAULT => -101, GOTOS => { - 'identifier' => 57, - 'anytext' => 125, - 'text' => 58, - 'constant' => 55, - 'commalisttext' => 130 + 'identifier' => 62, + 'anytext' => 129, + 'text' => 63, + 'constant' => 60 } }, {#State 96 ACTIONS => { - 'CONSTANT' => 56, - 'TEXT' => 13, - 'IDENTIFIER' => 22 + 'CONSTANT' => 61, + 'TEXT' => 16, + 'IDENTIFIER' => 26 }, - DEFAULT => -99, + DEFAULT => -101, GOTOS => { - 'identifier' => 57, - 'anytext' => 131, - 'text' => 58, - 'constant' => 55 + 'identifier' => 62, + 'anytext' => 130, + 'text' => 63, + 'constant' => 60, + 'commalisttext' => 131 } }, {#State 97 ACTIONS => { - 'CONSTANT' => 56, - 'TEXT' => 13, - 'IDENTIFIER' => 22 + 'CONSTANT' => 61, + 'TEXT' => 16, + 'IDENTIFIER' => 26 }, - DEFAULT => -99, + DEFAULT => -101, GOTOS => { - 'identifier' => 57, + 'identifier' => 62, 'anytext' => 132, - 'text' => 58, - 'constant' => 55 + 'text' => 63, + 'constant' => 60 } }, {#State 98 ACTIONS => { - 'CONSTANT' => 56, - 'TEXT' => 13, - 'IDENTIFIER' => 22 + 'CONSTANT' => 61, + 'TEXT' => 16, + 'IDENTIFIER' => 26 }, - DEFAULT => -99, + DEFAULT => -101, GOTOS => { - 'identifier' => 57, + 'identifier' => 62, 'anytext' => 133, - 'text' => 58, - 'constant' => 55 + 'text' => 63, + 'constant' => 60 } }, {#State 99 ACTIONS => { - 'CONSTANT' => 56, - 'TEXT' => 13, - 'IDENTIFIER' => 22 + 'CONSTANT' => 61, + 'TEXT' => 16, + 'IDENTIFIER' => 26 }, - DEFAULT => -99, + DEFAULT => -101, GOTOS => { - 'identifier' => 57, + 'identifier' => 62, 'anytext' => 134, - 'text' => 58, - 'constant' => 55 + 'text' => 63, + 'constant' => 60 } }, {#State 100 - DEFAULT => -94 + ACTIONS => { + 'CONSTANT' => 61, + 'TEXT' => 16, + 'IDENTIFIER' => 26 + }, + DEFAULT => -101, + GOTOS => { + 'identifier' => 62, + 'anytext' => 130, + 'text' => 63, + 'constant' => 60, + 'commalisttext' => 135 + } }, {#State 101 - DEFAULT => -124 + ACTIONS => { + 'CONSTANT' => 61, + 'TEXT' => 16, + 'IDENTIFIER' => 26 + }, + DEFAULT => -101, + GOTOS => { + 'identifier' => 62, + 'anytext' => 136, + 'text' => 63, + 'constant' => 60 + } }, {#State 102 - DEFAULT => -12 + ACTIONS => { + 'CONSTANT' => 61, + 'TEXT' => 16, + 'IDENTIFIER' => 26 + }, + DEFAULT => -101, + GOTOS => { + 'identifier' => 62, + 'anytext' => 137, + 'text' => 63, + 'constant' => 60 + } }, {#State 103 ACTIONS => { - ";" => 135 + 'CONSTANT' => 61, + 'TEXT' => 16, + 'IDENTIFIER' => 26 + }, + DEFAULT => -101, + GOTOS => { + 'identifier' => 62, + 'anytext' => 138, + 'text' => 63, + 'constant' => 60 } }, {#State 104 - DEFAULT => -15 - }, - {#State 105 ACTIONS => { - 'IDENTIFIER' => 22 + 'CONSTANT' => 61, + 'TEXT' => 16, + 'IDENTIFIER' => 26 }, + DEFAULT => -101, GOTOS => { - 'identifier' => 136 + 'identifier' => 62, + 'anytext' => 139, + 'text' => 63, + 'constant' => 60 } }, + {#State 105 + DEFAULT => -96 + }, {#State 106 - DEFAULT => -119 + DEFAULT => -126 }, {#State 107 - ACTIONS => { - "{" => 138 - }, - DEFAULT => -74, - GOTOS => { - 'union_body' => 139, - 'opt_union_body' => 137 - } + DEFAULT => -13 }, {#State 108 - DEFAULT => -41 - }, - {#State 109 ACTIONS => { - "{" => 141 - }, - DEFAULT => -64, - GOTOS => { - 'struct_body' => 140, - 'opt_struct_body' => 142 + ";" => 140 } }, + {#State 109 + DEFAULT => -16 + }, {#State 110 ACTIONS => { - "{" => 143 + 'IDENTIFIER' => 26 }, - DEFAULT => -47, GOTOS => { - 'opt_enum_body' => 145, - 'enum_body' => 144 + 'identifier' => 141 } }, {#State 111 - ACTIONS => { - "{" => 147 - }, - DEFAULT => -55, - GOTOS => { - 'bitmap_body' => 148, - 'opt_bitmap_body' => 146 - } + DEFAULT => -121 }, {#State 112 ACTIONS => { - "(" => 149 + "{" => 143 + }, + DEFAULT => -76, + GOTOS => { + 'union_body' => 144, + 'opt_union_body' => 142 } }, {#State 113 - DEFAULT => -32 + DEFAULT => -43 }, {#State 114 - DEFAULT => -30 + ACTIONS => { + "{" => 146 + }, + DEFAULT => -66, + GOTOS => { + 'struct_body' => 145, + 'opt_struct_body' => 147 + } }, {#State 115 - DEFAULT => -31 + ACTIONS => { + "{" => 148 + }, + DEFAULT => -49, + GOTOS => { + 'opt_enum_body' => 150, + 'enum_body' => 149 + } }, {#State 116 ACTIONS => { - ";" => 150 + "{" => 152 + }, + DEFAULT => -57, + GOTOS => { + 'bitmap_body' => 153, + 'opt_bitmap_body' => 151 } }, {#State 117 ACTIONS => { - 'IDENTIFIER' => 22, - "*" => 152 - }, - GOTOS => { - 'identifier' => 151 + "(" => 154 } }, {#State 118 - ACTIONS => { - "-" => 85, - ":" => 84, - "<" => 86, - "+" => 88, - "~" => 87, - "*" => 89, - "?" => 90, - "{" => 91, - "&" => 92, - "/" => 93, - "=" => 94, - "(" => 95, - "|" => 96, - "." => 97, - ">" => 98 - }, - DEFAULT => -112 + DEFAULT => -34 }, {#State 119 - ACTIONS => { - ":" => 84, - "<" => 86, - "~" => 87, - "?" => 90, - "{" => 91, - "=" => 94 - }, - DEFAULT => -103 + DEFAULT => -32 }, {#State 120 - ACTIONS => { - "-" => 85, - ":" => 84, - "<" => 86, - "+" => 88, - "~" => 87, - "*" => 89, - "?" => 90, - "{" => 91, - "&" => 92, - "/" => 93, - "=" => 94, - "(" => 95, - "|" => 96, - "." => 97, - ">" => 98 - }, - DEFAULT => -107 + DEFAULT => -33 }, {#State 121 ACTIONS => { - "-" => 85, - ":" => 84, - "<" => 86, - "+" => 88, - "~" => 87, - "*" => 89, - "?" => 90, - "{" => 91, - "&" => 92, - "/" => 93, - "=" => 94, - "(" => 95, - "|" => 96, - "." => 97, - ">" => 98 - }, - DEFAULT => -115 + ";" => 155 + } }, {#State 122 ACTIONS => { - ":" => 84, - "<" => 86, - "~" => 87, - "?" => 90, - "{" => 91, - "=" => 94 + 'IDENTIFIER' => 26, + "*" => 157 }, - DEFAULT => -114 + GOTOS => { + 'identifier' => 156 + } }, {#State 123 ACTIONS => { - ":" => 84, - "<" => 86, - "~" => 87, - "?" => 90, - "{" => 91, - "=" => 94 + "-" => 90, + ":" => 89, + "<" => 91, + "+" => 93, + "~" => 92, + "*" => 94, + "?" => 95, + "{" => 96, + "&" => 97, + "/" => 98, + "=" => 99, + "(" => 100, + "|" => 101, + "." => 102, + ">" => 103 }, - DEFAULT => -105 + DEFAULT => -114 }, {#State 124 ACTIONS => { - "-" => 85, - ":" => 84, - "<" => 86, - "+" => 88, - "~" => 87, - "*" => 89, - "?" => 90, - "{" => 91, - "&" => 92, - "/" => 93, - "=" => 94, - "(" => 95, - "|" => 96, - "." => 97, - ">" => 98 + ":" => 89, + "<" => 91, + "~" => 92, + "?" => 95, + "{" => 96, + "=" => 99 }, - DEFAULT => -111 + DEFAULT => -105 }, {#State 125 ACTIONS => { - "-" => 85, - ":" => 84, - "<" => 86, - "+" => 88, - "~" => 87, - "*" => 89, - "?" => 90, - "{" => 91, - "&" => 92, - "/" => 93, - "=" => 94, - "(" => 95, - "|" => 96, - "." => 97, - ">" => 98 + "-" => 90, + ":" => 89, + "<" => 91, + "+" => 93, + "~" => 92, + "*" => 94, + "?" => 95, + "{" => 96, + "&" => 97, + "/" => 98, + "=" => 99, + "(" => 100, + "|" => 101, + "." => 102, + ">" => 103 }, - DEFAULT => -97 + DEFAULT => -109 }, {#State 126 ACTIONS => { - "}" => 153, - "," => 154 - } + "-" => 90, + ":" => 89, + "<" => 91, + "+" => 93, + "~" => 92, + "*" => 94, + "?" => 95, + "{" => 96, + "&" => 97, + "/" => 98, + "=" => 99, + "(" => 100, + "|" => 101, + "." => 102, + ">" => 103 + }, + DEFAULT => -117 }, {#State 127 ACTIONS => { - ":" => 84, - "<" => 86, - "~" => 87, - "?" => 90, - "{" => 91, - "=" => 94 + ":" => 89, + "<" => 91, + "~" => 92, + "?" => 95, + "{" => 96, + "=" => 99 }, - DEFAULT => -109 + DEFAULT => -116 }, {#State 128 ACTIONS => { - ":" => 84, - "<" => 86, - "~" => 87, - "?" => 90, - "{" => 91, - "=" => 94 + ":" => 89, + "<" => 91, + "~" => 92, + "?" => 95, + "{" => 96, + "=" => 99 }, - DEFAULT => -110 + DEFAULT => -107 }, {#State 129 ACTIONS => { - "-" => 85, - ":" => 84, - "<" => 86, - "+" => 88, - "~" => 87, - "*" => 89, - "?" => 90, - "{" => 91, - "&" => 92, - "/" => 93, - "=" => 94, - "(" => 95, - "|" => 96, - "." => 97, - ">" => 98 + "-" => 90, + ":" => 89, + "<" => 91, + "+" => 93, + "~" => 92, + "*" => 94, + "?" => 95, + "{" => 96, + "&" => 97, + "/" => 98, + "=" => 99, + "(" => 100, + "|" => 101, + "." => 102, + ">" => 103 }, DEFAULT => -113 }, {#State 130 ACTIONS => { - "," => 154, - ")" => 155 - } + "-" => 90, + ":" => 89, + "<" => 91, + "+" => 93, + "~" => 92, + "*" => 94, + "?" => 95, + "{" => 96, + "&" => 97, + "/" => 98, + "=" => 99, + "(" => 100, + "|" => 101, + "." => 102, + ">" => 103 + }, + DEFAULT => -99 }, {#State 131 ACTIONS => { - ":" => 84, - "<" => 86, - "~" => 87, - "?" => 90, - "{" => 91, - "=" => 94 - }, - DEFAULT => -108 + "}" => 158, + "," => 159 + } }, {#State 132 ACTIONS => { - ":" => 84, - "<" => 86, - "~" => 87, - "?" => 90, - "{" => 91, - "=" => 94 + ":" => 89, + "<" => 91, + "~" => 92, + "?" => 95, + "{" => 96, + "=" => 99 }, - DEFAULT => -104 + DEFAULT => -111 }, {#State 133 ACTIONS => { - ":" => 84, - "<" => 86, - "~" => 87, - "?" => 90, - "{" => 91, - "=" => 94 + ":" => 89, + "<" => 91, + "~" => 92, + "?" => 95, + "{" => 96, + "=" => 99 }, - DEFAULT => -106 + DEFAULT => -112 }, {#State 134 ACTIONS => { - "-" => 85, - ":" => 84, - "<" => 86, - "+" => 88, - "~" => 87, - "*" => 89, - "?" => 90, - "{" => 91, - "&" => 92, - "/" => 93, - "=" => 94, - "(" => 95, - "|" => 96, - "." => 97, - ">" => 98 + "-" => 90, + ":" => 89, + "<" => 91, + "+" => 93, + "~" => 92, + "*" => 94, + "?" => 95, + "{" => 96, + "&" => 97, + "/" => 98, + "=" => 99, + "(" => 100, + "|" => 101, + "." => 102, + ">" => 103 }, - DEFAULT => -96 + DEFAULT => -115 }, {#State 135 - DEFAULT => -14 + ACTIONS => { + "," => 159, + ")" => 160 + } }, {#State 136 ACTIONS => { - "[" => 156 + ":" => 89, + "<" => 91, + "~" => 92, + "?" => 95, + "{" => 96, + "=" => 99 }, - DEFAULT => -86, - GOTOS => { - 'array_len' => 157 - } + DEFAULT => -110 }, {#State 137 - DEFAULT => -76 + ACTIONS => { + ":" => 89, + "<" => 91, + "~" => 92, + "?" => 95, + "{" => 96, + "=" => 99 + }, + DEFAULT => -106 }, {#State 138 - DEFAULT => -71, - GOTOS => { - 'union_elements' => 158 - } + ACTIONS => { + ":" => 89, + "<" => 91, + "~" => 92, + "?" => 95, + "{" => 96, + "=" => 99 + }, + DEFAULT => -108 }, {#State 139 - DEFAULT => -75 + ACTIONS => { + "-" => 90, + ":" => 89, + "<" => 91, + "+" => 93, + "~" => 92, + "*" => 94, + "?" => 95, + "{" => 96, + "&" => 97, + "/" => 98, + "=" => 99, + "(" => 100, + "|" => 101, + "." => 102, + ">" => 103 + }, + DEFAULT => -98 }, {#State 140 - DEFAULT => -65 + DEFAULT => -15 }, {#State 141 - DEFAULT => -80, + ACTIONS => { + "[" => 161 + }, + DEFAULT => -88, GOTOS => { - 'element_list1' => 159 + 'array_len' => 162 } }, {#State 142 - DEFAULT => -66 + DEFAULT => -78 }, {#State 143 - ACTIONS => { - 'IDENTIFIER' => 22 - }, + DEFAULT => -73, GOTOS => { - 'identifier' => 160, - 'enum_element' => 161, - 'enum_elements' => 162 + 'union_elements' => 163 } }, {#State 144 - DEFAULT => -48 + DEFAULT => -77 }, {#State 145 - DEFAULT => -49 + DEFAULT => -67 }, {#State 146 - DEFAULT => -57 + DEFAULT => -82, + GOTOS => { + 'element_list1' => 164 + } }, {#State 147 + DEFAULT => -68 + }, + {#State 148 ACTIONS => { - 'IDENTIFIER' => 22 + 'IDENTIFIER' => 26 }, - DEFAULT => -60, GOTOS => { 'identifier' => 165, - 'bitmap_element' => 164, - 'bitmap_elements' => 163, - 'opt_bitmap_elements' => 166 + 'enum_element' => 166, + 'enum_elements' => 167 } }, - {#State 148 - DEFAULT => -56 - }, {#State 149 - ACTIONS => { - "," => -82, - "void" => 170, - ")" => -82 - }, - DEFAULT => -89, - GOTOS => { - 'base_element' => 167, - 'element_list2' => 169, - 'property_list' => 168 - } + DEFAULT => -50 }, {#State 150 - DEFAULT => -26 + DEFAULT => -51 }, {#State 151 - ACTIONS => { - "[" => 156, - "=" => 172 - }, - GOTOS => { - 'array_len' => 171 - } + DEFAULT => -59 }, {#State 152 - DEFAULT => -79 - }, - {#State 153 ACTIONS => { - 'CONSTANT' => 56, - 'TEXT' => 13, - 'IDENTIFIER' => 22 + 'IDENTIFIER' => 26 }, - DEFAULT => -99, + DEFAULT => -62, GOTOS => { - 'identifier' => 57, - 'anytext' => 173, - 'text' => 58, - 'constant' => 55 + 'identifier' => 170, + 'bitmap_element' => 169, + 'bitmap_elements' => 168, + 'opt_bitmap_elements' => 171 } }, + {#State 153 + DEFAULT => -58 + }, {#State 154 ACTIONS => { - 'CONSTANT' => 56, - 'TEXT' => 13, - 'IDENTIFIER' => 22 + "," => -84, + "void" => 175, + ")" => -84 }, - DEFAULT => -99, + DEFAULT => -91, GOTOS => { - 'identifier' => 57, - 'anytext' => 174, - 'text' => 58, - 'constant' => 55 + 'base_element' => 172, + 'element_list2' => 174, + 'property_list' => 173 } }, {#State 155 - ACTIONS => { - 'CONSTANT' => 56, - 'TEXT' => 13, - 'IDENTIFIER' => 22 - }, - DEFAULT => -99, - GOTOS => { - 'identifier' => 57, - 'anytext' => 175, - 'text' => 58, - 'constant' => 55 - } + DEFAULT => -28 }, {#State 156 ACTIONS => { - 'CONSTANT' => 56, - 'TEXT' => 13, - "]" => 176, - 'IDENTIFIER' => 22 + "[" => 161, + "=" => 177 }, - DEFAULT => -99, GOTOS => { - 'identifier' => 57, - 'anytext' => 177, - 'text' => 58, - 'constant' => 55 + 'array_len' => 176 } }, {#State 157 - ACTIONS => { - ";" => 178 - } + DEFAULT => -81 }, {#State 158 ACTIONS => { - "}" => 179 + 'CONSTANT' => 61, + 'TEXT' => 16, + 'IDENTIFIER' => 26 }, - DEFAULT => -89, + DEFAULT => -101, GOTOS => { - 'optional_base_element' => 181, - 'property_list' => 180 + 'identifier' => 62, + 'anytext' => 178, + 'text' => 63, + 'constant' => 60 } }, {#State 159 ACTIONS => { - "}" => 182 + 'CONSTANT' => 61, + 'TEXT' => 16, + 'IDENTIFIER' => 26 }, - DEFAULT => -89, + DEFAULT => -101, GOTOS => { - 'base_element' => 183, - 'property_list' => 168 + 'identifier' => 62, + 'anytext' => 179, + 'text' => 63, + 'constant' => 60 } }, {#State 160 ACTIONS => { - "=" => 184 + 'CONSTANT' => 61, + 'TEXT' => 16, + 'IDENTIFIER' => 26 }, - DEFAULT => -52 + DEFAULT => -101, + GOTOS => { + 'identifier' => 62, + 'anytext' => 180, + 'text' => 63, + 'constant' => 60 + } }, {#State 161 - DEFAULT => -50 + ACTIONS => { + 'CONSTANT' => 61, + 'TEXT' => 16, + "]" => 181, + 'IDENTIFIER' => 26 + }, + DEFAULT => -101, + GOTOS => { + 'identifier' => 62, + 'anytext' => 182, + 'text' => 63, + 'constant' => 60 + } }, {#State 162 ACTIONS => { - "}" => 185, - "," => 186 + ";" => 183 } }, {#State 163 ACTIONS => { - "," => 187 + "}" => 184 }, - DEFAULT => -61 + DEFAULT => -91, + GOTOS => { + 'optional_base_element' => 186, + 'property_list' => 185 + } }, {#State 164 - DEFAULT => -58 + ACTIONS => { + "}" => 187 + }, + DEFAULT => -91, + GOTOS => { + 'base_element' => 188, + 'property_list' => 173 + } }, {#State 165 ACTIONS => { - "=" => 188 - } + "=" => 189 + }, + DEFAULT => -54 }, {#State 166 - ACTIONS => { - "}" => 189 - } + DEFAULT => -52 }, {#State 167 - DEFAULT => -84 + ACTIONS => { + "}" => 190, + "," => 191 + } }, {#State 168 ACTIONS => { - 'IDENTIFIER' => 22, - "signed" => 72, - 'void' => 66, - "unsigned" => 76, - "[" => 17 + "," => 192 }, - DEFAULT => -89, - GOTOS => { - 'existingtype' => 73, - 'bitmap' => 39, - 'usertype' => 68, - 'property_list' => 67, - 'identifier' => 69, - 'struct' => 45, - 'enum' => 49, - 'type' => 190, - 'union' => 51, - 'sign' => 70 - } + DEFAULT => -63 }, {#State 169 - ACTIONS => { - "," => 191, - ")" => 192 - } + DEFAULT => -60 }, {#State 170 - DEFAULT => -83 - }, - {#State 171 ACTIONS => { "=" => 193 } }, - {#State 172 + {#State 171 ACTIONS => { - 'CONSTANT' => 56, - 'TEXT' => 13, - 'IDENTIFIER' => 22 - }, - DEFAULT => -99, - GOTOS => { - 'identifier' => 57, - 'anytext' => 194, - 'text' => 58, - 'constant' => 55 + "}" => 194 } }, + {#State 172 + DEFAULT => -86 + }, {#State 173 ACTIONS => { - "-" => 85, - ":" => 84, - "<" => 86, - "+" => 88, - "~" => 87, - "*" => 89, - "?" => 90, - "{" => 91, - "&" => 92, - "/" => 93, - "=" => 94, - "(" => 95, - "|" => 96, - "." => 97, - ">" => 98 + 'IDENTIFIER' => 26, + "signed" => 77, + 'void' => 71, + "unsigned" => 81, + "[" => 20 }, - DEFAULT => -117 + DEFAULT => -91, + GOTOS => { + 'existingtype' => 78, + 'bitmap' => 44, + 'usertype' => 73, + 'property_list' => 72, + 'identifier' => 74, + 'struct' => 50, + 'enum' => 54, + 'type' => 195, + 'union' => 56, + 'sign' => 75 + } }, {#State 174 ACTIONS => { - "-" => 85, - ":" => 84, - "<" => 86, - "+" => 88, - "~" => 87, - "*" => 89, - "?" => 90, - "{" => 91, - "&" => 92, - "/" => 93, - "=" => 94, - "(" => 95, - "|" => 96, - "." => 97, - ">" => 98 - }, - DEFAULT => -98 + "," => 196, + ")" => 197 + } }, {#State 175 - ACTIONS => { - ":" => 84, - "<" => 86, - "~" => 87, - "?" => 90, - "{" => 91, - "=" => 94 - }, - DEFAULT => -116 + DEFAULT => -85 }, {#State 176 ACTIONS => { - "[" => 156 - }, - DEFAULT => -86, - GOTOS => { - 'array_len' => 195 + "=" => 198 } }, {#State 177 ACTIONS => { - "-" => 85, - ":" => 84, - "?" => 90, - "<" => 86, - "+" => 88, - "~" => 87, - "&" => 92, - "{" => 91, - "/" => 93, - "=" => 94, - "|" => 96, - "(" => 95, - "*" => 89, - "." => 97, - "]" => 196, - ">" => 98 + 'CONSTANT' => 61, + 'TEXT' => 16, + 'IDENTIFIER' => 26 + }, + DEFAULT => -101, + GOTOS => { + 'identifier' => 62, + 'anytext' => 199, + 'text' => 63, + 'constant' => 60 } }, {#State 178 - DEFAULT => -33 + ACTIONS => { + "-" => 90, + ":" => 89, + "<" => 91, + "+" => 93, + "~" => 92, + "*" => 94, + "?" => 95, + "{" => 96, + "&" => 97, + "/" => 98, + "=" => 99, + "(" => 100, + "|" => 101, + "." => 102, + ">" => 103 + }, + DEFAULT => -119 }, {#State 179 - DEFAULT => -73 + ACTIONS => { + "-" => 90, + ":" => 89, + "<" => 91, + "+" => 93, + "~" => 92, + "*" => 94, + "?" => 95, + "{" => 96, + "&" => 97, + "/" => 98, + "=" => 99, + "(" => 100, + "|" => 101, + "." => 102, + ">" => 103 + }, + DEFAULT => -100 }, {#State 180 ACTIONS => { - "[" => 17 + ":" => 89, + "<" => 91, + "~" => 92, + "?" => 95, + "{" => 96, + "=" => 99 }, - DEFAULT => -89, - GOTOS => { - 'base_or_empty' => 197, - 'base_element' => 198, - 'empty_element' => 199, - 'property_list' => 200 - } + DEFAULT => -118 }, {#State 181 - DEFAULT => -72 + ACTIONS => { + "[" => 161 + }, + DEFAULT => -88, + GOTOS => { + 'array_len' => 200 + } }, {#State 182 - DEFAULT => -63 - }, - {#State 183 ACTIONS => { - ";" => 201 + "-" => 90, + ":" => 89, + "?" => 95, + "<" => 91, + "+" => 93, + "~" => 92, + "&" => 97, + "{" => 96, + "/" => 98, + "=" => 99, + "|" => 101, + "(" => 100, + "*" => 94, + "." => 102, + "]" => 201, + ">" => 103 } }, + {#State 183 + DEFAULT => -35 + }, {#State 184 - ACTIONS => { - 'CONSTANT' => 56, - 'TEXT' => 13, - 'IDENTIFIER' => 22 - }, - DEFAULT => -99, - GOTOS => { - 'identifier' => 57, - 'anytext' => 202, - 'text' => 58, - 'constant' => 55 - } + DEFAULT => -75 }, {#State 185 - DEFAULT => -46 - }, - {#State 186 ACTIONS => { - 'IDENTIFIER' => 22 + "[" => 20 }, + DEFAULT => -91, GOTOS => { - 'identifier' => 160, - 'enum_element' => 203 + 'base_or_empty' => 202, + 'base_element' => 203, + 'empty_element' => 204, + 'property_list' => 205 } }, + {#State 186 + DEFAULT => -74 + }, {#State 187 + DEFAULT => -65 + }, + {#State 188 ACTIONS => { - 'IDENTIFIER' => 22 - }, - GOTOS => { - 'identifier' => 165, - 'bitmap_element' => 204 + ";" => 206 } }, - {#State 188 + {#State 189 ACTIONS => { - 'CONSTANT' => 56, - 'TEXT' => 13, - 'IDENTIFIER' => 22 + 'CONSTANT' => 61, + 'TEXT' => 16, + 'IDENTIFIER' => 26 }, - DEFAULT => -99, + DEFAULT => -101, GOTOS => { - 'identifier' => 57, - 'anytext' => 205, - 'text' => 58, - 'constant' => 55 + 'identifier' => 62, + 'anytext' => 207, + 'text' => 63, + 'constant' => 60 } }, - {#State 189 - DEFAULT => -54 - }, {#State 190 - DEFAULT => -78, - GOTOS => { - 'pointers' => 206 - } + DEFAULT => -48 }, {#State 191 - DEFAULT => -89, + ACTIONS => { + 'IDENTIFIER' => 26 + }, GOTOS => { - 'base_element' => 207, - 'property_list' => 168 + 'identifier' => 165, + 'enum_element' => 208 } }, {#State 192 ACTIONS => { - ";" => 208 + 'IDENTIFIER' => 26 + }, + GOTOS => { + 'identifier' => 170, + 'bitmap_element' => 209 } }, {#State 193 ACTIONS => { - 'CONSTANT' => 56, - 'TEXT' => 13, - 'IDENTIFIER' => 22 + 'CONSTANT' => 61, + 'TEXT' => 16, + 'IDENTIFIER' => 26 }, - DEFAULT => -99, + DEFAULT => -101, GOTOS => { - 'identifier' => 57, - 'anytext' => 209, - 'text' => 58, - 'constant' => 55 + 'identifier' => 62, + 'anytext' => 210, + 'text' => 63, + 'constant' => 60 } }, {#State 194 - ACTIONS => { - "-" => 85, - ":" => 84, - "?" => 90, - "<" => 86, - ";" => 210, - "+" => 88, - "~" => 87, - "&" => 92, - "{" => 91, - "/" => 93, - "=" => 94, - "|" => 96, - "(" => 95, - "*" => 89, - "." => 97, - ">" => 98 - } + DEFAULT => -56 }, {#State 195 - DEFAULT => -87 + DEFAULT => -80, + GOTOS => { + 'pointers' => 211 + } }, {#State 196 - ACTIONS => { - "[" => 156 - }, - DEFAULT => -86, + DEFAULT => -91, GOTOS => { - 'array_len' => 211 + 'base_element' => 212, + 'property_list' => 173 } }, {#State 197 - DEFAULT => -70 + ACTIONS => { + ";" => 213 + } }, {#State 198 ACTIONS => { - ";" => 212 + 'CONSTANT' => 61, + 'TEXT' => 16, + 'IDENTIFIER' => 26 + }, + DEFAULT => -101, + GOTOS => { + 'identifier' => 62, + 'anytext' => 214, + 'text' => 63, + 'constant' => 60 } }, {#State 199 - DEFAULT => -69 + ACTIONS => { + "-" => 90, + ":" => 89, + "?" => 95, + "<" => 91, + ";" => 215, + "+" => 93, + "~" => 92, + "&" => 97, + "{" => 96, + "/" => 98, + "=" => 99, + "|" => 101, + "(" => 100, + "*" => 94, + "." => 102, + ">" => 103 + } }, {#State 200 + DEFAULT => -89 + }, + {#State 201 ACTIONS => { - 'IDENTIFIER' => 22, - "signed" => 72, - ";" => 213, - 'void' => 66, - "unsigned" => 76, - "[" => 17 + "[" => 161 }, - DEFAULT => -89, + DEFAULT => -88, GOTOS => { - 'existingtype' => 73, - 'bitmap' => 39, - 'usertype' => 68, - 'property_list' => 67, - 'identifier' => 69, - 'struct' => 45, - 'enum' => 49, - 'type' => 190, - 'union' => 51, - 'sign' => 70 + 'array_len' => 216 } }, - {#State 201 - DEFAULT => -81 - }, {#State 202 - ACTIONS => { - "-" => 85, - ":" => 84, - "<" => 86, - "+" => 88, - "~" => 87, - "*" => 89, - "?" => 90, - "{" => 91, - "&" => 92, - "/" => 93, - "=" => 94, - "(" => 95, - "|" => 96, - "." => 97, - ">" => 98 - }, - DEFAULT => -53 + DEFAULT => -72 }, {#State 203 - DEFAULT => -51 + ACTIONS => { + ";" => 217 + } }, {#State 204 - DEFAULT => -59 + DEFAULT => -71 }, {#State 205 ACTIONS => { - "-" => 85, - ":" => 84, - "<" => 86, - "+" => 88, - "~" => 87, - "*" => 89, - "?" => 90, - "{" => 91, - "&" => 92, - "/" => 93, - "=" => 94, - "(" => 95, - "|" => 96, - "." => 97, - ">" => 98 - }, - DEFAULT => -62 - }, - {#State 206 - ACTIONS => { - 'IDENTIFIER' => 22, - "*" => 152 + 'IDENTIFIER' => 26, + "signed" => 77, + ";" => 218, + 'void' => 71, + "unsigned" => 81, + "[" => 20 }, + DEFAULT => -91, GOTOS => { - 'identifier' => 214 + 'existingtype' => 78, + 'bitmap' => 44, + 'usertype' => 73, + 'property_list' => 72, + 'identifier' => 74, + 'struct' => 50, + 'enum' => 54, + 'type' => 195, + 'union' => 56, + 'sign' => 75 } }, + {#State 206 + DEFAULT => -83 + }, {#State 207 - DEFAULT => -85 + ACTIONS => { + "-" => 90, + ":" => 89, + "<" => 91, + "+" => 93, + "~" => 92, + "*" => 94, + "?" => 95, + "{" => 96, + "&" => 97, + "/" => 98, + "=" => 99, + "(" => 100, + "|" => 101, + "." => 102, + ">" => 103 + }, + DEFAULT => -55 }, {#State 208 - DEFAULT => -25 + DEFAULT => -53 }, {#State 209 - ACTIONS => { - "-" => 85, - ":" => 84, - "?" => 90, - "<" => 86, - ";" => 215, - "+" => 88, - "~" => 87, - "&" => 92, - "{" => 91, - "/" => 93, - "=" => 94, - "|" => 96, - "(" => 95, - "*" => 89, - "." => 97, - ">" => 98 - } + DEFAULT => -61 }, {#State 210 - DEFAULT => -23 + ACTIONS => { + "-" => 90, + ":" => 89, + "<" => 91, + "+" => 93, + "~" => 92, + "*" => 94, + "?" => 95, + "{" => 96, + "&" => 97, + "/" => 98, + "=" => 99, + "(" => 100, + "|" => 101, + "." => 102, + ">" => 103 + }, + DEFAULT => -64 }, {#State 211 - DEFAULT => -88 + ACTIONS => { + 'IDENTIFIER' => 26, + "*" => 157 + }, + GOTOS => { + 'identifier' => 219 + } }, {#State 212 - DEFAULT => -68 + DEFAULT => -87 }, {#State 213 - DEFAULT => -67 + DEFAULT => -27 }, {#State 214 ACTIONS => { - "[" => 156 - }, - DEFAULT => -86, - GOTOS => { - 'array_len' => 216 + "-" => 90, + ":" => 89, + "?" => 95, + "<" => 91, + ";" => 220, + "+" => 93, + "~" => 92, + "&" => 97, + "{" => 96, + "/" => 98, + "=" => 99, + "|" => 101, + "(" => 100, + "*" => 94, + "." => 102, + ">" => 103 } }, {#State 215 - DEFAULT => -24 + DEFAULT => -25 }, {#State 216 - DEFAULT => -77 + DEFAULT => -90 + }, + {#State 217 + DEFAULT => -70 + }, + {#State 218 + DEFAULT => -69 + }, + {#State 219 + ACTIONS => { + "[" => 161 + }, + DEFAULT => -88, + GOTOS => { + 'array_len' => 221 + } + }, + {#State 220 + DEFAULT => -26 + }, + {#State 221 + DEFAULT => -79 } ], yyrules => @@ -1777,37 +1803,43 @@ 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 'idl', 2, sub -#line 21 "pidl/idl.yp" +#line 21 "idl.yp" { push(@{$_[1]}, $_[2]); $_[1] } ], [#Rule 5 'idl', 2, sub -#line 22 "pidl/idl.yp" +#line 22 "idl.yp" { push(@{$_[1]}, $_[2]); $_[1] } ], [#Rule 6 'idl', 2, sub -#line 23 "pidl/idl.yp" +#line 23 "idl.yp" { push(@{$_[1]}, $_[2]); $_[1] } ], [#Rule 7 + 'idl', 2, +sub +#line 24 "idl.yp" +{ push(@{$_[1]}, $_[2]); $_[1] } + ], + [#Rule 8 'import', 3, sub -#line 26 "pidl/idl.yp" +#line 27 "idl.yp" {{ "TYPE" => "IMPORT", "PATHS" => $_[2], @@ -1815,10 +1847,10 @@ sub "LINE" => $_[0]->YYData->{LINE} }} ], - [#Rule 8 + [#Rule 9 'include', 3, sub -#line 33 "pidl/idl.yp" +#line 34 "idl.yp" {{ "TYPE" => "INCLUDE", "PATHS" => $_[2], @@ -1826,10 +1858,10 @@ sub "LINE" => $_[0]->YYData->{LINE} }} ], - [#Rule 9 + [#Rule 10 'importlib', 3, sub -#line 40 "pidl/idl.yp" +#line 41 "idl.yp" {{ "TYPE" => "IMPORTLIB", "PATHS" => $_[2], @@ -1837,22 +1869,22 @@ sub "LINE" => $_[0]->YYData->{LINE} }} ], - [#Rule 10 + [#Rule 11 'commalist', 1, sub -#line 49 "pidl/idl.yp" +#line 50 "idl.yp" { [ $_[1] ] } ], - [#Rule 11 + [#Rule 12 'commalist', 3, sub -#line 50 "pidl/idl.yp" +#line 51 "idl.yp" { push(@{$_[1]}, $_[3]); $_[1] } ], - [#Rule 12 + [#Rule 13 'coclass', 7, sub -#line 54 "pidl/idl.yp" +#line 55 "idl.yp" {{ "TYPE" => "COCLASS", "PROPERTIES" => $_[1], @@ -1862,19 +1894,19 @@ sub "LINE" => $_[0]->YYData->{LINE}, }} ], - [#Rule 13 + [#Rule 14 'interface_names', 0, undef ], - [#Rule 14 + [#Rule 15 'interface_names', 4, sub -#line 66 "pidl/idl.yp" +#line 67 "idl.yp" { push(@{$_[1]}, $_[2]); $_[1] } ], - [#Rule 15 + [#Rule 16 'interface', 7, sub -#line 70 "pidl/idl.yp" +#line 71 "idl.yp" {{ "TYPE" => "INTERFACE", "PROPERTIES" => $_[1], @@ -1884,24 +1916,29 @@ sub "LINE" => $_[0]->YYData->{LINE}, }} ], - [#Rule 16 + [#Rule 17 + 'cpp_quote', 4, +sub +#line 82 "idl.yp" +{{ + "TYPE" => "CPP_QUOTE", + "FILE" => $_[0]->YYData->{FILE}, + "LINE" => $_[0]->YYData->{LINE}, + "DATA" => $_[3] + }} + ], + [#Rule 18 'definitions', 1, sub -#line 81 "pidl/idl.yp" +#line 91 "idl.yp" { [ $_[1] ] } ], - [#Rule 17 + [#Rule 19 'definitions', 2, sub -#line 82 "pidl/idl.yp" +#line 92 "idl.yp" { push(@{$_[1]}, $_[2]); $_[1] } ], - [#Rule 18 - 'definition', 1, undef - ], - [#Rule 19 - 'definition', 1, undef - ], [#Rule 20 'definition', 1, undef ], @@ -1912,9 +1949,15 @@ sub 'definition', 1, undef ], [#Rule 23 + 'definition', 1, undef + ], + [#Rule 24 + 'definition', 1, undef + ], + [#Rule 25 'const', 7, sub -#line 90 "pidl/idl.yp" +#line 100 "idl.yp" {{ "TYPE" => "CONST", "DTYPE" => $_[2], @@ -1925,10 +1968,10 @@ sub "LINE" => $_[0]->YYData->{LINE}, }} ], - [#Rule 24 + [#Rule 26 'const', 8, sub -#line 100 "pidl/idl.yp" +#line 110 "idl.yp" {{ "TYPE" => "CONST", "DTYPE" => $_[2], @@ -1940,10 +1983,10 @@ sub "LINE" => $_[0]->YYData->{LINE}, }} ], - [#Rule 25 + [#Rule 27 'function', 7, sub -#line 114 "pidl/idl.yp" +#line 124 "idl.yp" {{ "TYPE" => "FUNCTION", "NAME" => $_[3], @@ -1954,10 +1997,10 @@ sub "LINE" => $_[0]->YYData->{LINE}, }} ], - [#Rule 26 + [#Rule 28 'declare', 4, sub -#line 126 "pidl/idl.yp" +#line 136 "idl.yp" {{ "TYPE" => "DECLARE", "NAME" => $_[3], @@ -1966,46 +2009,46 @@ sub "LINE" => $_[0]->YYData->{LINE}, }} ], - [#Rule 27 + [#Rule 29 'decl_type', 1, undef ], - [#Rule 28 + [#Rule 30 'decl_type', 1, undef ], - [#Rule 29 + [#Rule 31 'decl_type', 1, undef ], - [#Rule 30 + [#Rule 32 'decl_enum', 2, sub -#line 139 "pidl/idl.yp" +#line 149 "idl.yp" {{ "TYPE" => "ENUM", "PROPERTIES" => $_[1] }} ], - [#Rule 31 + [#Rule 33 'decl_bitmap', 2, sub -#line 146 "pidl/idl.yp" +#line 156 "idl.yp" {{ "TYPE" => "BITMAP", "PROPERTIES" => $_[1] }} ], - [#Rule 32 + [#Rule 34 'decl_union', 2, sub -#line 153 "pidl/idl.yp" +#line 163 "idl.yp" {{ "TYPE" => "UNION", "PROPERTIES" => $_[1] }} ], - [#Rule 33 + [#Rule 35 'typedef', 6, sub -#line 160 "pidl/idl.yp" +#line 170 "idl.yp" {{ "TYPE" => "TYPEDEF", "PROPERTIES" => $_[1], @@ -2016,67 +2059,67 @@ sub "LINE" => $_[0]->YYData->{LINE}, }} ], - [#Rule 34 + [#Rule 36 'usertype', 1, undef ], - [#Rule 35 + [#Rule 37 'usertype', 1, undef ], - [#Rule 36 + [#Rule 38 'usertype', 1, undef ], - [#Rule 37 + [#Rule 39 'usertype', 1, undef ], - [#Rule 38 + [#Rule 40 'typedecl', 2, sub -#line 173 "pidl/idl.yp" +#line 183 "idl.yp" { $_[1] } ], - [#Rule 39 + [#Rule 41 'sign', 1, undef ], - [#Rule 40 + [#Rule 42 'sign', 1, undef ], - [#Rule 41 + [#Rule 43 'existingtype', 2, sub -#line 178 "pidl/idl.yp" +#line 188 "idl.yp" { ($_[1]?$_[1]:"signed") ." $_[2]" } ], - [#Rule 42 + [#Rule 44 'existingtype', 1, undef ], - [#Rule 43 + [#Rule 45 'type', 1, undef ], - [#Rule 44 + [#Rule 46 'type', 1, undef ], - [#Rule 45 + [#Rule 47 'type', 1, sub -#line 182 "pidl/idl.yp" +#line 192 "idl.yp" { "void" } ], - [#Rule 46 + [#Rule 48 'enum_body', 3, sub -#line 184 "pidl/idl.yp" +#line 194 "idl.yp" { $_[2] } ], - [#Rule 47 + [#Rule 49 'opt_enum_body', 0, undef ], - [#Rule 48 + [#Rule 50 'opt_enum_body', 1, undef ], - [#Rule 49 + [#Rule 51 'enum', 4, sub -#line 187 "pidl/idl.yp" +#line 197 "idl.yp" {{ "TYPE" => "ENUM", "PROPERTIES" => $_[1], @@ -2084,43 +2127,43 @@ sub "ELEMENTS" => $_[4] }} ], - [#Rule 50 + [#Rule 52 'enum_elements', 1, sub -#line 196 "pidl/idl.yp" +#line 206 "idl.yp" { [ $_[1] ] } ], - [#Rule 51 + [#Rule 53 'enum_elements', 3, sub -#line 197 "pidl/idl.yp" +#line 207 "idl.yp" { push(@{$_[1]}, $_[3]); $_[1] } ], - [#Rule 52 + [#Rule 54 'enum_element', 1, undef ], - [#Rule 53 + [#Rule 55 'enum_element', 3, sub -#line 201 "pidl/idl.yp" +#line 211 "idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 54 + [#Rule 56 'bitmap_body', 3, sub -#line 204 "pidl/idl.yp" +#line 214 "idl.yp" { $_[2] } ], - [#Rule 55 + [#Rule 57 'opt_bitmap_body', 0, undef ], - [#Rule 56 + [#Rule 58 'opt_bitmap_body', 1, undef ], - [#Rule 57 + [#Rule 59 'bitmap', 4, sub -#line 207 "pidl/idl.yp" +#line 217 "idl.yp" {{ "TYPE" => "BITMAP", "PROPERTIES" => $_[1], @@ -2128,46 +2171,46 @@ sub "ELEMENTS" => $_[4] }} ], - [#Rule 58 + [#Rule 60 'bitmap_elements', 1, sub -#line 216 "pidl/idl.yp" +#line 226 "idl.yp" { [ $_[1] ] } ], - [#Rule 59 + [#Rule 61 'bitmap_elements', 3, sub -#line 217 "pidl/idl.yp" +#line 227 "idl.yp" { push(@{$_[1]}, $_[3]); $_[1] } ], - [#Rule 60 + [#Rule 62 'opt_bitmap_elements', 0, undef ], - [#Rule 61 + [#Rule 63 'opt_bitmap_elements', 1, undef ], - [#Rule 62 + [#Rule 64 'bitmap_element', 3, sub -#line 222 "pidl/idl.yp" +#line 232 "idl.yp" { "$_[1] ( $_[3] )" } ], - [#Rule 63 + [#Rule 65 'struct_body', 3, sub -#line 225 "pidl/idl.yp" +#line 235 "idl.yp" { $_[2] } ], - [#Rule 64 + [#Rule 66 'opt_struct_body', 0, undef ], - [#Rule 65 + [#Rule 67 'opt_struct_body', 1, undef ], - [#Rule 66 + [#Rule 68 'struct', 4, sub -#line 229 "pidl/idl.yp" +#line 239 "idl.yp" {{ "TYPE" => "STRUCT", "PROPERTIES" => $_[1], @@ -2175,10 +2218,10 @@ sub "ELEMENTS" => $_[4] }} ], - [#Rule 67 + [#Rule 69 'empty_element', 2, sub -#line 238 "pidl/idl.yp" +#line 248 "idl.yp" {{ "NAME" => "", "TYPE" => "EMPTY", @@ -2189,43 +2232,43 @@ sub "LINE" => $_[0]->YYData->{LINE}, }} ], - [#Rule 68 + [#Rule 70 'base_or_empty', 2, undef ], - [#Rule 69 + [#Rule 71 'base_or_empty', 1, undef ], - [#Rule 70 + [#Rule 72 'optional_base_element', 2, sub -#line 252 "pidl/idl.yp" +#line 262 "idl.yp" { $_[2]->{PROPERTIES} = FlattenHash([$_[1],$_[2]->{PROPERTIES}]); $_[2] } ], - [#Rule 71 + [#Rule 73 'union_elements', 0, undef ], - [#Rule 72 + [#Rule 74 'union_elements', 2, sub -#line 257 "pidl/idl.yp" +#line 267 "idl.yp" { push(@{$_[1]}, $_[2]); $_[1] } ], - [#Rule 73 + [#Rule 75 'union_body', 3, sub -#line 260 "pidl/idl.yp" +#line 270 "idl.yp" { $_[2] } ], - [#Rule 74 + [#Rule 76 'opt_union_body', 0, undef ], - [#Rule 75 + [#Rule 77 'opt_union_body', 1, undef ], - [#Rule 76 + [#Rule 78 'union', 4, sub -#line 264 "pidl/idl.yp" +#line 274 "idl.yp" {{ "TYPE" => "UNION", "PROPERTIES" => $_[1], @@ -2233,10 +2276,10 @@ sub "ELEMENTS" => $_[4] }} ], - [#Rule 77 + [#Rule 79 'base_element', 5, sub -#line 273 "pidl/idl.yp" +#line 283 "idl.yp" {{ "NAME" => $_[4], "TYPE" => $_[2], @@ -2247,241 +2290,241 @@ sub "LINE" => $_[0]->YYData->{LINE}, }} ], - [#Rule 78 + [#Rule 80 'pointers', 0, sub -#line 287 "pidl/idl.yp" +#line 297 "idl.yp" { 0 } ], - [#Rule 79 + [#Rule 81 'pointers', 2, sub -#line 288 "pidl/idl.yp" +#line 298 "idl.yp" { $_[1]+1 } ], - [#Rule 80 + [#Rule 82 'element_list1', 0, sub -#line 292 "pidl/idl.yp" +#line 302 "idl.yp" { [] } ], - [#Rule 81 + [#Rule 83 'element_list1', 3, sub -#line 293 "pidl/idl.yp" +#line 303 "idl.yp" { push(@{$_[1]}, $_[2]); $_[1] } ], - [#Rule 82 + [#Rule 84 'element_list2', 0, undef ], - [#Rule 83 + [#Rule 85 'element_list2', 1, undef ], - [#Rule 84 + [#Rule 86 'element_list2', 1, sub -#line 299 "pidl/idl.yp" +#line 309 "idl.yp" { [ $_[1] ] } ], - [#Rule 85 + [#Rule 87 'element_list2', 3, sub -#line 300 "pidl/idl.yp" +#line 310 "idl.yp" { push(@{$_[1]}, $_[3]); $_[1] } ], - [#Rule 86 + [#Rule 88 'array_len', 0, undef ], - [#Rule 87 + [#Rule 89 'array_len', 3, sub -#line 305 "pidl/idl.yp" +#line 315 "idl.yp" { push(@{$_[3]}, "*"); $_[3] } ], - [#Rule 88 + [#Rule 90 'array_len', 4, sub -#line 306 "pidl/idl.yp" +#line 316 "idl.yp" { push(@{$_[4]}, "$_[2]"); $_[4] } ], - [#Rule 89 + [#Rule 91 'property_list', 0, undef ], - [#Rule 90 + [#Rule 92 'property_list', 4, sub -#line 312 "pidl/idl.yp" +#line 322 "idl.yp" { FlattenHash([$_[1],$_[3]]); } ], - [#Rule 91 + [#Rule 93 'properties', 1, sub -#line 315 "pidl/idl.yp" +#line 325 "idl.yp" { $_[1] } ], - [#Rule 92 + [#Rule 94 'properties', 3, sub -#line 316 "pidl/idl.yp" +#line 326 "idl.yp" { FlattenHash([$_[1], $_[3]]); } ], - [#Rule 93 + [#Rule 95 'property', 1, sub -#line 319 "pidl/idl.yp" +#line 329 "idl.yp" {{ "$_[1]" => "1" }} ], - [#Rule 94 + [#Rule 96 'property', 4, sub -#line 320 "pidl/idl.yp" +#line 330 "idl.yp" {{ "$_[1]" => "$_[3]" }} ], - [#Rule 95 + [#Rule 97 'listtext', 1, undef ], - [#Rule 96 + [#Rule 98 'listtext', 3, sub -#line 325 "pidl/idl.yp" +#line 335 "idl.yp" { "$_[1] $_[3]" } ], - [#Rule 97 + [#Rule 99 'commalisttext', 1, undef ], - [#Rule 98 + [#Rule 100 'commalisttext', 3, sub -#line 330 "pidl/idl.yp" +#line 340 "idl.yp" { "$_[1],$_[3]" } ], - [#Rule 99 + [#Rule 101 'anytext', 0, sub -#line 334 "pidl/idl.yp" +#line 344 "idl.yp" { "" } ], - [#Rule 100 - 'anytext', 1, undef - ], - [#Rule 101 - 'anytext', 1, undef - ], [#Rule 102 'anytext', 1, undef ], [#Rule 103 - 'anytext', 3, -sub -#line 336 "pidl/idl.yp" -{ "$_[1]$_[2]$_[3]" } + 'anytext', 1, undef ], [#Rule 104 - 'anytext', 3, -sub -#line 337 "pidl/idl.yp" -{ "$_[1]$_[2]$_[3]" } + 'anytext', 1, undef ], [#Rule 105 'anytext', 3, sub -#line 338 "pidl/idl.yp" +#line 346 "idl.yp" { "$_[1]$_[2]$_[3]" } ], [#Rule 106 'anytext', 3, sub -#line 339 "pidl/idl.yp" +#line 347 "idl.yp" { "$_[1]$_[2]$_[3]" } ], [#Rule 107 'anytext', 3, sub -#line 340 "pidl/idl.yp" +#line 348 "idl.yp" { "$_[1]$_[2]$_[3]" } ], [#Rule 108 'anytext', 3, sub -#line 341 "pidl/idl.yp" +#line 349 "idl.yp" { "$_[1]$_[2]$_[3]" } ], [#Rule 109 'anytext', 3, sub -#line 342 "pidl/idl.yp" +#line 350 "idl.yp" { "$_[1]$_[2]$_[3]" } ], [#Rule 110 'anytext', 3, sub -#line 343 "pidl/idl.yp" +#line 351 "idl.yp" { "$_[1]$_[2]$_[3]" } ], [#Rule 111 'anytext', 3, sub -#line 344 "pidl/idl.yp" +#line 352 "idl.yp" { "$_[1]$_[2]$_[3]" } ], [#Rule 112 'anytext', 3, sub -#line 345 "pidl/idl.yp" +#line 353 "idl.yp" { "$_[1]$_[2]$_[3]" } ], [#Rule 113 'anytext', 3, sub -#line 346 "pidl/idl.yp" +#line 354 "idl.yp" { "$_[1]$_[2]$_[3]" } ], [#Rule 114 'anytext', 3, sub -#line 347 "pidl/idl.yp" +#line 355 "idl.yp" { "$_[1]$_[2]$_[3]" } ], [#Rule 115 'anytext', 3, sub -#line 348 "pidl/idl.yp" +#line 356 "idl.yp" { "$_[1]$_[2]$_[3]" } ], [#Rule 116 + 'anytext', 3, +sub +#line 357 "idl.yp" +{ "$_[1]$_[2]$_[3]" } + ], + [#Rule 117 + 'anytext', 3, +sub +#line 358 "idl.yp" +{ "$_[1]$_[2]$_[3]" } + ], + [#Rule 118 'anytext', 5, sub -#line 349 "pidl/idl.yp" +#line 359 "idl.yp" { "$_[1]$_[2]$_[3]$_[4]$_[5]" } ], - [#Rule 117 + [#Rule 119 'anytext', 5, sub -#line 350 "pidl/idl.yp" +#line 360 "idl.yp" { "$_[1]$_[2]$_[3]$_[4]$_[5]" } ], - [#Rule 118 + [#Rule 120 'identifier', 1, undef ], - [#Rule 119 + [#Rule 121 'optional_identifier', 1, undef ], - [#Rule 120 + [#Rule 122 'optional_identifier', 0, undef ], - [#Rule 121 + [#Rule 123 'constant', 1, undef ], - [#Rule 122 + [#Rule 124 'text', 1, sub -#line 364 "pidl/idl.yp" +#line 374 "idl.yp" { "\"$_[1]\"" } ], - [#Rule 123 + [#Rule 125 'optional_semicolon', 0, undef ], - [#Rule 124 + [#Rule 126 'optional_semicolon', 1, undef ] ], @@ -2489,7 +2532,7 @@ sub bless($self,$class); } -#line 375 "pidl/idl.yp" +#line 385 "idl.yp" use Parse::Pidl qw(error); @@ -2584,7 +2627,7 @@ again: if (s/^([\w_]+)//) { $parser->YYData->{LAST_TOKEN} = $1; if ($1 =~ - /^(coclass|interface|const|typedef|declare|union + /^(coclass|interface|const|typedef|declare|union|cpp_quote |struct|enum|bitmap|void|unsigned|signed|import|include |importlib)$/x) { return $1; diff --git a/tools/pidl/lib/Parse/Pidl/NDR.pm b/tools/pidl/lib/Parse/Pidl/NDR.pm index d2556cb8e6..f624d2bdc0 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 align_type mapToScalar ParseType); +@EXPORT_OK = qw(GetElementLevelTable ParseElement ValidElement align_type mapToScalar ParseType can_contain_deferred); use strict; use Parse::Pidl qw(warning fatal); @@ -113,6 +113,8 @@ sub GetElementLevelTable($) my $is_varying = 0; my $is_conformant = 0; my $is_string = 0; + my $is_fixed = 0; + my $is_inline = 0; if ($d eq "*") { $is_conformant = 1; @@ -136,17 +138,20 @@ sub GetElementLevelTable($) } } + $is_fixed = 1 if (not $is_conformant and Parse::Pidl::Util::is_constant($size)); + $is_inline = 1 if (not $is_conformant and not Parse::Pidl::Util::is_constant($size)); + push (@$order, { TYPE => "ARRAY", SIZE_IS => $size, LENGTH_IS => $length, - IS_DEFERRED => "$is_deferred", - IS_SURROUNDING => "$is_surrounding", - IS_ZERO_TERMINATED => "$is_string", - IS_VARYING => "$is_varying", - IS_CONFORMANT => "$is_conformant", - IS_FIXED => (not $is_conformant and Parse::Pidl::Util::is_constant($size)), - IS_INLINE => (not $is_conformant and not Parse::Pidl::Util::is_constant($size)) + IS_DEFERRED => $is_deferred, + IS_SURROUNDING => $is_surrounding, + IS_ZERO_TERMINATED => $is_string, + IS_VARYING => $is_varying, + IS_CONFORMANT => $is_conformant, + IS_FIXED => $is_fixed, + IS_INLINE => $is_inline }); } @@ -204,15 +209,15 @@ sub GetElementLevelTable($) if ($array_size or $is_string) { push (@$order, { TYPE => "ARRAY", - IS_ZERO_TERMINATED => "$is_string", SIZE_IS => $array_size, LENGTH_IS => $array_length, - IS_DEFERRED => "$is_deferred", + IS_DEFERRED => $is_deferred, IS_SURROUNDING => 0, - IS_VARYING => "$is_varying", - IS_CONFORMANT => "$is_conformant", + IS_ZERO_TERMINATED => $is_string, + IS_VARYING => $is_varying, + IS_CONFORMANT => $is_conformant, IS_FIXED => 0, - IS_INLINE => 0, + IS_INLINE => 0 }); $is_deferred = 0; @@ -244,22 +249,22 @@ sub GetElementLevelTable($) } if (scalar(@size_is) > 0) { - warning($e, "size_is() on non-array element"); + fatal($e, "size_is() on non-array element"); } if (scalar(@length_is) > 0) { - warning($e, "length_is() on non-array element"); + fatal($e, "length_is() on non-array element"); } if (has_property($e, "string")) { - warning($e, "string() attribute on non-array element"); + fatal($e, "string() attribute on non-array element"); } push (@$order, { TYPE => "DATA", DATA_TYPE => $e->{TYPE}, IS_DEFERRED => $is_deferred, - CONTAINS_DEFERRED => can_contain_deferred($e), + CONTAINS_DEFERRED => can_contain_deferred($e->{TYPE}), IS_SURROUNDING => 0 #FIXME }); @@ -274,18 +279,23 @@ sub GetElementLevelTable($) sub can_contain_deferred($) { sub can_contain_deferred($); - my $e = shift; + my ($type) = @_; + + return 1 unless (hasType($type)); # assume the worst - return 0 if (Parse::Pidl::Typelist::is_scalar($e->{TYPE})); - return 1 unless (hasType($e->{TYPE})); # assume the worst + $type = getType($type); - my $type = getType($e->{TYPE}); + return 0 if (Parse::Pidl::Typelist::is_scalar($type)); return 1 if ($type->{TYPE} eq "DECLARE"); # assume the worst - foreach my $x (@{$type->{DATA}->{ELEMENTS}}) { - return 1 if ($x->{POINTERS}); - return 1 if (can_contain_deferred ($x)); + return can_contain_deferred($type->{DATA}) if ($type->{TYPE} eq "TYPEDEF"); + + return 0 unless defined($type->{ELEMENTS}); + + foreach (@{$type->{ELEMENTS}}) { + return 1 if ($_->{POINTERS}); + return 1 if (can_contain_deferred ($_->{TYPE})); } return 0; @@ -392,6 +402,18 @@ sub ParseStruct($$) my @elements = (); my $surrounding = undef; + return { + TYPE => "STRUCT", + NAME => $struct->{NAME}, + SURROUNDING_ELEMENT => undef, + ELEMENTS => undef, + PROPERTIES => $struct->{PROPERTIES}, + ORIGINAL => $struct, + ALIGN => undef + } unless defined($struct->{ELEMENTS}); + + CheckPointerTypes($struct, $pointer_default); + foreach my $x (@{$struct->{ELEMENTS}}) { my $e = ParseElement($x, $pointer_default); @@ -433,12 +455,23 @@ sub ParseUnion($$) { my ($e, $pointer_default) = @_; my @elements = (); + my $hasdefault = 0; my $switch_type = has_property($e, "switch_type"); unless (defined($switch_type)) { $switch_type = "uint32"; } - if (has_property($e, "nodiscriminant")) { $switch_type = undef; } - - my $hasdefault = 0; + + return { + TYPE => "UNION", + NAME => $e->{NAME}, + SWITCH_TYPE => $switch_type, + ELEMENTS => undef, + PROPERTIES => $e->{PROPERTIES}, + HAS_DEFAULT => $hasdefault, + ORIGINAL => $e + } unless defined($e->{ELEMENTS}); + + CheckPointerTypes($e, $pointer_default); + foreach my $x (@{$e->{ELEMENTS}}) { my $t; @@ -501,11 +534,6 @@ 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); - } - my $data = { STRUCT => \&ParseStruct, UNION => \&ParseUnion, @@ -589,6 +617,8 @@ sub CheckPointerTypes($$) { my ($s,$default) = @_; + return unless defined($s->{ELEMENTS}); + foreach my $e (@{$s->{ELEMENTS}}) { if ($e->{POINTERS} and not defined(pointer_type($e))) { $e->{PROPERTIES}->{$default} = 1; @@ -602,6 +632,8 @@ sub FindNestedTypes($$) my ($l, $t) = @_; return if not defined($t->{ELEMENTS}); + return if ($t->{TYPE} eq "ENUM"); + return if ($t->{TYPE} eq "BITMAP"); foreach (@{$t->{ELEMENTS}}) { if (ref($_->{TYPE}) eq "HASH") { @@ -688,6 +720,7 @@ sub Parse($) my @ndr = (); foreach (@{$idl}) { + ($_->{TYPE} eq "CPP_QUOTE") && push(@ndr, $_); ($_->{TYPE} eq "INTERFACE") && push(@ndr, ParseInterface($_)); ($_->{TYPE} eq "IMPORT") && push(@ndr, $_); } @@ -1003,6 +1036,8 @@ sub ValidStruct($) ValidProperties($struct, "STRUCT"); + return unless defined($struct->{ELEMENTS}); + foreach my $e (@{$struct->{ELEMENTS}}) { $e->{PARENT} = $struct; ValidElement($e); @@ -1020,7 +1055,9 @@ sub ValidUnion($) if (has_property($union->{PARENT}, "nodiscriminant") and has_property($union->{PARENT}, "switch_type")) { fatal($union->{PARENT}, $union->{PARENT}->{NAME} . ": switch_type() on union without discriminant"); } - + + return unless defined($union->{ELEMENTS}); + foreach my $e (@{$union->{ELEMENTS}}) { $e->{PARENT} = $union; @@ -1127,7 +1164,7 @@ sub ValidInterface($) $d->{TYPE} eq "STRUCT" or $d->{TYPE} eq "UNION" or $d->{TYPE} eq "ENUM" or - $d->{TYPE} eq "BITMAP") && ValidType($d); + $d->{TYPE} eq "BITMAP") && ValidType($d); } } @@ -1142,7 +1179,7 @@ sub Validate($) ($x->{TYPE} eq "INTERFACE") && ValidInterface($x); ($x->{TYPE} eq "IMPORTLIB") && - warning($x, "importlib() not supported"); + fatal($x, "importlib() not supported"); } } diff --git a/tools/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm b/tools/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm index 27b71053fb..9c3f01ad93 100644 --- a/tools/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm +++ b/tools/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm @@ -16,6 +16,7 @@ use Parse::Pidl::Typelist qw(hasType getType mapTypeName scalar_is_reference); use Parse::Pidl::Util qw(has_property is_constant ParseExpr); use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel ContainsDeferred); use Parse::Pidl::Samba4 qw(DeclLong); +use Parse::Pidl::Samba4::NDR::Parser qw(GenerateFunctionInEnv); use vars qw($VERSION); $VERSION = '0.01'; @@ -33,27 +34,14 @@ sub new($) bless($self, $class); } -sub GenerateFunctionInEnv($) -{ - my $fn = shift; - my %env; - - foreach my $e (@{$fn->{ELEMENTS}}) { - if (grep (/in/, @{$e->{DIRECTION}})) { - $env{$e->{NAME}} = "r.in.$e->{NAME}"; - } - } - - return \%env; -} - sub ParseFunction($$$) { - my ($self, $uif, $fn) = @_; + my ($self, $if, $fn) = @_; my $inargs = ""; my $defargs = ""; - my $ufn = "DCERPC_".uc($fn->{NAME}); + my $uif = uc($if); + my $ufn = "NDR_".uc($fn->{NAME}); foreach (@{$fn->{ELEMENTS}}) { $defargs .= ", " . DeclLong($_); @@ -76,7 +64,7 @@ sub ParseFunction($$$) $self->pidl("if (DEBUGLEVEL >= 10)"); $self->pidl("\tNDR_PRINT_IN_DEBUG($fn->{NAME}, &r);"); $self->pidl(""); - $self->pidl("status = cli_do_rpc_ndr(cli, mem_ctx, PI_$uif, $ufn, &r, (ndr_pull_flags_fn_t)ndr_pull_$fn->{NAME}, (ndr_push_flags_fn_t)ndr_push_$fn->{NAME});"); + $self->pidl("status = cli_do_rpc_ndr(cli, mem_ctx, PI_$uif, &ndr_table_$if, $ufn, &r);"); $self->pidl(""); $self->pidl("if (!NT_STATUS_IS_OK(status)) {"); @@ -96,31 +84,35 @@ sub ParseFunction($$$) $self->pidl("/* Return variables */"); foreach my $e (@{$fn->{ELEMENTS}}) { next unless (grep(/out/, @{$e->{DIRECTION}})); + my $level = 0; - fatal($e, "[out] argument is not a pointer or array") if ($e->{LEVELS}[0]->{TYPE} ne "POINTER" and $e->{LEVELS}[0]->{TYPE} ne "ARRAY"); + fatal($e->{ORIGINAL}, "[out] argument is not a pointer or array") if ($e->{LEVELS}[0]->{TYPE} ne "POINTER" and $e->{LEVELS}[0]->{TYPE} ne "ARRAY"); - if ( ($e->{LEVELS}[0]->{TYPE} eq "POINTER") and - ($e->{LEVELS}[0]->{POINTER_TYPE} ne "ref") ) { - $self->pidl("if ( $e->{NAME} ) {"); - $self->indent; + if ($e->{LEVELS}[0]->{TYPE} eq "POINTER") { + $level = 1; + if ($e->{LEVELS}[0]->{POINTER_TYPE} ne "ref") { + $self->pidl("if ( $e->{NAME} ) {"); + $self->indent; + } } - if ($e->{LEVELS}[0]->{TYPE} eq "ARRAY") { + if ($e->{LEVELS}[$level]->{TYPE} eq "ARRAY") { # This is a call to GenerateFunctionInEnv intentionally. # Since the data is being copied into a user-provided data # structure, the user should be able to know the size beforehand # to allocate a structure of the right size. - my $env = GenerateFunctionInEnv($fn); - my $size_is = ParseExpr($e->{LEVELS}[0]->{SIZE_IS}, $env, $e); + my $env = GenerateFunctionInEnv($fn, "r."); + my $size_is = ParseExpr($e->{LEVELS}[$level]->{SIZE_IS}, $env, $e->{ORIGINAL}); $self->pidl("memcpy($e->{NAME}, r.out.$e->{NAME}, $size_is);"); } else { $self->pidl("*$e->{NAME} = *r.out.$e->{NAME};"); } - if ( ($e->{LEVELS}[0]->{TYPE} eq "POINTER") and - ($e->{LEVELS}[0]->{POINTER_TYPE} ne "ref") ) { - $self->deindent; - $self->pidl("}"); + if ($e->{LEVELS}[0]->{TYPE} eq "POINTER") { + if ($e->{LEVELS}[0]->{POINTER_TYPE} ne "ref") { + $self->deindent; + $self->pidl("}"); + } } } @@ -150,7 +142,7 @@ sub ParseInterface($$) $self->pidl_hdr("#ifndef __CLI_$uif\__"); $self->pidl_hdr("#define __CLI_$uif\__"); - $self->ParseFunction(uc($if->{NAME}), $_) foreach (@{$if->{FUNCTIONS}}); + $self->ParseFunction($if->{NAME}, $_) foreach (@{$if->{FUNCTIONS}}); $self->pidl_hdr("#endif /* __CLI_$uif\__ */"); } diff --git a/tools/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm b/tools/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm index aa4f3dd1ce..b3aa98ee0a 100644 --- a/tools/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm +++ b/tools/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm @@ -11,7 +11,8 @@ use Parse::Pidl qw(warning fatal); use Parse::Pidl::Typelist qw(mapTypeName scalar_is_reference); use Parse::Pidl::Util qw(ParseExpr has_property is_constant); use Parse::Pidl::NDR qw(GetNextLevel); -use Parse::Pidl::Samba4 qw(DeclLong); +use Parse::Pidl::Samba4 qw(ElementStars DeclLong); +use Parse::Pidl::Samba4::NDR::Parser qw(GenerateFunctionOutEnv); use vars qw($VERSION); $VERSION = '0.01'; @@ -27,36 +28,20 @@ sub fn_declare($) { my ($n) = @_; pidl $n; pidl_hdr "$n;"; } sub DeclLevel($$) { - sub DeclLevel($$); my ($e, $l) = @_; - - my $ret = ""; + my $res = ""; if (has_property($e, "charset")) { - $ret.="const char"; + $res .= "const char"; } else { - $ret.=mapTypeName($e->{TYPE}); + $res .= mapTypeName($e->{TYPE}); } - my $numstar = $e->{ORIGINAL}->{POINTERS}; - if ($numstar >= 1) { - $numstar-- if scalar_is_reference($e->{TYPE}); - } - foreach (@{$e->{ORIGINAL}->{ARRAY_LEN}}) - { - next if is_constant($_) and - not has_property($e, "charset"); - $numstar++; - } - $numstar -= $l; - die ("Too few pointers") if $numstar < 0; - if ($numstar > 0) - { - $ret.=" "; - $ret.="*" foreach (1..$numstar); - } + my $stars = ElementStars($e, $l); - return $ret; + $res .= " ".$stars unless ($stars eq ""); + + return $res; } sub AllocOutVar($$$$) @@ -64,24 +49,30 @@ sub AllocOutVar($$$$) my ($e, $mem_ctx, $name, $env) = @_; my $l = $e->{LEVELS}[0]; - my $nl = $l; + # we skip pointer to arrays if ($l->{TYPE} eq "POINTER") { - $nl = GetNextLevel($e, $l); + my $nl = GetNextLevel($e, $l); + $l = $nl if ($nl->{TYPE} eq "ARRAY"); + } + + # we don't support multi-dimentional arrays yet + if ($l->{TYPE} eq "ARRAY") { + my $nl = GetNextLevel($e, $l); + if ($nl->{TYPE} eq "ARRAY") { + fatal($e->{ORIGINAL},"multi-dimentional [out] arrays are not supported!"); + } } if ($l->{TYPE} eq "ARRAY") { my $size = ParseExpr($l->{SIZE_IS}, $env, $e); pidl "$name = talloc_zero_array($mem_ctx, " . DeclLevel($e, 1) . ", $size);"; - } elsif ($l->{TYPE} eq "POINTER" and $nl->{TYPE} eq "ARRAY") { - my $size = ParseExpr($nl->{SIZE_IS}, $env, $e); - pidl "$name = talloc_zero_array($mem_ctx, " . DeclLevel($e, 1) . ", $size);"; } else { pidl "$name = talloc_zero($mem_ctx, " . DeclLevel($e, 1) . ");"; } pidl "if ($name == NULL) {"; - pidl "\ttalloc_free(mem_ctx);"; + pidl "\ttalloc_free($mem_ctx);"; pidl "\treturn False;"; pidl "}"; pidl ""; @@ -91,64 +82,71 @@ sub ParseFunction($$) { my ($if,$fn) = @_; + my $op = "NDR_".uc($fn->{NAME}); + pidl "static BOOL api_$fn->{NAME}(pipes_struct *p)"; pidl "{"; indent; + pidl "const struct ndr_interface_call *call;"; pidl "struct ndr_pull *pull;"; pidl "struct ndr_push *push;"; pidl "NTSTATUS status;"; pidl "DATA_BLOB blob;"; - pidl "struct $fn->{NAME} r;"; - pidl "TALLOC_CTX *mem_ctx = talloc_init(\"api_$fn->{NAME}\");"; + pidl "struct $fn->{NAME} *r;"; + pidl ""; + pidl "call = &ndr_table_$if->{NAME}.calls[$op];"; + pidl ""; + pidl "r = talloc(NULL, struct $fn->{NAME});"; + pidl "if (r == NULL) {"; + pidl "\treturn False;"; + pidl "}"; pidl ""; - pidl "if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {"; - pidl "\ttalloc_free(mem_ctx);"; + pidl "if (!prs_data_blob(&p->in_data.data, &blob, r)) {"; + pidl "\ttalloc_free(r);"; pidl "\treturn False;"; pidl "}"; pidl ""; - pidl "pull = ndr_pull_init_blob(&blob, mem_ctx);"; + pidl "pull = ndr_pull_init_blob(&blob, r);"; pidl "if (pull == NULL) {"; - pidl "\ttalloc_free(mem_ctx);"; + pidl "\ttalloc_free(r);"; pidl "\treturn False;"; pidl "}"; pidl ""; pidl "pull->flags |= LIBNDR_FLAG_REF_ALLOC;"; - pidl "status = ndr_pull_$fn->{NAME}(pull, NDR_IN, &r);"; + pidl "status = call->ndr_pull(pull, NDR_IN, r);"; pidl "if (NT_STATUS_IS_ERR(status)) {"; - pidl "\ttalloc_free(mem_ctx);"; + pidl "\ttalloc_free(r);"; pidl "\treturn False;"; pidl "}"; pidl ""; pidl "if (DEBUGLEVEL >= 10)"; - pidl "\tNDR_PRINT_IN_DEBUG($fn->{NAME}, &r);"; + pidl "\tNDR_PRINT_IN_DEBUG($fn->{NAME}, r);"; pidl ""; - my %env = (); + my $env = GenerateFunctionOutEnv($fn); my $hasout = 0; foreach (@{$fn->{ELEMENTS}}) { if (grep(/out/, @{$_->{DIRECTION}})) { $hasout = 1; } - next unless (grep (/in/, @{$_->{DIRECTION}})); - $env{$_->{NAME}} = "r.in.$_->{NAME}"; } - pidl "ZERO_STRUCT(r.out);" if ($hasout); + pidl "ZERO_STRUCT(r->out);" if ($hasout); my $proto = "_$fn->{NAME}(pipes_struct *p, struct $fn->{NAME} *r"; - my $ret = "_$fn->{NAME}(p, &r"; + my $ret = "_$fn->{NAME}(p, r"; foreach (@{$fn->{ELEMENTS}}) { my @dir = @{$_->{DIRECTION}}; if (grep(/in/, @dir) and grep(/out/, @dir)) { - pidl "r.out.$_->{NAME} = r.in.$_->{NAME};"; + pidl "r->out.$_->{NAME} = r->in.$_->{NAME};"; } elsif (grep(/out/, @dir) and not has_property($_, "represent_as")) { - AllocOutVar($_, "mem_ctx", "r.out.$_->{NAME}", \%env); + AllocOutVar($_, "r", "r->out.$_->{NAME}", $env); } } $ret .= ")"; $proto .= ");"; if ($fn->{RETURN_TYPE}) { - $ret = "r.out.result = $ret"; + $ret = "r->out.result = $ret"; $proto = "$fn->{RETURN_TYPE} $proto"; } else { $proto = "void $proto"; @@ -159,33 +157,33 @@ sub ParseFunction($$) pidl ""; pidl "if (p->rng_fault_state) {"; - pidl "\ttalloc_free(mem_ctx);"; + pidl "\ttalloc_free(r);"; pidl "\t/* Return True here, srv_pipe_hnd.c will take care */"; pidl "\treturn True;"; pidl "}"; pidl ""; pidl "if (DEBUGLEVEL >= 10)"; - pidl "\tNDR_PRINT_OUT_DEBUG($fn->{NAME}, &r);"; + pidl "\tNDR_PRINT_OUT_DEBUG($fn->{NAME}, r);"; pidl ""; - pidl "push = ndr_push_init_ctx(mem_ctx);"; + pidl "push = ndr_push_init_ctx(r);"; pidl "if (push == NULL) {"; - pidl "\ttalloc_free(mem_ctx);"; + pidl "\ttalloc_free(r);"; pidl "\treturn False;"; pidl "}"; pidl ""; - pidl "status = ndr_push_$fn->{NAME}(push, NDR_OUT, &r);"; + pidl "status = call->ndr_push(push, NDR_OUT, r);"; pidl "if (NT_STATUS_IS_ERR(status)) {"; - pidl "\ttalloc_free(mem_ctx);"; + pidl "\ttalloc_free(r);"; pidl "\treturn False;"; pidl "}"; pidl ""; pidl "blob = ndr_push_blob(push);"; pidl "if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {"; - pidl "\ttalloc_free(mem_ctx);"; + pidl "\ttalloc_free(r);"; pidl "\treturn False;"; pidl "}"; pidl ""; - pidl "talloc_free(mem_ctx);"; + pidl "talloc_free(r);"; pidl ""; pidl "return True;"; deindent; @@ -210,7 +208,7 @@ sub ParseInterface($) indent; foreach (@{$if->{FUNCTIONS}}) { - pidl "{\"" . uc($_->{NAME}) . "\", DCERPC_" . uc($_->{NAME}) . ", api_$_->{NAME}},"; + pidl "{\"" . uc($_->{NAME}) . "\", NDR_" . uc($_->{NAME}) . ", api_$_->{NAME}},"; } deindent; diff --git a/tools/pidl/lib/Parse/Pidl/Samba4.pm b/tools/pidl/lib/Parse/Pidl/Samba4.pm index f6c0ee38f7..5848543a60 100644 --- a/tools/pidl/lib/Parse/Pidl/Samba4.pm +++ b/tools/pidl/lib/Parse/Pidl/Samba4.pm @@ -7,9 +7,10 @@ package Parse::Pidl::Samba4; require Exporter; @ISA = qw(Exporter); -@EXPORT = qw(is_intree choose_header DeclLong); +@EXPORT = qw(is_intree choose_header NumStars ElementStars ArrayBrackets DeclLong); use Parse::Pidl::Util qw(has_property is_constant); +use Parse::Pidl::NDR qw(GetNextLevel); use Parse::Pidl::Typelist qw(mapTypeName scalar_is_reference); use strict; @@ -34,40 +35,84 @@ sub choose_header($$) return "#include <$out>"; } +sub NumStars($;$) +{ + my ($e, $d) = @_; + $d = 0 unless defined($d); + my $n = 0; + + foreach my $l (@{$e->{LEVELS}}) { + next unless ($l->{TYPE} eq "POINTER"); + + my $nl = GetNextLevel($e, $l); + next if (defined($nl) and $nl->{TYPE} eq "ARRAY"); + + $n++; + } + + if ($n >= 1) { + $n-- if (scalar_is_reference($e->{TYPE})); + } + + foreach my $l (@{$e->{LEVELS}}) { + next unless ($l->{TYPE} eq "ARRAY"); + next if ($l->{IS_FIXED}) and not has_property($e, "charset"); + $n++; + } + + fatal($e->{ORIGINAL}, "Too few pointers $n < $d") if ($n < $d); + + $n -= $d; + + return $n; +} + +sub ElementStars($;$) +{ + my ($e, $d) = @_; + my $res = ""; + my $n = 0; + + $n = NumStars($e, $d); + $res .= "*" foreach (1..$n); + + return $res; +} + +sub ArrayBrackets($) +{ + my ($e) = @_; + my $res = ""; + + foreach my $l (@{$e->{LEVELS}}) { + next unless ($l->{TYPE} eq "ARRAY"); + next unless ($l->{IS_FIXED}) and not has_property($e, "charset"); + $res .= "[$l->{SIZE_IS}]"; + } + + return $res; +} + sub DeclLong($) { - my($element) = shift; - my $ret = ""; + my ($e) = shift; + my $res = ""; - if (has_property($element, "represent_as")) { - $ret.=mapTypeName($element->{PROPERTIES}->{represent_as})." "; + if (has_property($e, "represent_as")) { + $res .= mapTypeName($e->{PROPERTIES}->{represent_as})." "; } else { - if (has_property($element, "charset")) { - $ret.="const char"; + if (has_property($e, "charset")) { + $res .= "const char "; } else { - $ret.=mapTypeName($element->{TYPE}); + $res .= mapTypeName($e->{TYPE})." "; } - $ret.=" "; - my $numstar = $element->{ORIGINAL}->{POINTERS}; - if ($numstar >= 1) { - $numstar-- if scalar_is_reference($element->{TYPE}); - } - foreach (@{$element->{ORIGINAL}->{ARRAY_LEN}}) - { - next if is_constant($_) and - not has_property($element, "charset"); - $numstar++; - } - $ret.="*" foreach (1..$numstar); - } - $ret.=$element->{NAME}; - foreach (@{$element->{ARRAY_LEN}}) { - next unless (is_constant($_) and not has_property($element, "charset")); - $ret.="[$_]"; + $res .= ElementStars($e); } + $res .= $e->{NAME}; + $res .= ArrayBrackets($e); - return $ret; + return $res; } 1; diff --git a/tools/pidl/lib/Parse/Pidl/Samba4/EJS.pm b/tools/pidl/lib/Parse/Pidl/Samba4/EJS.pm index 0473341db3..13e38545a7 100644 --- a/tools/pidl/lib/Parse/Pidl/Samba4/EJS.pm +++ b/tools/pidl/lib/Parse/Pidl/Samba4/EJS.pm @@ -689,8 +689,8 @@ sub EjsFunction($$$) { my ($self, $d, $iface) = @_; my $name = $d->{NAME}; - my $callnum = uc("DCERPC_$name"); - my $table = "&dcerpc_table_$iface"; + my $callnum = uc("NDR_$name"); + my $table = "&ndr_table_$iface"; $self->pidl("static int ejs_$name(int eid, int argc, struct MprVar **argv)"); $self->pidl("{"); diff --git a/tools/pidl/lib/Parse/Pidl/Samba4/Header.pm b/tools/pidl/lib/Parse/Pidl/Samba4/Header.pm index 2eddf22b05..071bec297c 100644 --- a/tools/pidl/lib/Parse/Pidl/Samba4/Header.pm +++ b/tools/pidl/lib/Parse/Pidl/Samba4/Header.pm @@ -7,9 +7,10 @@ package Parse::Pidl::Samba4::Header; use strict; +use Parse::Pidl qw(fatal); use Parse::Pidl::Typelist qw(mapTypeName scalar_is_reference); -use Parse::Pidl::Util qw(has_property is_constant); -use Parse::Pidl::Samba4 qw(is_intree); +use Parse::Pidl::Util qw(has_property is_constant unmake_str); +use Parse::Pidl::Samba4 qw(is_intree ElementStars ArrayBrackets); use vars qw($VERSION); $VERSION = '0.01'; @@ -30,10 +31,10 @@ sub tabs() # parse a properties list sub HeaderProperties($$) { - my($props,$ignores) = @_; + my($props,$ignores) = @_; my $ret = ""; - foreach my $d (keys %{$props}) { + foreach my $d (keys %{$props}) { next if (grep(/^$d$/, @$ignores)); if($props->{$d} ne "1") { $ret.= "$d($props->{$d}),"; @@ -62,25 +63,10 @@ sub HeaderElement($) } else { HeaderType($element, $element->{TYPE}, ""); } - pidl " "; - my $numstar = $element->{POINTERS}; - if ($numstar >= 1) { - $numstar-- if (scalar_is_reference($element->{TYPE})); - } - foreach (@{$element->{ARRAY_LEN}}) - { - next if is_constant($_) and - not has_property($element, "charset"); - $numstar++; - } - pidl "*" foreach (1..$numstar); + pidl " ".ElementStars($element); } pidl $element->{NAME}; - foreach (@{$element->{ARRAY_LEN}}) { - next unless (is_constant($_) and - not has_property($element, "charset")); - pidl "[$_]"; - } + pidl ArrayBrackets($element); pidl ";"; if (defined $element->{PROPERTIES}) { @@ -93,22 +79,22 @@ sub HeaderElement($) # parse a struct sub HeaderStruct($$) { - my($struct,$name) = @_; + my($struct,$name) = @_; pidl "struct $name"; - return if (not defined($struct->{ELEMENTS})); + return if (not defined($struct->{ELEMENTS})); pidl " {\n"; - $tab_depth++; - my $el_count=0; + $tab_depth++; + my $el_count=0; foreach (@{$struct->{ELEMENTS}}) { HeaderElement($_); $el_count++; - } - if ($el_count == 0) { - # some compilers can't handle empty structures - pidl tabs()."char _empty_;\n"; - } - $tab_depth--; - pidl tabs()."}"; + } + if ($el_count == 0) { + # some compilers can't handle empty structures + pidl tabs()."char _empty_;\n"; + } + $tab_depth--; + pidl tabs()."}"; if (defined $struct->{PROPERTIES}) { HeaderProperties($struct->{PROPERTIES}, []); } @@ -118,17 +104,19 @@ sub HeaderStruct($$) # parse a enum sub HeaderEnum($$) { - my($enum,$name) = @_; - my $first = 1; + my($enum,$name) = @_; + my $first = 1; pidl "#ifndef USE_UINT_ENUMS\n"; pidl "enum $name {\n"; $tab_depth++; - foreach my $e (@{$enum->{ELEMENTS}}) { - unless ($first) { pidl ",\n"; } - $first = 0; - pidl tabs(); - pidl $e; + if (defined($enum->{ELEMENTS})) { + foreach my $e (@{$enum->{ELEMENTS}}) { + unless ($first) { pidl ",\n"; } + $first = 0; + pidl tabs(); + pidl $e; + } } pidl "\n"; $tab_depth--; @@ -138,24 +126,26 @@ sub HeaderEnum($$) pidl "enum $name { __donnot_use_enum_$name=0x7FFFFFFF}\n"; my $with_val = 0; my $without_val = 0; - foreach my $e (@{$enum->{ELEMENTS}}) { - my $t = "$e"; - my $name; - my $value; - if ($t =~ /(.*)=(.*)/) { - $name = $1; - $value = $2; - $with_val = 1; - die ("you can't mix enum member with values and without values when using --uint-enums!") - unless ($without_val == 0); - } else { - $name = $t; - $value = $count++; - $without_val = 1; - die ("you can't mix enum member with values and without values when using --uint-enums!") - unless ($with_val == 0); - } - pidl "#define $name ( $value )\n"; + if (defined($enum->{ELEMENTS})) { + foreach my $e (@{$enum->{ELEMENTS}}) { + my $t = "$e"; + my $name; + my $value; + if ($t =~ /(.*)=(.*)/) { + $name = $1; + $value = $2; + $with_val = 1; + fatal($e->{ORIGINAL}, "you can't mix enum member with values and without values!") + unless ($without_val == 0); + } else { + $name = $t; + $value = $count++; + $without_val = 1; + fatal($e->{ORIGINAL}, "you can't mix enum member with values and without values!") + unless ($with_val == 0); + } + pidl "#define $name ( $value )\n"; + } } pidl "#endif\n"; } @@ -164,11 +154,13 @@ sub HeaderEnum($$) # parse a bitmap sub HeaderBitmap($$) { - my($bitmap,$name) = @_; + my($bitmap,$name) = @_; + + return unless defined($bitmap->{ELEMENTS}); - pidl "/* bitmap $name */\n"; - pidl "#define $_\n" foreach (@{$bitmap->{ELEMENTS}}); - pidl "\n"; + pidl "/* bitmap $name */\n"; + pidl "#define $_\n" foreach (@{$bitmap->{ELEMENTS}}); + pidl "\n"; } ##################################################################### @@ -222,20 +214,20 @@ sub HeaderType($$$) # parse a typedef sub HeaderTypedef($) { - my($typedef) = shift; - HeaderType($typedef, $typedef->{DATA}, $typedef->{NAME}); + my($typedef) = shift; + HeaderType($typedef, $typedef->{DATA}, $typedef->{NAME}); } ##################################################################### # parse a const sub HeaderConst($) { - my($const) = shift; - if (!defined($const->{ARRAY_LEN}[0])) { - pidl "#define $const->{NAME}\t( $const->{VALUE} )\n"; - } else { - pidl "#define $const->{NAME}\t $const->{VALUE}\n"; - } + my($const) = shift; + if (!defined($const->{ARRAY_LEN}[0])) { + pidl "#define $const->{NAME}\t( $const->{VALUE} )\n"; + } else { + pidl "#define $const->{NAME}\t $const->{VALUE}\n"; + } } sub ElementDirection($) @@ -252,10 +244,12 @@ sub ElementDirection($) # parse a function sub HeaderFunctionInOut($$) { - my($fn,$prop) = @_; + my($fn,$prop) = @_; - foreach (@{$fn->{ELEMENTS}}) { - HeaderElement($_) if (ElementDirection($_) eq $prop); + return unless defined($fn->{ELEMENTS}); + + foreach my $e (@{$fn->{ELEMENTS}}) { + HeaderElement($e) if (ElementDirection($e) eq $prop); } } @@ -263,15 +257,17 @@ sub HeaderFunctionInOut($$) # determine if we need an "in" or "out" section sub HeaderFunctionInOut_needed($$) { - my($fn,$prop) = @_; + my($fn,$prop) = @_; + + return 1 if ($prop eq "out" && defined($fn->{RETURN_TYPE})); - return 1 if ($prop eq "out" && $fn->{RETURN_TYPE} ne "void"); + return undef unless defined($fn->{ELEMENTS}); - foreach (@{$fn->{ELEMENTS}}) { - return 1 if (ElementDirection($_) eq $prop); - } + foreach my $e (@{$fn->{ELEMENTS}}) { + return 1 if (ElementDirection($e) eq $prop); + } - return undef; + return undef; } my %headerstructs; @@ -280,48 +276,48 @@ my %headerstructs; # parse a function sub HeaderFunction($) { - my($fn) = shift; + my($fn) = shift; - return if ($headerstructs{$fn->{NAME}}); + return if ($headerstructs{$fn->{NAME}}); - $headerstructs{$fn->{NAME}} = 1; + $headerstructs{$fn->{NAME}} = 1; - pidl "\nstruct $fn->{NAME} {\n"; - $tab_depth++; - my $needed = 0; + pidl "\nstruct $fn->{NAME} {\n"; + $tab_depth++; + my $needed = 0; - if (HeaderFunctionInOut_needed($fn, "in") or + if (HeaderFunctionInOut_needed($fn, "in") or HeaderFunctionInOut_needed($fn, "inout")) { - pidl tabs()."struct {\n"; - $tab_depth++; - HeaderFunctionInOut($fn, "in"); - HeaderFunctionInOut($fn, "inout"); - $tab_depth--; - pidl tabs()."} in;\n\n"; - $needed++; - } - - if (HeaderFunctionInOut_needed($fn, "out") or + pidl tabs()."struct {\n"; + $tab_depth++; + HeaderFunctionInOut($fn, "in"); + HeaderFunctionInOut($fn, "inout"); + $tab_depth--; + pidl tabs()."} in;\n\n"; + $needed++; + } + + if (HeaderFunctionInOut_needed($fn, "out") or HeaderFunctionInOut_needed($fn, "inout")) { - pidl tabs()."struct {\n"; - $tab_depth++; - HeaderFunctionInOut($fn, "out"); - HeaderFunctionInOut($fn, "inout"); - if ($fn->{RETURN_TYPE} ne "void") { - pidl tabs().mapTypeName($fn->{RETURN_TYPE}) . " result;\n"; - } - $tab_depth--; - pidl tabs()."} out;\n\n"; - $needed++; - } - - if (!$needed) { - # sigh - some compilers don't like empty structures - pidl tabs()."int _dummy_element;\n"; - } - - $tab_depth--; - pidl "};\n\n"; + pidl tabs()."struct {\n"; + $tab_depth++; + HeaderFunctionInOut($fn, "out"); + HeaderFunctionInOut($fn, "inout"); + if (defined($fn->{RETURN_TYPE})) { + pidl tabs().mapTypeName($fn->{RETURN_TYPE}) . " result;\n"; + } + $tab_depth--; + pidl tabs()."} out;\n\n"; + $needed++; + } + + if (!$needed) { + # sigh - some compilers don't like empty structures + pidl tabs()."int _dummy_element;\n"; + } + + $tab_depth--; + pidl "};\n\n"; } sub HeaderImport @@ -351,55 +347,62 @@ sub HeaderInterface($) pidl "#ifndef _HEADER_$interface->{NAME}\n"; pidl "#define _HEADER_$interface->{NAME}\n\n"; - foreach my $d (@{$interface->{DATA}}) { - next if ($d->{TYPE} ne "CONST"); - HeaderConst($d); + foreach my $c (@{$interface->{CONSTS}}) { + HeaderConst($c); } - foreach my $d (@{$interface->{DATA}}) { - HeaderTypedef($d) if ($d->{TYPE} eq "TYPEDEF"); - HeaderStruct($d, $d->{NAME}) if ($d->{TYPE} eq "STRUCT"); - HeaderUnion($d, $d->{NAME}) if ($d->{TYPE} eq "UNION"); - HeaderEnum($d, $d->{NAME}) if ($d->{TYPE} eq "ENUM"); - HeaderBitmap($d, $d->{NAME}) if ($d->{TYPE} eq "BITMAP"); - pidl ";\n\n" if ($d->{TYPE} eq "BITMAP" or - $d->{TYPE} eq "STRUCT" or - $d->{TYPE} eq "TYPEDEF" or - $d->{TYPE} eq "UNION" or - $d->{TYPE} eq "ENUM"); + foreach my $t (@{$interface->{TYPES}}) { + HeaderTypedef($t) if ($t->{TYPE} eq "TYPEDEF"); + HeaderStruct($t, $t->{NAME}) if ($t->{TYPE} eq "STRUCT"); + HeaderUnion($t, $t->{NAME}) if ($t->{TYPE} eq "UNION"); + HeaderEnum($t, $t->{NAME}) if ($t->{TYPE} eq "ENUM"); + HeaderBitmap($t, $t->{NAME}) if ($t->{TYPE} eq "BITMAP"); + pidl ";\n\n" if ($t->{TYPE} eq "BITMAP" or + $t->{TYPE} eq "STRUCT" or + $t->{TYPE} eq "TYPEDEF" or + $t->{TYPE} eq "UNION" or + $t->{TYPE} eq "ENUM"); } - foreach my $d (@{$interface->{DATA}}) { - next if ($d->{TYPE} ne "FUNCTION"); - - HeaderFunction($d); + foreach my $fn (@{$interface->{FUNCTIONS}}) { + HeaderFunction($fn); } pidl "#endif /* _HEADER_$interface->{NAME} */\n"; } +sub HeaderQuote($) +{ + my($quote) = shift; + + pidl unmake_str($quote->{DATA}) . "\n"; +} + ##################################################################### # parse a parsed IDL into a C header sub Parse($) { - my($idl) = shift; - $tab_depth = 0; + my($ndr) = shift; + $tab_depth = 0; $res = ""; %headerstructs = (); - pidl "/* header auto-generated by pidl */\n\n"; + pidl "/* header auto-generated by pidl */\n\n"; if (!is_intree()) { - pidl "#include <core.h>\n"; + pidl "#include <util/data_blob.h>\n"; + pidl "#include <gen_ndr/misc.h>\n"; } pidl "#include <stdint.h>\n"; pidl "\n"; - - foreach (@{$idl}) { - ($_->{TYPE} eq "INTERFACE") && HeaderInterface($_); - ($_->{TYPE} eq "IMPORT") && HeaderImport(@{$_->{PATHS}}); - ($_->{TYPE} eq "INCLUDE") && HeaderInclude(@{$_->{PATHS}}); - } - return $res; + + foreach (@{$ndr}) { + ($_->{TYPE} eq "CPP_QUOTE") && HeaderQuote($_); + ($_->{TYPE} eq "INTERFACE") && HeaderInterface($_); + ($_->{TYPE} eq "IMPORT") && HeaderImport(@{$_->{PATHS}}); + ($_->{TYPE} eq "INCLUDE") && HeaderInclude(@{$_->{PATHS}}); + } + + return $res; } 1; diff --git a/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm b/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm index 3b12c8f173..cf14b645a9 100644 --- a/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm +++ b/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm @@ -34,7 +34,7 @@ struct rpc_request *dcerpc_$name\_send(struct dcerpc_pipe *p, TALLOC_CTX *mem_ct NDR_PRINT_IN_DEBUG($name, r); } - return dcerpc_ndr_request_send(p, NULL, &dcerpc_table_$interface->{NAME}, DCERPC_$uname, mem_ctx, r); + return dcerpc_ndr_request_send(p, NULL, &ndr_table_$interface->{NAME}, NDR_$uname, mem_ctx, r); } NTSTATUS dcerpc_$name(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *r) @@ -74,7 +74,7 @@ sub ParseInterface($) $res_hdr .= "#define _HEADER_RPC_$interface->{NAME}\n\n"; if (defined $interface->{PROPERTIES}->{uuid}) { - $res_hdr .= "extern const struct dcerpc_interface_table dcerpc_table_$interface->{NAME};\n"; + $res_hdr .= "extern const struct ndr_interface_table ndr_table_$interface->{NAME};\n"; } $res .= "/* $interface->{NAME} - client functions generated by pidl */\n\n"; diff --git a/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm index b65df06884..9a29b72c1d 100644 --- a/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm +++ b/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm @@ -243,30 +243,34 @@ sub EnvSubstituteValue($$) return $env; } -sub GenerateFunctionInEnv($) +sub GenerateFunctionInEnv($;$) { - my $fn = shift; + my ($fn, $base) = @_; my %env; + $base = "r->" unless defined($base); + foreach my $e (@{$fn->{ELEMENTS}}) { if (grep (/in/, @{$e->{DIRECTION}})) { - $env{$e->{NAME}} = "r->in.$e->{NAME}"; + $env{$e->{NAME}} = $base."in.$e->{NAME}"; } } return \%env; } -sub GenerateFunctionOutEnv($) +sub GenerateFunctionOutEnv($;$) { - my $fn = shift; + my ($fn, $base) = @_; my %env; + $base = "r->" unless defined($base); + foreach my $e (@{$fn->{ELEMENTS}}) { if (grep (/out/, @{$e->{DIRECTION}})) { - $env{$e->{NAME}} = "r->out.$e->{NAME}"; + $env{$e->{NAME}} = $base."out.$e->{NAME}"; } elsif (grep (/in/, @{$e->{DIRECTION}})) { - $env{$e->{NAME}} = "r->in.$e->{NAME}"; + $env{$e->{NAME}} = $base."in.$e->{NAME}"; } } @@ -2277,7 +2281,7 @@ sub FunctionTable($$) return if ($#{$interface->{FUNCTIONS}}+1 == 0); return unless defined ($interface->{PROPERTIES}->{uuid}); - $self->pidl("static const struct dcerpc_interface_call $interface->{NAME}\_calls[] = {"); + $self->pidl("static const struct ndr_interface_call $interface->{NAME}\_calls[] = {"); foreach my $d (@{$interface->{FUNCTIONS}}) { next if not defined($d->{OPNUM}); $self->pidl("\t{"); @@ -2286,11 +2290,11 @@ sub FunctionTable($$) $self->pidl("\t\t(ndr_push_flags_fn_t) ndr_push_$d->{NAME},"); $self->pidl("\t\t(ndr_pull_flags_fn_t) ndr_pull_$d->{NAME},"); $self->pidl("\t\t(ndr_print_function_t) ndr_print_$d->{NAME},"); - $self->pidl("\t\t".($d->{ASYNC}?"True":"False").","); + $self->pidl("\t\t".($d->{ASYNC}?"true":"false").","); $self->pidl("\t},"); $count++; } - $self->pidl("\t{ NULL, 0, NULL, NULL, NULL, False }"); + $self->pidl("\t{ NULL, 0, NULL, NULL, NULL, false }"); $self->pidl("};"); $self->pidl(""); @@ -2303,7 +2307,7 @@ sub FunctionTable($$) $self->pidl("};"); $self->pidl(""); - $self->pidl("static const struct dcerpc_endpoint_list $interface->{NAME}\_endpoints = {"); + $self->pidl("static const struct ndr_interface_string_array $interface->{NAME}\_endpoints = {"); $self->pidl("\t.count\t= $endpoint_count,"); $self->pidl("\t.names\t= $interface->{NAME}\_endpoint_strings"); $self->pidl("};"); @@ -2323,19 +2327,19 @@ sub FunctionTable($$) $self->pidl("};"); $self->pidl(""); - $self->pidl("static const struct dcerpc_authservice_list $interface->{NAME}\_authservices = {"); + $self->pidl("static const struct ndr_interface_string_array $interface->{NAME}\_authservices = {"); $self->pidl("\t.count\t= $endpoint_count,"); $self->pidl("\t.names\t= $interface->{NAME}\_authservice_strings"); $self->pidl("};"); $self->pidl(""); - $self->pidl("\nconst struct dcerpc_interface_table dcerpc_table_$interface->{NAME} = {"); + $self->pidl("\nconst struct ndr_interface_table ndr_table_$interface->{NAME} = {"); $self->pidl("\t.name\t\t= \"$interface->{NAME}\","); $self->pidl("\t.syntax_id\t= {"); $self->pidl("\t\t" . print_uuid($interface->{UUID}) .","); - $self->pidl("\t\tDCERPC_$uname\_VERSION"); + $self->pidl("\t\tNDR_$uname\_VERSION"); $self->pidl("\t},"); - $self->pidl("\t.helpstring\t= DCERPC_$uname\_HELPSTRING,"); + $self->pidl("\t.helpstring\t= NDR_$uname\_HELPSTRING,"); $self->pidl("\t.num_calls\t= $count,"); $self->pidl("\t.calls\t\t= $interface->{NAME}\_calls,"); $self->pidl("\t.endpoints\t= &$interface->{NAME}\_endpoints,"); @@ -2391,19 +2395,18 @@ sub HeaderInterface($$) if (defined $interface->{PROPERTIES}->{uuid}) { my $name = uc $interface->{NAME}; - $self->pidl_hdr("#define DCERPC_$name\_UUID " . + $self->pidl_hdr("#define NDR_$name\_UUID " . Parse::Pidl::Util::make_str(lc($interface->{PROPERTIES}->{uuid}))); if(!defined $interface->{PROPERTIES}->{version}) { $interface->{PROPERTIES}->{version} = "0.0"; } - $self->pidl_hdr("#define DCERPC_$name\_VERSION $interface->{PROPERTIES}->{version}"); + $self->pidl_hdr("#define NDR_$name\_VERSION $interface->{PROPERTIES}->{version}"); - $self->pidl_hdr("#define DCERPC_$name\_NAME \"$interface->{NAME}\""); + $self->pidl_hdr("#define NDR_$name\_NAME \"$interface->{NAME}\""); if(!defined $interface->{PROPERTIES}->{helpstring}) { $interface->{PROPERTIES}->{helpstring} = "NULL"; } - $self->pidl_hdr("#define DCERPC_$name\_HELPSTRING $interface->{PROPERTIES}->{helpstring}"); + $self->pidl_hdr("#define NDR_$name\_HELPSTRING $interface->{PROPERTIES}->{helpstring}"); - $self->pidl_hdr("extern const struct dcerpc_interface_table dcerpc_table_$interface->{NAME};"); - $self->pidl_hdr("NTSTATUS dcerpc_server_$interface->{NAME}_init(void);"); + $self->pidl_hdr("extern const struct ndr_interface_table ndr_table_$interface->{NAME};"); } foreach (@{$interface->{FUNCTIONS}}) { @@ -2413,10 +2416,10 @@ sub HeaderInterface($$) my $val = sprintf("0x%02x", $count); if (defined($interface->{BASE})) { - $val .= " + DCERPC_" . uc $interface->{BASE} . "_CALL_COUNT"; + $val .= " + NDR_" . uc $interface->{BASE} . "_CALL_COUNT"; } - $self->pidl_hdr("#define DCERPC_$u_name ($val)"); + $self->pidl_hdr("#define NDR_$u_name ($val)"); $self->pidl_hdr(""); $count++; @@ -2425,10 +2428,10 @@ sub HeaderInterface($$) my $val = $count; if (defined($interface->{BASE})) { - $val .= " + DCERPC_" . uc $interface->{BASE} . "_CALL_COUNT"; + $val .= " + NDR_" . uc $interface->{BASE} . "_CALL_COUNT"; } - $self->pidl_hdr("#define DCERPC_" . uc $interface->{NAME} . "_CALL_COUNT ($val)"); + $self->pidl_hdr("#define NDR_" . uc $interface->{NAME} . "_CALL_COUNT ($val)"); } @@ -2596,8 +2599,6 @@ sub GenerateIncludes($) if (is_intree() != 3) { $self->pidl(choose_header("libcli/util/nterr.h", "core/nterr.h")); $self->pidl(choose_header("librpc/gen_ndr/ndr_misc.h", "gen_ndr/ndr_misc.h")); - $self->pidl(choose_header("librpc/gen_ndr/ndr_dcerpc.h", "gen_ndr/ndr_dcerpc.h")); - $self->pidl(choose_header("librpc/rpc/dcerpc.h", "dcerpc.h")); #FIXME: This shouldn't be here! } } diff --git a/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm b/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm index bd58342189..ed17fcc0da 100644 --- a/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm +++ b/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm @@ -106,18 +106,21 @@ static NTSTATUS $name\__op_ndr_pull(struct dcesrv_call_state *dce_call, TALLOC_C dce_call->fault_code = 0; - if (opnum >= dcerpc_table_$name.num_calls) { + if (opnum >= ndr_table_$name.num_calls) { dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR; return NT_STATUS_NET_WRITE_FAULT; } - *r = talloc_size(mem_ctx, dcerpc_table_$name.calls[opnum].struct_size); + *r = talloc_named(mem_ctx, + ndr_table_$name.calls[opnum].struct_size, + \"struct %s\", + ndr_table_$name.calls[opnum].name); NT_STATUS_HAVE_NO_MEMORY(*r); /* unravel the NDR for the packet */ - status = dcerpc_table_$name.calls[opnum].ndr_pull(pull, NDR_IN, *r); + status = ndr_table_$name.calls[opnum].ndr_pull(pull, NDR_IN, *r); if (!NT_STATUS_IS_OK(status)) { - dcerpc_log_packet(&dcerpc_table_$name, opnum, NDR_IN, + dcerpc_log_packet(&ndr_table_$name, opnum, NDR_IN, &dce_call->pkt.u.request.stub_and_verifier); dce_call->fault_code = DCERPC_FAULT_NDR; return NT_STATUS_NET_WRITE_FAULT; @@ -141,7 +144,7 @@ pidl " } if (dce_call->fault_code != 0) { - dcerpc_log_packet(&dcerpc_table_$name, opnum, NDR_IN, + dcerpc_log_packet(&ndr_table_$name, opnum, NDR_IN, &dce_call->pkt.u.request.stub_and_verifier); return NT_STATUS_NET_WRITE_FAULT; } @@ -164,7 +167,7 @@ pidl " } if (dce_call->fault_code != 0) { - dcerpc_log_packet(&dcerpc_table_$name, opnum, NDR_IN, + dcerpc_log_packet(&ndr_table_$name, opnum, NDR_IN, &dce_call->pkt.u.request.stub_and_verifier); return NT_STATUS_NET_WRITE_FAULT; } @@ -177,7 +180,7 @@ static NTSTATUS $name\__op_ndr_push(struct dcesrv_call_state *dce_call, TALLOC_C NTSTATUS status; uint16_t opnum = dce_call->pkt.u.request.opnum; - status = dcerpc_table_$name.calls[opnum].ndr_push(push, NDR_OUT, r); + status = ndr_table_$name.calls[opnum].ndr_push(push, NDR_OUT, r); if (!NT_STATUS_IS_OK(status)) { dce_call->fault_code = DCERPC_FAULT_NDR; return NT_STATUS_NET_WRITE_FAULT; @@ -213,9 +216,9 @@ static NTSTATUS $name\__op_init_server(struct dcesrv_context *dce_ctx, const str { int i; - for (i=0;i<dcerpc_table_$name.endpoints->count;i++) { + for (i=0;i<ndr_table_$name.endpoints->count;i++) { NTSTATUS ret; - const char *name = dcerpc_table_$name.endpoints->names[i]; + const char *name = ndr_table_$name.endpoints->names[i]; ret = dcesrv_interface_register(dce_ctx, name, &dcesrv_$name\_interface, NULL); if (!NT_STATUS_IS_OK(ret)) { @@ -227,25 +230,25 @@ static NTSTATUS $name\__op_init_server(struct dcesrv_context *dce_ctx, const str return NT_STATUS_OK; } -static BOOL $name\__op_interface_by_uuid(struct dcesrv_interface *iface, const struct GUID *uuid, uint32_t if_version) +static bool $name\__op_interface_by_uuid(struct dcesrv_interface *iface, const struct GUID *uuid, uint32_t if_version) { if (dcesrv_$name\_interface.syntax_id.if_version == if_version && GUID_equal(\&dcesrv\_$name\_interface.syntax_id.uuid, uuid)) { memcpy(iface,&dcesrv\_$name\_interface, sizeof(*iface)); - return True; + return true; } - return False; + return false; } -static BOOL $name\__op_interface_by_name(struct dcesrv_interface *iface, const char *name) +static bool $name\__op_interface_by_name(struct dcesrv_interface *iface, const char *name) { if (strcmp(dcesrv_$name\_interface.name, name)==0) { memcpy(iface, &dcesrv_$name\_interface, sizeof(*iface)); - return True; + return true; } - return False; + return false; } NTSTATUS dcerpc_server_$name\_init(void) diff --git a/tools/pidl/lib/Parse/Pidl/Samba4/SWIG.pm b/tools/pidl/lib/Parse/Pidl/Samba4/SWIG.pm index d541f318ee..df960d8de8 100644 --- a/tools/pidl/lib/Parse/Pidl/Samba4/SWIG.pm +++ b/tools/pidl/lib/Parse/Pidl/Samba4/SWIG.pm @@ -52,7 +52,7 @@ sub ParseInterface($$) pidl "struct $if->{NAME} *ret = talloc(mem_ctx, struct $if->{NAME});"; pidl "NTSTATUS status;"; pidl ""; - pidl "status = dcerpc_pipe_connect(mem_ctx, &ret->pipe, binding, &dcerpc_table_$if->{NAME}, cred, event);"; + pidl "status = dcerpc_pipe_connect(mem_ctx, &ret->pipe, binding, &ndr_table_$if->{NAME}, cred, event);"; pidl "if (NT_STATUS_IS_ERR(status)) {"; pidl "\tntstatus_exception(status);"; pidl "\treturn NULL;"; diff --git a/tools/pidl/lib/Parse/Pidl/Samba4/TDR.pm b/tools/pidl/lib/Parse/Pidl/Samba4/TDR.pm index a3cb4f3016..832a2c5463 100644 --- a/tools/pidl/lib/Parse/Pidl/Samba4/TDR.pm +++ b/tools/pidl/lib/Parse/Pidl/Samba4/TDR.pm @@ -194,8 +194,8 @@ sub ParserBitmap($$$$) sub ParserEnum($$$$) { my ($self,$e,$t,$p) = @_; - my $bt = ($e->{PROPERTIES}->{base_type} or "uint8"); - + my $bt = Parse::Pidl::Typelist::enum_type_fn($e); + $self->fn_declare($p, "NTSTATUS tdr_$t\_$e->{NAME} (struct tdr_$t *tdr".typearg($t).", enum $e->{NAME} *v)"); $self->pidl("{"); if ($t eq "pull") { diff --git a/tools/pidl/lib/Parse/Pidl/Samba4/Template.pm b/tools/pidl/lib/Parse/Pidl/Samba4/Template.pm index f953d0f2fe..a35fc7d2eb 100644 --- a/tools/pidl/lib/Parse/Pidl/Samba4/Template.pm +++ b/tools/pidl/lib/Parse/Pidl/Samba4/Template.pm @@ -30,7 +30,7 @@ sub Template($) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -39,8 +39,7 @@ sub Template($) GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include \"includes.h\" diff --git a/tools/pidl/lib/Parse/Pidl/Typelist.pm b/tools/pidl/lib/Parse/Pidl/Typelist.pm index e635411f3c..b2069c784b 100644 --- a/tools/pidl/lib/Parse/Pidl/Typelist.pm +++ b/tools/pidl/lib/Parse/Pidl/Typelist.pm @@ -174,8 +174,18 @@ sub enum_type_fn($) { my $enum = shift; $enum->{TYPE} eq "ENUM" or die("not an enum"); - if (has_property($enum->{PARENT}, "enum8bit")) { + + # for typedef enum { } we need to check $enum->{PARENT} + if (has_property($enum, "enum8bit")) { return "uint8"; + } elsif (has_property($enum, "enum16bit")) { + return "uint16"; + } elsif (has_property($enum, "v1_enum")) { + return "uint32"; + } elsif (has_property($enum->{PARENT}, "enum8bit")) { + return "uint8"; + } elsif (has_property($enum->{PARENT}, "enum16bit")) { + return "uint16"; } elsif (has_property($enum->{PARENT}, "v1_enum")) { return "uint32"; } diff --git a/tools/pidl/lib/Parse/Pidl/Util.pm b/tools/pidl/lib/Parse/Pidl/Util.pm index 8716094abd..006718d139 100644 --- a/tools/pidl/lib/Parse/Pidl/Util.pm +++ b/tools/pidl/lib/Parse/Pidl/Util.pm @@ -6,7 +6,7 @@ package Parse::Pidl::Util; require Exporter; @ISA = qw(Exporter); -@EXPORT = qw(has_property property_matches ParseExpr ParseExprExt is_constant make_str print_uuid MyDumper); +@EXPORT = qw(has_property property_matches ParseExpr ParseExprExt is_constant make_str unmake_str print_uuid MyDumper); use vars qw($VERSION); $VERSION = '0.01'; @@ -104,6 +104,19 @@ sub make_str($) return "\"$str\""; } +=item B<unmake_str> +unquote a "" quoted string + +=cut +sub unmake_str($) +{ + my $str = shift; + + $str =~ s/^\"(.*)\"$/$1/; + + return $str; +} + =item B<print_uuid> Print C representation of a UUID. diff --git a/tools/pidl/pidl b/tools/pidl/pidl index 5ce9b0f004..4150ff7720 100755 --- a/tools/pidl/pidl +++ b/tools/pidl/pidl @@ -273,7 +273,7 @@ Datagram support (ncadg_*) in, out, ref, length_is, switch_is, size_is, uuid, case, default, string, unique, ptr, pointer_default, v1_enum, object, helpstring, range, local, call_as, endpoint, switch_type, progid, coclass, iid_is, represent_as, -transmit_as, import, include. +transmit_as, import, include, cpp_quote. =head2 PIDL Specific properties @@ -347,7 +347,7 @@ to the host format. Commonly used values are UCS2, DOS and UTF8. =head2 Unsupported MIDL properties or statements -aggregatable, appobject, async_uuid, bindable, control, cpp_quote, +aggregatable, appobject, async_uuid, bindable, control, defaultbind, defaultcollelem, defaultvalue, defaultvtable, dispinterface, displaybind, dual, entry, first_is, helpcontext, helpfile, helpstringcontext, helpstringdll, hidden, idl_module, idl_quote, id, immediatebind, importlib, @@ -601,12 +601,18 @@ sub process_file($) } if (defined($opt_ws_parser) or - defined($opt_client) or defined($opt_server) or - defined($opt_ndr_parser) or defined($opt_ejs) or - defined($opt_dump_ndr_tree) or defined($opt_samba3_header) or - defined($opt_samba3_parser) or defined($opt_samba3_server) or - defined($opt_swig) or defined($opt_samba3_ndr_client) or - defined($opt_samba3_ndr_server)) { + defined($opt_client) or + defined($opt_server) or + defined($opt_header) or + defined($opt_ndr_parser) or + defined($opt_ejs) or + defined($opt_dump_ndr_tree) or + defined($opt_samba3_header) or + defined($opt_samba3_parser) or + defined($opt_samba3_server) or + defined($opt_swig) or + defined($opt_samba3_ndr_client) or + defined($opt_samba3_ndr_server)) { require Parse::Pidl::NDR; $ndr = Parse::Pidl::NDR::Parse($pidl); } @@ -619,7 +625,7 @@ sub process_file($) my $gen_header = ($opt_header or "$outputdir/$basename.h"); if (defined($opt_header)) { require Parse::Pidl::Samba4::Header; - FileSave($gen_header, Parse::Pidl::Samba4::Header::Parse($pidl)); + FileSave($gen_header, Parse::Pidl::Samba4::Header::Parse($ndr)); } my $h_filename = "$outputdir/ndr_$basename.h"; diff --git a/tools/pidl/tests/Util.pm b/tools/pidl/tests/Util.pm index 897e848440..c7fca95aaa 100644 --- a/tools/pidl/tests/Util.pm +++ b/tools/pidl/tests/Util.pm @@ -48,12 +48,14 @@ sub test_samba4_ndr { my ($name,$idl,$c,$extra) = @_; my $pidl = Parse::Pidl::IDL::parse_string("interface echo { $idl }; ", "<$name>"); - ok(defined($pidl), "($name) parse idl"); - my $header = Parse::Pidl::Samba4::Header::Parse($pidl); - ok(defined($header), "($name) generate generic header"); + my $pndr = Parse::Pidl::NDR::Parse($pidl); ok(defined($pndr), "($name) generate NDR tree"); + + my $header = Parse::Pidl::Samba4::Header::Parse($pndr); + ok(defined($header), "($name) generate generic header"); + my $generator = new Parse::Pidl::Samba4::NDR::Parser(); my ($ndrheader,$ndrparser) = $generator->Parse($pndr, undef, undef); ok(defined($ndrparser), "($name) generate NDR parser"); @@ -100,7 +102,7 @@ SKIP: { print CC "#include <stdio.h>\n"; print CC "#include <stdbool.h>\n"; print CC "#include <stdarg.h>\n"; - print CC "#include <core.h>\n"; + print CC "#include <util/data_blob.h>\n"; print CC $header; print CC $ndrheader; print CC $extra if ($extra); diff --git a/tools/pidl/tests/header.pl b/tools/pidl/tests/header.pl index 331f4dd9fb..8d0dccf507 100755 --- a/tools/pidl/tests/header.pl +++ b/tools/pidl/tests/header.pl @@ -4,19 +4,21 @@ use strict; use warnings; -use Test::More tests => 15; +use Test::More tests => 16; use FindBin qw($RealBin); use lib "$RealBin"; use Util; use Parse::Pidl::Util qw(MyDumper); use Parse::Pidl::Samba4::Header; use Parse::Pidl::IDL qw(parse_string); +use Parse::Pidl::NDR; sub parse_idl($) { my $text = shift; my $idl = Parse::Pidl::IDL::parse_string($text, "nofile"); - return Parse::Pidl::Samba4::Header::Parse($idl); + my $ndr = Parse::Pidl::NDR::Parse($idl); + return Parse::Pidl::Samba4::Header::Parse($ndr); } like(parse_idl(""), qr/\/\* header auto-generated by pidl \*\/\n/sm, "includes work"); @@ -51,3 +53,6 @@ like(parse_idl("interface p { struct x; };"), like(parse_idl("interface p { typedef struct x { int p; } x; };"), qr/struct x.*{.*int32_t p;.*};/sm, "double struct declaration"); + +like(parse_idl("cpp_quote(\"some-foo\")"), + qr/some-foo/sm, "cpp quote"); diff --git a/tools/pidl/tests/ndr.pl b/tools/pidl/tests/ndr.pl index 8245f768e8..1512f19d52 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 => 26; +use Test::More tests => 34; use FindBin qw($RealBin); use lib "$RealBin"; use Util; use Parse::Pidl::Util qw(MyDumper); -use Parse::Pidl::NDR qw(GetElementLevelTable ParseElement align_type mapToScalar ParseType); +use Parse::Pidl::NDR qw(GetElementLevelTable ParseElement align_type mapToScalar ParseType can_contain_deferred); # Case 1 @@ -225,5 +225,46 @@ 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" }); +my $t; +$t = { + TYPE => "STRUCT", + NAME => "foo", + SURROUNDING_ELEMENT => undef, + ELEMENTS => undef, + PROPERTIES => undef, + ORIGINAL => { + TYPE => "STRUCT", + NAME => "foo" + }, + ALIGN => undef +}; +is_deeply(ParseType($t->{ORIGINAL}, "ref"), $t); + +$t = { + TYPE => "UNION", + NAME => "foo", + SWITCH_TYPE => "uint32", + ELEMENTS => undef, + PROPERTIES => undef, + HAS_DEFAULT => 0, + ORIGINAL => { + TYPE => "UNION", + NAME => "foo" + } +}; +is_deeply(ParseType($t->{ORIGINAL}, "ref"), $t); + +ok(not can_contain_deferred("uint32")); +ok(can_contain_deferred("some_unknown_type")); +ok(can_contain_deferred({ TYPE => "STRUCT", + ELEMENTS => [ { TYPE => "uint32", POINTERS => 40 } ]})); +ok(can_contain_deferred({ TYPE => "TYPEDEF", + DATA => { TYPE => "STRUCT", + ELEMENTS => [ { TYPE => "uint32", POINTERS => 40 } ]}})); +ok(not can_contain_deferred({ TYPE => "STRUCT", + ELEMENTS => [ { TYPE => "uint32" } ]})); +ok(not can_contain_deferred({ TYPE => "TYPEDEF", + DATA => { TYPE => "STRUCT", + ELEMENTS => [ { TYPE => "uint32" } ]}})); +ok(can_contain_deferred({ TYPE => "STRUCT", + ELEMENTS => [ { TYPE => "someunknowntype" } ]})); diff --git a/tools/pidl/tests/parse_idl.pl b/tools/pidl/tests/parse_idl.pl index b82bd80e54..96c7b2adc8 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 => 64 * 2 + 2; +use Test::More tests => 65 * 2 + 3; use FindBin qw($RealBin); use lib "$RealBin"; use Util qw(test_errors); @@ -109,6 +109,7 @@ 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; }"; +testok "cpp-quote", "cpp_quote(\"bla\")"; my $x = Parse::Pidl::IDL::parse_string("interface foo { struct x {}; }", "<foo>"); @@ -122,3 +123,10 @@ is_deeply($x, [ { 'FILE' => '<foo>', 'NAME' => 'foo', 'DATA' => [ { 'NAME' => 'x', 'TYPE' => 'STRUCT' } ], 'TYPE' => 'INTERFACE', 'LINE' => 0 } ]); + +$x = Parse::Pidl::IDL::parse_string("cpp_quote(\"foobar\")", "<quote>"); +is_deeply($x, + [ { 'FILE' => '<quote>', 'DATA' => '"foobar"', + 'TYPE' => 'CPP_QUOTE', 'LINE' => 0 } ]); + + diff --git a/tools/pidl/tests/samba3-cli.pl b/tools/pidl/tests/samba3-cli.pl index c5537c145e..8c06ed8c27 100755 --- a/tools/pidl/tests/samba3-cli.pl +++ b/tools/pidl/tests/samba3-cli.pl @@ -4,22 +4,26 @@ use strict; use warnings; -use Test::More tests => 4; +use Test::More tests => 7; use FindBin qw($RealBin); use lib "$RealBin"; use Util; use Parse::Pidl::Util qw(MyDumper); -use Parse::Pidl::Samba3::ClientNDR qw(GenerateFunctionInEnv ParseFunction); +use Parse::Pidl::Samba3::ClientNDR qw(ParseFunction); +use Parse::Pidl::Samba4::NDR::Parser qw(GenerateFunctionInEnv GenerateFunctionOutEnv); # Make sure GenerateFunctionInEnv and GenerateFunctionOutEnv work my $fn = { ELEMENTS => [ { DIRECTION => ["in"], NAME => "foo" } ] }; -is_deeply({ "foo" => "r.in.foo" }, GenerateFunctionInEnv($fn)); +is_deeply({ "foo" => "r.in.foo" }, GenerateFunctionInEnv($fn, "r.")); +is_deeply({ "foo" => "r.in.foo" }, GenerateFunctionOutEnv($fn, "r.")); $fn = { ELEMENTS => [ { DIRECTION => ["out", "in"], NAME => "foo" } ] }; -is_deeply({ "foo" => "r.in.foo" }, GenerateFunctionInEnv($fn)); +is_deeply({ "foo" => "r.in.foo" }, GenerateFunctionInEnv($fn, "r.")); +is_deeply({ "foo" => "r.out.foo" }, GenerateFunctionOutEnv($fn, "r.")); $fn = { ELEMENTS => [ { DIRECTION => ["out"], NAME => "foo" } ] }; -is_deeply({ }, GenerateFunctionInEnv($fn)); +is_deeply({ }, GenerateFunctionInEnv($fn, "r.")); +is_deeply({ "foo" => "r.out.foo" }, GenerateFunctionOutEnv($fn, "r.")); my $x = new Parse::Pidl::Samba3::ClientNDR(); @@ -35,7 +39,7 @@ is($x->{res}, "NTSTATUS rpccli_bar(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ \tif (DEBUGLEVEL >= 10) \t\tNDR_PRINT_IN_DEBUG(bar, &r); \t -\tstatus = cli_do_rpc_ndr(cli, mem_ctx, PI_foo, DCERPC_BAR, &r, (ndr_pull_flags_fn_t)ndr_pull_bar, (ndr_push_flags_fn_t)ndr_push_bar); +\tstatus = cli_do_rpc_ndr(cli, mem_ctx, PI_FOO, &ndr_table_foo, NDR_BAR, &r); \t \tif (!NT_STATUS_IS_OK(status)) { \t\treturn status; diff --git a/tools/pidl/tests/util.pl b/tools/pidl/tests/util.pl index ba2f7b7b49..cb77f34c51 100755 --- a/tools/pidl/tests/util.pl +++ b/tools/pidl/tests/util.pl @@ -4,7 +4,7 @@ use strict; use warnings; -use Test::More tests => 70; +use Test::More tests => 72; use FindBin qw($RealBin); use lib "$RealBin"; use Util; @@ -33,6 +33,9 @@ is("\"\"bla\"\"", make_str("\"\"bla\"\"")); is("\"bla\"\"", make_str("bla\"")); is("\"foo\"bar\"", make_str("foo\"bar")); +is("bla", unmake_str("\"bla\"")); +is("\"bla\"", unmake_str("\"\"bla\"\"")); + # print_uuid() is(undef, print_uuid("invalid")); is("{0x12345778,0x1234,0xabcd,{0xef,0x00},{0x01,0x23,0x45,0x67,0x89,0xac}}", |