summaryrefslogtreecommitdiff
path: root/source4/pidl
diff options
context:
space:
mode:
Diffstat (limited to 'source4/pidl')
-rw-r--r--source4/pidl/idl.yp7
-rw-r--r--source4/pidl/lib/Parse/Pidl/CUtil.pm15
-rw-r--r--source4/pidl/lib/Parse/Pidl/Compat.pm4
-rw-r--r--source4/pidl/lib/Parse/Pidl/IDL.pm845
-rw-r--r--source4/pidl/lib/Parse/Pidl/NDR.pm50
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/Header.pm85
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm188
-rw-r--r--source4/pidl/tests/Util.pm2
-rwxr-xr-xsource4/pidl/tests/ndr.pl289
-rwxr-xr-xsource4/pidl/tests/ndr_compat.pl8
10 files changed, 855 insertions, 638 deletions
diff --git a/source4/pidl/idl.yp b/source4/pidl/idl.yp
index d2543c580c..028b628e18 100644
--- a/source4/pidl/idl.yp
+++ b/source4/pidl/idl.yp
@@ -293,12 +293,7 @@ properties: property { $_[1] }
;
property: identifier {{ "$_[1]" => "1" }}
- | identifier '(' listtext ')' {{ "$_[1]" => "$_[3]" }}
-;
-
-listtext:
- anytext
- | listtext ',' anytext { "$_[1] $_[3]" }
+ | identifier '(' commalisttext ')' {{ "$_[1]" => "$_[3]" }}
;
commalisttext:
diff --git a/source4/pidl/lib/Parse/Pidl/CUtil.pm b/source4/pidl/lib/Parse/Pidl/CUtil.pm
index bd7b16812c..9deb6ee177 100644
--- a/source4/pidl/lib/Parse/Pidl/CUtil.pm
+++ b/source4/pidl/lib/Parse/Pidl/CUtil.pm
@@ -6,7 +6,7 @@ package Parse::Pidl::CUtil;
require Exporter;
@ISA = qw(Exporter);
-@EXPORT = qw(get_pointer_to get_value_of);
+@EXPORT = qw(get_pointer_to get_value_of get_array_element);
use vars qw($VERSION);
$VERSION = '0.01';
@@ -36,4 +36,17 @@ sub get_value_of($)
}
}
+sub get_array_element($$)
+{
+ my ($var_name, $idx) = @_;
+
+ if ($var_name =~ /^\*.*$/) {
+ $var_name = "($var_name)";
+ } elsif ($var_name =~ /^\&.*$/) {
+ $var_name = "($var_name)";
+ }
+
+ return "$var_name"."[$idx]";
+}
+
1;
diff --git a/source4/pidl/lib/Parse/Pidl/Compat.pm b/source4/pidl/lib/Parse/Pidl/Compat.pm
index 7939bb2df2..7519021144 100644
--- a/source4/pidl/lib/Parse/Pidl/Compat.pm
+++ b/source4/pidl/lib/Parse/Pidl/Compat.pm
@@ -148,10 +148,6 @@ sub CheckInterface($)
{
my $if = shift;
- if (has_property($if, "pointer_default_top") and
- $if->{PROPERTIES}->{pointer_default_top} ne "ref") {
- warning($if, "pointer_default_top() is pidl-specific");
- }
}
sub Check($)
diff --git a/source4/pidl/lib/Parse/Pidl/IDL.pm b/source4/pidl/lib/Parse/Pidl/IDL.pm
index 35e1d7bcd7..aeee69e306 100644
--- a/source4/pidl/lib/Parse/Pidl/IDL.pm
+++ b/source4/pidl/lib/Parse/Pidl/IDL.pm
@@ -124,7 +124,7 @@ sub new {
}
},
{#State 16
- DEFAULT => -116
+ DEFAULT => -114
},
{#State 17
DEFAULT => -11
@@ -184,7 +184,7 @@ sub new {
}
},
{#State 26
- DEFAULT => -112
+ DEFAULT => -110
},
{#State 27
ACTIONS => {
@@ -263,17 +263,17 @@ sub new {
},
{#State 40
ACTIONS => {
- 'CONSTANT' => 59,
+ 'CONSTANT' => 58,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -93,
+ DEFAULT => -91,
GOTOS => {
'identifier' => 60,
'text' => 61,
- 'listtext' => 57,
'anytext' => 56,
- 'constant' => 58
+ 'constant' => 57,
+ 'commalisttext' => 59
}
},
{#State 41
@@ -392,28 +392,28 @@ sub new {
DEFAULT => -89
},
{#State 57
- ACTIONS => {
- "," => 97,
- ")" => 98
- }
+ DEFAULT => -93
},
{#State 58
- DEFAULT => -95
+ DEFAULT => -113
},
{#State 59
- DEFAULT => -115
+ ACTIONS => {
+ "," => 97,
+ ")" => 98
+ }
},
{#State 60
- DEFAULT => -94
+ DEFAULT => -92
},
{#State 61
- DEFAULT => -96
+ DEFAULT => -94
},
{#State 62
ACTIONS => {
";" => 99
},
- DEFAULT => -117,
+ DEFAULT => -115,
GOTOS => {
'optional_semicolon' => 100
}
@@ -430,7 +430,7 @@ sub new {
ACTIONS => {
";" => 99
},
- DEFAULT => -117,
+ DEFAULT => -115,
GOTOS => {
'optional_semicolon' => 102
}
@@ -466,7 +466,7 @@ sub new {
ACTIONS => {
'IDENTIFIER' => 104
},
- DEFAULT => -114,
+ DEFAULT => -112,
GOTOS => {
'optional_identifier' => 105
}
@@ -501,7 +501,7 @@ sub new {
ACTIONS => {
'IDENTIFIER' => 104
},
- DEFAULT => -114,
+ DEFAULT => -112,
GOTOS => {
'optional_identifier' => 107
}
@@ -516,7 +516,7 @@ sub new {
ACTIONS => {
'IDENTIFIER' => 104
},
- DEFAULT => -114,
+ DEFAULT => -112,
GOTOS => {
'optional_identifier' => 108
}
@@ -525,7 +525,7 @@ sub new {
ACTIONS => {
'IDENTIFIER' => 104
},
- DEFAULT => -114,
+ DEFAULT => -112,
GOTOS => {
'optional_identifier' => 109
}
@@ -549,242 +549,242 @@ sub new {
},
{#State 82
ACTIONS => {
- 'CONSTANT' => 59,
+ 'CONSTANT' => 58,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -93,
+ DEFAULT => -91,
GOTOS => {
'identifier' => 60,
'anytext' => 112,
'text' => 61,
- 'constant' => 58
+ 'constant' => 57
}
},
{#State 83
ACTIONS => {
- 'CONSTANT' => 59,
+ 'CONSTANT' => 58,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -93,
+ DEFAULT => -91,
GOTOS => {
'identifier' => 60,
'anytext' => 113,
'text' => 61,
- 'constant' => 58
+ 'constant' => 57
}
},
{#State 84
ACTIONS => {
- 'CONSTANT' => 59,
+ 'CONSTANT' => 58,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -93,
+ DEFAULT => -91,
GOTOS => {
'identifier' => 60,
'anytext' => 114,
'text' => 61,
- 'constant' => 58
+ 'constant' => 57
}
},
{#State 85
ACTIONS => {
- 'CONSTANT' => 59,
+ 'CONSTANT' => 58,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -93,
+ DEFAULT => -91,
GOTOS => {
'identifier' => 60,
'anytext' => 115,
'text' => 61,
- 'constant' => 58
+ 'constant' => 57
}
},
{#State 86
ACTIONS => {
- 'CONSTANT' => 59,
+ 'CONSTANT' => 58,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -93,
+ DEFAULT => -91,
GOTOS => {
'identifier' => 60,
'anytext' => 116,
'text' => 61,
- 'constant' => 58
+ 'constant' => 57
}
},
{#State 87
ACTIONS => {
- 'CONSTANT' => 59,
+ 'CONSTANT' => 58,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -93,
+ DEFAULT => -91,
GOTOS => {
'identifier' => 60,
'anytext' => 117,
'text' => 61,
- 'constant' => 58
+ 'constant' => 57
}
},
{#State 88
ACTIONS => {
- 'CONSTANT' => 59,
+ 'CONSTANT' => 58,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -93,
+ DEFAULT => -91,
GOTOS => {
'identifier' => 60,
'anytext' => 118,
'text' => 61,
- 'constant' => 58
+ 'constant' => 57
}
},
{#State 89
ACTIONS => {
- 'CONSTANT' => 59,
+ 'CONSTANT' => 58,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -93,
+ DEFAULT => -91,
GOTOS => {
'identifier' => 60,
- 'anytext' => 119,
+ 'anytext' => 56,
'text' => 61,
- 'constant' => 58,
- 'commalisttext' => 120
+ 'constant' => 57,
+ 'commalisttext' => 119
}
},
{#State 90
ACTIONS => {
- 'CONSTANT' => 59,
+ 'CONSTANT' => 58,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -93,
+ DEFAULT => -91,
GOTOS => {
'identifier' => 60,
- 'anytext' => 121,
+ 'anytext' => 120,
'text' => 61,
- 'constant' => 58
+ 'constant' => 57
}
},
{#State 91
ACTIONS => {
- 'CONSTANT' => 59,
+ 'CONSTANT' => 58,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -93,
+ DEFAULT => -91,
GOTOS => {
'identifier' => 60,
- 'anytext' => 122,
+ 'anytext' => 121,
'text' => 61,
- 'constant' => 58
+ 'constant' => 57
}
},
{#State 92
ACTIONS => {
- 'CONSTANT' => 59,
+ 'CONSTANT' => 58,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -93,
+ DEFAULT => -91,
GOTOS => {
'identifier' => 60,
- 'anytext' => 123,
+ 'anytext' => 122,
'text' => 61,
- 'constant' => 58
+ 'constant' => 57
}
},
{#State 93
ACTIONS => {
- 'CONSTANT' => 59,
+ 'CONSTANT' => 58,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -93,
+ DEFAULT => -91,
GOTOS => {
'identifier' => 60,
- 'anytext' => 119,
+ 'anytext' => 56,
'text' => 61,
- 'constant' => 58,
- 'commalisttext' => 124
+ 'constant' => 57,
+ 'commalisttext' => 123
}
},
{#State 94
ACTIONS => {
- 'CONSTANT' => 59,
+ 'CONSTANT' => 58,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -93,
+ DEFAULT => -91,
GOTOS => {
'identifier' => 60,
- 'anytext' => 125,
+ 'anytext' => 124,
'text' => 61,
- 'constant' => 58
+ 'constant' => 57
}
},
{#State 95
ACTIONS => {
- 'CONSTANT' => 59,
+ 'CONSTANT' => 58,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -93,
+ DEFAULT => -91,
GOTOS => {
'identifier' => 60,
- 'anytext' => 126,
+ 'anytext' => 125,
'text' => 61,
- 'constant' => 58
+ 'constant' => 57
}
},
{#State 96
ACTIONS => {
- 'CONSTANT' => 59,
+ 'CONSTANT' => 58,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -93,
+ DEFAULT => -91,
GOTOS => {
'identifier' => 60,
- 'anytext' => 127,
+ 'anytext' => 126,
'text' => 61,
- 'constant' => 58
+ 'constant' => 57
}
},
{#State 97
ACTIONS => {
- 'CONSTANT' => 59,
+ 'CONSTANT' => 58,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -93,
+ DEFAULT => -91,
GOTOS => {
'identifier' => 60,
- 'anytext' => 128,
+ 'anytext' => 127,
'text' => 61,
- 'constant' => 58
+ 'constant' => 57
}
},
{#State 98
DEFAULT => -88
},
{#State 99
- DEFAULT => -118
+ DEFAULT => -116
},
{#State 100
DEFAULT => -13
},
{#State 101
ACTIONS => {
- ";" => 129
+ ";" => 128
}
},
{#State 102
@@ -795,20 +795,20 @@ sub new {
'IDENTIFIER' => 26
},
GOTOS => {
- 'identifier' => 130
+ 'identifier' => 129
}
},
{#State 104
- DEFAULT => -113
+ DEFAULT => -111
},
{#State 105
ACTIONS => {
- "{" => 132
+ "{" => 131
},
DEFAULT => -68,
GOTOS => {
- 'union_body' => 133,
- 'opt_union_body' => 131
+ 'union_body' => 132,
+ 'opt_union_body' => 130
}
},
{#State 106
@@ -816,46 +816,46 @@ sub new {
},
{#State 107
ACTIONS => {
- "{" => 135
+ "{" => 134
},
DEFAULT => -58,
GOTOS => {
- 'struct_body' => 134,
- 'opt_struct_body' => 136
+ 'struct_body' => 133,
+ 'opt_struct_body' => 135
}
},
{#State 108
ACTIONS => {
- "{" => 137
+ "{" => 136
},
DEFAULT => -41,
GOTOS => {
- 'opt_enum_body' => 139,
- 'enum_body' => 138
+ 'opt_enum_body' => 138,
+ 'enum_body' => 137
}
},
{#State 109
ACTIONS => {
- "{" => 141
+ "{" => 140
},
DEFAULT => -49,
GOTOS => {
- 'bitmap_body' => 142,
- 'opt_bitmap_body' => 140
+ 'bitmap_body' => 141,
+ 'opt_bitmap_body' => 139
}
},
{#State 110
ACTIONS => {
- "(" => 143
+ "(" => 142
}
},
{#State 111
ACTIONS => {
'IDENTIFIER' => 26,
- "*" => 145
+ "*" => 144
},
GOTOS => {
- 'identifier' => 144
+ 'identifier' => 143
}
},
{#State 112
@@ -876,7 +876,7 @@ sub new {
"." => 95,
">" => 96
},
- DEFAULT => -106
+ DEFAULT => -104
},
{#State 113
ACTIONS => {
@@ -887,7 +887,7 @@ sub new {
"{" => 89,
"=" => 92
},
- DEFAULT => -97
+ DEFAULT => -95
},
{#State 114
ACTIONS => {
@@ -907,7 +907,7 @@ sub new {
"." => 95,
">" => 96
},
- DEFAULT => -101
+ DEFAULT => -99
},
{#State 115
ACTIONS => {
@@ -927,7 +927,7 @@ sub new {
"." => 95,
">" => 96
},
- DEFAULT => -109
+ DEFAULT => -107
},
{#State 116
ACTIONS => {
@@ -938,7 +938,7 @@ sub new {
"{" => 89,
"=" => 92
},
- DEFAULT => -108
+ DEFAULT => -106
},
{#State 117
ACTIONS => {
@@ -949,7 +949,7 @@ sub new {
"{" => 89,
"=" => 92
},
- DEFAULT => -99
+ DEFAULT => -97
},
{#State 118
ACTIONS => {
@@ -969,35 +969,15 @@ sub new {
"." => 95,
">" => 96
},
- DEFAULT => -105
+ DEFAULT => -103
},
{#State 119
ACTIONS => {
- "-" => 83,
- ":" => 82,
- "<" => 84,
- "+" => 86,
- "~" => 85,
- "*" => 87,
- "?" => 88,
- "{" => 89,
- "&" => 90,
- "/" => 91,
- "=" => 92,
- "(" => 93,
- "|" => 94,
- "." => 95,
- ">" => 96
- },
- DEFAULT => -91
- },
- {#State 120
- ACTIONS => {
- "}" => 146,
- "," => 147
+ "}" => 145,
+ "," => 97
}
},
- {#State 121
+ {#State 120
ACTIONS => {
":" => 82,
"<" => 84,
@@ -1006,9 +986,9 @@ sub new {
"{" => 89,
"=" => 92
},
- DEFAULT => -103
+ DEFAULT => -101
},
- {#State 122
+ {#State 121
ACTIONS => {
":" => 82,
"<" => 84,
@@ -1017,9 +997,9 @@ sub new {
"{" => 89,
"=" => 92
},
- DEFAULT => -104
+ DEFAULT => -102
},
- {#State 123
+ {#State 122
ACTIONS => {
"-" => 83,
":" => 82,
@@ -1037,15 +1017,15 @@ sub new {
"." => 95,
">" => 96
},
- DEFAULT => -107
+ DEFAULT => -105
},
- {#State 124
+ {#State 123
ACTIONS => {
- "," => 147,
- ")" => 148
+ "," => 97,
+ ")" => 146
}
},
- {#State 125
+ {#State 124
ACTIONS => {
":" => 82,
"<" => 84,
@@ -1054,9 +1034,9 @@ sub new {
"{" => 89,
"=" => 92
},
- DEFAULT => -102
+ DEFAULT => -100
},
- {#State 126
+ {#State 125
ACTIONS => {
":" => 82,
"<" => 84,
@@ -1065,9 +1045,9 @@ sub new {
"{" => 89,
"=" => 92
},
- DEFAULT => -98
+ DEFAULT => -96
},
- {#State 127
+ {#State 126
ACTIONS => {
":" => 82,
"<" => 84,
@@ -1076,9 +1056,9 @@ sub new {
"{" => 89,
"=" => 92
},
- DEFAULT => -100
+ DEFAULT => -98
},
- {#State 128
+ {#State 127
ACTIONS => {
"-" => 83,
":" => 82,
@@ -1098,221 +1078,207 @@ sub new {
},
DEFAULT => -90
},
- {#State 129
+ {#State 128
DEFAULT => -15
},
- {#State 130
+ {#State 129
ACTIONS => {
- "[" => 149
+ "[" => 147
},
DEFAULT => -80,
GOTOS => {
- 'array_len' => 150
+ 'array_len' => 148
}
},
- {#State 131
+ {#State 130
DEFAULT => -70
},
- {#State 132
+ {#State 131
DEFAULT => -65,
GOTOS => {
- 'union_elements' => 151
+ 'union_elements' => 149
}
},
- {#State 133
+ {#State 132
DEFAULT => -69
},
- {#State 134
+ {#State 133
DEFAULT => -59
},
- {#State 135
+ {#State 134
DEFAULT => -74,
GOTOS => {
- 'element_list1' => 152
+ 'element_list1' => 150
}
},
- {#State 136
+ {#State 135
DEFAULT => -60
},
- {#State 137
+ {#State 136
ACTIONS => {
'IDENTIFIER' => 26
},
GOTOS => {
- 'identifier' => 153,
- 'enum_element' => 154,
- 'enum_elements' => 155
+ 'identifier' => 151,
+ 'enum_element' => 152,
+ 'enum_elements' => 153
}
},
- {#State 138
+ {#State 137
DEFAULT => -42
},
- {#State 139
+ {#State 138
DEFAULT => -43
},
- {#State 140
+ {#State 139
DEFAULT => -51
},
- {#State 141
+ {#State 140
ACTIONS => {
'IDENTIFIER' => 26
},
DEFAULT => -54,
GOTOS => {
- 'identifier' => 158,
- 'bitmap_element' => 157,
- 'bitmap_elements' => 156,
- 'opt_bitmap_elements' => 159
+ 'identifier' => 156,
+ 'bitmap_element' => 155,
+ 'bitmap_elements' => 154,
+ 'opt_bitmap_elements' => 157
}
},
- {#State 142
+ {#State 141
DEFAULT => -50
},
- {#State 143
+ {#State 142
ACTIONS => {
"," => -76,
- "void" => 163,
+ "void" => 161,
")" => -76
},
DEFAULT => -83,
GOTOS => {
- 'base_element' => 160,
- 'element_list2' => 162,
- 'property_list' => 161
+ 'base_element' => 158,
+ 'element_list2' => 160,
+ 'property_list' => 159
}
},
- {#State 144
+ {#State 143
ACTIONS => {
- "[" => 149,
- "=" => 165
+ "[" => 147,
+ "=" => 163
},
GOTOS => {
- 'array_len' => 164
+ 'array_len' => 162
}
},
- {#State 145
+ {#State 144
DEFAULT => -73
},
- {#State 146
- ACTIONS => {
- 'CONSTANT' => 59,
- 'TEXT' => 16,
- 'IDENTIFIER' => 26
- },
- DEFAULT => -93,
- GOTOS => {
- 'identifier' => 60,
- 'anytext' => 166,
- 'text' => 61,
- 'constant' => 58
- }
- },
- {#State 147
+ {#State 145
ACTIONS => {
- 'CONSTANT' => 59,
+ 'CONSTANT' => 58,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -93,
+ DEFAULT => -91,
GOTOS => {
'identifier' => 60,
- 'anytext' => 167,
+ 'anytext' => 164,
'text' => 61,
- 'constant' => 58
+ 'constant' => 57
}
},
- {#State 148
+ {#State 146
ACTIONS => {
- 'CONSTANT' => 59,
+ 'CONSTANT' => 58,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -93,
+ DEFAULT => -91,
GOTOS => {
'identifier' => 60,
- 'anytext' => 168,
+ 'anytext' => 165,
'text' => 61,
- 'constant' => 58
+ 'constant' => 57
}
},
- {#State 149
+ {#State 147
ACTIONS => {
- 'CONSTANT' => 59,
+ 'CONSTANT' => 58,
'TEXT' => 16,
- "]" => 169,
+ "]" => 166,
'IDENTIFIER' => 26
},
- DEFAULT => -93,
+ DEFAULT => -91,
GOTOS => {
'identifier' => 60,
- 'anytext' => 170,
+ 'anytext' => 167,
'text' => 61,
- 'constant' => 58
+ 'constant' => 57
}
},
- {#State 150
+ {#State 148
ACTIONS => {
- ";" => 171
+ ";" => 168
}
},
- {#State 151
+ {#State 149
ACTIONS => {
- "}" => 172
+ "}" => 169
},
DEFAULT => -83,
GOTOS => {
- 'optional_base_element' => 174,
- 'property_list' => 173
+ 'optional_base_element' => 171,
+ 'property_list' => 170
}
},
- {#State 152
+ {#State 150
ACTIONS => {
- "}" => 175
+ "}" => 172
},
DEFAULT => -83,
GOTOS => {
- 'base_element' => 176,
- 'property_list' => 161
+ 'base_element' => 173,
+ 'property_list' => 159
}
},
- {#State 153
+ {#State 151
ACTIONS => {
- "=" => 177
+ "=" => 174
},
DEFAULT => -46
},
- {#State 154
+ {#State 152
DEFAULT => -44
},
- {#State 155
+ {#State 153
ACTIONS => {
- "}" => 178,
- "," => 179
+ "}" => 175,
+ "," => 176
}
},
- {#State 156
+ {#State 154
ACTIONS => {
- "," => 180
+ "," => 177
},
DEFAULT => -55
},
- {#State 157
+ {#State 155
DEFAULT => -52
},
- {#State 158
+ {#State 156
ACTIONS => {
- "=" => 181
+ "=" => 178
}
},
- {#State 159
+ {#State 157
ACTIONS => {
- "}" => 182
+ "}" => 179
}
},
- {#State 160
+ {#State 158
DEFAULT => -78
},
- {#State 161
+ {#State 159
ACTIONS => {
'IDENTIFIER' => 26,
"signed" => 75,
@@ -1329,60 +1295,40 @@ sub new {
'identifier' => 72,
'struct' => 49,
'enum' => 52,
- 'type' => 183,
+ 'type' => 180,
'union' => 54,
'sign' => 73
}
},
- {#State 162
+ {#State 160
ACTIONS => {
- "," => 184,
- ")" => 185
+ "," => 181,
+ ")" => 182
}
},
- {#State 163
+ {#State 161
DEFAULT => -77
},
- {#State 164
+ {#State 162
ACTIONS => {
- "=" => 186
+ "=" => 183
}
},
- {#State 165
+ {#State 163
ACTIONS => {
- 'CONSTANT' => 59,
+ 'CONSTANT' => 58,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -93,
+ DEFAULT => -91,
GOTOS => {
'identifier' => 60,
- 'anytext' => 187,
+ 'anytext' => 184,
'text' => 61,
- 'constant' => 58
+ 'constant' => 57
}
},
- {#State 166
- ACTIONS => {
- "-" => 83,
- ":" => 82,
- "<" => 84,
- "+" => 86,
- "~" => 85,
- "*" => 87,
- "?" => 88,
- "{" => 89,
- "&" => 90,
- "/" => 91,
- "=" => 92,
- "(" => 93,
- "|" => 94,
- "." => 95,
- ">" => 96
- },
- DEFAULT => -111
- },
- {#State 167
+ {#State 164
ACTIONS => {
"-" => 83,
":" => 82,
@@ -1400,9 +1346,9 @@ sub new {
"." => 95,
">" => 96
},
- DEFAULT => -92
+ DEFAULT => -109
},
- {#State 168
+ {#State 165
ACTIONS => {
":" => 82,
"<" => 84,
@@ -1411,18 +1357,18 @@ sub new {
"{" => 89,
"=" => 92
},
- DEFAULT => -110
+ DEFAULT => -108
},
- {#State 169
+ {#State 166
ACTIONS => {
- "[" => 149
+ "[" => 147
},
DEFAULT => -80,
GOTOS => {
- 'array_len' => 188
+ 'array_len' => 185
}
},
- {#State 170
+ {#State 167
ACTIONS => {
"-" => 83,
":" => 82,
@@ -1438,130 +1384,130 @@ sub new {
"(" => 93,
"*" => 87,
"." => 95,
- "]" => 189,
+ "]" => 186,
">" => 96
}
},
- {#State 171
+ {#State 168
DEFAULT => -27
},
- {#State 172
+ {#State 169
DEFAULT => -67
},
- {#State 173
+ {#State 170
ACTIONS => {
"[" => 20
},
DEFAULT => -83,
GOTOS => {
- 'base_or_empty' => 190,
- 'base_element' => 191,
- 'empty_element' => 192,
- 'property_list' => 193
+ 'base_or_empty' => 187,
+ 'base_element' => 188,
+ 'empty_element' => 189,
+ 'property_list' => 190
}
},
- {#State 174
+ {#State 171
DEFAULT => -66
},
- {#State 175
+ {#State 172
DEFAULT => -57
},
- {#State 176
+ {#State 173
ACTIONS => {
- ";" => 194
+ ";" => 191
}
},
- {#State 177
+ {#State 174
ACTIONS => {
- 'CONSTANT' => 59,
+ 'CONSTANT' => 58,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -93,
+ DEFAULT => -91,
GOTOS => {
'identifier' => 60,
- 'anytext' => 195,
+ 'anytext' => 192,
'text' => 61,
- 'constant' => 58
+ 'constant' => 57
}
},
- {#State 178
+ {#State 175
DEFAULT => -40
},
- {#State 179
+ {#State 176
ACTIONS => {
'IDENTIFIER' => 26
},
GOTOS => {
- 'identifier' => 153,
- 'enum_element' => 196
+ 'identifier' => 151,
+ 'enum_element' => 193
}
},
- {#State 180
+ {#State 177
ACTIONS => {
'IDENTIFIER' => 26
},
GOTOS => {
- 'identifier' => 158,
- 'bitmap_element' => 197
+ 'identifier' => 156,
+ 'bitmap_element' => 194
}
},
- {#State 181
+ {#State 178
ACTIONS => {
- 'CONSTANT' => 59,
+ 'CONSTANT' => 58,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -93,
+ DEFAULT => -91,
GOTOS => {
'identifier' => 60,
- 'anytext' => 198,
+ 'anytext' => 195,
'text' => 61,
- 'constant' => 58
+ 'constant' => 57
}
},
- {#State 182
+ {#State 179
DEFAULT => -48
},
- {#State 183
+ {#State 180
DEFAULT => -72,
GOTOS => {
- 'pointers' => 199
+ 'pointers' => 196
}
},
- {#State 184
+ {#State 181
DEFAULT => -83,
GOTOS => {
- 'base_element' => 200,
- 'property_list' => 161
+ 'base_element' => 197,
+ 'property_list' => 159
}
},
- {#State 185
+ {#State 182
ACTIONS => {
- ";" => 201
+ ";" => 198
}
},
- {#State 186
+ {#State 183
ACTIONS => {
- 'CONSTANT' => 59,
+ 'CONSTANT' => 58,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -93,
+ DEFAULT => -91,
GOTOS => {
'identifier' => 60,
- 'anytext' => 202,
+ 'anytext' => 199,
'text' => 61,
- 'constant' => 58
+ 'constant' => 57
}
},
- {#State 187
+ {#State 184
ACTIONS => {
"-" => 83,
":" => 82,
"?" => 88,
"<" => 84,
- ";" => 203,
+ ";" => 200,
"+" => 86,
"~" => 85,
"&" => 90,
@@ -1575,34 +1521,34 @@ sub new {
">" => 96
}
},
- {#State 188
+ {#State 185
DEFAULT => -81
},
- {#State 189
+ {#State 186
ACTIONS => {
- "[" => 149
+ "[" => 147
},
DEFAULT => -80,
GOTOS => {
- 'array_len' => 204
+ 'array_len' => 201
}
},
- {#State 190
+ {#State 187
DEFAULT => -64
},
- {#State 191
+ {#State 188
ACTIONS => {
- ";" => 205
+ ";" => 202
}
},
- {#State 192
+ {#State 189
DEFAULT => -63
},
- {#State 193
+ {#State 190
ACTIONS => {
'IDENTIFIER' => 26,
"signed" => 75,
- ";" => 206,
+ ";" => 203,
'void' => 69,
"unsigned" => 79,
"[" => 20
@@ -1616,15 +1562,15 @@ sub new {
'identifier' => 72,
'struct' => 49,
'enum' => 52,
- 'type' => 183,
+ 'type' => 180,
'union' => 54,
'sign' => 73
}
},
- {#State 194
+ {#State 191
DEFAULT => -75
},
- {#State 195
+ {#State 192
ACTIONS => {
"-" => 83,
":" => 82,
@@ -1644,13 +1590,13 @@ sub new {
},
DEFAULT => -47
},
- {#State 196
+ {#State 193
DEFAULT => -45
},
- {#State 197
+ {#State 194
DEFAULT => -53
},
- {#State 198
+ {#State 195
ACTIONS => {
"-" => 83,
":" => 82,
@@ -1670,28 +1616,28 @@ sub new {
},
DEFAULT => -56
},
- {#State 199
+ {#State 196
ACTIONS => {
'IDENTIFIER' => 26,
- "*" => 145
+ "*" => 144
},
GOTOS => {
- 'identifier' => 207
+ 'identifier' => 204
}
},
- {#State 200
+ {#State 197
DEFAULT => -79
},
- {#State 201
+ {#State 198
DEFAULT => -26
},
- {#State 202
+ {#State 199
ACTIONS => {
"-" => 83,
":" => 82,
"?" => 88,
"<" => 84,
- ";" => 208,
+ ";" => 205,
"+" => 86,
"~" => 85,
"&" => 90,
@@ -1705,31 +1651,31 @@ sub new {
">" => 96
}
},
- {#State 203
+ {#State 200
DEFAULT => -24
},
- {#State 204
+ {#State 201
DEFAULT => -82
},
- {#State 205
+ {#State 202
DEFAULT => -62
},
- {#State 206
+ {#State 203
DEFAULT => -61
},
- {#State 207
+ {#State 204
ACTIONS => {
- "[" => 149
+ "[" => 147
},
DEFAULT => -80,
GOTOS => {
- 'array_len' => 209
+ 'array_len' => 206
}
},
- {#State 208
+ {#State 205
DEFAULT => -25
},
- {#State 209
+ {#State 206
DEFAULT => -71
}
],
@@ -1744,43 +1690,43 @@ sub new {
[#Rule 2
'idl', 2,
sub
-#line 19 "idl.yp"
+#line 19 "pidl/idl.yp"
{ push(@{$_[1]}, $_[2]); $_[1] }
],
[#Rule 3
'idl', 2,
sub
-#line 20 "idl.yp"
+#line 20 "pidl/idl.yp"
{ push(@{$_[1]}, $_[2]); $_[1] }
],
[#Rule 4
'idl', 2,
sub
-#line 21 "idl.yp"
+#line 21 "pidl/idl.yp"
{ push(@{$_[1]}, $_[2]); $_[1] }
],
[#Rule 5
'idl', 2,
sub
-#line 22 "idl.yp"
+#line 22 "pidl/idl.yp"
{ push(@{$_[1]}, $_[2]); $_[1] }
],
[#Rule 6
'idl', 2,
sub
-#line 23 "idl.yp"
+#line 23 "pidl/idl.yp"
{ push(@{$_[1]}, $_[2]); $_[1] }
],
[#Rule 7
'idl', 2,
sub
-#line 24 "idl.yp"
+#line 24 "pidl/idl.yp"
{ push(@{$_[1]}, $_[2]); $_[1] }
],
[#Rule 8
'import', 3,
sub
-#line 27 "idl.yp"
+#line 27 "pidl/idl.yp"
{{
"TYPE" => "IMPORT",
"PATHS" => $_[2],
@@ -1791,7 +1737,7 @@ sub
[#Rule 9
'include', 3,
sub
-#line 34 "idl.yp"
+#line 34 "pidl/idl.yp"
{{
"TYPE" => "INCLUDE",
"PATHS" => $_[2],
@@ -1802,7 +1748,7 @@ sub
[#Rule 10
'importlib', 3,
sub
-#line 41 "idl.yp"
+#line 41 "pidl/idl.yp"
{{
"TYPE" => "IMPORTLIB",
"PATHS" => $_[2],
@@ -1813,19 +1759,19 @@ sub
[#Rule 11
'commalist', 1,
sub
-#line 50 "idl.yp"
+#line 50 "pidl/idl.yp"
{ [ $_[1] ] }
],
[#Rule 12
'commalist', 3,
sub
-#line 51 "idl.yp"
+#line 51 "pidl/idl.yp"
{ push(@{$_[1]}, $_[3]); $_[1] }
],
[#Rule 13
'coclass', 7,
sub
-#line 55 "idl.yp"
+#line 55 "pidl/idl.yp"
{{
"TYPE" => "COCLASS",
"PROPERTIES" => $_[1],
@@ -1841,13 +1787,13 @@ sub
[#Rule 15
'interface_names', 4,
sub
-#line 67 "idl.yp"
+#line 67 "pidl/idl.yp"
{ push(@{$_[1]}, $_[2]); $_[1] }
],
[#Rule 16
'interface', 7,
sub
-#line 71 "idl.yp"
+#line 71 "pidl/idl.yp"
{{
"TYPE" => "INTERFACE",
"PROPERTIES" => $_[1],
@@ -1860,7 +1806,7 @@ sub
[#Rule 17
'cpp_quote', 4,
sub
-#line 82 "idl.yp"
+#line 82 "pidl/idl.yp"
{{
"TYPE" => "CPP_QUOTE",
"FILE" => $_[0]->YYData->{FILE},
@@ -1871,13 +1817,13 @@ sub
[#Rule 18
'definitions', 1,
sub
-#line 91 "idl.yp"
+#line 91 "pidl/idl.yp"
{ [ $_[1] ] }
],
[#Rule 19
'definitions', 2,
sub
-#line 92 "idl.yp"
+#line 92 "pidl/idl.yp"
{ push(@{$_[1]}, $_[2]); $_[1] }
],
[#Rule 20
@@ -1895,7 +1841,7 @@ sub
[#Rule 24
'const', 7,
sub
-#line 100 "idl.yp"
+#line 100 "pidl/idl.yp"
{{
"TYPE" => "CONST",
"DTYPE" => $_[2],
@@ -1909,7 +1855,7 @@ sub
[#Rule 25
'const', 8,
sub
-#line 110 "idl.yp"
+#line 110 "pidl/idl.yp"
{{
"TYPE" => "CONST",
"DTYPE" => $_[2],
@@ -1924,7 +1870,7 @@ sub
[#Rule 26
'function', 7,
sub
-#line 124 "idl.yp"
+#line 124 "pidl/idl.yp"
{{
"TYPE" => "FUNCTION",
"NAME" => $_[3],
@@ -1938,7 +1884,7 @@ sub
[#Rule 27
'typedef', 6,
sub
-#line 136 "idl.yp"
+#line 136 "pidl/idl.yp"
{{
"TYPE" => "TYPEDEF",
"PROPERTIES" => $_[1],
@@ -1964,7 +1910,7 @@ sub
[#Rule 32
'typedecl', 2,
sub
-#line 149 "idl.yp"
+#line 149 "pidl/idl.yp"
{ $_[1] }
],
[#Rule 33
@@ -1976,7 +1922,7 @@ sub
[#Rule 35
'existingtype', 2,
sub
-#line 154 "idl.yp"
+#line 154 "pidl/idl.yp"
{ ($_[1]?$_[1]:"signed") ." $_[2]" }
],
[#Rule 36
@@ -1991,13 +1937,13 @@ sub
[#Rule 39
'type', 1,
sub
-#line 158 "idl.yp"
+#line 158 "pidl/idl.yp"
{ "void" }
],
[#Rule 40
'enum_body', 3,
sub
-#line 160 "idl.yp"
+#line 160 "pidl/idl.yp"
{ $_[2] }
],
[#Rule 41
@@ -2009,7 +1955,7 @@ sub
[#Rule 43
'enum', 4,
sub
-#line 163 "idl.yp"
+#line 163 "pidl/idl.yp"
{{
"TYPE" => "ENUM",
"PROPERTIES" => $_[1],
@@ -2020,13 +1966,13 @@ sub
[#Rule 44
'enum_elements', 1,
sub
-#line 172 "idl.yp"
+#line 172 "pidl/idl.yp"
{ [ $_[1] ] }
],
[#Rule 45
'enum_elements', 3,
sub
-#line 173 "idl.yp"
+#line 173 "pidl/idl.yp"
{ push(@{$_[1]}, $_[3]); $_[1] }
],
[#Rule 46
@@ -2035,13 +1981,13 @@ sub
[#Rule 47
'enum_element', 3,
sub
-#line 177 "idl.yp"
+#line 177 "pidl/idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
[#Rule 48
'bitmap_body', 3,
sub
-#line 180 "idl.yp"
+#line 180 "pidl/idl.yp"
{ $_[2] }
],
[#Rule 49
@@ -2053,7 +1999,7 @@ sub
[#Rule 51
'bitmap', 4,
sub
-#line 183 "idl.yp"
+#line 183 "pidl/idl.yp"
{{
"TYPE" => "BITMAP",
"PROPERTIES" => $_[1],
@@ -2064,13 +2010,13 @@ sub
[#Rule 52
'bitmap_elements', 1,
sub
-#line 192 "idl.yp"
+#line 192 "pidl/idl.yp"
{ [ $_[1] ] }
],
[#Rule 53
'bitmap_elements', 3,
sub
-#line 193 "idl.yp"
+#line 193 "pidl/idl.yp"
{ push(@{$_[1]}, $_[3]); $_[1] }
],
[#Rule 54
@@ -2082,13 +2028,13 @@ sub
[#Rule 56
'bitmap_element', 3,
sub
-#line 198 "idl.yp"
+#line 198 "pidl/idl.yp"
{ "$_[1] ( $_[3] )" }
],
[#Rule 57
'struct_body', 3,
sub
-#line 201 "idl.yp"
+#line 201 "pidl/idl.yp"
{ $_[2] }
],
[#Rule 58
@@ -2100,7 +2046,7 @@ sub
[#Rule 60
'struct', 4,
sub
-#line 205 "idl.yp"
+#line 205 "pidl/idl.yp"
{{
"TYPE" => "STRUCT",
"PROPERTIES" => $_[1],
@@ -2111,7 +2057,7 @@ sub
[#Rule 61
'empty_element', 2,
sub
-#line 214 "idl.yp"
+#line 214 "pidl/idl.yp"
{{
"NAME" => "",
"TYPE" => "EMPTY",
@@ -2131,7 +2077,7 @@ sub
[#Rule 64
'optional_base_element', 2,
sub
-#line 228 "idl.yp"
+#line 228 "pidl/idl.yp"
{ $_[2]->{PROPERTIES} = FlattenHash([$_[1],$_[2]->{PROPERTIES}]); $_[2] }
],
[#Rule 65
@@ -2140,13 +2086,13 @@ sub
[#Rule 66
'union_elements', 2,
sub
-#line 233 "idl.yp"
+#line 233 "pidl/idl.yp"
{ push(@{$_[1]}, $_[2]); $_[1] }
],
[#Rule 67
'union_body', 3,
sub
-#line 236 "idl.yp"
+#line 236 "pidl/idl.yp"
{ $_[2] }
],
[#Rule 68
@@ -2158,7 +2104,7 @@ sub
[#Rule 70
'union', 4,
sub
-#line 240 "idl.yp"
+#line 240 "pidl/idl.yp"
{{
"TYPE" => "UNION",
"PROPERTIES" => $_[1],
@@ -2169,7 +2115,7 @@ sub
[#Rule 71
'base_element', 5,
sub
-#line 249 "idl.yp"
+#line 249 "pidl/idl.yp"
{{
"NAME" => $_[4],
"TYPE" => $_[2],
@@ -2183,25 +2129,25 @@ sub
[#Rule 72
'pointers', 0,
sub
-#line 263 "idl.yp"
+#line 263 "pidl/idl.yp"
{ 0 }
],
[#Rule 73
'pointers', 2,
sub
-#line 264 "idl.yp"
+#line 264 "pidl/idl.yp"
{ $_[1]+1 }
],
[#Rule 74
'element_list1', 0,
sub
-#line 268 "idl.yp"
+#line 268 "pidl/idl.yp"
{ [] }
],
[#Rule 75
'element_list1', 3,
sub
-#line 269 "idl.yp"
+#line 269 "pidl/idl.yp"
{ push(@{$_[1]}, $_[2]); $_[1] }
],
[#Rule 76
@@ -2213,13 +2159,13 @@ sub
[#Rule 78
'element_list2', 1,
sub
-#line 275 "idl.yp"
+#line 275 "pidl/idl.yp"
{ [ $_[1] ] }
],
[#Rule 79
'element_list2', 3,
sub
-#line 276 "idl.yp"
+#line 276 "pidl/idl.yp"
{ push(@{$_[1]}, $_[3]); $_[1] }
],
[#Rule 80
@@ -2228,13 +2174,13 @@ sub
[#Rule 81
'array_len', 3,
sub
-#line 281 "idl.yp"
+#line 281 "pidl/idl.yp"
{ push(@{$_[3]}, "*"); $_[3] }
],
[#Rule 82
'array_len', 4,
sub
-#line 282 "idl.yp"
+#line 282 "pidl/idl.yp"
{ push(@{$_[4]}, "$_[2]"); $_[4] }
],
[#Rule 83
@@ -2243,178 +2189,169 @@ sub
[#Rule 84
'property_list', 4,
sub
-#line 288 "idl.yp"
+#line 288 "pidl/idl.yp"
{ FlattenHash([$_[1],$_[3]]); }
],
[#Rule 85
'properties', 1,
sub
-#line 291 "idl.yp"
+#line 291 "pidl/idl.yp"
{ $_[1] }
],
[#Rule 86
'properties', 3,
sub
-#line 292 "idl.yp"
+#line 292 "pidl/idl.yp"
{ FlattenHash([$_[1], $_[3]]); }
],
[#Rule 87
'property', 1,
sub
-#line 295 "idl.yp"
+#line 295 "pidl/idl.yp"
{{ "$_[1]" => "1" }}
],
[#Rule 88
'property', 4,
sub
-#line 296 "idl.yp"
+#line 296 "pidl/idl.yp"
{{ "$_[1]" => "$_[3]" }}
],
[#Rule 89
- 'listtext', 1, undef
- ],
- [#Rule 90
- 'listtext', 3,
-sub
-#line 301 "idl.yp"
-{ "$_[1] $_[3]" }
- ],
- [#Rule 91
'commalisttext', 1, undef
],
- [#Rule 92
+ [#Rule 90
'commalisttext', 3,
sub
-#line 306 "idl.yp"
+#line 301 "pidl/idl.yp"
{ "$_[1],$_[3]" }
],
- [#Rule 93
+ [#Rule 91
'anytext', 0,
sub
-#line 310 "idl.yp"
+#line 305 "pidl/idl.yp"
{ "" }
],
+ [#Rule 92
+ 'anytext', 1, undef
+ ],
+ [#Rule 93
+ 'anytext', 1, undef
+ ],
[#Rule 94
'anytext', 1, undef
],
[#Rule 95
- 'anytext', 1, undef
+ 'anytext', 3,
+sub
+#line 307 "pidl/idl.yp"
+{ "$_[1]$_[2]$_[3]" }
],
[#Rule 96
- 'anytext', 1, undef
+ 'anytext', 3,
+sub
+#line 308 "pidl/idl.yp"
+{ "$_[1]$_[2]$_[3]" }
],
[#Rule 97
'anytext', 3,
sub
-#line 312 "idl.yp"
+#line 309 "pidl/idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
[#Rule 98
'anytext', 3,
sub
-#line 313 "idl.yp"
+#line 310 "pidl/idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
[#Rule 99
'anytext', 3,
sub
-#line 314 "idl.yp"
+#line 311 "pidl/idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
[#Rule 100
'anytext', 3,
sub
-#line 315 "idl.yp"
+#line 312 "pidl/idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
[#Rule 101
'anytext', 3,
sub
-#line 316 "idl.yp"
+#line 313 "pidl/idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
[#Rule 102
'anytext', 3,
sub
-#line 317 "idl.yp"
+#line 314 "pidl/idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
[#Rule 103
'anytext', 3,
sub
-#line 318 "idl.yp"
+#line 315 "pidl/idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
[#Rule 104
'anytext', 3,
sub
-#line 319 "idl.yp"
+#line 316 "pidl/idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
[#Rule 105
'anytext', 3,
sub
-#line 320 "idl.yp"
+#line 317 "pidl/idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
[#Rule 106
'anytext', 3,
sub
-#line 321 "idl.yp"
+#line 318 "pidl/idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
[#Rule 107
'anytext', 3,
sub
-#line 322 "idl.yp"
+#line 319 "pidl/idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
[#Rule 108
- 'anytext', 3,
-sub
-#line 323 "idl.yp"
-{ "$_[1]$_[2]$_[3]" }
- ],
- [#Rule 109
- 'anytext', 3,
-sub
-#line 324 "idl.yp"
-{ "$_[1]$_[2]$_[3]" }
- ],
- [#Rule 110
'anytext', 5,
sub
-#line 325 "idl.yp"
+#line 320 "pidl/idl.yp"
{ "$_[1]$_[2]$_[3]$_[4]$_[5]" }
],
- [#Rule 111
+ [#Rule 109
'anytext', 5,
sub
-#line 326 "idl.yp"
+#line 321 "pidl/idl.yp"
{ "$_[1]$_[2]$_[3]$_[4]$_[5]" }
],
- [#Rule 112
+ [#Rule 110
'identifier', 1, undef
],
- [#Rule 113
+ [#Rule 111
'optional_identifier', 1, undef
],
- [#Rule 114
+ [#Rule 112
'optional_identifier', 0, undef
],
- [#Rule 115
+ [#Rule 113
'constant', 1, undef
],
- [#Rule 116
+ [#Rule 114
'text', 1,
sub
-#line 340 "idl.yp"
+#line 335 "pidl/idl.yp"
{ "\"$_[1]\"" }
],
- [#Rule 117
+ [#Rule 115
'optional_semicolon', 0, undef
],
- [#Rule 118
+ [#Rule 116
'optional_semicolon', 1, undef
]
],
@@ -2422,7 +2359,7 @@ sub
bless($self,$class);
}
-#line 351 "idl.yp"
+#line 346 "pidl/idl.yp"
use Parse::Pidl qw(error);
diff --git a/source4/pidl/lib/Parse/Pidl/NDR.pm b/source4/pidl/lib/Parse/Pidl/NDR.pm
index fc6bfe4c96..86ed1a8d10 100644
--- a/source4/pidl/lib/Parse/Pidl/NDR.pm
+++ b/source4/pidl/lib/Parse/Pidl/NDR.pm
@@ -72,9 +72,9 @@ my $scalar_alignment = {
'ipv4address' => 4
};
-sub GetElementLevelTable($)
+sub GetElementLevelTable($$)
{
- my $e = shift;
+ my ($e, $pointer_default) = @_;
my $order = [];
my $is_deferred = 0;
@@ -157,32 +157,45 @@ sub GetElementLevelTable($)
# Next, all the pointers
foreach my $i (1..$e->{POINTERS}) {
- my $pt = pointer_type($e);
-
my $level = "EMBEDDED";
# Top level "ref" pointers do not have a referrent identifier
- $level = "TOP" if ( defined($pt)
- and $i == 1
- and $e->{PARENT}->{TYPE} eq "FUNCTION");
+ $level = "TOP" if ($i == 1 and $e->{PARENT}->{TYPE} eq "FUNCTION");
+
+ my $pt;
+ #
+ # Only the first level gets the pointer type from the
+ # pointer property, the others get them from
+ # the pointer_default() interface property
+ #
+ # see http://msdn2.microsoft.com/en-us/library/aa378984(VS.85).aspx
+ # (Here they talk about the rightmost pointer, but testing shows
+ # they mean the leftmost pointer.)
+ #
+ # --metze
+ #
+ $pt = pointer_type($e);
+ if ($i > 1) {
+ $is_deferred = 1 if ($pt ne "ref" and $e->{PARENT}->{TYPE} eq "FUNCTION");
+ $pt = $pointer_default;
+ }
push (@$order, {
TYPE => "POINTER",
- # for now, there can only be one pointer type per element
- POINTER_TYPE => pointer_type($e),
+ POINTER_TYPE => $pt,
POINTER_INDEX => $pointer_idx,
IS_DEFERRED => "$is_deferred",
LEVEL => $level
});
warning($e, "top-level \[out\] pointer `$e->{NAME}' is not a \[ref\] pointer")
- if ($i == 1 and pointer_type($e) ne "ref" and
+ if ($i == 1 and $pt ne "ref" and
$e->{PARENT}->{TYPE} eq "FUNCTION" and
not has_property($e, "in"));
$pointer_idx++;
# everything that follows will be deferred
- $is_deferred = 1 if ($e->{PARENT}->{TYPE} ne "FUNCTION");
+ $is_deferred = 1 if ($level ne "TOP");
my $array_size = shift @size_is;
my $array_length;
@@ -391,7 +404,7 @@ sub ParseElement($$)
NAME => $e->{NAME},
TYPE => $e->{TYPE},
PROPERTIES => $e->{PROPERTIES},
- LEVELS => GetElementLevelTable($e),
+ LEVELS => GetElementLevelTable($e, $pointer_default),
REPRESENTATION_TYPE => ($e->{PROPERTIES}->{represent_as} or $e->{TYPE}),
ALIGN => align_type($e->{TYPE}),
ORIGINAL => $e
@@ -581,7 +594,7 @@ sub ParseFunction($$$)
my $rettype = undef;
my $thisopnum = undef;
- CheckPointerTypes($d, $ndr->{PROPERTIES}->{pointer_default_top});
+ CheckPointerTypes($d, "ref");
if (not defined($d->{PROPERTIES}{noopnum})) {
$thisopnum = ${$opnum};
@@ -623,7 +636,7 @@ sub CheckPointerTypes($$)
foreach my $e (@{$s->{ELEMENTS}}) {
if ($e->{POINTERS} and not defined(pointer_type($e))) {
- $e->{PROPERTIES}->{$default} = 1;
+ $e->{PROPERTIES}->{$default} = '1';
}
}
}
@@ -661,12 +674,6 @@ sub ParseInterface($)
$idl->{PROPERTIES}->{pointer_default} = "unique";
}
- if (not has_property($idl, "pointer_default_top")) {
- $idl->{PROPERTIES}->{pointer_default_top} = "ref";
- } else {
- warning($idl, "pointer_default_top() is a pidl extension and should not be used");
- }
-
foreach my $d (@{$idl->{DATA}}) {
if ($d->{TYPE} eq "FUNCTION") {
push (@functions, ParseFunction($idl, $d, \$opnum));
@@ -688,7 +695,7 @@ sub ParseInterface($)
if (!defined $idl->{PROPERTIES}->{endpoint}) {
push @endpoints, "\"ncacn_np:[\\\\pipe\\\\" . $idl->{NAME} . "]\"";
} else {
- @endpoints = split / /, $idl->{PROPERTIES}->{endpoint};
+ @endpoints = split /,/, $idl->{PROPERTIES}->{endpoint};
}
return {
@@ -824,7 +831,6 @@ my %property_list = (
"uuid" => ["INTERFACE"],
"endpoint" => ["INTERFACE"],
"pointer_default" => ["INTERFACE"],
- "pointer_default_top" => ["INTERFACE"],
"helper" => ["INTERFACE"],
"authservice" => ["INTERFACE"],
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/Header.pm b/source4/pidl/lib/Parse/Pidl/Samba4/Header.pm
index 2b3a9df80f..2e77ff01b8 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/Header.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/Header.pm
@@ -82,10 +82,11 @@ sub HeaderElement($)
#####################################################################
# parse a struct
-sub HeaderStruct($$)
+sub HeaderStruct($$;$)
{
- my($struct,$name) = @_;
+ my($struct,$name,$tail) = @_;
pidl "struct $name";
+ pidl $tail if defined($tail) and not defined($struct->{ELEMENTS});
return if (not defined($struct->{ELEMENTS}));
pidl " {\n";
$tab_depth++;
@@ -103,13 +104,14 @@ sub HeaderStruct($$)
if (defined $struct->{PROPERTIES}) {
HeaderProperties($struct->{PROPERTIES}, []);
}
+ pidl $tail if defined($tail);
}
#####################################################################
# parse a enum
-sub HeaderEnum($$)
+sub HeaderEnum($$;$)
{
- my($enum,$name) = @_;
+ my($enum,$name,$tail) = @_;
my $first = 1;
pidl "enum $name";
@@ -131,30 +133,29 @@ sub HeaderEnum($$)
my $count = 0;
my $with_val = 0;
my $without_val = 0;
- if (defined($enum->{ELEMENTS})) {
- pidl " { __donnot_use_enum_$name=0x7FFFFFFF}\n";
- 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 " { __donnot_use_enum_$name=0x7FFFFFFF}\n";
+ 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";
}
+ pidl $tail if defined($tail);
}
#####################################################################
@@ -172,12 +173,13 @@ sub HeaderBitmap($$)
#####################################################################
# parse a union
-sub HeaderUnion($$)
+sub HeaderUnion($$;$)
{
- my($union,$name) = @_;
+ my($union,$name,$tail) = @_;
my %done = ();
pidl "union $name";
+ pidl $tail if defined($tail) and not defined($union->{ELEMENTS});
return if (not defined($union->{ELEMENTS}));
pidl " {\n";
$tab_depth++;
@@ -195,18 +197,19 @@ sub HeaderUnion($$)
if (defined $union->{PROPERTIES}) {
HeaderProperties($union->{PROPERTIES}, []);
}
+ pidl $tail if defined($tail);
}
#####################################################################
# parse a type
-sub HeaderType($$$)
+sub HeaderType($$$;$)
{
- my($e,$data,$name) = @_;
+ my($e,$data,$name,$tail) = @_;
if (ref($data) eq "HASH") {
- ($data->{TYPE} eq "ENUM") && HeaderEnum($data, $name);
+ ($data->{TYPE} eq "ENUM") && HeaderEnum($data, $name, $tail);
($data->{TYPE} eq "BITMAP") && HeaderBitmap($data, $name);
- ($data->{TYPE} eq "STRUCT") && HeaderStruct($data, $name);
- ($data->{TYPE} eq "UNION") && HeaderUnion($data, $name);
+ ($data->{TYPE} eq "STRUCT") && HeaderStruct($data, $name, $tail);
+ ($data->{TYPE} eq "UNION") && HeaderUnion($data, $name, $tail);
return;
}
@@ -215,14 +218,15 @@ sub HeaderType($$$)
} else {
pidl mapTypeName($e->{TYPE});
}
+ pidl $tail if defined($tail);
}
#####################################################################
# parse a typedef
-sub HeaderTypedef($)
+sub HeaderTypedef($;$)
{
- my($typedef) = shift;
- HeaderType($typedef, $typedef->{DATA}, $typedef->{NAME}) if defined ($typedef->{DATA});
+ my($typedef,$tail) = @_;
+ HeaderType($typedef, $typedef->{DATA}, $typedef->{NAME}, $tail) if defined ($typedef->{DATA});
}
#####################################################################
@@ -359,16 +363,11 @@ sub HeaderInterface($)
}
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");
+ HeaderTypedef($t, ";\n\n") if ($t->{TYPE} eq "TYPEDEF");
+ HeaderStruct($t, $t->{NAME}, ";\n\n") if ($t->{TYPE} eq "STRUCT");
+ HeaderUnion($t, $t->{NAME}, ";\n\n") if ($t->{TYPE} eq "UNION");
+ HeaderEnum($t, $t->{NAME}, ";\n\n") 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 $fn (@{$interface->{FUNCTIONS}}) {
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index 02d3a80992..60d5bf8781 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -14,7 +14,7 @@ require Exporter;
use strict;
use Parse::Pidl::Typelist qw(hasType getType mapTypeName typeHasBody);
use Parse::Pidl::Util qw(has_property ParseExpr ParseExprExt print_uuid);
-use Parse::Pidl::CUtil qw(get_pointer_to get_value_of);
+use Parse::Pidl::CUtil qw(get_pointer_to get_value_of get_array_element);
use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel ContainsDeferred is_charset_array);
use Parse::Pidl::Samba4 qw(is_intree choose_header);
use Parse::Pidl::Samba4::Header qw(GenerateFunctionInEnv GenerateFunctionOutEnv EnvSubstituteValue GenerateStructEnv);
@@ -42,19 +42,21 @@ sub append_prefix($$)
{
my ($e, $var_name) = @_;
my $pointers = 0;
+ my $arrays = 0;
foreach my $l (@{$e->{LEVELS}}) {
if ($l->{TYPE} eq "POINTER") {
$pointers++;
} elsif ($l->{TYPE} eq "ARRAY") {
+ $arrays++;
if (($pointers == 0) and
(not $l->{IS_FIXED}) and
(not $l->{IS_INLINE})) {
- return get_value_of($var_name);
+ return get_value_of($var_name);
}
} elsif ($l->{TYPE} eq "DATA") {
if (Parse::Pidl::Typelist::scalar_is_reference($l->{DATA_TYPE})) {
- return get_value_of($var_name) unless ($pointers);
+ return get_value_of($var_name) unless ($pointers or $arrays);
}
}
}
@@ -375,7 +377,7 @@ sub ParseArrayPullHeader($$$$$$)
}
if (not $l->{IS_FIXED} and not is_charset_array($e, $l)) {
- $self->AllocateArrayLevel($e,$l,$ndr,$env,$size);
+ $self->AllocateArrayLevel($e,$l,$ndr,$var_name,$size);
}
return $length;
@@ -384,7 +386,7 @@ sub ParseArrayPullHeader($$$$$$)
sub compression_alg($$)
{
my ($e, $l) = @_;
- my ($alg, $clen, $dlen) = split(/ /, $l->{COMPRESSION});
+ my ($alg, $clen, $dlen) = split(/,/, $l->{COMPRESSION});
return $alg;
}
@@ -392,7 +394,7 @@ sub compression_alg($$)
sub compression_clen($$$)
{
my ($e, $l, $env) = @_;
- my ($alg, $clen, $dlen) = split(/ /, $l->{COMPRESSION});
+ my ($alg, $clen, $dlen) = split(/,/, $l->{COMPRESSION});
return ParseExpr($clen, $env, $e->{ORIGINAL});
}
@@ -400,7 +402,7 @@ sub compression_clen($$$)
sub compression_dlen($$$)
{
my ($e,$l,$env) = @_;
- my ($alg, $clen, $dlen) = split(/ /, $l->{COMPRESSION});
+ my ($alg, $clen, $dlen) = split(/,/, $l->{COMPRESSION});
return ParseExpr($dlen, $env, $e->{ORIGINAL});
}
@@ -582,7 +584,7 @@ sub ParseElementPushLevel
my $length = ParseExpr($l->{LENGTH_IS}, $env, $e->{ORIGINAL});
my $counter = "cntr_$e->{NAME}_$l->{LEVEL_INDEX}";
- $var_name = $var_name . "[$counter]";
+ $var_name = get_array_element($var_name, $counter);
if (($primitives and not $l->{IS_DEFERRED}) or ($deferred and $l->{IS_DEFERRED})) {
$self->pidl("for ($counter = 0; $counter < $length; $counter++) {");
@@ -669,23 +671,48 @@ sub ParsePtrPush($$$$)
}
}
+sub need_pointer_to($$$)
+{
+ my ($e, $l, $scalar_only) = @_;
+
+ my $t;
+ if (ref($l->{DATA_TYPE})) {
+ $t = "$l->{DATA_TYPE}->{TYPE}_$l->{DATA_TYPE}->{NAME}";
+ } else {
+ $t = $l->{DATA_TYPE};
+ }
+
+ if (not Parse::Pidl::Typelist::is_scalar($t)) {
+ return 1 if $scalar_only;
+ }
+
+ my $arrays = 0;
+
+ foreach my $tl (@{$e->{LEVELS}}) {
+ last if $l == $tl;
+ if ($tl->{TYPE} eq "ARRAY") {
+ $arrays++;
+ }
+ }
+
+ if (Parse::Pidl::Typelist::scalar_is_reference($t)) {
+ return 1 unless $arrays;
+ }
+
+ return 0;
+}
+
sub ParseDataPrint($$$$)
{
my ($self, $e, $l, $var_name) = @_;
- if (not ref($l->{DATA_TYPE}) or
- defined($l->{DATA_TYPE}->{NAME})) {
- my $t;
- if (ref($l->{DATA_TYPE})) {
- $t = "$l->{DATA_TYPE}->{TYPE}_$l->{DATA_TYPE}->{NAME}";
- } else {
- $t = $l->{DATA_TYPE};
- }
- if (not Parse::Pidl::Typelist::is_scalar($t) or
- Parse::Pidl::Typelist::scalar_is_reference($t)) {
+ if (not ref($l->{DATA_TYPE}) or defined($l->{DATA_TYPE}->{NAME})) {
+
+ if (need_pointer_to($e, $l, 1)) {
$var_name = get_pointer_to($var_name);
}
- $self->pidl("ndr_print_$t(ndr, \"$e->{NAME}\", $var_name);");
+
+ $self->pidl(TypeFunctionName("ndr_print", $l->{DATA_TYPE})."(ndr, \"$e->{NAME}\", $var_name);");
} else {
$self->ParseTypePrint($l->{DATA_TYPE}, $var_name);
}
@@ -752,7 +779,7 @@ sub ParseElementPrint($$$$)
$self->pidl("if (idx_$l->{LEVEL_INDEX}) {");
$self->indent;
- $var_name = $var_name . "[$counter]";
+ $var_name = get_array_element($var_name, $counter);
}
} elsif ($l->{TYPE} eq "DATA") {
$self->ParseDataPrint($e, $l, $var_name);
@@ -815,12 +842,11 @@ sub ParseDataPull($$$$$$$)
{
my ($self,$e,$l,$ndr,$var_name,$primitives,$deferred) = @_;
- if (not ref($l->{DATA_TYPE}) or
- defined($l->{DATA_TYPE}->{NAME})) {
+ if (not ref($l->{DATA_TYPE}) or defined($l->{DATA_TYPE}->{NAME})) {
my $ndr_flags = CalcNdrFlags($l, $primitives, $deferred);
- if (Parse::Pidl::Typelist::scalar_is_reference($l->{DATA_TYPE})) {
+ if (need_pointer_to($e, $l, 0)) {
$var_name = get_pointer_to($var_name);
}
@@ -830,7 +856,7 @@ sub ParseDataPull($$$$$$$)
if (my $range = has_property($e, "range")) {
$var_name = get_value_of($var_name);
- my ($low, $high) = split(/ /, $range, 2);
+ my ($low, $high) = split(/,/, $range, 2);
$self->pidl("if ($var_name < $low || $var_name > $high) {");
$self->pidl("\treturn ndr_pull_error($ndr, NDR_ERR_RANGE, \"value out of range\");");
$self->pidl("}");
@@ -845,21 +871,15 @@ sub ParseDataPush($$$$$$$)
my ($self,$e,$l,$ndr,$var_name,$primitives,$deferred) = @_;
if (not ref($l->{DATA_TYPE}) or defined($l->{DATA_TYPE}->{NAME})) {
- my $t;
- if (ref($l->{DATA_TYPE}) eq "HASH") {
- $t = "$l->{DATA_TYPE}->{TYPE}_$l->{DATA_TYPE}->{NAME}";
- } else {
- $t = $l->{DATA_TYPE};
- }
-
+
+ my $ndr_flags = CalcNdrFlags($l, $primitives, $deferred);
+
# strings are passed by value rather than reference
- if (not Parse::Pidl::Typelist::is_scalar($t) or
- Parse::Pidl::Typelist::scalar_is_reference($t)) {
+ if (need_pointer_to($e, $l, 1)) {
$var_name = get_pointer_to($var_name);
}
- my $ndr_flags = CalcNdrFlags($l, $primitives, $deferred);
- $self->pidl("NDR_CHECK(ndr_push_$t($ndr, $ndr_flags, $var_name));");
+ $self->pidl("NDR_CHECK(".TypeFunctionName("ndr_push", $l->{DATA_TYPE})."($ndr, $ndr_flags, $var_name));");
} else {
$self->ParseTypePush($l->{DATA_TYPE}, $var_name, $primitives, $deferred);
}
@@ -890,15 +910,17 @@ sub CalcNdrFlags($$$)
return undef;
}
-sub ParseMemCtxPullStart($$$$)
+sub ParseMemCtxPullFlags($$$$)
{
- my ($self, $e, $l, $ptr_name) = @_;
+ my ($self, $e, $l) = @_;
- my $mem_r_ctx = "_mem_save_$e->{NAME}_$l->{LEVEL_INDEX}";
- my $mem_c_ctx = $ptr_name;
- my $mem_c_flags = "0";
+ return undef unless ($l->{TYPE} eq "POINTER" or $l->{TYPE} eq "ARRAY");
- return if ($l->{TYPE} eq "ARRAY" and $l->{IS_FIXED});
+ return undef if ($l->{TYPE} eq "ARRAY" and $l->{IS_FIXED});
+ return undef if has_fast_array($e, $l);
+ return undef if is_charset_array($e, $l);
+
+ my $mem_flags = "0";
if (($l->{TYPE} eq "POINTER") and ($l->{POINTER_TYPE} eq "ref")) {
my $nl = GetNextLevel($e, $l);
@@ -906,12 +928,25 @@ sub ParseMemCtxPullStart($$$$)
my $next_is_string = (($nl->{TYPE} eq "DATA") and
($nl->{DATA_TYPE} eq "string"));
if ($next_is_array or $next_is_string) {
- return;
- } else {
- $mem_c_flags = "LIBNDR_FLAG_REF_ALLOC";
+ return undef;
+ } elsif ($l->{LEVEL} eq "TOP") {
+ $mem_flags = "LIBNDR_FLAG_REF_ALLOC";
}
}
+ return $mem_flags;
+}
+
+sub ParseMemCtxPullStart($$$$)
+{
+ my ($self, $e, $l, $ptr_name) = @_;
+
+ my $mem_r_ctx = "_mem_save_$e->{NAME}_$l->{LEVEL_INDEX}";
+ my $mem_c_ctx = $ptr_name;
+ my $mem_c_flags = $self->ParseMemCtxPullFlags($e, $l);
+
+ return unless defined($mem_c_flags);
+
$self->pidl("$mem_r_ctx = NDR_PULL_GET_MEM_CTX(ndr);");
$self->pidl("NDR_PULL_SET_MEM_CTX(ndr, $mem_c_ctx, $mem_c_flags);");
}
@@ -921,21 +956,9 @@ sub ParseMemCtxPullEnd($$$)
my ($self, $e, $l) = @_;
my $mem_r_ctx = "_mem_save_$e->{NAME}_$l->{LEVEL_INDEX}";
- my $mem_r_flags = "0";
+ my $mem_r_flags = $self->ParseMemCtxPullFlags($e, $l);
- return if ($l->{TYPE} eq "ARRAY" and $l->{IS_FIXED});
-
- if (($l->{TYPE} eq "POINTER") and ($l->{POINTER_TYPE} eq "ref")) {
- my $nl = GetNextLevel($e, $l);
- my $next_is_array = ($nl->{TYPE} eq "ARRAY");
- my $next_is_string = (($nl->{TYPE} eq "DATA") and
- ($nl->{DATA_TYPE} eq "string"));
- if ($next_is_array or $next_is_string) {
- return;
- } else {
- $mem_r_flags = "LIBNDR_FLAG_REF_ALLOC";
- }
- }
+ return unless defined($mem_r_flags);
$self->pidl("NDR_PULL_SET_MEM_CTX(ndr, $mem_r_ctx, $mem_r_flags);");
}
@@ -1025,7 +1048,7 @@ sub ParseElementPullLevel
my $counter = "cntr_$e->{NAME}_$l->{LEVEL_INDEX}";
my $array_name = $var_name;
- $var_name = $var_name . "[$counter]";
+ $var_name = get_array_element($var_name, $counter);
$self->ParseMemCtxPullStart($e, $l, $array_name);
@@ -1106,10 +1129,7 @@ sub ParsePtrPull($$$$$)
my $next_is_string = (($nl->{TYPE} eq "DATA") and
($nl->{DATA_TYPE} eq "string"));
- if ($l->{POINTER_TYPE} eq "ref") {
- if ($l->{LEVEL} eq "EMBEDDED") {
- $self->pidl("NDR_CHECK(ndr_pull_ref_ptr($ndr, &_ptr_$e->{NAME}));");
- }
+ if ($l->{POINTER_TYPE} eq "ref" and $l->{LEVEL} eq "TOP") {
if (!$next_is_array and !$next_is_string) {
$self->pidl("if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {");
@@ -1118,16 +1138,19 @@ sub ParsePtrPull($$$$$)
}
return;
+ } elsif ($l->{POINTER_TYPE} eq "ref" and $l->{LEVEL} eq "EMBEDDED") {
+ $self->pidl("NDR_CHECK(ndr_pull_ref_ptr($ndr, &_ptr_$e->{NAME}));");
} elsif (($l->{POINTER_TYPE} eq "unique") or
($l->{POINTER_TYPE} eq "relative") or
($l->{POINTER_TYPE} eq "full")) {
$self->pidl("NDR_CHECK(ndr_pull_generic_ptr($ndr, &_ptr_$e->{NAME}));");
- $self->pidl("if (_ptr_$e->{NAME}) {");
- $self->indent;
} else {
die("Unhandled pointer type $l->{POINTER_TYPE}");
}
+ $self->pidl("if (_ptr_$e->{NAME}) {");
+ $self->indent;
+
# Don't do this for arrays, they're allocated at the actual level
# of the array
unless ($next_is_array or $next_is_string) {
@@ -1441,31 +1464,12 @@ sub DeclareArrayVariables($$)
}
}
-sub need_decl_mem_ctx($$)
-{
- my ($e,$l) = @_;
-
- return 0 if has_fast_array($e,$l);
- return 0 if is_charset_array($e,$l);
- return 1 if (($l->{TYPE} eq "ARRAY") and not $l->{IS_FIXED});
-
- if (($l->{TYPE} eq "POINTER") and ($l->{POINTER_TYPE} eq "ref")) {
- my $nl = GetNextLevel($e, $l);
- my $next_is_array = ($nl->{TYPE} eq "ARRAY");
- my $next_is_string = (($nl->{TYPE} eq "DATA") and
- ($nl->{DATA_TYPE} eq "string"));
- return 0 if ($next_is_array or $next_is_string);
- }
- return 1 if ($l->{TYPE} eq "POINTER");
-
- return 0;
-}
-
sub DeclareMemCtxVariables($$)
{
my ($self,$e) = @_;
foreach my $l (@{$e->{LEVELS}}) {
- if (need_decl_mem_ctx($e, $l)) {
+ my $mem_flags = $self->ParseMemCtxPullFlags($e, $l);
+ if (defined($mem_flags)) {
$self->pidl("TALLOC_CTX *_mem_save_$e->{NAME}_$l->{LEVEL_INDEX};");
}
}
@@ -1607,7 +1611,7 @@ sub ParseUnionPushPrimitives($$$)
if ($el->{CASE} eq "default") {
$have_default = 1;
}
- $self->pidl("$el->{CASE}:");
+ $self->pidl("$el->{CASE}: {");
if ($el->{TYPE} ne "EMPTY") {
$self->indent;
@@ -1621,7 +1625,7 @@ sub ParseUnionPushPrimitives($$$)
$self->ParseElementPush($el, "ndr", {$el->{NAME} => "$varname->$el->{NAME}"}, 1, 0);
$self->deindent;
}
- $self->pidl("break;");
+ $self->pidl("break; }");
$self->pidl("");
}
if (! $have_default) {
@@ -2058,9 +2062,7 @@ sub ParseFunctionPush($$)
sub AllocateArrayLevel($$$$$$)
{
- my ($self,$e,$l,$ndr,$env,$size) = @_;
-
- my $var = ParseExpr($e->{NAME}, $env, $e->{ORIGINAL});
+ my ($self,$e,$l,$ndr,$var,$size) = @_;
my $pl = GetPrevLevel($e, $l);
if (defined($pl) and
@@ -2236,7 +2238,7 @@ sub FunctionTable($$)
$interface->{PROPERTIES}->{authservice} = "\"host\"";
}
- my @a = split / /, $interface->{PROPERTIES}->{authservice};
+ my @a = split /,/, $interface->{PROPERTIES}->{authservice};
my $authservice_count = $#a + 1;
$self->pidl("static const char * const $interface->{NAME}\_authservice_strings[] = {");
@@ -2311,7 +2313,7 @@ sub HeaderInterface($$$)
}
if (defined $interface->{PROPERTIES}->{helper}) {
- $self->HeaderInclude(split / /, $interface->{PROPERTIES}->{helper});
+ $self->HeaderInclude(split /,/, $interface->{PROPERTIES}->{helper});
}
if (defined $interface->{PROPERTIES}->{uuid}) {
diff --git a/source4/pidl/tests/Util.pm b/source4/pidl/tests/Util.pm
index 82ab130e5a..4ad216a6a1 100644
--- a/source4/pidl/tests/Util.pm
+++ b/source4/pidl/tests/Util.pm
@@ -134,7 +134,7 @@ $c
$cc = "cc";
}
- my $flags = `pkg-config --libs --cflags ndr samba-config`;
+ my $flags = `pkg-config --libs --cflags ndr`;
my $cmd = "$cc $cflags -x c - -o $outfile $flags $ldflags";
$cmd =~ s/\n//g;
diff --git a/source4/pidl/tests/ndr.pl b/source4/pidl/tests/ndr.pl
index 7fcc7ef40e..504b7ec8de 100755
--- a/source4/pidl/tests/ndr.pl
+++ b/source4/pidl/tests/ndr.pl
@@ -4,7 +4,7 @@
use strict;
use warnings;
-use Test::More tests => 40;
+use Test::More tests => 46;
use FindBin qw($RealBin);
use lib "$RealBin";
use Util;
@@ -22,7 +22,7 @@ my $e = {
'PARENT' => { TYPE => 'STRUCT' },
'LINE' => 42 };
-is_deeply(GetElementLevelTable($e), [
+is_deeply(GetElementLevelTable($e, "unique"), [
{
'IS_DEFERRED' => 0,
'LEVEL_INDEX' => 0,
@@ -33,7 +33,7 @@ is_deeply(GetElementLevelTable($e), [
}
]);
-my $ne = ParseElement($e, undef);
+my $ne = ParseElement($e, "unique");
is($ne->{ORIGINAL}, $e);
is($ne->{NAME}, "v");
is($ne->{ALIGN}, 1);
@@ -60,7 +60,7 @@ $e = {
'TYPE' => 'uint8',
'LINE' => 42 };
-is_deeply(GetElementLevelTable($e), [
+is_deeply(GetElementLevelTable($e, "unique"), [
{
LEVEL_INDEX => 0,
IS_DEFERRED => 0,
@@ -90,7 +90,7 @@ $e = {
'PARENT' => { TYPE => 'STRUCT' },
'LINE' => 42 };
-is_deeply(GetElementLevelTable($e), [
+is_deeply(GetElementLevelTable($e, "unique"), [
{
LEVEL_INDEX => 0,
IS_DEFERRED => 0,
@@ -128,7 +128,7 @@ $e = {
'PARENT' => { TYPE => 'STRUCT' },
'LINE' => 42 };
-is_deeply(GetElementLevelTable($e), [
+is_deeply(GetElementLevelTable($e, "unique"), [
{
LEVEL_INDEX => 0,
IS_DEFERRED => 0,
@@ -147,6 +147,97 @@ is_deeply(GetElementLevelTable($e), [
}
]);
+# Case 3 : ref pointers
+#
+$e = {
+ 'FILE' => 'foo.idl',
+ 'NAME' => 'v',
+ 'PROPERTIES' => {"ref" => 1},
+ 'POINTERS' => 3,
+ 'TYPE' => 'uint8',
+ 'PARENT' => { TYPE => 'STRUCT' },
+ 'LINE' => 42 };
+
+is_deeply(GetElementLevelTable($e, "unique"), [
+ {
+ LEVEL_INDEX => 0,
+ IS_DEFERRED => 0,
+ TYPE => 'POINTER',
+ POINTER_TYPE => "ref",
+ POINTER_INDEX => 0,
+ LEVEL => 'EMBEDDED'
+ },
+ {
+ LEVEL_INDEX => 1,
+ IS_DEFERRED => 1,
+ TYPE => 'POINTER',
+ POINTER_TYPE => "unique",
+ POINTER_INDEX => 1,
+ LEVEL => 'EMBEDDED'
+ },
+ {
+ LEVEL_INDEX => 2,
+ IS_DEFERRED => 1,
+ TYPE => 'POINTER',
+ POINTER_TYPE => "unique",
+ POINTER_INDEX => 2,
+ LEVEL => 'EMBEDDED'
+ },
+ {
+ 'IS_DEFERRED' => 1,
+ 'LEVEL_INDEX' => 3,
+ 'DATA_TYPE' => 'uint8',
+ 'CONTAINS_DEFERRED' => 0,
+ 'TYPE' => 'DATA',
+ 'IS_SURROUNDING' => 0,
+ }
+]);
+
+# Case 3 : ref pointers
+#
+$e = {
+ 'FILE' => 'foo.idl',
+ 'NAME' => 'v',
+ 'PROPERTIES' => {"ref" => 1},
+ 'POINTERS' => 3,
+ 'TYPE' => 'uint8',
+ 'PARENT' => { TYPE => 'STRUCT' },
+ 'LINE' => 42 };
+
+is_deeply(GetElementLevelTable($e, "ref"), [
+ {
+ LEVEL_INDEX => 0,
+ IS_DEFERRED => 0,
+ TYPE => 'POINTER',
+ POINTER_TYPE => "ref",
+ POINTER_INDEX => 0,
+ LEVEL => 'EMBEDDED'
+ },
+ {
+ LEVEL_INDEX => 1,
+ IS_DEFERRED => 1,
+ TYPE => 'POINTER',
+ POINTER_TYPE => "ref",
+ POINTER_INDEX => 1,
+ LEVEL => 'EMBEDDED'
+ },
+ {
+ LEVEL_INDEX => 2,
+ IS_DEFERRED => 1,
+ TYPE => 'POINTER',
+ POINTER_TYPE => "ref",
+ POINTER_INDEX => 2,
+ LEVEL => 'EMBEDDED'
+ },
+ {
+ 'IS_DEFERRED' => 1,
+ 'LEVEL_INDEX' => 3,
+ 'DATA_TYPE' => 'uint8',
+ 'CONTAINS_DEFERRED' => 0,
+ 'TYPE' => 'DATA',
+ 'IS_SURROUNDING' => 0,
+ }
+]);
# Case 4 : top-level ref pointers
#
@@ -159,7 +250,7 @@ $e = {
'PARENT' => { TYPE => 'FUNCTION' },
'LINE' => 42 };
-is_deeply(GetElementLevelTable($e), [
+is_deeply(GetElementLevelTable($e, "unique"), [
{
LEVEL_INDEX => 0,
IS_DEFERRED => 0,
@@ -178,6 +269,190 @@ is_deeply(GetElementLevelTable($e), [
}
]);
+# Case 4 : top-level ref pointers, triple with pointer_default("unique")
+#
+$e = {
+ 'FILE' => 'foo.idl',
+ 'NAME' => 'v',
+ 'PROPERTIES' => {"ref" => 1},
+ 'POINTERS' => 3,
+ 'TYPE' => 'uint8',
+ 'PARENT' => { TYPE => 'FUNCTION' },
+ 'LINE' => 42 };
+
+is_deeply(GetElementLevelTable($e, "unique"), [
+ {
+ LEVEL_INDEX => 0,
+ IS_DEFERRED => 0,
+ TYPE => 'POINTER',
+ POINTER_TYPE => "ref",
+ POINTER_INDEX => 0,
+ LEVEL => 'TOP'
+ },
+ {
+ LEVEL_INDEX => 1,
+ IS_DEFERRED => 0,
+ TYPE => 'POINTER',
+ POINTER_TYPE => "unique",
+ POINTER_INDEX => 1,
+ LEVEL => 'EMBEDDED'
+ },
+ {
+ LEVEL_INDEX => 2,
+ IS_DEFERRED => 1,
+ TYPE => 'POINTER',
+ POINTER_TYPE => "unique",
+ POINTER_INDEX => 2,
+ LEVEL => 'EMBEDDED'
+ },
+ {
+ 'IS_DEFERRED' => 1,
+ 'LEVEL_INDEX' => 3,
+ 'DATA_TYPE' => 'uint8',
+ 'CONTAINS_DEFERRED' => 0,
+ 'TYPE' => 'DATA',
+ 'IS_SURROUNDING' => 0,
+ }
+]);
+
+# Case 4 : top-level unique pointers, triple with pointer_default("unique")
+#
+$e = {
+ 'FILE' => 'foo.idl',
+ 'NAME' => 'v',
+ 'PROPERTIES' => {"unique" => 1, "in" => 1},
+ 'POINTERS' => 3,
+ 'TYPE' => 'uint8',
+ 'PARENT' => { TYPE => 'FUNCTION' },
+ 'LINE' => 42 };
+
+is_deeply(GetElementLevelTable($e, "unique"), [
+ {
+ LEVEL_INDEX => 0,
+ IS_DEFERRED => 0,
+ TYPE => 'POINTER',
+ POINTER_TYPE => "unique",
+ POINTER_INDEX => 0,
+ LEVEL => 'TOP'
+ },
+ {
+ LEVEL_INDEX => 1,
+ IS_DEFERRED => 1,
+ TYPE => 'POINTER',
+ POINTER_TYPE => "unique",
+ POINTER_INDEX => 1,
+ LEVEL => 'EMBEDDED'
+ },
+ {
+ LEVEL_INDEX => 2,
+ IS_DEFERRED => 1,
+ TYPE => 'POINTER',
+ POINTER_TYPE => "unique",
+ POINTER_INDEX => 2,
+ LEVEL => 'EMBEDDED'
+ },
+ {
+ 'IS_DEFERRED' => 1,
+ 'LEVEL_INDEX' => 3,
+ 'DATA_TYPE' => 'uint8',
+ 'CONTAINS_DEFERRED' => 0,
+ 'TYPE' => 'DATA',
+ 'IS_SURROUNDING' => 0,
+ }
+]);
+
+# Case 4 : top-level unique pointers, triple with pointer_default("ref")
+#
+$e = {
+ 'FILE' => 'foo.idl',
+ 'NAME' => 'v',
+ 'PROPERTIES' => {"unique" => 1, "in" => 1},
+ 'POINTERS' => 3,
+ 'TYPE' => 'uint8',
+ 'PARENT' => { TYPE => 'FUNCTION' },
+ 'LINE' => 42 };
+
+is_deeply(GetElementLevelTable($e, "ref"), [
+ {
+ LEVEL_INDEX => 0,
+ IS_DEFERRED => 0,
+ TYPE => 'POINTER',
+ POINTER_TYPE => "unique",
+ POINTER_INDEX => 0,
+ LEVEL => 'TOP'
+ },
+ {
+ LEVEL_INDEX => 1,
+ IS_DEFERRED => 1,
+ TYPE => 'POINTER',
+ POINTER_TYPE => "ref",
+ POINTER_INDEX => 1,
+ LEVEL => 'EMBEDDED'
+ },
+ {
+ LEVEL_INDEX => 2,
+ IS_DEFERRED => 1,
+ TYPE => 'POINTER',
+ POINTER_TYPE => "ref",
+ POINTER_INDEX => 2,
+ LEVEL => 'EMBEDDED'
+ },
+ {
+ 'IS_DEFERRED' => 1,
+ 'LEVEL_INDEX' => 3,
+ 'DATA_TYPE' => 'uint8',
+ 'CONTAINS_DEFERRED' => 0,
+ 'TYPE' => 'DATA',
+ 'IS_SURROUNDING' => 0,
+ }
+]);
+
+# Case 4 : top-level ref pointers, triple with pointer_default("ref")
+#
+$e = {
+ 'FILE' => 'foo.idl',
+ 'NAME' => 'v',
+ 'PROPERTIES' => {"ref" => 1},
+ 'POINTERS' => 3,
+ 'TYPE' => 'uint8',
+ 'PARENT' => { TYPE => 'FUNCTION' },
+ 'LINE' => 42 };
+
+is_deeply(GetElementLevelTable($e, "ref"), [
+ {
+ LEVEL_INDEX => 0,
+ IS_DEFERRED => 0,
+ TYPE => 'POINTER',
+ POINTER_TYPE => "ref",
+ POINTER_INDEX => 0,
+ LEVEL => 'TOP'
+ },
+ {
+ LEVEL_INDEX => 1,
+ IS_DEFERRED => 0,
+ TYPE => 'POINTER',
+ POINTER_TYPE => "ref",
+ POINTER_INDEX => 1,
+ LEVEL => 'EMBEDDED'
+ },
+ {
+ LEVEL_INDEX => 2,
+ IS_DEFERRED => 1,
+ TYPE => 'POINTER',
+ POINTER_TYPE => "ref",
+ POINTER_INDEX => 2,
+ LEVEL => 'EMBEDDED'
+ },
+ {
+ 'IS_DEFERRED' => 1,
+ 'LEVEL_INDEX' => 3,
+ 'DATA_TYPE' => 'uint8',
+ 'CONTAINS_DEFERRED' => 0,
+ 'TYPE' => 'DATA',
+ 'IS_SURROUNDING' => 0,
+ }
+]);
+
# representation_type
$e = {
'FILE' => 'foo.idl',
diff --git a/source4/pidl/tests/ndr_compat.pl b/source4/pidl/tests/ndr_compat.pl
index 735d929e27..355e7f6732 100755
--- a/source4/pidl/tests/ndr_compat.pl
+++ b/source4/pidl/tests/ndr_compat.pl
@@ -3,7 +3,7 @@
# Published under the GNU General Public License
use strict;
-use Test::More tests => 3;
+use Test::More tests => 2;
use FindBin qw($RealBin);
use lib "$RealBin";
use Util;
@@ -19,9 +19,3 @@ sub parse_idl($)
test_warnings("", sub {parse_idl("void x();"); });
test_warnings("nofile:0: top-level [out] pointer `x' is not a [ref] pointer\n", sub {parse_idl("void x([out,unique] int *x);"); });
-
-test_warnings("nofile:0: pointer_default_top() is a pidl extension and should not be used\n", sub {
- my $pidl = Parse::Pidl::IDL::parse_string("[pointer_default_top(unique)] interface echo { void x(); }; ", "nofile");
- Parse::Pidl::NDR::Parse($pidl);
-});
-