From e3fd8743417a655a478f49dd76f7cae6245f150b Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 6 Jan 2005 06:32:07 +0000 Subject: r4551: add support for a pidl extensions 'declare bitmap foo1;' 'declare enum foo2;' and also allow typedef [public] bitmap ... typedef [public] enum ... you need to a forward declaration of bitmaps and enums when you want to use them in another idl file, and you need to make the real declaration to be public see the next commit to samr.idl and netlogon.idl metze (This used to be commit a8d61aa47388b82595ee02b9cfd35f15afb93c2a) --- source4/build/pidl/header.pm | 34 +- source4/build/pidl/idl.pm | 1029 +++++++++++++++++++++++------------------- source4/build/pidl/idl.yp | 28 +- source4/build/pidl/parser.pm | 5 +- 4 files changed, 622 insertions(+), 474 deletions(-) (limited to 'source4/build') diff --git a/source4/build/pidl/header.pm b/source4/build/pidl/header.pm index 10adf94dba..0deead29ff 100644 --- a/source4/build/pidl/header.pm +++ b/source4/build/pidl/header.pm @@ -199,6 +199,19 @@ sub HeaderType($$$) } } +##################################################################### +# parse a declare +sub HeaderDeclare($) +{ + my($declare) = shift; + + if ($declare->{DATA}->{TYPE} eq "ENUM") { + util::enum_bitmap($declare, $declare->{NAME}); + } elsif ($declare->{DATA}->{TYPE} eq "BITMAP") { + util::register_bitmap($declare, $declare->{NAME}); + } +} + ##################################################################### # parse a typedef sub HeaderTypedef($) @@ -237,6 +250,23 @@ sub HeaderTypedefProto($) $res .= "void ndr_print_$d->{NAME}(struct ndr_print *ndr, const char *name, int level, union $d->{NAME} *r);\n"; } } + + if ($d->{DATA}{TYPE} eq "ENUM") { + $res .= "NTSTATUS ndr_push_$d->{NAME}(struct ndr_push *ndr, enum $d->{NAME} r);\n"; + $res .= "NTSTATUS ndr_pull_$d->{NAME}(struct ndr_pull *ndr, enum $d->{NAME} *r);\n"; + if (!util::has_property($d, "noprint")) { + $res .= "void ndr_print_$d->{NAME}(struct ndr_print *ndr, const char *name, enum $d->{NAME} r);\n"; + } + } + + if ($d->{DATA}{TYPE} eq "BITMAP") { + my $type_decl = util::bitmap_type_decl($d->{DATA}); + $res .= "NTSTATUS ndr_push_$d->{NAME}(struct ndr_push *ndr, $type_decl r);\n"; + $res .= "NTSTATUS ndr_pull_$d->{NAME}(struct ndr_pull *ndr, $type_decl *r);\n"; + if (!util::has_property($d, "noprint")) { + $res .= "void ndr_print_$d->{NAME}(struct ndr_print *ndr, const char *name, $type_decl r);\n"; + } + } } ##################################################################### @@ -431,6 +461,8 @@ sub HeaderInterface($) foreach my $d (@{$data}) { ($d->{TYPE} eq "CONST") && HeaderConst($d); + ($d->{TYPE} eq "DECLARE") && + HeaderDeclare($d); ($d->{TYPE} eq "TYPEDEF") && HeaderTypedef($d); ($d->{TYPE} eq "TYPEDEF") && @@ -438,7 +470,7 @@ sub HeaderInterface($) ($d->{TYPE} eq "FUNCTION") && HeaderFunction($d); ($d->{TYPE} eq "FUNCTION") && - HeaderFnProto($interface, $d); + HeaderFnProto($interface, $d); } (util::has_property($interface, "object")) && diff --git a/source4/build/pidl/idl.pm b/source4/build/pidl/idl.pm index a3e23fcda1..e1600b5b40 100644 --- a/source4/build/pidl/idl.pm +++ b/source4/build/pidl/idl.pm @@ -509,7 +509,7 @@ sub new { ACTIONS => { '' => 2 }, - DEFAULT => -54, + DEFAULT => -60, GOTOS => { 'interface' => 3, 'coclass' => 4, @@ -559,7 +559,7 @@ sub new { } }, {#State 9 - DEFAULT => -78 + DEFAULT => -84 }, {#State 10 ACTIONS => { @@ -570,10 +570,10 @@ sub new { ACTIONS => { "(" => 16 }, - DEFAULT => -58 + DEFAULT => -64 }, {#State 12 - DEFAULT => -56 + DEFAULT => -62 }, {#State 13 ACTIONS => { @@ -602,7 +602,7 @@ sub new { 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -64, + DEFAULT => -70, GOTOS => { 'identifier' => 23, 'listtext' => 26, @@ -621,7 +621,7 @@ sub new { } }, {#State 18 - DEFAULT => -55 + DEFAULT => -61 }, {#State 19 ACTIONS => { @@ -640,20 +640,20 @@ sub new { ACTIONS => { "}" => 32 }, - DEFAULT => -54, + DEFAULT => -60, GOTOS => { 'interface' => 33, 'property_list' => 34 } }, {#State 22 - DEFAULT => -80 + DEFAULT => -86 }, {#State 23 - DEFAULT => -65 + DEFAULT => -71 }, {#State 24 - DEFAULT => -67 + DEFAULT => -73 }, {#State 25 ACTIONS => { @@ -668,7 +668,7 @@ sub new { "." => 43, ">" => 44 }, - DEFAULT => -60 + DEFAULT => -66 }, {#State 26 ACTIONS => { @@ -677,13 +677,13 @@ sub new { } }, {#State 27 - DEFAULT => -66 + DEFAULT => -72 }, {#State 28 - DEFAULT => -79 + DEFAULT => -85 }, {#State 29 - DEFAULT => -57 + DEFAULT => -63 }, {#State 30 DEFAULT => -9 @@ -691,13 +691,15 @@ sub new { {#State 31 ACTIONS => { "typedef" => 47, - "const" => 53 + "declare" => 52, + "const" => 55 }, - DEFAULT => -54, + DEFAULT => -60, GOTOS => { - 'const' => 52, + 'const' => 54, + 'declare' => 53, 'function' => 48, - 'typedef' => 54, + 'typedef' => 56, 'definitions' => 49, 'definition' => 51, 'property_list' => 50 @@ -705,11 +707,11 @@ sub new { }, {#State 32 ACTIONS => { - ";" => 56 + ";" => 58 }, - DEFAULT => -81, + DEFAULT => -87, GOTOS => { - 'optional_semicolon' => 55 + 'optional_semicolon' => 57 } }, {#State 33 @@ -727,11 +729,11 @@ sub new { 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -64, + DEFAULT => -70, GOTOS => { 'identifier' => 23, 'text' => 24, - 'anytext' => 57, + 'anytext' => 59, 'constant' => 27 } }, @@ -741,11 +743,11 @@ sub new { 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -64, + DEFAULT => -70, GOTOS => { 'identifier' => 23, 'text' => 24, - 'anytext' => 58, + 'anytext' => 60, 'constant' => 27 } }, @@ -755,13 +757,13 @@ sub new { 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -64, + DEFAULT => -70, GOTOS => { 'identifier' => 23, 'text' => 24, - 'anytext' => 59, + 'anytext' => 61, 'constant' => 27, - 'commalisttext' => 60 + 'commalisttext' => 62 } }, {#State 38 @@ -770,11 +772,11 @@ sub new { 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -64, + DEFAULT => -70, GOTOS => { 'identifier' => 23, 'text' => 24, - 'anytext' => 61, + 'anytext' => 63, 'constant' => 27 } }, @@ -784,11 +786,11 @@ sub new { 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -64, + DEFAULT => -70, GOTOS => { 'identifier' => 23, 'text' => 24, - 'anytext' => 62, + 'anytext' => 64, 'constant' => 27 } }, @@ -798,11 +800,11 @@ sub new { 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -64, + DEFAULT => -70, GOTOS => { 'identifier' => 23, 'text' => 24, - 'anytext' => 63, + 'anytext' => 65, 'constant' => 27 } }, @@ -812,13 +814,13 @@ sub new { 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -64, + DEFAULT => -70, GOTOS => { 'identifier' => 23, 'text' => 24, - 'anytext' => 59, + 'anytext' => 61, 'constant' => 27, - 'commalisttext' => 64 + 'commalisttext' => 66 } }, {#State 42 @@ -827,11 +829,11 @@ sub new { 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -64, + DEFAULT => -70, GOTOS => { 'identifier' => 23, 'text' => 24, - 'anytext' => 65, + 'anytext' => 67, 'constant' => 27 } }, @@ -841,11 +843,11 @@ sub new { 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -64, + DEFAULT => -70, GOTOS => { 'identifier' => 23, 'text' => 24, - 'anytext' => 66, + 'anytext' => 68, 'constant' => 27 } }, @@ -855,11 +857,11 @@ sub new { 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -64, + DEFAULT => -70, GOTOS => { 'identifier' => 23, 'text' => 24, - 'anytext' => 67, + 'anytext' => 69, 'constant' => 27 } }, @@ -869,21 +871,21 @@ sub new { 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -64, + DEFAULT => -70, GOTOS => { 'identifier' => 23, 'text' => 24, - 'anytext' => 68, + 'anytext' => 70, 'constant' => 27 } }, {#State 46 - DEFAULT => -59 + DEFAULT => -65 }, {#State 47 - DEFAULT => -54, + DEFAULT => -60, GOTOS => { - 'property_list' => 69 + 'property_list' => 71 } }, {#State 48 @@ -891,74 +893,85 @@ sub new { }, {#State 49 ACTIONS => { - "}" => 70, + "}" => 72, "typedef" => 47, - "const" => 53 + "declare" => 52, + "const" => 55 }, - DEFAULT => -54, + DEFAULT => -60, GOTOS => { - 'const' => 52, + 'const' => 54, + 'declare' => 53, 'function' => 48, - 'typedef' => 54, - 'definition' => 71, + 'typedef' => 56, + 'definition' => 73, 'property_list' => 50 } }, {#State 50 ACTIONS => { 'IDENTIFIER' => 9, - "union" => 72, - "enum" => 73, + "union" => 74, + "enum" => 75, "[" => 7, - 'void' => 75, - "bitmap" => 74, - "struct" => 82 + 'void' => 77, + "bitmap" => 76, + "struct" => 84 }, GOTOS => { - 'identifier' => 77, - 'struct' => 78, - 'enum' => 79, - 'type' => 80, - 'union' => 81, - 'bitmap' => 76 + 'identifier' => 79, + 'struct' => 80, + 'enum' => 81, + 'type' => 82, + 'union' => 83, + 'bitmap' => 78 } }, {#State 51 DEFAULT => -10 }, {#State 52 - DEFAULT => -13 + DEFAULT => -60, + GOTOS => { + 'property_list' => 85 + } }, {#State 53 + DEFAULT => -15 + }, + {#State 54 + DEFAULT => -13 + }, + {#State 55 ACTIONS => { 'IDENTIFIER' => 9 }, GOTOS => { - 'identifier' => 83 + 'identifier' => 86 } }, - {#State 54 + {#State 56 DEFAULT => -14 }, - {#State 55 + {#State 57 DEFAULT => -4 }, - {#State 56 - DEFAULT => -82 + {#State 58 + DEFAULT => -88 }, - {#State 57 + {#State 59 ACTIONS => { "{" => 37 }, - DEFAULT => -68 + DEFAULT => -74 }, - {#State 58 + {#State 60 ACTIONS => { "{" => 37 }, - DEFAULT => -75 + DEFAULT => -81 }, - {#State 59 + {#State 61 ACTIONS => { "-" => 35, "+" => 36, @@ -971,57 +984,57 @@ sub new { "." => 43, ">" => 44 }, - DEFAULT => -62 + DEFAULT => -68 }, - {#State 60 + {#State 62 ACTIONS => { - "}" => 84, - "," => 85 + "}" => 87, + "," => 88 } }, - {#State 61 + {#State 63 ACTIONS => { "{" => 37 }, - DEFAULT => -73 + DEFAULT => -79 }, - {#State 62 + {#State 64 ACTIONS => { "{" => 37 }, - DEFAULT => -74 + DEFAULT => -80 }, - {#State 63 + {#State 65 ACTIONS => { "{" => 37 }, - DEFAULT => -72 + DEFAULT => -78 }, - {#State 64 + {#State 66 ACTIONS => { - "," => 85, - ")" => 86 + "," => 88, + ")" => 89 } }, - {#State 65 + {#State 67 ACTIONS => { "{" => 37 }, - DEFAULT => -70 + DEFAULT => -76 }, - {#State 66 + {#State 68 ACTIONS => { "{" => 37 }, - DEFAULT => -69 + DEFAULT => -75 }, - {#State 67 + {#State 69 ACTIONS => { "{" => 37 }, - DEFAULT => -71 + DEFAULT => -77 }, - {#State 68 + {#State 70 ACTIONS => { "-" => 35, "+" => 36, @@ -1034,196 +1047,228 @@ sub new { "." => 43, ">" => 44 }, - DEFAULT => -61 + DEFAULT => -67 }, - {#State 69 + {#State 71 ACTIONS => { 'IDENTIFIER' => 9, - "union" => 72, - "enum" => 73, + "union" => 74, + "enum" => 75, "[" => 7, - 'void' => 75, - "bitmap" => 74, - "struct" => 82 + 'void' => 77, + "bitmap" => 76, + "struct" => 84 }, GOTOS => { - 'identifier' => 77, - 'struct' => 78, - 'enum' => 79, - 'type' => 87, - 'union' => 81, - 'bitmap' => 76 + 'identifier' => 79, + 'struct' => 80, + 'enum' => 81, + 'type' => 90, + 'union' => 83, + 'bitmap' => 78 } }, - {#State 70 + {#State 72 ACTIONS => { - ";" => 56 + ";" => 58 }, - DEFAULT => -81, + DEFAULT => -87, GOTOS => { - 'optional_semicolon' => 88 + 'optional_semicolon' => 91 } }, - {#State 71 + {#State 73 DEFAULT => -11 }, - {#State 72 + {#State 74 ACTIONS => { - "{" => 89 + "{" => 92 } }, - {#State 73 + {#State 75 ACTIONS => { - "{" => 90 + "{" => 93 } }, - {#State 74 + {#State 76 ACTIONS => { - "{" => 91 + "{" => 94 } }, - {#State 75 - DEFAULT => -24 - }, - {#State 76 - DEFAULT => -22 - }, {#State 77 - DEFAULT => -23 + DEFAULT => -30 }, {#State 78 - DEFAULT => -19 + DEFAULT => -28 }, {#State 79 - DEFAULT => -21 + DEFAULT => -29 }, {#State 80 + DEFAULT => -25 + }, + {#State 81 + DEFAULT => -27 + }, + {#State 82 ACTIONS => { 'IDENTIFIER' => 9 }, GOTOS => { - 'identifier' => 92 + 'identifier' => 95 } }, - {#State 81 - DEFAULT => -20 + {#State 83 + DEFAULT => -26 }, - {#State 82 + {#State 84 ACTIONS => { - "{" => 93 + "{" => 96 } }, - {#State 83 + {#State 85 + ACTIONS => { + "enum" => 97, + "[" => 7, + "bitmap" => 98 + }, + GOTOS => { + 'decl_enum' => 99, + 'decl_bitmap' => 100, + 'decl_type' => 101 + } + }, + {#State 86 ACTIONS => { 'IDENTIFIER' => 9 }, GOTOS => { - 'identifier' => 94 + 'identifier' => 102 } }, - {#State 84 + {#State 87 ACTIONS => { 'CONSTANT' => 28, 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -64, + DEFAULT => -70, GOTOS => { 'identifier' => 23, 'text' => 24, - 'anytext' => 95, + 'anytext' => 103, 'constant' => 27 } }, - {#State 85 + {#State 88 ACTIONS => { 'CONSTANT' => 28, 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -64, + DEFAULT => -70, GOTOS => { 'identifier' => 23, 'text' => 24, - 'anytext' => 96, + 'anytext' => 104, 'constant' => 27 } }, - {#State 86 + {#State 89 ACTIONS => { 'CONSTANT' => 28, 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -64, + DEFAULT => -70, GOTOS => { 'identifier' => 23, 'text' => 24, - 'anytext' => 97, + 'anytext' => 105, 'constant' => 27 } }, - {#State 87 + {#State 90 ACTIONS => { 'IDENTIFIER' => 9 }, GOTOS => { - 'identifier' => 98 + 'identifier' => 106 } }, - {#State 88 + {#State 91 DEFAULT => -7 }, - {#State 89 + {#State 92 ACTIONS => { - "[" => 101 + "[" => 109 }, GOTOS => { - 'union_elements' => 99, - 'union_element' => 100 + 'union_elements' => 107, + 'union_element' => 108 } }, - {#State 90 + {#State 93 ACTIONS => { 'IDENTIFIER' => 9 }, GOTOS => { - 'identifier' => 102, - 'enum_element' => 103, - 'enum_elements' => 104 + 'identifier' => 110, + 'enum_element' => 111, + 'enum_elements' => 112 } }, - {#State 91 + {#State 94 ACTIONS => { 'IDENTIFIER' => 9 }, GOTOS => { - 'identifier' => 107, - 'bitmap_elements' => 106, - 'bitmap_element' => 105 + 'identifier' => 115, + 'bitmap_elements' => 114, + 'bitmap_element' => 113 } }, - {#State 92 + {#State 95 ACTIONS => { - "(" => 108 + "(" => 116 } }, - {#State 93 - DEFAULT => -45, + {#State 96 + DEFAULT => -51, GOTOS => { - 'element_list1' => 109 + 'element_list1' => 117 } }, - {#State 94 + {#State 97 + DEFAULT => -22 + }, + {#State 98 + DEFAULT => -23 + }, + {#State 99 + DEFAULT => -20 + }, + {#State 100 + DEFAULT => -21 + }, + {#State 101 ACTIONS => { - "[" => 112, - "=" => 111 + 'IDENTIFIER' => 9 }, GOTOS => { - 'array_len' => 110 + 'identifier' => 118 } }, - {#State 95 + {#State 102 + ACTIONS => { + "[" => 121, + "=" => 120 + }, + GOTOS => { + 'array_len' => 119 + } + }, + {#State 103 ACTIONS => { "-" => 35, "+" => 36, @@ -1236,9 +1281,9 @@ sub new { "." => 43, ">" => 44 }, - DEFAULT => -77 + DEFAULT => -83 }, - {#State 96 + {#State 104 ACTIONS => { "-" => 35, "+" => 36, @@ -1251,257 +1296,265 @@ sub new { "." => 43, ">" => 44 }, - DEFAULT => -63 + DEFAULT => -69 }, - {#State 97 + {#State 105 ACTIONS => { "{" => 37 }, - DEFAULT => -76 + DEFAULT => -82 }, - {#State 98 + {#State 106 ACTIONS => { - "[" => 112 + "[" => 121 }, - DEFAULT => -51, + DEFAULT => -57, GOTOS => { - 'array_len' => 113 + 'array_len' => 122 } }, - {#State 99 + {#State 107 ACTIONS => { - "}" => 114, - "[" => 101 + "}" => 123, + "[" => 109 }, GOTOS => { - 'union_element' => 115 + 'union_element' => 124 } }, - {#State 100 - DEFAULT => -36 + {#State 108 + DEFAULT => -42 }, - {#State 101 + {#State 109 ACTIONS => { - "case" => 116, - "default" => 117 + "case" => 125, + "default" => 126 } }, - {#State 102 + {#State 110 ACTIONS => { - "=" => 118 + "=" => 127 }, - DEFAULT => -28 + DEFAULT => -34 }, - {#State 103 - DEFAULT => -26 + {#State 111 + DEFAULT => -32 }, - {#State 104 + {#State 112 ACTIONS => { - "}" => 119, - "," => 120 + "}" => 128, + "," => 129 } }, - {#State 105 - DEFAULT => -31 + {#State 113 + DEFAULT => -37 }, - {#State 106 + {#State 114 ACTIONS => { - "}" => 121, - "," => 122 + "}" => 130, + "," => 131 } }, - {#State 107 + {#State 115 ACTIONS => { - "=" => 123 + "=" => 132 } }, - {#State 108 + {#State 116 ACTIONS => { - "," => -47, - "void" => 126, - ")" => -47 + "," => -53, + "void" => 135, + ")" => -53 }, - DEFAULT => -54, + DEFAULT => -60, GOTOS => { - 'base_element' => 124, - 'element_list2' => 127, - 'property_list' => 125 + 'base_element' => 133, + 'element_list2' => 136, + 'property_list' => 134 } }, - {#State 109 + {#State 117 ACTIONS => { - "}" => 128 + "}" => 137 }, - DEFAULT => -54, + DEFAULT => -60, GOTOS => { - 'base_element' => 129, - 'property_list' => 125 + 'base_element' => 138, + 'property_list' => 134 } }, - {#State 110 + {#State 118 ACTIONS => { - "=" => 130 + ";" => 139 } }, - {#State 111 + {#State 119 + ACTIONS => { + "=" => 140 + } + }, + {#State 120 ACTIONS => { 'IDENTIFIER' => 9, 'CONSTANT' => 28, 'TEXT' => 22 }, - DEFAULT => -64, + DEFAULT => -70, GOTOS => { 'identifier' => 23, 'text' => 24, - 'anytext' => 131, + 'anytext' => 141, 'constant' => 27 } }, - {#State 112 + {#State 121 ACTIONS => { 'IDENTIFIER' => 9, 'CONSTANT' => 28, 'TEXT' => 22, - "]" => 133 + "]" => 143 }, - DEFAULT => -64, + DEFAULT => -70, GOTOS => { 'identifier' => 23, 'text' => 24, - 'anytext' => 132, + 'anytext' => 142, 'constant' => 27 } }, - {#State 113 + {#State 122 ACTIONS => { - ";" => 134 + ";" => 144 } }, - {#State 114 - DEFAULT => -35 + {#State 123 + DEFAULT => -41 }, - {#State 115 - DEFAULT => -37 + {#State 124 + DEFAULT => -43 }, - {#State 116 + {#State 125 ACTIONS => { - "(" => 135 + "(" => 145 } }, - {#State 117 + {#State 126 ACTIONS => { - "]" => 136 + "]" => 146 } }, - {#State 118 + {#State 127 ACTIONS => { 'CONSTANT' => 28, 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -64, + DEFAULT => -70, GOTOS => { 'identifier' => 23, 'text' => 24, - 'anytext' => 137, + 'anytext' => 147, 'constant' => 27 } }, - {#State 119 - DEFAULT => -25 + {#State 128 + DEFAULT => -31 }, - {#State 120 + {#State 129 ACTIONS => { 'IDENTIFIER' => 9 }, GOTOS => { - 'identifier' => 102, - 'enum_element' => 138 + 'identifier' => 110, + 'enum_element' => 148 } }, - {#State 121 - DEFAULT => -30 + {#State 130 + DEFAULT => -36 }, - {#State 122 + {#State 131 ACTIONS => { 'IDENTIFIER' => 9 }, GOTOS => { - 'identifier' => 107, - 'bitmap_element' => 139 + 'identifier' => 115, + 'bitmap_element' => 149 } }, - {#State 123 + {#State 132 ACTIONS => { 'CONSTANT' => 28, 'TEXT' => 22, 'IDENTIFIER' => 9 }, - DEFAULT => -64, + DEFAULT => -70, GOTOS => { 'identifier' => 23, 'text' => 24, - 'anytext' => 140, + 'anytext' => 150, 'constant' => 27 } }, - {#State 124 - DEFAULT => -49 + {#State 133 + DEFAULT => -55 }, - {#State 125 + {#State 134 ACTIONS => { 'IDENTIFIER' => 9, - "union" => 72, - "enum" => 73, + "union" => 74, + "enum" => 75, "[" => 7, - 'void' => 75, - "bitmap" => 74, - "struct" => 82 + 'void' => 77, + "bitmap" => 76, + "struct" => 84 }, GOTOS => { - 'identifier' => 77, - 'struct' => 78, - 'enum' => 79, - 'type' => 141, - 'union' => 81, - 'bitmap' => 76 + 'identifier' => 79, + 'struct' => 80, + 'enum' => 81, + 'type' => 151, + 'union' => 83, + 'bitmap' => 78 } }, - {#State 126 - DEFAULT => -48 + {#State 135 + DEFAULT => -54 }, - {#State 127 + {#State 136 ACTIONS => { - "," => 142, - ")" => 143 + "," => 152, + ")" => 153 } }, - {#State 128 - DEFAULT => -34 + {#State 137 + DEFAULT => -40 }, - {#State 129 + {#State 138 ACTIONS => { - ";" => 144 + ";" => 154 } }, - {#State 130 + {#State 139 + DEFAULT => -19 + }, + {#State 140 ACTIONS => { 'IDENTIFIER' => 9, 'CONSTANT' => 28, 'TEXT' => 22 }, - DEFAULT => -64, + DEFAULT => -70, GOTOS => { 'identifier' => 23, 'text' => 24, - 'anytext' => 145, + 'anytext' => 155, 'constant' => 27 } }, - {#State 131 + {#State 141 ACTIONS => { "-" => 35, - ";" => 146, + ";" => 156, "+" => 36, "&" => 38, "{" => 37, @@ -1513,7 +1566,7 @@ sub new { ">" => 44 } }, - {#State 132 + {#State 142 ACTIONS => { "-" => 35, "+" => 36, @@ -1524,41 +1577,41 @@ sub new { "|" => 40, "*" => 42, "." => 43, - "]" => 147, + "]" => 157, ">" => 44 } }, - {#State 133 - DEFAULT => -52 + {#State 143 + DEFAULT => -58 }, - {#State 134 - DEFAULT => -18 + {#State 144 + DEFAULT => -24 }, - {#State 135 + {#State 145 ACTIONS => { 'IDENTIFIER' => 9, 'CONSTANT' => 28, 'TEXT' => 22 }, - DEFAULT => -64, + DEFAULT => -70, GOTOS => { 'identifier' => 23, 'text' => 24, - 'anytext' => 148, + 'anytext' => 158, 'constant' => 27 } }, - {#State 136 + {#State 146 ACTIONS => { - ";" => 149 + ";" => 159 }, - DEFAULT => -54, + DEFAULT => -60, GOTOS => { - 'base_element' => 150, - 'property_list' => 125 + 'base_element' => 160, + 'property_list' => 134 } }, - {#State 137 + {#State 147 ACTIONS => { "-" => 35, "+" => 36, @@ -1571,15 +1624,15 @@ sub new { "." => 43, ">" => 44 }, - DEFAULT => -29 + DEFAULT => -35 }, - {#State 138 - DEFAULT => -27 + {#State 148 + DEFAULT => -33 }, - {#State 139 - DEFAULT => -32 + {#State 149 + DEFAULT => -38 }, - {#State 140 + {#State 150 ACTIONS => { "-" => 35, "+" => 36, @@ -1592,33 +1645,33 @@ sub new { "." => 43, ">" => 44 }, - DEFAULT => -33 + DEFAULT => -39 }, - {#State 141 - DEFAULT => -43, + {#State 151 + DEFAULT => -49, GOTOS => { - 'pointers' => 151 + 'pointers' => 161 } }, - {#State 142 - DEFAULT => -54, + {#State 152 + DEFAULT => -60, GOTOS => { - 'base_element' => 152, - 'property_list' => 125 + 'base_element' => 162, + 'property_list' => 134 } }, - {#State 143 + {#State 153 ACTIONS => { - ";" => 153 + ";" => 163 } }, - {#State 144 - DEFAULT => -46 + {#State 154 + DEFAULT => -52 }, - {#State 145 + {#State 155 ACTIONS => { "-" => 35, - ";" => 154, + ";" => 164, "+" => 36, "&" => 38, "{" => 37, @@ -1630,13 +1683,13 @@ sub new { ">" => 44 } }, - {#State 146 - DEFAULT => -15 + {#State 156 + DEFAULT => -16 }, - {#State 147 - DEFAULT => -53 + {#State 157 + DEFAULT => -59 }, - {#State 148 + {#State 158 ACTIONS => { "-" => 35, "+" => 36, @@ -1647,79 +1700,79 @@ sub new { "|" => 40, "*" => 42, "." => 43, - ")" => 155, + ")" => 165, ">" => 44 } }, - {#State 149 - DEFAULT => -41 + {#State 159 + DEFAULT => -47 }, - {#State 150 + {#State 160 ACTIONS => { - ";" => 156 + ";" => 166 } }, - {#State 151 + {#State 161 ACTIONS => { 'IDENTIFIER' => 9, - "*" => 158 + "*" => 168 }, GOTOS => { - 'identifier' => 157 + 'identifier' => 167 } }, - {#State 152 - DEFAULT => -50 + {#State 162 + DEFAULT => -56 }, - {#State 153 - DEFAULT => -17 + {#State 163 + DEFAULT => -18 }, - {#State 154 - DEFAULT => -16 + {#State 164 + DEFAULT => -17 }, - {#State 155 + {#State 165 ACTIONS => { - "]" => 159 + "]" => 169 } }, - {#State 156 - DEFAULT => -40 + {#State 166 + DEFAULT => -46 }, - {#State 157 + {#State 167 ACTIONS => { - "[" => 112 + "[" => 121 }, - DEFAULT => -51, + DEFAULT => -57, GOTOS => { - 'array_len' => 160 + 'array_len' => 170 } }, - {#State 158 - DEFAULT => -44 + {#State 168 + DEFAULT => -50 }, - {#State 159 + {#State 169 ACTIONS => { - ";" => 161 + ";" => 171 }, - DEFAULT => -54, + DEFAULT => -60, GOTOS => { - 'base_element' => 162, - 'property_list' => 125 + 'base_element' => 172, + 'property_list' => 134 } }, - {#State 160 - DEFAULT => -42 + {#State 170 + DEFAULT => -48 }, - {#State 161 - DEFAULT => -39 + {#State 171 + DEFAULT => -45 }, - {#State 162 + {#State 172 ACTIONS => { - ";" => 163 + ";" => 173 } }, - {#State 163 - DEFAULT => -38 + {#State 173 + DEFAULT => -44 } ], yyrules => @@ -1805,6 +1858,9 @@ sub 'definition', 1, undef ], [#Rule 15 + 'definition', 1, undef + ], + [#Rule 16 'const', 6, sub #line 62 "build/pidl/idl.yp" @@ -1815,7 +1871,7 @@ sub "VALUE" => $_[5] }} ], - [#Rule 16 + [#Rule 17 'const', 7, sub #line 69 "build/pidl/idl.yp" @@ -1827,7 +1883,7 @@ sub "VALUE" => $_[6], }} ], - [#Rule 17 + [#Rule 18 'function', 7, sub #line 80 "build/pidl/idl.yp" @@ -1839,10 +1895,43 @@ sub "DATA" => $_[5] }} ], - [#Rule 18 - 'typedef', 6, + [#Rule 19 + 'declare', 5, sub #line 90 "build/pidl/idl.yp" +{{ + "TYPE" => "DECLARE", + "PROPERTIES" => $_[2], + "NAME" => $_[4], + "DATA" => $_[3], + }} + ], + [#Rule 20 + 'decl_type', 1, undef + ], + [#Rule 21 + 'decl_type', 1, undef + ], + [#Rule 22 + 'decl_enum', 1, +sub +#line 102 "build/pidl/idl.yp" +{{ + "TYPE" => "ENUM" + }} + ], + [#Rule 23 + 'decl_bitmap', 1, +sub +#line 108 "build/pidl/idl.yp" +{{ + "TYPE" => "BITMAP" + }} + ], + [#Rule 24 + 'typedef', 6, +sub +#line 114 "build/pidl/idl.yp" {{ "TYPE" => "TYPEDEF", "PROPERTIES" => $_[2], @@ -1851,156 +1940,156 @@ sub "ARRAY_LEN" => $_[5] }} ], - [#Rule 19 + [#Rule 25 'type', 1, undef ], - [#Rule 20 + [#Rule 26 'type', 1, undef ], - [#Rule 21 + [#Rule 27 'type', 1, undef ], - [#Rule 22 + [#Rule 28 'type', 1, undef ], - [#Rule 23 + [#Rule 29 'type', 1, undef ], - [#Rule 24 + [#Rule 30 'type', 1, sub -#line 100 "build/pidl/idl.yp" +#line 124 "build/pidl/idl.yp" { "void" } ], - [#Rule 25 + [#Rule 31 'enum', 4, sub -#line 105 "build/pidl/idl.yp" +#line 129 "build/pidl/idl.yp" {{ "TYPE" => "ENUM", "ELEMENTS" => $_[3] }} ], - [#Rule 26 + [#Rule 32 'enum_elements', 1, sub -#line 112 "build/pidl/idl.yp" +#line 136 "build/pidl/idl.yp" { [ $_[1] ] } ], - [#Rule 27 + [#Rule 33 'enum_elements', 3, sub -#line 113 "build/pidl/idl.yp" +#line 137 "build/pidl/idl.yp" { push(@{$_[1]}, $_[3]); $_[1] } ], - [#Rule 28 + [#Rule 34 'enum_element', 1, undef ], - [#Rule 29 + [#Rule 35 'enum_element', 3, sub -#line 117 "build/pidl/idl.yp" +#line 141 "build/pidl/idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 30 + [#Rule 36 'bitmap', 4, sub -#line 121 "build/pidl/idl.yp" +#line 145 "build/pidl/idl.yp" {{ "TYPE" => "BITMAP", "ELEMENTS" => $_[3] }} ], - [#Rule 31 + [#Rule 37 'bitmap_elements', 1, sub -#line 128 "build/pidl/idl.yp" +#line 152 "build/pidl/idl.yp" { [ $_[1] ] } ], - [#Rule 32 + [#Rule 38 'bitmap_elements', 3, sub -#line 129 "build/pidl/idl.yp" +#line 153 "build/pidl/idl.yp" { push(@{$_[1]}, $_[3]); $_[1] } ], - [#Rule 33 + [#Rule 39 'bitmap_element', 3, sub -#line 132 "build/pidl/idl.yp" +#line 156 "build/pidl/idl.yp" { "$_[1] ( $_[3] )" } ], - [#Rule 34 + [#Rule 40 'struct', 4, sub -#line 136 "build/pidl/idl.yp" +#line 160 "build/pidl/idl.yp" {{ "TYPE" => "STRUCT", "ELEMENTS" => $_[3] }} ], - [#Rule 35 + [#Rule 41 'union', 4, sub -#line 143 "build/pidl/idl.yp" +#line 167 "build/pidl/idl.yp" {{ "TYPE" => "UNION", "DATA" => $_[3] }} ], - [#Rule 36 + [#Rule 42 'union_elements', 1, sub -#line 150 "build/pidl/idl.yp" +#line 174 "build/pidl/idl.yp" { [ $_[1] ] } ], - [#Rule 37 + [#Rule 43 'union_elements', 2, sub -#line 151 "build/pidl/idl.yp" +#line 175 "build/pidl/idl.yp" { push(@{$_[1]}, $_[2]); $_[1] } ], - [#Rule 38 + [#Rule 44 'union_element', 8, sub -#line 156 "build/pidl/idl.yp" +#line 180 "build/pidl/idl.yp" {{ "TYPE" => "UNION_ELEMENT", "CASE" => $_[4], "DATA" => $_[7] }} ], - [#Rule 39 + [#Rule 45 'union_element', 7, sub -#line 162 "build/pidl/idl.yp" +#line 186 "build/pidl/idl.yp" {{ "TYPE" => "EMPTY", "CASE" => $_[4], }} ], - [#Rule 40 + [#Rule 46 'union_element', 5, sub -#line 167 "build/pidl/idl.yp" +#line 191 "build/pidl/idl.yp" {{ "TYPE" => "UNION_ELEMENT", "CASE" => "default", "DATA" => $_[4] }} ], - [#Rule 41 + [#Rule 47 'union_element', 4, sub -#line 173 "build/pidl/idl.yp" +#line 197 "build/pidl/idl.yp" {{ "TYPE" => "EMPTY", "CASE" => "default", }} ], - [#Rule 42 + [#Rule 48 'base_element', 5, sub -#line 180 "build/pidl/idl.yp" +#line 204 "build/pidl/idl.yp" {{ "NAME" => $_[4], "TYPE" => $_[2], @@ -2009,202 +2098,202 @@ sub "ARRAY_LEN" => $_[5] }} ], - [#Rule 43 + [#Rule 49 'pointers', 0, sub -#line 192 "build/pidl/idl.yp" +#line 216 "build/pidl/idl.yp" { 0 } ], - [#Rule 44 + [#Rule 50 'pointers', 2, sub -#line 193 "build/pidl/idl.yp" +#line 217 "build/pidl/idl.yp" { $_[1]+1 } ], - [#Rule 45 + [#Rule 51 'element_list1', 0, undef ], - [#Rule 46 + [#Rule 52 'element_list1', 3, sub -#line 200 "build/pidl/idl.yp" +#line 224 "build/pidl/idl.yp" { push(@{$_[1]}, $_[2]); $_[1] } ], - [#Rule 47 + [#Rule 53 'element_list2', 0, undef ], - [#Rule 48 + [#Rule 54 'element_list2', 1, undef ], - [#Rule 49 + [#Rule 55 'element_list2', 1, sub -#line 206 "build/pidl/idl.yp" +#line 230 "build/pidl/idl.yp" { [ $_[1] ] } ], - [#Rule 50 + [#Rule 56 'element_list2', 3, sub -#line 207 "build/pidl/idl.yp" +#line 231 "build/pidl/idl.yp" { push(@{$_[1]}, $_[3]); $_[1] } ], - [#Rule 51 + [#Rule 57 'array_len', 0, undef ], - [#Rule 52 + [#Rule 58 'array_len', 2, sub -#line 212 "build/pidl/idl.yp" +#line 236 "build/pidl/idl.yp" { "*" } ], - [#Rule 53 + [#Rule 59 'array_len', 3, sub -#line 213 "build/pidl/idl.yp" +#line 237 "build/pidl/idl.yp" { "$_[2]" } ], - [#Rule 54 + [#Rule 60 'property_list', 0, undef ], - [#Rule 55 + [#Rule 61 'property_list', 4, sub -#line 219 "build/pidl/idl.yp" +#line 243 "build/pidl/idl.yp" { util::FlattenHash([$_[1],$_[3]]); } ], - [#Rule 56 + [#Rule 62 'properties', 1, sub -#line 222 "build/pidl/idl.yp" +#line 246 "build/pidl/idl.yp" { $_[1] } ], - [#Rule 57 + [#Rule 63 'properties', 3, sub -#line 223 "build/pidl/idl.yp" +#line 247 "build/pidl/idl.yp" { util::FlattenHash([$_[1], $_[3]]); } ], - [#Rule 58 + [#Rule 64 'property', 1, sub -#line 226 "build/pidl/idl.yp" +#line 250 "build/pidl/idl.yp" {{ "$_[1]" => "1" }} ], - [#Rule 59 + [#Rule 65 'property', 4, sub -#line 227 "build/pidl/idl.yp" +#line 251 "build/pidl/idl.yp" {{ "$_[1]" => "$_[3]" }} ], - [#Rule 60 + [#Rule 66 'listtext', 1, undef ], - [#Rule 61 + [#Rule 67 'listtext', 3, sub -#line 232 "build/pidl/idl.yp" +#line 256 "build/pidl/idl.yp" { "$_[1] $_[3]" } ], - [#Rule 62 + [#Rule 68 'commalisttext', 1, undef ], - [#Rule 63 + [#Rule 69 'commalisttext', 3, sub -#line 237 "build/pidl/idl.yp" +#line 261 "build/pidl/idl.yp" { "$_[1],$_[3]" } ], - [#Rule 64 + [#Rule 70 'anytext', 0, sub -#line 241 "build/pidl/idl.yp" +#line 265 "build/pidl/idl.yp" { "" } ], - [#Rule 65 + [#Rule 71 'anytext', 1, undef ], - [#Rule 66 + [#Rule 72 'anytext', 1, undef ], - [#Rule 67 + [#Rule 73 'anytext', 1, undef ], - [#Rule 68 + [#Rule 74 'anytext', 3, sub -#line 243 "build/pidl/idl.yp" +#line 267 "build/pidl/idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 69 + [#Rule 75 'anytext', 3, sub -#line 244 "build/pidl/idl.yp" +#line 268 "build/pidl/idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 70 + [#Rule 76 'anytext', 3, sub -#line 245 "build/pidl/idl.yp" +#line 269 "build/pidl/idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 71 + [#Rule 77 'anytext', 3, sub -#line 246 "build/pidl/idl.yp" +#line 270 "build/pidl/idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 72 + [#Rule 78 'anytext', 3, sub -#line 247 "build/pidl/idl.yp" +#line 271 "build/pidl/idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 73 + [#Rule 79 'anytext', 3, sub -#line 248 "build/pidl/idl.yp" +#line 272 "build/pidl/idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 74 + [#Rule 80 'anytext', 3, sub -#line 249 "build/pidl/idl.yp" +#line 273 "build/pidl/idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 75 + [#Rule 81 'anytext', 3, sub -#line 250 "build/pidl/idl.yp" +#line 274 "build/pidl/idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 76 + [#Rule 82 'anytext', 5, sub -#line 251 "build/pidl/idl.yp" +#line 275 "build/pidl/idl.yp" { "$_[1]$_[2]$_[3]$_[4]$_[5]" } ], - [#Rule 77 + [#Rule 83 'anytext', 5, sub -#line 252 "build/pidl/idl.yp" +#line 276 "build/pidl/idl.yp" { "$_[1]$_[2]$_[3]$_[4]$_[5]" } ], - [#Rule 78 + [#Rule 84 'identifier', 1, undef ], - [#Rule 79 + [#Rule 85 'constant', 1, undef ], - [#Rule 80 + [#Rule 86 'text', 1, sub -#line 261 "build/pidl/idl.yp" +#line 285 "build/pidl/idl.yp" { "\"$_[1]\"" } ], - [#Rule 81 + [#Rule 87 'optional_semicolon', 0, undef ], - [#Rule 82 + [#Rule 88 'optional_semicolon', 1, undef ] ], @@ -2212,7 +2301,7 @@ sub bless($self,$class); } -#line 272 "build/pidl/idl.yp" +#line 296 "build/pidl/idl.yp" use util; @@ -2271,7 +2360,7 @@ again: if (s/^([\w_]+)//) { $parser->YYData->{LAST_TOKEN} = $1; if ($1 =~ - /^(coclass|interface|const|typedef|union + /^(coclass|interface|const|typedef|declare|union |struct|enum|bitmap|void|case|default)$/x) { return $1; } diff --git a/source4/build/pidl/idl.yp b/source4/build/pidl/idl.yp index f77062adf6..73b9a44b3f 100644 --- a/source4/build/pidl/idl.yp +++ b/source4/build/pidl/idl.yp @@ -55,7 +55,7 @@ definitions: ; -definition: function | const | typedef +definition: function | const | typedef | declare ; const: 'const' identifier identifier '=' anytext ';' @@ -86,6 +86,30 @@ function: property_list type identifier '(' element_list2 ')' ';' }} ; +declare: 'declare' property_list decl_type identifier';' + {{ + "TYPE" => "DECLARE", + "PROPERTIES" => $_[2], + "NAME" => $_[4], + "DATA" => $_[3], + }} +; + +decl_type: decl_enum | decl_bitmap +; + +decl_enum: 'enum' + {{ + "TYPE" => "ENUM" + }} +; + +decl_bitmap: 'bitmap' + {{ + "TYPE" => "BITMAP" + }} +; + typedef: 'typedef' property_list type identifier array_len ';' {{ "TYPE" => "TYPEDEF", @@ -327,7 +351,7 @@ again: if (s/^([\w_]+)//) { $parser->YYData->{LAST_TOKEN} = $1; if ($1 =~ - /^(coclass|interface|const|typedef|union + /^(coclass|interface|const|typedef|declare|union |struct|enum|bitmap|void|case|default)$/x) { return $1; } diff --git a/source4/build/pidl/parser.pm b/source4/build/pidl/parser.pm index 2aa7dfc3d6..33937b5800 100644 --- a/source4/build/pidl/parser.pm +++ b/source4/build/pidl/parser.pm @@ -1716,9 +1716,12 @@ sub ParseInterface($) my($data) = $interface->{DATA}; foreach my $d (@{$data}) { + if ($d->{TYPE} eq "DECLARE") { + $structs{$d->{NAME}} = $d; + } if ($d->{TYPE} eq "TYPEDEF") { $structs{$d->{NAME}} = $d; - } + } } foreach my $d (@{$data}) { -- cgit