mirror of
https://github.com/samba-team/samba.git
synced 2025-03-09 08:58:35 +03:00
r5320: Treat structs and unions somewhat more similarly:
- use same names in hashes (DATA -> ELEMENTS, etc) - [case()] and [default] are no longer special case, they're just regular properties
This commit is contained in:
parent
a469a5fefb
commit
6a0f599f82
@ -98,11 +98,11 @@ sub DumpUnionElement($)
|
|||||||
my($element) = shift;
|
my($element) = shift;
|
||||||
my($res);
|
my($res);
|
||||||
|
|
||||||
if ($element->{CASE} eq "default") {
|
if (util::has_property($element, "default")) {
|
||||||
$res .= "[default] ;\n";
|
$res .= "[default] ;\n";
|
||||||
} else {
|
} else {
|
||||||
$res .= "[case($element->{CASE})] ";
|
$res .= "[case($element->{PROPERTIES}->{case})] ";
|
||||||
$res .= DumpElement($element->{DATA}), if defined($element->{DATA});
|
$res .= DumpElement($element), if defined($element);
|
||||||
$res .= ";\n";
|
$res .= ";\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ sub DumpUnion($)
|
|||||||
(defined $union->{PROPERTIES}) &&
|
(defined $union->{PROPERTIES}) &&
|
||||||
($res .= DumpProperties($union->{PROPERTIES}));
|
($res .= DumpProperties($union->{PROPERTIES}));
|
||||||
$res .= "union {\n";
|
$res .= "union {\n";
|
||||||
foreach my $e (@{$union->{DATA}}) {
|
foreach my $e (@{$union->{ELEMENTS}}) {
|
||||||
$res .= DumpUnionElement($e);
|
$res .= DumpUnionElement($e);
|
||||||
}
|
}
|
||||||
$res .= "}";
|
$res .= "}";
|
||||||
|
@ -153,12 +153,12 @@ sub HeaderUnion($$)
|
|||||||
(defined $union->{PROPERTIES}) && HeaderProperties($union->{PROPERTIES});
|
(defined $union->{PROPERTIES}) && HeaderProperties($union->{PROPERTIES});
|
||||||
$res .= "\nunion $name {\n";
|
$res .= "\nunion $name {\n";
|
||||||
$tab_depth++;
|
$tab_depth++;
|
||||||
foreach my $e (@{$union->{DATA}}) {
|
foreach my $e (@{$union->{ELEMENTS}}) {
|
||||||
if ($e->{TYPE} eq "UNION_ELEMENT") {
|
if ($e->{TYPE} ne "EMPTY") {
|
||||||
if (! defined $done{$e->{DATA}->{NAME}}) {
|
if (! defined $done{$e->{NAME}}) {
|
||||||
HeaderElement($e->{DATA});
|
HeaderElement($e);
|
||||||
}
|
}
|
||||||
$done{$e->{DATA}->{NAME}} = 1;
|
$done{$e->{NAME}} = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$tab_depth--;
|
$tab_depth--;
|
||||||
|
@ -1241,12 +1241,9 @@ sub new {
|
|||||||
DEFAULT => -7
|
DEFAULT => -7
|
||||||
},
|
},
|
||||||
{#State 94
|
{#State 94
|
||||||
ACTIONS => {
|
DEFAULT => -45,
|
||||||
"[" => 111
|
|
||||||
},
|
|
||||||
GOTOS => {
|
GOTOS => {
|
||||||
'union_elements' => 109,
|
'union_elements' => 109
|
||||||
'union_element' => 110
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{#State 95
|
{#State 95
|
||||||
@ -1254,9 +1251,9 @@ sub new {
|
|||||||
'IDENTIFIER' => 9
|
'IDENTIFIER' => 9
|
||||||
},
|
},
|
||||||
GOTOS => {
|
GOTOS => {
|
||||||
'identifier' => 112,
|
'identifier' => 110,
|
||||||
'enum_element' => 113,
|
'enum_element' => 111,
|
||||||
'enum_elements' => 114
|
'enum_elements' => 112
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{#State 96
|
{#State 96
|
||||||
@ -1264,20 +1261,20 @@ sub new {
|
|||||||
'IDENTIFIER' => 9
|
'IDENTIFIER' => 9
|
||||||
},
|
},
|
||||||
GOTOS => {
|
GOTOS => {
|
||||||
'identifier' => 117,
|
'identifier' => 115,
|
||||||
'bitmap_elements' => 116,
|
'bitmap_elements' => 114,
|
||||||
'bitmap_element' => 115
|
'bitmap_element' => 113
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{#State 97
|
{#State 97
|
||||||
ACTIONS => {
|
ACTIONS => {
|
||||||
"(" => 118
|
"(" => 116
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{#State 98
|
{#State 98
|
||||||
DEFAULT => -51,
|
DEFAULT => -51,
|
||||||
GOTOS => {
|
GOTOS => {
|
||||||
'element_list1' => 119
|
'element_list1' => 117
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{#State 99
|
{#State 99
|
||||||
@ -1297,16 +1294,16 @@ sub new {
|
|||||||
'IDENTIFIER' => 9
|
'IDENTIFIER' => 9
|
||||||
},
|
},
|
||||||
GOTOS => {
|
GOTOS => {
|
||||||
'identifier' => 120
|
'identifier' => 118
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{#State 104
|
{#State 104
|
||||||
ACTIONS => {
|
ACTIONS => {
|
||||||
"[" => 123,
|
"[" => 121,
|
||||||
"=" => 122
|
"=" => 120
|
||||||
},
|
},
|
||||||
GOTOS => {
|
GOTOS => {
|
||||||
'array_len' => 121
|
'array_len' => 119
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{#State 105
|
{#State 105
|
||||||
@ -1350,94 +1347,86 @@ sub new {
|
|||||||
},
|
},
|
||||||
{#State 108
|
{#State 108
|
||||||
ACTIONS => {
|
ACTIONS => {
|
||||||
"[" => 123
|
"[" => 121
|
||||||
},
|
},
|
||||||
DEFAULT => -57,
|
DEFAULT => -57,
|
||||||
GOTOS => {
|
GOTOS => {
|
||||||
'array_len' => 124
|
'array_len' => 122
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{#State 109
|
{#State 109
|
||||||
ACTIONS => {
|
ACTIONS => {
|
||||||
"}" => 125,
|
"}" => 123
|
||||||
"[" => 111
|
|
||||||
},
|
},
|
||||||
|
DEFAULT => -60,
|
||||||
GOTOS => {
|
GOTOS => {
|
||||||
'union_element' => 126
|
'optional_base_element' => 125,
|
||||||
|
'property_list' => 124
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{#State 110
|
{#State 110
|
||||||
DEFAULT => -42
|
|
||||||
},
|
|
||||||
{#State 111
|
|
||||||
ACTIONS => {
|
ACTIONS => {
|
||||||
"case" => 127,
|
"=" => 126
|
||||||
"default" => 128
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{#State 112
|
|
||||||
ACTIONS => {
|
|
||||||
"=" => 129
|
|
||||||
},
|
},
|
||||||
DEFAULT => -34
|
DEFAULT => -34
|
||||||
},
|
},
|
||||||
{#State 113
|
{#State 111
|
||||||
DEFAULT => -32
|
DEFAULT => -32
|
||||||
},
|
},
|
||||||
|
{#State 112
|
||||||
|
ACTIONS => {
|
||||||
|
"}" => 127,
|
||||||
|
"," => 128
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{#State 113
|
||||||
|
DEFAULT => -37
|
||||||
|
},
|
||||||
{#State 114
|
{#State 114
|
||||||
ACTIONS => {
|
ACTIONS => {
|
||||||
"}" => 130,
|
"}" => 129,
|
||||||
"," => 131
|
"," => 130
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{#State 115
|
{#State 115
|
||||||
DEFAULT => -37
|
ACTIONS => {
|
||||||
|
"=" => 131
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{#State 116
|
{#State 116
|
||||||
ACTIONS => {
|
|
||||||
"}" => 132,
|
|
||||||
"," => 133
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{#State 117
|
|
||||||
ACTIONS => {
|
|
||||||
"=" => 134
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{#State 118
|
|
||||||
ACTIONS => {
|
ACTIONS => {
|
||||||
"," => -53,
|
"," => -53,
|
||||||
"void" => 137,
|
"void" => 134,
|
||||||
")" => -53
|
")" => -53
|
||||||
},
|
},
|
||||||
DEFAULT => -60,
|
DEFAULT => -60,
|
||||||
GOTOS => {
|
GOTOS => {
|
||||||
'base_element' => 135,
|
'base_element' => 132,
|
||||||
'element_list2' => 138,
|
'element_list2' => 135,
|
||||||
'property_list' => 136
|
'property_list' => 133
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{#State 117
|
||||||
|
ACTIONS => {
|
||||||
|
"}" => 136
|
||||||
|
},
|
||||||
|
DEFAULT => -60,
|
||||||
|
GOTOS => {
|
||||||
|
'base_element' => 137,
|
||||||
|
'property_list' => 133
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{#State 118
|
||||||
|
ACTIONS => {
|
||||||
|
";" => 138
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{#State 119
|
{#State 119
|
||||||
ACTIONS => {
|
ACTIONS => {
|
||||||
"}" => 139
|
"=" => 139
|
||||||
},
|
|
||||||
DEFAULT => -60,
|
|
||||||
GOTOS => {
|
|
||||||
'base_element' => 140,
|
|
||||||
'property_list' => 136
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{#State 120
|
{#State 120
|
||||||
ACTIONS => {
|
|
||||||
";" => 141
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{#State 121
|
|
||||||
ACTIONS => {
|
|
||||||
"=" => 142
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{#State 122
|
|
||||||
ACTIONS => {
|
ACTIONS => {
|
||||||
'IDENTIFIER' => 9,
|
'IDENTIFIER' => 9,
|
||||||
'CONSTANT' => 28,
|
'CONSTANT' => 28,
|
||||||
@ -1447,85 +1436,87 @@ sub new {
|
|||||||
GOTOS => {
|
GOTOS => {
|
||||||
'identifier' => 23,
|
'identifier' => 23,
|
||||||
'text' => 24,
|
'text' => 24,
|
||||||
'anytext' => 143,
|
'anytext' => 140,
|
||||||
'constant' => 27
|
'constant' => 27
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{#State 123
|
{#State 121
|
||||||
ACTIONS => {
|
ACTIONS => {
|
||||||
'IDENTIFIER' => 9,
|
'IDENTIFIER' => 9,
|
||||||
'CONSTANT' => 28,
|
'CONSTANT' => 28,
|
||||||
'TEXT' => 22,
|
'TEXT' => 22,
|
||||||
"]" => 145
|
"]" => 142
|
||||||
},
|
},
|
||||||
DEFAULT => -70,
|
DEFAULT => -70,
|
||||||
GOTOS => {
|
GOTOS => {
|
||||||
'identifier' => 23,
|
'identifier' => 23,
|
||||||
'text' => 24,
|
'text' => 24,
|
||||||
'anytext' => 144,
|
'anytext' => 141,
|
||||||
'constant' => 27
|
'constant' => 27
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{#State 122
|
||||||
|
ACTIONS => {
|
||||||
|
";" => 143
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{#State 123
|
||||||
|
DEFAULT => -47
|
||||||
|
},
|
||||||
{#State 124
|
{#State 124
|
||||||
ACTIONS => {
|
ACTIONS => {
|
||||||
";" => 146
|
"[" => 7
|
||||||
|
},
|
||||||
|
DEFAULT => -60,
|
||||||
|
GOTOS => {
|
||||||
|
'base_or_empty' => 144,
|
||||||
|
'base_element' => 145,
|
||||||
|
'empty_element' => 146,
|
||||||
|
'property_list' => 147
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{#State 125
|
{#State 125
|
||||||
DEFAULT => -41
|
DEFAULT => -46
|
||||||
},
|
},
|
||||||
{#State 126
|
{#State 126
|
||||||
DEFAULT => -43
|
ACTIONS => {
|
||||||
|
'CONSTANT' => 28,
|
||||||
|
'TEXT' => 22,
|
||||||
|
'IDENTIFIER' => 9
|
||||||
|
},
|
||||||
|
DEFAULT => -70,
|
||||||
|
GOTOS => {
|
||||||
|
'identifier' => 23,
|
||||||
|
'text' => 24,
|
||||||
|
'anytext' => 148,
|
||||||
|
'constant' => 27
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{#State 127
|
{#State 127
|
||||||
ACTIONS => {
|
DEFAULT => -31
|
||||||
"(" => 147
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{#State 128
|
{#State 128
|
||||||
ACTIONS => {
|
ACTIONS => {
|
||||||
"]" => 148
|
'IDENTIFIER' => 9
|
||||||
|
},
|
||||||
|
GOTOS => {
|
||||||
|
'identifier' => 110,
|
||||||
|
'enum_element' => 149
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{#State 129
|
{#State 129
|
||||||
ACTIONS => {
|
DEFAULT => -36
|
||||||
'CONSTANT' => 28,
|
|
||||||
'TEXT' => 22,
|
|
||||||
'IDENTIFIER' => 9
|
|
||||||
},
|
|
||||||
DEFAULT => -70,
|
|
||||||
GOTOS => {
|
|
||||||
'identifier' => 23,
|
|
||||||
'text' => 24,
|
|
||||||
'anytext' => 149,
|
|
||||||
'constant' => 27
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{#State 130
|
{#State 130
|
||||||
DEFAULT => -31
|
ACTIONS => {
|
||||||
|
'IDENTIFIER' => 9
|
||||||
|
},
|
||||||
|
GOTOS => {
|
||||||
|
'identifier' => 115,
|
||||||
|
'bitmap_element' => 150
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{#State 131
|
{#State 131
|
||||||
ACTIONS => {
|
|
||||||
'IDENTIFIER' => 9
|
|
||||||
},
|
|
||||||
GOTOS => {
|
|
||||||
'identifier' => 112,
|
|
||||||
'enum_element' => 150
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{#State 132
|
|
||||||
DEFAULT => -36
|
|
||||||
},
|
|
||||||
{#State 133
|
|
||||||
ACTIONS => {
|
|
||||||
'IDENTIFIER' => 9
|
|
||||||
},
|
|
||||||
GOTOS => {
|
|
||||||
'identifier' => 117,
|
|
||||||
'bitmap_element' => 151
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{#State 134
|
|
||||||
ACTIONS => {
|
ACTIONS => {
|
||||||
'CONSTANT' => 28,
|
'CONSTANT' => 28,
|
||||||
'TEXT' => 22,
|
'TEXT' => 22,
|
||||||
@ -1535,14 +1526,14 @@ sub new {
|
|||||||
GOTOS => {
|
GOTOS => {
|
||||||
'identifier' => 23,
|
'identifier' => 23,
|
||||||
'text' => 24,
|
'text' => 24,
|
||||||
'anytext' => 152,
|
'anytext' => 151,
|
||||||
'constant' => 27
|
'constant' => 27
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{#State 135
|
{#State 132
|
||||||
DEFAULT => -55
|
DEFAULT => -55
|
||||||
},
|
},
|
||||||
{#State 136
|
{#State 133
|
||||||
ACTIONS => {
|
ACTIONS => {
|
||||||
'IDENTIFIER' => 9,
|
'IDENTIFIER' => 9,
|
||||||
"union" => 76,
|
"union" => 76,
|
||||||
@ -1556,32 +1547,32 @@ sub new {
|
|||||||
'identifier' => 81,
|
'identifier' => 81,
|
||||||
'struct' => 82,
|
'struct' => 82,
|
||||||
'enum' => 83,
|
'enum' => 83,
|
||||||
'type' => 153,
|
'type' => 152,
|
||||||
'union' => 85,
|
'union' => 85,
|
||||||
'bitmap' => 80
|
'bitmap' => 80
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{#State 137
|
{#State 134
|
||||||
DEFAULT => -54
|
DEFAULT => -54
|
||||||
},
|
},
|
||||||
{#State 138
|
{#State 135
|
||||||
ACTIONS => {
|
ACTIONS => {
|
||||||
"," => 154,
|
"," => 153,
|
||||||
")" => 155
|
")" => 154
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{#State 139
|
{#State 136
|
||||||
DEFAULT => -40
|
DEFAULT => -40
|
||||||
},
|
},
|
||||||
{#State 140
|
{#State 137
|
||||||
ACTIONS => {
|
ACTIONS => {
|
||||||
";" => 156
|
";" => 155
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{#State 141
|
{#State 138
|
||||||
DEFAULT => -19
|
DEFAULT => -19
|
||||||
},
|
},
|
||||||
{#State 142
|
{#State 139
|
||||||
ACTIONS => {
|
ACTIONS => {
|
||||||
'IDENTIFIER' => 9,
|
'IDENTIFIER' => 9,
|
||||||
'CONSTANT' => 28,
|
'CONSTANT' => 28,
|
||||||
@ -1591,15 +1582,15 @@ sub new {
|
|||||||
GOTOS => {
|
GOTOS => {
|
||||||
'identifier' => 23,
|
'identifier' => 23,
|
||||||
'text' => 24,
|
'text' => 24,
|
||||||
'anytext' => 157,
|
'anytext' => 156,
|
||||||
'constant' => 27
|
'constant' => 27
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{#State 143
|
{#State 140
|
||||||
ACTIONS => {
|
ACTIONS => {
|
||||||
"-" => 35,
|
"-" => 35,
|
||||||
"<" => 36,
|
"<" => 36,
|
||||||
";" => 158,
|
";" => 157,
|
||||||
"+" => 37,
|
"+" => 37,
|
||||||
"&" => 39,
|
"&" => 39,
|
||||||
"{" => 38,
|
"{" => 38,
|
||||||
@ -1611,7 +1602,7 @@ sub new {
|
|||||||
">" => 45
|
">" => 45
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{#State 144
|
{#State 141
|
||||||
ACTIONS => {
|
ACTIONS => {
|
||||||
"-" => 35,
|
"-" => 35,
|
||||||
"<" => 36,
|
"<" => 36,
|
||||||
@ -1622,42 +1613,49 @@ sub new {
|
|||||||
"(" => 42,
|
"(" => 42,
|
||||||
"|" => 41,
|
"|" => 41,
|
||||||
"*" => 43,
|
"*" => 43,
|
||||||
"]" => 159,
|
"]" => 158,
|
||||||
"." => 44,
|
"." => 44,
|
||||||
">" => 45
|
">" => 45
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{#State 145
|
{#State 142
|
||||||
DEFAULT => -58
|
DEFAULT => -58
|
||||||
},
|
},
|
||||||
{#State 146
|
{#State 143
|
||||||
DEFAULT => -24
|
DEFAULT => -24
|
||||||
},
|
},
|
||||||
|
{#State 144
|
||||||
|
DEFAULT => -44
|
||||||
|
},
|
||||||
|
{#State 145
|
||||||
|
ACTIONS => {
|
||||||
|
";" => 159
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{#State 146
|
||||||
|
DEFAULT => -43
|
||||||
|
},
|
||||||
{#State 147
|
{#State 147
|
||||||
ACTIONS => {
|
ACTIONS => {
|
||||||
'IDENTIFIER' => 9,
|
'IDENTIFIER' => 9,
|
||||||
'CONSTANT' => 28,
|
"union" => 76,
|
||||||
'TEXT' => 22
|
";" => 160,
|
||||||
|
"enum" => 77,
|
||||||
|
"[" => 7,
|
||||||
|
'void' => 79,
|
||||||
|
"bitmap" => 78,
|
||||||
|
"struct" => 86
|
||||||
},
|
},
|
||||||
DEFAULT => -70,
|
|
||||||
GOTOS => {
|
GOTOS => {
|
||||||
'identifier' => 23,
|
'identifier' => 81,
|
||||||
'text' => 24,
|
'struct' => 82,
|
||||||
'anytext' => 160,
|
'enum' => 83,
|
||||||
'constant' => 27
|
'type' => 152,
|
||||||
|
'union' => 85,
|
||||||
|
'bitmap' => 80
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{#State 148
|
{#State 148
|
||||||
ACTIONS => {
|
|
||||||
";" => 161
|
|
||||||
},
|
|
||||||
DEFAULT => -60,
|
|
||||||
GOTOS => {
|
|
||||||
'base_element' => 162,
|
|
||||||
'property_list' => 136
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{#State 149
|
|
||||||
ACTIONS => {
|
ACTIONS => {
|
||||||
"-" => 35,
|
"-" => 35,
|
||||||
"<" => 36,
|
"<" => 36,
|
||||||
@ -1673,13 +1671,13 @@ sub new {
|
|||||||
},
|
},
|
||||||
DEFAULT => -35
|
DEFAULT => -35
|
||||||
},
|
},
|
||||||
{#State 150
|
{#State 149
|
||||||
DEFAULT => -33
|
DEFAULT => -33
|
||||||
},
|
},
|
||||||
{#State 151
|
{#State 150
|
||||||
DEFAULT => -38
|
DEFAULT => -38
|
||||||
},
|
},
|
||||||
{#State 152
|
{#State 151
|
||||||
ACTIONS => {
|
ACTIONS => {
|
||||||
"-" => 35,
|
"-" => 35,
|
||||||
"<" => 36,
|
"<" => 36,
|
||||||
@ -1695,32 +1693,32 @@ sub new {
|
|||||||
},
|
},
|
||||||
DEFAULT => -39
|
DEFAULT => -39
|
||||||
},
|
},
|
||||||
{#State 153
|
{#State 152
|
||||||
DEFAULT => -49,
|
DEFAULT => -49,
|
||||||
GOTOS => {
|
GOTOS => {
|
||||||
'pointers' => 163
|
'pointers' => 161
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{#State 153
|
||||||
|
DEFAULT => -60,
|
||||||
|
GOTOS => {
|
||||||
|
'base_element' => 162,
|
||||||
|
'property_list' => 133
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{#State 154
|
{#State 154
|
||||||
DEFAULT => -60,
|
ACTIONS => {
|
||||||
GOTOS => {
|
";" => 163
|
||||||
'base_element' => 164,
|
|
||||||
'property_list' => 136
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{#State 155
|
{#State 155
|
||||||
ACTIONS => {
|
|
||||||
";" => 165
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{#State 156
|
|
||||||
DEFAULT => -52
|
DEFAULT => -52
|
||||||
},
|
},
|
||||||
{#State 157
|
{#State 156
|
||||||
ACTIONS => {
|
ACTIONS => {
|
||||||
"-" => 35,
|
"-" => 35,
|
||||||
"<" => 36,
|
"<" => 36,
|
||||||
";" => 166,
|
";" => 164,
|
||||||
"+" => 37,
|
"+" => 37,
|
||||||
"&" => 39,
|
"&" => 39,
|
||||||
"{" => 38,
|
"{" => 38,
|
||||||
@ -1732,97 +1730,50 @@ sub new {
|
|||||||
">" => 45
|
">" => 45
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{#State 158
|
{#State 157
|
||||||
DEFAULT => -16
|
DEFAULT => -16
|
||||||
},
|
},
|
||||||
{#State 159
|
{#State 158
|
||||||
DEFAULT => -59
|
DEFAULT => -59
|
||||||
},
|
},
|
||||||
|
{#State 159
|
||||||
|
DEFAULT => -42
|
||||||
|
},
|
||||||
{#State 160
|
{#State 160
|
||||||
ACTIONS => {
|
DEFAULT => -41
|
||||||
"-" => 35,
|
|
||||||
"<" => 36,
|
|
||||||
"+" => 37,
|
|
||||||
"&" => 39,
|
|
||||||
"{" => 38,
|
|
||||||
"/" => 40,
|
|
||||||
"(" => 42,
|
|
||||||
"|" => 41,
|
|
||||||
"*" => 43,
|
|
||||||
")" => 167,
|
|
||||||
"." => 44,
|
|
||||||
">" => 45
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{#State 161
|
{#State 161
|
||||||
DEFAULT => -47
|
|
||||||
},
|
|
||||||
{#State 162
|
|
||||||
ACTIONS => {
|
|
||||||
";" => 168
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{#State 163
|
|
||||||
ACTIONS => {
|
ACTIONS => {
|
||||||
'IDENTIFIER' => 9,
|
'IDENTIFIER' => 9,
|
||||||
"*" => 170
|
"*" => 166
|
||||||
},
|
},
|
||||||
GOTOS => {
|
GOTOS => {
|
||||||
'identifier' => 169
|
'identifier' => 165
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{#State 164
|
{#State 162
|
||||||
DEFAULT => -56
|
DEFAULT => -56
|
||||||
},
|
},
|
||||||
{#State 165
|
{#State 163
|
||||||
DEFAULT => -18
|
DEFAULT => -18
|
||||||
},
|
},
|
||||||
{#State 166
|
{#State 164
|
||||||
DEFAULT => -17
|
DEFAULT => -17
|
||||||
},
|
},
|
||||||
{#State 167
|
{#State 165
|
||||||
ACTIONS => {
|
ACTIONS => {
|
||||||
"]" => 171
|
"[" => 121
|
||||||
}
|
|
||||||
},
|
|
||||||
{#State 168
|
|
||||||
DEFAULT => -46
|
|
||||||
},
|
|
||||||
{#State 169
|
|
||||||
ACTIONS => {
|
|
||||||
"[" => 123
|
|
||||||
},
|
},
|
||||||
DEFAULT => -57,
|
DEFAULT => -57,
|
||||||
GOTOS => {
|
GOTOS => {
|
||||||
'array_len' => 172
|
'array_len' => 167
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{#State 170
|
{#State 166
|
||||||
DEFAULT => -50
|
DEFAULT => -50
|
||||||
},
|
},
|
||||||
{#State 171
|
{#State 167
|
||||||
ACTIONS => {
|
|
||||||
";" => 173
|
|
||||||
},
|
|
||||||
DEFAULT => -60,
|
|
||||||
GOTOS => {
|
|
||||||
'base_element' => 174,
|
|
||||||
'property_list' => 136
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{#State 172
|
|
||||||
DEFAULT => -48
|
DEFAULT => -48
|
||||||
},
|
|
||||||
{#State 173
|
|
||||||
DEFAULT => -45
|
|
||||||
},
|
|
||||||
{#State 174
|
|
||||||
ACTIONS => {
|
|
||||||
";" => 175
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{#State 175
|
|
||||||
DEFAULT => -44
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
yyrules =>
|
yyrules =>
|
||||||
@ -2078,68 +2029,50 @@ sub
|
|||||||
}}
|
}}
|
||||||
],
|
],
|
||||||
[#Rule 41
|
[#Rule 41
|
||||||
'union', 4,
|
'empty_element', 2,
|
||||||
sub
|
sub
|
||||||
#line 167 "build/pidl/idl.yp"
|
#line 167 "build/pidl/idl.yp"
|
||||||
{{
|
{{
|
||||||
"TYPE" => "UNION",
|
"NAME" => "",
|
||||||
"DATA" => $_[3]
|
"TYPE" => "EMPTY",
|
||||||
|
"PROPERTIES" => $_[0],
|
||||||
|
"POINTERS" => 0
|
||||||
}}
|
}}
|
||||||
],
|
],
|
||||||
[#Rule 42
|
[#Rule 42
|
||||||
'union_elements', 1,
|
'base_or_empty', 2, undef
|
||||||
sub
|
|
||||||
#line 174 "build/pidl/idl.yp"
|
|
||||||
{ [ $_[1] ] }
|
|
||||||
],
|
],
|
||||||
[#Rule 43
|
[#Rule 43
|
||||||
'union_elements', 2,
|
'base_or_empty', 1, undef
|
||||||
sub
|
|
||||||
#line 175 "build/pidl/idl.yp"
|
|
||||||
{ push(@{$_[1]}, $_[2]); $_[1] }
|
|
||||||
],
|
],
|
||||||
[#Rule 44
|
[#Rule 44
|
||||||
'union_element', 8,
|
'optional_base_element', 2,
|
||||||
sub
|
sub
|
||||||
#line 180 "build/pidl/idl.yp"
|
#line 178 "build/pidl/idl.yp"
|
||||||
{{
|
{ $_[2]->{PROPERTIES} = util::FlattenHash([$_[1],$_[2]->{PROPERTIES}]); $_[2] }
|
||||||
"TYPE" => "UNION_ELEMENT",
|
|
||||||
"CASE" => $_[4],
|
|
||||||
"DATA" => $_[7]
|
|
||||||
}}
|
|
||||||
],
|
],
|
||||||
[#Rule 45
|
[#Rule 45
|
||||||
'union_element', 7,
|
'union_elements', 0, undef
|
||||||
sub
|
|
||||||
#line 186 "build/pidl/idl.yp"
|
|
||||||
{{
|
|
||||||
"TYPE" => "EMPTY",
|
|
||||||
"CASE" => $_[4],
|
|
||||||
}}
|
|
||||||
],
|
],
|
||||||
[#Rule 46
|
[#Rule 46
|
||||||
'union_element', 5,
|
'union_elements', 2,
|
||||||
sub
|
sub
|
||||||
#line 191 "build/pidl/idl.yp"
|
#line 183 "build/pidl/idl.yp"
|
||||||
{{
|
{ push(@{$_[1]}, $_[2]); $_[1] }
|
||||||
"TYPE" => "UNION_ELEMENT",
|
|
||||||
"CASE" => "default",
|
|
||||||
"DATA" => $_[4]
|
|
||||||
}}
|
|
||||||
],
|
],
|
||||||
[#Rule 47
|
[#Rule 47
|
||||||
'union_element', 4,
|
'union', 4,
|
||||||
sub
|
sub
|
||||||
#line 197 "build/pidl/idl.yp"
|
#line 187 "build/pidl/idl.yp"
|
||||||
{{
|
{{
|
||||||
"TYPE" => "EMPTY",
|
"TYPE" => "UNION",
|
||||||
"CASE" => "default",
|
"ELEMENTS" => $_[3]
|
||||||
}}
|
}}
|
||||||
],
|
],
|
||||||
[#Rule 48
|
[#Rule 48
|
||||||
'base_element', 5,
|
'base_element', 5,
|
||||||
sub
|
sub
|
||||||
#line 204 "build/pidl/idl.yp"
|
#line 194 "build/pidl/idl.yp"
|
||||||
{{
|
{{
|
||||||
"NAME" => $_[4],
|
"NAME" => $_[4],
|
||||||
"TYPE" => $_[2],
|
"TYPE" => $_[2],
|
||||||
@ -2151,13 +2084,13 @@ sub
|
|||||||
[#Rule 49
|
[#Rule 49
|
||||||
'pointers', 0,
|
'pointers', 0,
|
||||||
sub
|
sub
|
||||||
#line 216 "build/pidl/idl.yp"
|
#line 206 "build/pidl/idl.yp"
|
||||||
{ 0 }
|
{ 0 }
|
||||||
],
|
],
|
||||||
[#Rule 50
|
[#Rule 50
|
||||||
'pointers', 2,
|
'pointers', 2,
|
||||||
sub
|
sub
|
||||||
#line 217 "build/pidl/idl.yp"
|
#line 207 "build/pidl/idl.yp"
|
||||||
{ $_[1]+1 }
|
{ $_[1]+1 }
|
||||||
],
|
],
|
||||||
[#Rule 51
|
[#Rule 51
|
||||||
@ -2166,7 +2099,7 @@ sub
|
|||||||
[#Rule 52
|
[#Rule 52
|
||||||
'element_list1', 3,
|
'element_list1', 3,
|
||||||
sub
|
sub
|
||||||
#line 224 "build/pidl/idl.yp"
|
#line 212 "build/pidl/idl.yp"
|
||||||
{ push(@{$_[1]}, $_[2]); $_[1] }
|
{ push(@{$_[1]}, $_[2]); $_[1] }
|
||||||
],
|
],
|
||||||
[#Rule 53
|
[#Rule 53
|
||||||
@ -2178,13 +2111,13 @@ sub
|
|||||||
[#Rule 55
|
[#Rule 55
|
||||||
'element_list2', 1,
|
'element_list2', 1,
|
||||||
sub
|
sub
|
||||||
#line 230 "build/pidl/idl.yp"
|
#line 218 "build/pidl/idl.yp"
|
||||||
{ [ $_[1] ] }
|
{ [ $_[1] ] }
|
||||||
],
|
],
|
||||||
[#Rule 56
|
[#Rule 56
|
||||||
'element_list2', 3,
|
'element_list2', 3,
|
||||||
sub
|
sub
|
||||||
#line 231 "build/pidl/idl.yp"
|
#line 219 "build/pidl/idl.yp"
|
||||||
{ push(@{$_[1]}, $_[3]); $_[1] }
|
{ push(@{$_[1]}, $_[3]); $_[1] }
|
||||||
],
|
],
|
||||||
[#Rule 57
|
[#Rule 57
|
||||||
@ -2193,13 +2126,13 @@ sub
|
|||||||
[#Rule 58
|
[#Rule 58
|
||||||
'array_len', 2,
|
'array_len', 2,
|
||||||
sub
|
sub
|
||||||
#line 236 "build/pidl/idl.yp"
|
#line 224 "build/pidl/idl.yp"
|
||||||
{ "*" }
|
{ "*" }
|
||||||
],
|
],
|
||||||
[#Rule 59
|
[#Rule 59
|
||||||
'array_len', 3,
|
'array_len', 3,
|
||||||
sub
|
sub
|
||||||
#line 237 "build/pidl/idl.yp"
|
#line 225 "build/pidl/idl.yp"
|
||||||
{ "$_[2]" }
|
{ "$_[2]" }
|
||||||
],
|
],
|
||||||
[#Rule 60
|
[#Rule 60
|
||||||
@ -2208,31 +2141,31 @@ sub
|
|||||||
[#Rule 61
|
[#Rule 61
|
||||||
'property_list', 4,
|
'property_list', 4,
|
||||||
sub
|
sub
|
||||||
#line 243 "build/pidl/idl.yp"
|
#line 231 "build/pidl/idl.yp"
|
||||||
{ util::FlattenHash([$_[1],$_[3]]); }
|
{ util::FlattenHash([$_[1],$_[3]]); }
|
||||||
],
|
],
|
||||||
[#Rule 62
|
[#Rule 62
|
||||||
'properties', 1,
|
'properties', 1,
|
||||||
sub
|
sub
|
||||||
#line 246 "build/pidl/idl.yp"
|
#line 234 "build/pidl/idl.yp"
|
||||||
{ $_[1] }
|
{ $_[1] }
|
||||||
],
|
],
|
||||||
[#Rule 63
|
[#Rule 63
|
||||||
'properties', 3,
|
'properties', 3,
|
||||||
sub
|
sub
|
||||||
#line 247 "build/pidl/idl.yp"
|
#line 235 "build/pidl/idl.yp"
|
||||||
{ util::FlattenHash([$_[1], $_[3]]); }
|
{ util::FlattenHash([$_[1], $_[3]]); }
|
||||||
],
|
],
|
||||||
[#Rule 64
|
[#Rule 64
|
||||||
'property', 1,
|
'property', 1,
|
||||||
sub
|
sub
|
||||||
#line 250 "build/pidl/idl.yp"
|
#line 238 "build/pidl/idl.yp"
|
||||||
{{ "$_[1]" => "1" }}
|
{{ "$_[1]" => "1" }}
|
||||||
],
|
],
|
||||||
[#Rule 65
|
[#Rule 65
|
||||||
'property', 4,
|
'property', 4,
|
||||||
sub
|
sub
|
||||||
#line 251 "build/pidl/idl.yp"
|
#line 239 "build/pidl/idl.yp"
|
||||||
{{ "$_[1]" => "$_[3]" }}
|
{{ "$_[1]" => "$_[3]" }}
|
||||||
],
|
],
|
||||||
[#Rule 66
|
[#Rule 66
|
||||||
@ -2241,7 +2174,7 @@ sub
|
|||||||
[#Rule 67
|
[#Rule 67
|
||||||
'listtext', 3,
|
'listtext', 3,
|
||||||
sub
|
sub
|
||||||
#line 256 "build/pidl/idl.yp"
|
#line 244 "build/pidl/idl.yp"
|
||||||
{ "$_[1] $_[3]" }
|
{ "$_[1] $_[3]" }
|
||||||
],
|
],
|
||||||
[#Rule 68
|
[#Rule 68
|
||||||
@ -2250,13 +2183,13 @@ sub
|
|||||||
[#Rule 69
|
[#Rule 69
|
||||||
'commalisttext', 3,
|
'commalisttext', 3,
|
||||||
sub
|
sub
|
||||||
#line 261 "build/pidl/idl.yp"
|
#line 249 "build/pidl/idl.yp"
|
||||||
{ "$_[1],$_[3]" }
|
{ "$_[1],$_[3]" }
|
||||||
],
|
],
|
||||||
[#Rule 70
|
[#Rule 70
|
||||||
'anytext', 0,
|
'anytext', 0,
|
||||||
sub
|
sub
|
||||||
#line 265 "build/pidl/idl.yp"
|
#line 253 "build/pidl/idl.yp"
|
||||||
{ "" }
|
{ "" }
|
||||||
],
|
],
|
||||||
[#Rule 71
|
[#Rule 71
|
||||||
@ -2271,67 +2204,67 @@ sub
|
|||||||
[#Rule 74
|
[#Rule 74
|
||||||
'anytext', 3,
|
'anytext', 3,
|
||||||
sub
|
sub
|
||||||
#line 267 "build/pidl/idl.yp"
|
#line 255 "build/pidl/idl.yp"
|
||||||
{ "$_[1]$_[2]$_[3]" }
|
{ "$_[1]$_[2]$_[3]" }
|
||||||
],
|
],
|
||||||
[#Rule 75
|
[#Rule 75
|
||||||
'anytext', 3,
|
'anytext', 3,
|
||||||
sub
|
sub
|
||||||
#line 268 "build/pidl/idl.yp"
|
#line 256 "build/pidl/idl.yp"
|
||||||
{ "$_[1]$_[2]$_[3]" }
|
{ "$_[1]$_[2]$_[3]" }
|
||||||
],
|
],
|
||||||
[#Rule 76
|
[#Rule 76
|
||||||
'anytext', 3,
|
'anytext', 3,
|
||||||
sub
|
sub
|
||||||
#line 269 "build/pidl/idl.yp"
|
#line 257 "build/pidl/idl.yp"
|
||||||
{ "$_[1]$_[2]$_[3]" }
|
{ "$_[1]$_[2]$_[3]" }
|
||||||
],
|
],
|
||||||
[#Rule 77
|
[#Rule 77
|
||||||
'anytext', 3,
|
'anytext', 3,
|
||||||
sub
|
sub
|
||||||
#line 270 "build/pidl/idl.yp"
|
#line 258 "build/pidl/idl.yp"
|
||||||
{ "$_[1]$_[2]$_[3]" }
|
{ "$_[1]$_[2]$_[3]" }
|
||||||
],
|
],
|
||||||
[#Rule 78
|
[#Rule 78
|
||||||
'anytext', 3,
|
'anytext', 3,
|
||||||
sub
|
sub
|
||||||
#line 271 "build/pidl/idl.yp"
|
#line 259 "build/pidl/idl.yp"
|
||||||
{ "$_[1]$_[2]$_[3]" }
|
{ "$_[1]$_[2]$_[3]" }
|
||||||
],
|
],
|
||||||
[#Rule 79
|
[#Rule 79
|
||||||
'anytext', 3,
|
'anytext', 3,
|
||||||
sub
|
sub
|
||||||
#line 272 "build/pidl/idl.yp"
|
#line 260 "build/pidl/idl.yp"
|
||||||
{ "$_[1]$_[2]$_[3]" }
|
{ "$_[1]$_[2]$_[3]" }
|
||||||
],
|
],
|
||||||
[#Rule 80
|
[#Rule 80
|
||||||
'anytext', 3,
|
'anytext', 3,
|
||||||
sub
|
sub
|
||||||
#line 273 "build/pidl/idl.yp"
|
#line 261 "build/pidl/idl.yp"
|
||||||
{ "$_[1]$_[2]$_[3]" }
|
{ "$_[1]$_[2]$_[3]" }
|
||||||
],
|
],
|
||||||
[#Rule 81
|
[#Rule 81
|
||||||
'anytext', 3,
|
'anytext', 3,
|
||||||
sub
|
sub
|
||||||
#line 274 "build/pidl/idl.yp"
|
#line 262 "build/pidl/idl.yp"
|
||||||
{ "$_[1]$_[2]$_[3]" }
|
{ "$_[1]$_[2]$_[3]" }
|
||||||
],
|
],
|
||||||
[#Rule 82
|
[#Rule 82
|
||||||
'anytext', 3,
|
'anytext', 3,
|
||||||
sub
|
sub
|
||||||
#line 275 "build/pidl/idl.yp"
|
#line 263 "build/pidl/idl.yp"
|
||||||
{ "$_[1]$_[2]$_[3]" }
|
{ "$_[1]$_[2]$_[3]" }
|
||||||
],
|
],
|
||||||
[#Rule 83
|
[#Rule 83
|
||||||
'anytext', 5,
|
'anytext', 5,
|
||||||
sub
|
sub
|
||||||
#line 276 "build/pidl/idl.yp"
|
#line 264 "build/pidl/idl.yp"
|
||||||
{ "$_[1]$_[2]$_[3]$_[4]$_[5]" }
|
{ "$_[1]$_[2]$_[3]$_[4]$_[5]" }
|
||||||
],
|
],
|
||||||
[#Rule 84
|
[#Rule 84
|
||||||
'anytext', 5,
|
'anytext', 5,
|
||||||
sub
|
sub
|
||||||
#line 277 "build/pidl/idl.yp"
|
#line 265 "build/pidl/idl.yp"
|
||||||
{ "$_[1]$_[2]$_[3]$_[4]$_[5]" }
|
{ "$_[1]$_[2]$_[3]$_[4]$_[5]" }
|
||||||
],
|
],
|
||||||
[#Rule 85
|
[#Rule 85
|
||||||
@ -2343,7 +2276,7 @@ sub
|
|||||||
[#Rule 87
|
[#Rule 87
|
||||||
'text', 1,
|
'text', 1,
|
||||||
sub
|
sub
|
||||||
#line 286 "build/pidl/idl.yp"
|
#line 274 "build/pidl/idl.yp"
|
||||||
{ "\"$_[1]\"" }
|
{ "\"$_[1]\"" }
|
||||||
],
|
],
|
||||||
[#Rule 88
|
[#Rule 88
|
||||||
@ -2357,7 +2290,7 @@ sub
|
|||||||
bless($self,$class);
|
bless($self,$class);
|
||||||
}
|
}
|
||||||
|
|
||||||
#line 297 "build/pidl/idl.yp"
|
#line 285 "build/pidl/idl.yp"
|
||||||
|
|
||||||
|
|
||||||
use util;
|
use util;
|
||||||
@ -2417,7 +2350,7 @@ again:
|
|||||||
$parser->YYData->{LAST_TOKEN} = $1;
|
$parser->YYData->{LAST_TOKEN} = $1;
|
||||||
if ($1 =~
|
if ($1 =~
|
||||||
/^(coclass|interface|const|typedef|declare|union
|
/^(coclass|interface|const|typedef|declare|union
|
||||||
|struct|enum|bitmap|void|case|default)$/x) {
|
|struct|enum|bitmap|void)$/x) {
|
||||||
return $1;
|
return $1;
|
||||||
}
|
}
|
||||||
return('IDENTIFIER',$1);
|
return('IDENTIFIER',$1);
|
||||||
|
@ -163,40 +163,30 @@ struct: 'struct' '{' element_list1 '}'
|
|||||||
}}
|
}}
|
||||||
;
|
;
|
||||||
|
|
||||||
union: 'union' '{' union_elements '}'
|
empty_element: property_list ';'
|
||||||
{{
|
{{
|
||||||
"TYPE" => "UNION",
|
"NAME" => "",
|
||||||
"DATA" => $_[3]
|
"TYPE" => "EMPTY",
|
||||||
|
"PROPERTIES" => $_[0],
|
||||||
|
"POINTERS" => 0
|
||||||
}}
|
}}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
base_or_empty: base_element ';' | empty_element;
|
||||||
|
|
||||||
|
optional_base_element:
|
||||||
|
property_list base_or_empty { $_[2]->{PROPERTIES} = util::FlattenHash([$_[1],$_[2]->{PROPERTIES}]); $_[2] }
|
||||||
|
;
|
||||||
|
|
||||||
union_elements:
|
union_elements:
|
||||||
union_element { [ $_[1] ] }
|
#empty
|
||||||
| union_elements union_element { push(@{$_[1]}, $_[2]); $_[1] }
|
| union_elements optional_base_element { push(@{$_[1]}, $_[2]); $_[1] }
|
||||||
;
|
;
|
||||||
|
|
||||||
union_element:
|
union: 'union' '{' union_elements '}'
|
||||||
'[' 'case' '(' anytext ')' ']' base_element ';'
|
|
||||||
{{
|
{{
|
||||||
"TYPE" => "UNION_ELEMENT",
|
"TYPE" => "UNION",
|
||||||
"CASE" => $_[4],
|
"ELEMENTS" => $_[3]
|
||||||
"DATA" => $_[7]
|
|
||||||
}}
|
|
||||||
| '[' 'case' '(' anytext ')' ']' ';'
|
|
||||||
{{
|
|
||||||
"TYPE" => "EMPTY",
|
|
||||||
"CASE" => $_[4],
|
|
||||||
}}
|
|
||||||
| '[' 'default' ']' base_element ';'
|
|
||||||
{{
|
|
||||||
"TYPE" => "UNION_ELEMENT",
|
|
||||||
"CASE" => "default",
|
|
||||||
"DATA" => $_[4]
|
|
||||||
}}
|
|
||||||
| '[' 'default' ']' ';'
|
|
||||||
{{
|
|
||||||
"TYPE" => "EMPTY",
|
|
||||||
"CASE" => "default",
|
|
||||||
}}
|
}}
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -217,8 +207,6 @@ pointers:
|
|||||||
| pointers '*' { $_[1]+1 }
|
| pointers '*' { $_[1]+1 }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
element_list1:
|
element_list1:
|
||||||
#empty
|
#empty
|
||||||
| element_list1 base_element ';' { push(@{$_[1]}, $_[2]); $_[1] }
|
| element_list1 base_element ';' { push(@{$_[1]}, $_[2]); $_[1] }
|
||||||
@ -353,7 +341,7 @@ again:
|
|||||||
$parser->YYData->{LAST_TOKEN} = $1;
|
$parser->YYData->{LAST_TOKEN} = $1;
|
||||||
if ($1 =~
|
if ($1 =~
|
||||||
/^(coclass|interface|const|typedef|declare|union
|
/^(coclass|interface|const|typedef|declare|union
|
||||||
|struct|enum|bitmap|void|case|default)$/x) {
|
|struct|enum|bitmap|void)$/x) {
|
||||||
return $1;
|
return $1;
|
||||||
}
|
}
|
||||||
return('IDENTIFIER',$1);
|
return('IDENTIFIER',$1);
|
||||||
|
@ -305,7 +305,7 @@ sub end_flags($)
|
|||||||
|
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
# work out the correct alignment for a structure
|
# work out the correct alignment for a structure or union
|
||||||
sub struct_alignment
|
sub struct_alignment
|
||||||
{
|
{
|
||||||
my $s = shift;
|
my $s = shift;
|
||||||
@ -328,35 +328,6 @@ sub struct_alignment
|
|||||||
return $align;
|
return $align;
|
||||||
}
|
}
|
||||||
|
|
||||||
#####################################################################
|
|
||||||
# work out the correct alignment for a union
|
|
||||||
sub union_alignment
|
|
||||||
{
|
|
||||||
my $u = shift;
|
|
||||||
|
|
||||||
my $align = 1;
|
|
||||||
|
|
||||||
foreach my $e (@{$u->{DATA}}) {
|
|
||||||
my $a = 1;
|
|
||||||
|
|
||||||
if ($e->{TYPE} eq "EMPTY") {
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (need_wire_pointer($e->{DATA})) {
|
|
||||||
$a = 4;
|
|
||||||
} else {
|
|
||||||
$a = align_type($e->{DATA}->{TYPE});
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($align < $a) {
|
|
||||||
$align = $a;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $align;
|
|
||||||
}
|
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
# align a type
|
# align a type
|
||||||
sub align_type
|
sub align_type
|
||||||
@ -369,12 +340,8 @@ sub align_type
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (defined $typedefs{$e}) {
|
if (defined $typedefs{$e}) {
|
||||||
if ($typedefs{$e}->{DATA}->{TYPE} eq "STRUCT") {
|
if ($typedefs{$e}->{DATA}->{TYPE} eq "STRUCT" or $typedefs{$e}->{DATA}->{TYPE} eq "UNION") {
|
||||||
return struct_alignment($typedefs{$e}->{DATA});
|
return struct_alignment($typedefs{$e}->{DATA});
|
||||||
} elsif ($typedefs{$e}->{DATA}->{TYPE} eq "UNION") {
|
|
||||||
if (defined $typedefs{$e}->{DATA}) {
|
|
||||||
return union_alignment($typedefs{$e}->{DATA});
|
|
||||||
}
|
|
||||||
} elsif ($typedefs{$e}->{DATA}->{TYPE} eq "ENUM") {
|
} elsif ($typedefs{$e}->{DATA}->{TYPE} eq "ENUM") {
|
||||||
return align_type(util::enum_type_fn(util::get_enum($e)));
|
return align_type(util::enum_type_fn(util::get_enum($e)));
|
||||||
} elsif ($typedefs{$e}->{DATA}->{TYPE} eq "BITMAP") {
|
} elsif ($typedefs{$e}->{DATA}->{TYPE} eq "BITMAP") {
|
||||||
@ -1192,15 +1159,15 @@ sub ParseUnionPush($)
|
|||||||
# pidl "\tNDR_CHECK(ndr_push_align(ndr, $align));\n";
|
# pidl "\tNDR_CHECK(ndr_push_align(ndr, $align));\n";
|
||||||
|
|
||||||
pidl "\tswitch (level) {\n";
|
pidl "\tswitch (level) {\n";
|
||||||
foreach my $el (@{$e->{DATA}}) {
|
foreach my $el (@{$e->{ELEMENTS}}) {
|
||||||
if ($el->{CASE} eq "default") {
|
if (util::has_property($el, "default")) {
|
||||||
pidl "\tdefault:\n";
|
pidl "\tdefault:\n";
|
||||||
$have_default = 1;
|
$have_default = 1;
|
||||||
} else {
|
} else {
|
||||||
pidl "\tcase $el->{CASE}:\n";
|
pidl "\tcase $el->{PROPERTIES}->{case}:\n";
|
||||||
}
|
}
|
||||||
if ($el->{TYPE} eq "UNION_ELEMENT") {
|
if ($el->{TYPE} ne "EMPTY") {
|
||||||
ParseElementPushScalar($el->{DATA}, "r->", "NDR_SCALARS");
|
ParseElementPushScalar($el, "r->", "NDR_SCALARS");
|
||||||
}
|
}
|
||||||
pidl "\tbreak;\n\n";
|
pidl "\tbreak;\n\n";
|
||||||
}
|
}
|
||||||
@ -1212,14 +1179,14 @@ sub ParseUnionPush($)
|
|||||||
pidl "buffers:\n";
|
pidl "buffers:\n";
|
||||||
pidl "\tif (!(ndr_flags & NDR_BUFFERS)) goto done;\n";
|
pidl "\tif (!(ndr_flags & NDR_BUFFERS)) goto done;\n";
|
||||||
pidl "\tswitch (level) {\n";
|
pidl "\tswitch (level) {\n";
|
||||||
foreach my $el (@{$e->{DATA}}) {
|
foreach my $el (@{$e->{ELEMENTS}}) {
|
||||||
if ($el->{CASE} eq "default") {
|
if (util::has_property($el, "default")) {
|
||||||
pidl "\tdefault:\n";
|
pidl "\tdefault:\n";
|
||||||
} else {
|
} else {
|
||||||
pidl "\tcase $el->{CASE}:\n";
|
pidl "\tcase $el->{PROPERTIES}->{case}:\n";
|
||||||
}
|
}
|
||||||
if ($el->{TYPE} eq "UNION_ELEMENT") {
|
if ($el->{TYPE} ne "EMPTY") {
|
||||||
ParseElementPushBuffer($el->{DATA}, "r->", "NDR_BUFFERS");
|
ParseElementPushBuffer($el, "r->", "NDR_BUFFERS");
|
||||||
}
|
}
|
||||||
pidl "\tbreak;\n\n";
|
pidl "\tbreak;\n\n";
|
||||||
}
|
}
|
||||||
@ -1243,15 +1210,15 @@ sub ParseUnionPrint($)
|
|||||||
start_flags($e);
|
start_flags($e);
|
||||||
|
|
||||||
pidl "\tswitch (level) {\n";
|
pidl "\tswitch (level) {\n";
|
||||||
foreach my $el (@{$e->{DATA}}) {
|
foreach my $el (@{$e->{ELEMENTS}}) {
|
||||||
if ($el->{CASE} eq "default") {
|
if (util::has_property($el, "default")) {
|
||||||
$have_default = 1;
|
$have_default = 1;
|
||||||
pidl "\tdefault:\n";
|
pidl "\tdefault:\n";
|
||||||
} else {
|
} else {
|
||||||
pidl "\tcase $el->{CASE}:\n";
|
pidl "\tcase $el->{PROPERTIES}->{case}:\n";
|
||||||
}
|
}
|
||||||
if ($el->{TYPE} eq "UNION_ELEMENT") {
|
if ($el->{TYPE} ne "EMPTY") {
|
||||||
ParseElementPrintScalar($el->{DATA}, "r->");
|
ParseElementPrintScalar($el, "r->");
|
||||||
}
|
}
|
||||||
pidl "\tbreak;\n\n";
|
pidl "\tbreak;\n\n";
|
||||||
}
|
}
|
||||||
@ -1280,19 +1247,18 @@ sub ParseUnionPull($)
|
|||||||
# pidl "\tNDR_CHECK(ndr_pull_align(ndr, $align));\n";
|
# pidl "\tNDR_CHECK(ndr_pull_align(ndr, $align));\n";
|
||||||
|
|
||||||
pidl "\tswitch (level) {\n";
|
pidl "\tswitch (level) {\n";
|
||||||
foreach my $el (@{$e->{DATA}}) {
|
foreach my $el (@{$e->{ELEMENTS}}) {
|
||||||
if ($el->{CASE} eq "default") {
|
if (util::has_property($el, "default")) {
|
||||||
pidl "\tdefault: {\n";
|
pidl "\tdefault: {\n";
|
||||||
$have_default = 1;
|
$have_default = 1;
|
||||||
} else {
|
} else {
|
||||||
pidl "\tcase $el->{CASE}: {\n";
|
pidl "\tcase $el->{PROPERTIES}->{case}: {\n";
|
||||||
}
|
}
|
||||||
if ($el->{TYPE} eq "UNION_ELEMENT") {
|
if ($el->{TYPE} ne "EMPTY") {
|
||||||
my $e2 = $el->{DATA};
|
if ($el->{POINTERS}) {
|
||||||
if ($e2->{POINTERS}) {
|
pidl "\t\tuint32_t _ptr_$el->{NAME};\n";
|
||||||
pidl "\t\tuint32_t _ptr_$e2->{NAME};\n";
|
|
||||||
}
|
}
|
||||||
ParseElementPullScalar($el->{DATA}, "r->", "NDR_SCALARS");
|
ParseElementPullScalar($el, "r->", "NDR_SCALARS");
|
||||||
}
|
}
|
||||||
pidl "\tbreak; }\n\n";
|
pidl "\tbreak; }\n\n";
|
||||||
}
|
}
|
||||||
@ -1304,14 +1270,14 @@ sub ParseUnionPull($)
|
|||||||
pidl "buffers:\n";
|
pidl "buffers:\n";
|
||||||
pidl "\tif (!(ndr_flags & NDR_BUFFERS)) goto done;\n";
|
pidl "\tif (!(ndr_flags & NDR_BUFFERS)) goto done;\n";
|
||||||
pidl "\tswitch (level) {\n";
|
pidl "\tswitch (level) {\n";
|
||||||
foreach my $el (@{$e->{DATA}}) {
|
foreach my $el (@{$e->{ELEMENTS}}) {
|
||||||
if ($el->{CASE} eq "default") {
|
if (util::has_property($el, "default")) {
|
||||||
pidl "\tdefault:\n";
|
pidl "\tdefault:\n";
|
||||||
} else {
|
} else {
|
||||||
pidl "\tcase $el->{CASE}:\n";
|
pidl "\tcase $el->{PROPERTIES}->{case}:\n";
|
||||||
}
|
}
|
||||||
if ($el->{TYPE} eq "UNION_ELEMENT") {
|
if ($el->{TYPE} ne "EMPTY") {
|
||||||
ParseElementPullBuffer($el->{DATA}, "r->", "NDR_BUFFERS");
|
ParseElementPullBuffer($el, "r->", "NDR_BUFFERS");
|
||||||
}
|
}
|
||||||
pidl "\tbreak;\n\n";
|
pidl "\tbreak;\n\n";
|
||||||
}
|
}
|
||||||
@ -1866,18 +1832,23 @@ sub ParseInterface($)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Push functions
|
||||||
foreach my $d (@{$data}) {
|
foreach my $d (@{$data}) {
|
||||||
($d->{TYPE} eq "TYPEDEF") &&
|
($d->{TYPE} eq "TYPEDEF") &&
|
||||||
ParseTypedefPush($d);
|
ParseTypedefPush($d);
|
||||||
($d->{TYPE} eq "FUNCTION") &&
|
($d->{TYPE} eq "FUNCTION") &&
|
||||||
ParseFunctionPush($d);
|
ParseFunctionPush($d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Pull functions
|
||||||
foreach my $d (@{$data}) {
|
foreach my $d (@{$data}) {
|
||||||
($d->{TYPE} eq "TYPEDEF") &&
|
($d->{TYPE} eq "TYPEDEF") &&
|
||||||
ParseTypedefPull($d);
|
ParseTypedefPull($d);
|
||||||
($d->{TYPE} eq "FUNCTION") &&
|
($d->{TYPE} eq "FUNCTION") &&
|
||||||
ParseFunctionPull($d);
|
ParseFunctionPull($d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Print functions
|
||||||
foreach my $d (@{$data}) {
|
foreach my $d (@{$data}) {
|
||||||
if ($d->{TYPE} eq "TYPEDEF" &&
|
if ($d->{TYPE} eq "TYPEDEF" &&
|
||||||
!util::has_property($d, "noprint")) {
|
!util::has_property($d, "noprint")) {
|
||||||
@ -1889,6 +1860,7 @@ sub ParseInterface($)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Size functions
|
||||||
foreach my $d (@{$data}) {
|
foreach my $d (@{$data}) {
|
||||||
($d->{TYPE} eq "TYPEDEF") &&
|
($d->{TYPE} eq "TYPEDEF") &&
|
||||||
ParseTypedefNdrSize($d);
|
ParseTypedefNdrSize($d);
|
||||||
|
@ -38,7 +38,7 @@ sub NeededTypedef($)
|
|||||||
$needed{"push_$t->{NAME}"} = 0;
|
$needed{"push_$t->{NAME}"} = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($t->{DATA}->{TYPE} eq "STRUCT") {
|
if ($t->{DATA}->{TYPE} eq "STRUCT" or $t->{DATA}->{TYPE} eq "UNION") {
|
||||||
if (util::has_property($t, "gensize")) {
|
if (util::has_property($t, "gensize")) {
|
||||||
$needed{"ndr_size_$t->{NAME}"} = 1;
|
$needed{"ndr_size_$t->{NAME}"} = 1;
|
||||||
}
|
}
|
||||||
@ -53,26 +53,6 @@ sub NeededTypedef($)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($t->{DATA}->{TYPE} eq "UNION") {
|
|
||||||
if (util::has_property($t, "gensize")) {
|
|
||||||
$needed{"ndr_size_$t->{NAME}"} = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
for my $e (@{$t->{DATA}->{DATA}}) {
|
|
||||||
$e->{PARENT} = $t->{DATA};
|
|
||||||
if ($e->{TYPE} eq "UNION_ELEMENT") {
|
|
||||||
if ($needed{"pull_$t->{NAME}"}) {
|
|
||||||
$needed{"pull_$e->{DATA}->{TYPE}"} = 1;
|
|
||||||
}
|
|
||||||
if ($needed{"push_$t->{NAME}"}) {
|
|
||||||
$needed{"push_$e->{DATA}->{TYPE}"} = 1;
|
|
||||||
}
|
|
||||||
if ($needed{"ndr_size_$t->{NAME}"}) {
|
|
||||||
$needed{"ndr_size_$e->{DATA}->{TYPE}"} = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
@ -168,7 +168,7 @@ sub get_interface($$)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
# see if a pidl property list contains a give property
|
# see if a pidl property list contains a given property
|
||||||
sub has_property($$)
|
sub has_property($$)
|
||||||
{
|
{
|
||||||
my($e) = shift;
|
my($e) = shift;
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
# released under the GNU GPL
|
# released under the GNU GPL
|
||||||
|
|
||||||
package IdlValidator;
|
package IdlValidator;
|
||||||
|
use Data::Dumper;
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
@ -66,8 +67,19 @@ sub ValidStruct($)
|
|||||||
sub ValidUnion($)
|
sub ValidUnion($)
|
||||||
{
|
{
|
||||||
my($union) = shift;
|
my($union) = shift;
|
||||||
foreach my $e (@{$union->{DATA}}) {
|
foreach my $e (@{$union->{ELEMENTS}}) {
|
||||||
$e->{PARENT} = $union;
|
$e->{PARENT} = $union;
|
||||||
|
|
||||||
|
if (defined($e->{PROPERTIES}->{default}) and
|
||||||
|
defined($e->{PROPERTIES}->{case})) {
|
||||||
|
fatal "Union member $e->{NAME} can not have both default and case properties!\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
unless (defined ($e->{PROPERTIES}->{default}) or
|
||||||
|
defined ($e->{PROPERTIES}->{case})) {
|
||||||
|
fatal "Union member $e->{NAME} must have default or case property\n";
|
||||||
|
}
|
||||||
|
|
||||||
ValidElement($e);
|
ValidElement($e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user