summaryrefslogtreecommitdiff
path: root/source4/pidl/lib/Parse
diff options
context:
space:
mode:
Diffstat (limited to 'source4/pidl/lib/Parse')
-rw-r--r--source4/pidl/lib/Parse/Pidl.pm2
-rw-r--r--source4/pidl/lib/Parse/Pidl/CUtil.pm39
-rw-r--r--source4/pidl/lib/Parse/Pidl/Compat.pm7
-rw-r--r--source4/pidl/lib/Parse/Pidl/IDL.pm2186
-rw-r--r--source4/pidl/lib/Parse/Pidl/NDR.pm35
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm4
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm6
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4.pm1
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm41
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/Header.pm135
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm111
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/Python.pm882
-rw-r--r--source4/pidl/lib/Parse/Pidl/Typelist.pm50
13 files changed, 2014 insertions, 1485 deletions
diff --git a/source4/pidl/lib/Parse/Pidl.pm b/source4/pidl/lib/Parse/Pidl.pm
index 0c6e0e5727..c2c9463d03 100644
--- a/source4/pidl/lib/Parse/Pidl.pm
+++ b/source4/pidl/lib/Parse/Pidl.pm
@@ -9,7 +9,7 @@ package Parse::Pidl;
require Exporter;
@ISA = qw(Exporter);
-@EXPORT_OK = qw(warning error fatal);
+@EXPORT_OK = qw(warning error fatal $VERSION);
use strict;
diff --git a/source4/pidl/lib/Parse/Pidl/CUtil.pm b/source4/pidl/lib/Parse/Pidl/CUtil.pm
new file mode 100644
index 0000000000..bd7b16812c
--- /dev/null
+++ b/source4/pidl/lib/Parse/Pidl/CUtil.pm
@@ -0,0 +1,39 @@
+###################################################
+# C utility functions for pidl
+# Copyright jelmer@samba.org 2005-2007
+# released under the GNU GPL
+package Parse::Pidl::CUtil;
+
+require Exporter;
+@ISA = qw(Exporter);
+@EXPORT = qw(get_pointer_to get_value_of);
+use vars qw($VERSION);
+$VERSION = '0.01';
+
+use strict;
+
+sub get_pointer_to($)
+{
+ my $var_name = shift;
+
+ if ($var_name =~ /^\*(.*)$/) {
+ return $1;
+ } elsif ($var_name =~ /^\&(.*)$/) {
+ return "&($var_name)";
+ } else {
+ return "&$var_name";
+ }
+}
+
+sub get_value_of($)
+{
+ my $var_name = shift;
+
+ if ($var_name =~ /^\&(.*)$/) {
+ return $1;
+ } else {
+ return "*$var_name";
+ }
+}
+
+1;
diff --git a/source4/pidl/lib/Parse/Pidl/Compat.pm b/source4/pidl/lib/Parse/Pidl/Compat.pm
index f1241ef341..7939bb2df2 100644
--- a/source4/pidl/lib/Parse/Pidl/Compat.pm
+++ b/source4/pidl/lib/Parse/Pidl/Compat.pm
@@ -152,13 +152,6 @@ sub CheckInterface($)
$if->{PROPERTIES}->{pointer_default_top} ne "ref") {
warning($if, "pointer_default_top() is pidl-specific");
}
-
- foreach my $x (@{$if->{DATA}}) {
- if ($x->{TYPE} eq "DECLARE") {
- warning($if, "the declare keyword is pidl-specific");
- next;
- }
- }
}
sub Check($)
diff --git a/source4/pidl/lib/Parse/Pidl/IDL.pm b/source4/pidl/lib/Parse/Pidl/IDL.pm
index e9155e4e00..35e1d7bcd7 100644
--- a/source4/pidl/lib/Parse/Pidl/IDL.pm
+++ b/source4/pidl/lib/Parse/Pidl/IDL.pm
@@ -38,7 +38,7 @@ sub new {
"import" => 7,
"include" => 13
},
- DEFAULT => -91,
+ DEFAULT => -83,
GOTOS => {
'cpp_quote' => 11,
'importlib' => 10,
@@ -124,7 +124,7 @@ sub new {
}
},
{#State 16
- DEFAULT => -124
+ DEFAULT => -116
},
{#State 17
DEFAULT => -11
@@ -184,7 +184,7 @@ sub new {
}
},
{#State 26
- DEFAULT => -120
+ DEFAULT => -112
},
{#State 27
ACTIONS => {
@@ -206,10 +206,10 @@ sub new {
ACTIONS => {
"(" => 40
},
- DEFAULT => -95
+ DEFAULT => -87
},
{#State 31
- DEFAULT => -93
+ DEFAULT => -85
},
{#State 32
DEFAULT => -8
@@ -231,10 +231,9 @@ sub new {
},
{#State 37
ACTIONS => {
- "declare" => 49,
- "const" => 53
+ "const" => 51
},
- DEFAULT => -91,
+ DEFAULT => -83,
GOTOS => {
'typedecl' => 42,
'function' => 43,
@@ -243,12 +242,11 @@ sub new {
'definition' => 48,
'property_list' => 47,
'usertype' => 46,
- 'const' => 52,
- 'declare' => 51,
- 'struct' => 50,
- 'typedef' => 55,
- 'enum' => 54,
- 'union' => 56
+ 'const' => 50,
+ 'struct' => 49,
+ 'typedef' => 53,
+ 'enum' => 52,
+ 'union' => 54
}
},
{#State 38
@@ -257,1539 +255,1482 @@ sub new {
},
GOTOS => {
'identifier' => 30,
- 'property' => 57
+ 'property' => 55
}
},
{#State 39
- DEFAULT => -92
+ DEFAULT => -84
},
{#State 40
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'text' => 63,
- 'listtext' => 59,
- 'anytext' => 58,
- 'constant' => 60
+ 'identifier' => 60,
+ 'text' => 61,
+ 'listtext' => 57,
+ 'anytext' => 56,
+ 'constant' => 58
}
},
{#State 41
ACTIONS => {
- "}" => 64,
- "interface" => 65
+ "}" => 62,
+ "interface" => 63
}
},
{#State 42
- DEFAULT => -24
+ DEFAULT => -23
},
{#State 43
DEFAULT => -20
},
{#State 44
- DEFAULT => -39
+ DEFAULT => -31
},
{#State 45
ACTIONS => {
- "}" => 66,
- "declare" => 49,
- "const" => 53
+ "}" => 64,
+ "const" => 51
},
- DEFAULT => -91,
+ DEFAULT => -83,
GOTOS => {
'typedecl' => 42,
'function' => 43,
'bitmap' => 44,
- 'definition' => 67,
+ 'definition' => 65,
'property_list' => 47,
'usertype' => 46,
- 'const' => 52,
- 'struct' => 50,
- 'declare' => 51,
- 'typedef' => 55,
- 'enum' => 54,
- 'union' => 56
+ 'struct' => 49,
+ 'const' => 50,
+ 'typedef' => 53,
+ 'enum' => 52,
+ 'union' => 54
}
},
{#State 46
ACTIONS => {
- ";" => 68
+ ";" => 66
}
},
{#State 47
ACTIONS => {
- "typedef" => 69,
+ "typedef" => 67,
'IDENTIFIER' => 26,
- "signed" => 77,
- "union" => 70,
- "enum" => 79,
- "bitmap" => 80,
- 'void' => 71,
- "unsigned" => 81,
+ "signed" => 75,
+ "union" => 68,
+ "enum" => 77,
+ "bitmap" => 78,
+ 'void' => 69,
+ "unsigned" => 79,
"[" => 20,
- "struct" => 76
+ "struct" => 74
},
GOTOS => {
- 'existingtype' => 78,
+ 'existingtype' => 76,
'bitmap' => 44,
- 'usertype' => 73,
- 'property_list' => 72,
- 'identifier' => 74,
- 'struct' => 50,
- 'enum' => 54,
- 'type' => 82,
- 'union' => 56,
- 'sign' => 75
+ 'usertype' => 71,
+ 'property_list' => 70,
+ 'identifier' => 72,
+ 'struct' => 49,
+ 'enum' => 52,
+ 'type' => 80,
+ 'union' => 54,
+ 'sign' => 73
}
},
{#State 48
DEFAULT => -18
},
{#State 49
- DEFAULT => -91,
- GOTOS => {
- 'decl_enum' => 84,
- 'decl_bitmap' => 85,
- 'decl_type' => 87,
- 'decl_union' => 86,
- 'property_list' => 83
- }
+ DEFAULT => -28
},
{#State 50
- DEFAULT => -36
- },
- {#State 51
- DEFAULT => -23
- },
- {#State 52
DEFAULT => -21
},
- {#State 53
+ {#State 51
ACTIONS => {
'IDENTIFIER' => 26
},
GOTOS => {
- 'identifier' => 88
+ 'identifier' => 81
}
},
+ {#State 52
+ DEFAULT => -30
+ },
+ {#State 53
+ DEFAULT => -22
+ },
{#State 54
- DEFAULT => -38
+ DEFAULT => -29
},
{#State 55
- DEFAULT => -22
+ DEFAULT => -86
},
{#State 56
- DEFAULT => -37
+ ACTIONS => {
+ "-" => 83,
+ ":" => 82,
+ "<" => 84,
+ "+" => 86,
+ "~" => 85,
+ "*" => 87,
+ "?" => 88,
+ "{" => 89,
+ "&" => 90,
+ "/" => 91,
+ "=" => 92,
+ "(" => 93,
+ "|" => 94,
+ "." => 95,
+ ">" => 96
+ },
+ DEFAULT => -89
},
{#State 57
- DEFAULT => -94
+ ACTIONS => {
+ "," => 97,
+ ")" => 98
+ }
},
{#State 58
- ACTIONS => {
- "-" => 90,
- ":" => 89,
- "<" => 91,
- "+" => 93,
- "~" => 92,
- "*" => 94,
- "?" => 95,
- "{" => 96,
- "&" => 97,
- "/" => 98,
- "=" => 99,
- "(" => 100,
- "|" => 101,
- "." => 102,
- ">" => 103
- },
- DEFAULT => -97
+ DEFAULT => -95
},
{#State 59
- ACTIONS => {
- "," => 104,
- ")" => 105
- }
+ DEFAULT => -115
},
{#State 60
- DEFAULT => -103
+ DEFAULT => -94
},
{#State 61
- DEFAULT => -123
+ DEFAULT => -96
},
{#State 62
- DEFAULT => -102
- },
- {#State 63
- DEFAULT => -104
- },
- {#State 64
ACTIONS => {
- ";" => 106
+ ";" => 99
},
- DEFAULT => -125,
+ DEFAULT => -117,
GOTOS => {
- 'optional_semicolon' => 107
+ 'optional_semicolon' => 100
}
},
- {#State 65
+ {#State 63
ACTIONS => {
'IDENTIFIER' => 26
},
GOTOS => {
- 'identifier' => 108
+ 'identifier' => 101
}
},
- {#State 66
+ {#State 64
ACTIONS => {
- ";" => 106
+ ";" => 99
},
- DEFAULT => -125,
+ DEFAULT => -117,
GOTOS => {
- 'optional_semicolon' => 109
+ 'optional_semicolon' => 102
}
},
- {#State 67
+ {#State 65
DEFAULT => -19
},
- {#State 68
- DEFAULT => -40
+ {#State 66
+ DEFAULT => -32
},
- {#State 69
+ {#State 67
ACTIONS => {
'IDENTIFIER' => 26,
- "signed" => 77,
- 'void' => 71,
- "unsigned" => 81
+ "signed" => 75,
+ 'void' => 69,
+ "unsigned" => 79
},
- DEFAULT => -91,
+ DEFAULT => -83,
GOTOS => {
- 'existingtype' => 78,
+ 'existingtype' => 76,
'bitmap' => 44,
- 'usertype' => 73,
- 'property_list' => 72,
- 'identifier' => 74,
- 'struct' => 50,
- 'enum' => 54,
- 'type' => 110,
- 'union' => 56,
- 'sign' => 75
+ 'usertype' => 71,
+ 'property_list' => 70,
+ 'identifier' => 72,
+ 'struct' => 49,
+ 'enum' => 52,
+ 'type' => 103,
+ 'union' => 54,
+ 'sign' => 73
}
},
- {#State 70
+ {#State 68
ACTIONS => {
- 'IDENTIFIER' => 111
+ 'IDENTIFIER' => 104
},
- DEFAULT => -122,
+ DEFAULT => -114,
GOTOS => {
- 'optional_identifier' => 112
+ 'optional_identifier' => 105
}
},
- {#State 71
- DEFAULT => -47
+ {#State 69
+ DEFAULT => -39
},
- {#State 72
+ {#State 70
ACTIONS => {
- "union" => 70,
- "enum" => 79,
- "bitmap" => 80,
+ "union" => 68,
+ "enum" => 77,
+ "bitmap" => 78,
"[" => 20,
- "struct" => 76
+ "struct" => 74
}
},
- {#State 73
- DEFAULT => -45
+ {#State 71
+ DEFAULT => -37
},
- {#State 74
- DEFAULT => -44
+ {#State 72
+ DEFAULT => -36
},
- {#State 75
+ {#State 73
ACTIONS => {
'IDENTIFIER' => 26
},
GOTOS => {
- 'identifier' => 113
+ 'identifier' => 106
}
},
- {#State 76
+ {#State 74
ACTIONS => {
- 'IDENTIFIER' => 111
+ 'IDENTIFIER' => 104
},
- DEFAULT => -122,
+ DEFAULT => -114,
GOTOS => {
- 'optional_identifier' => 114
+ 'optional_identifier' => 107
}
},
- {#State 77
- DEFAULT => -41
- },
- {#State 78
- DEFAULT => -46
+ {#State 75
+ DEFAULT => -33
},
- {#State 79
- ACTIONS => {
- 'IDENTIFIER' => 111
- },
- DEFAULT => -122,
- GOTOS => {
- 'optional_identifier' => 115
- }
+ {#State 76
+ DEFAULT => -38
},
- {#State 80
+ {#State 77
ACTIONS => {
- 'IDENTIFIER' => 111
+ 'IDENTIFIER' => 104
},
- DEFAULT => -122,
+ DEFAULT => -114,
GOTOS => {
- 'optional_identifier' => 116
+ 'optional_identifier' => 108
}
},
- {#State 81
- DEFAULT => -42
- },
- {#State 82
+ {#State 78
ACTIONS => {
- 'IDENTIFIER' => 26
+ 'IDENTIFIER' => 104
},
+ DEFAULT => -114,
GOTOS => {
- 'identifier' => 117
- }
- },
- {#State 83
- ACTIONS => {
- "union" => 118,
- "enum" => 119,
- "bitmap" => 120,
- "[" => 20
+ 'optional_identifier' => 109
}
},
- {#State 84
- DEFAULT => -29
- },
- {#State 85
- DEFAULT => -30
- },
- {#State 86
- DEFAULT => -31
+ {#State 79
+ DEFAULT => -34
},
- {#State 87
+ {#State 80
ACTIONS => {
'IDENTIFIER' => 26
},
GOTOS => {
- 'identifier' => 121
+ 'identifier' => 110
}
},
- {#State 88
- DEFAULT => -80,
+ {#State 81
+ DEFAULT => -72,
GOTOS => {
- 'pointers' => 122
+ 'pointers' => 111
}
},
- {#State 89
+ {#State 82
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 123,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 112,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 90
+ {#State 83
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 124,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 113,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 91
+ {#State 84
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 125,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 114,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 92
+ {#State 85
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 126,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 115,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 93
+ {#State 86
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 127,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 116,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 94
+ {#State 87
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 128,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 117,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 95
+ {#State 88
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 129,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 118,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 96
+ {#State 89
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 130,
- 'text' => 63,
- 'constant' => 60,
- 'commalisttext' => 131
+ 'identifier' => 60,
+ 'anytext' => 119,
+ 'text' => 61,
+ 'constant' => 58,
+ 'commalisttext' => 120
}
},
- {#State 97
+ {#State 90
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 132,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 121,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 98
+ {#State 91
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 133,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 122,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 99
+ {#State 92
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 134,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 123,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 100
+ {#State 93
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 130,
- 'text' => 63,
- 'constant' => 60,
- 'commalisttext' => 135
+ 'identifier' => 60,
+ 'anytext' => 119,
+ 'text' => 61,
+ 'constant' => 58,
+ 'commalisttext' => 124
}
},
- {#State 101
+ {#State 94
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 136,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 125,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 102
+ {#State 95
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 137,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 126,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 103
+ {#State 96
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 138,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 127,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 104
+ {#State 97
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 139,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 128,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 105
- DEFAULT => -96
+ {#State 98
+ DEFAULT => -88
},
- {#State 106
- DEFAULT => -126
+ {#State 99
+ DEFAULT => -118
},
- {#State 107
+ {#State 100
DEFAULT => -13
},
- {#State 108
+ {#State 101
ACTIONS => {
- ";" => 140
+ ";" => 129
}
},
- {#State 109
+ {#State 102
DEFAULT => -16
},
- {#State 110
+ {#State 103
ACTIONS => {
'IDENTIFIER' => 26
},
GOTOS => {
- 'identifier' => 141
+ 'identifier' => 130
}
},
- {#State 111
- DEFAULT => -121
+ {#State 104
+ DEFAULT => -113
},
- {#State 112
+ {#State 105
ACTIONS => {
- "{" => 143
+ "{" => 132
},
- DEFAULT => -76,
+ DEFAULT => -68,
GOTOS => {
- 'union_body' => 144,
- 'opt_union_body' => 142
+ 'union_body' => 133,
+ 'opt_union_body' => 131
}
},
- {#State 113
- DEFAULT => -43
+ {#State 106
+ DEFAULT => -35
},
- {#State 114
+ {#State 107
ACTIONS => {
- "{" => 146
+ "{" => 135
},
- DEFAULT => -66,
+ DEFAULT => -58,
GOTOS => {
- 'struct_body' => 145,
- 'opt_struct_body' => 147
+ 'struct_body' => 134,
+ 'opt_struct_body' => 136
}
},
- {#State 115
+ {#State 108
ACTIONS => {
- "{" => 148
+ "{" => 137
},
- DEFAULT => -49,
+ DEFAULT => -41,
GOTOS => {
- 'opt_enum_body' => 150,
- 'enum_body' => 149
+ 'opt_enum_body' => 139,
+ 'enum_body' => 138
}
},
- {#State 116
+ {#State 109
ACTIONS => {
- "{" => 152
+ "{" => 141
},
- DEFAULT => -57,
+ DEFAULT => -49,
GOTOS => {
- 'bitmap_body' => 153,
- 'opt_bitmap_body' => 151
+ 'bitmap_body' => 142,
+ 'opt_bitmap_body' => 140
}
},
- {#State 117
- ACTIONS => {
- "(" => 154
- }
- },
- {#State 118
- DEFAULT => -34
- },
- {#State 119
- DEFAULT => -32
- },
- {#State 120
- DEFAULT => -33
- },
- {#State 121
+ {#State 110
ACTIONS => {
- ";" => 155
+ "(" => 143
}
},
- {#State 122
+ {#State 111
ACTIONS => {
'IDENTIFIER' => 26,
- "*" => 157
+ "*" => 145
},
GOTOS => {
- 'identifier' => 156
+ 'identifier' => 144
}
},
- {#State 123
- ACTIONS => {
- "-" => 90,
- ":" => 89,
- "<" => 91,
- "+" => 93,
- "~" => 92,
- "*" => 94,
- "?" => 95,
- "{" => 96,
- "&" => 97,
- "/" => 98,
- "=" => 99,
- "(" => 100,
- "|" => 101,
- "." => 102,
- ">" => 103
- },
- DEFAULT => -114
- },
- {#State 124
+ {#State 112
ACTIONS => {
- ":" => 89,
- "<" => 91,
- "~" => 92,
- "?" => 95,
- "{" => 96,
- "=" => 99
+ "-" => 83,
+ ":" => 82,
+ "<" => 84,
+ "+" => 86,
+ "~" => 85,
+ "*" => 87,
+ "?" => 88,
+ "{" => 89,
+ "&" => 90,
+ "/" => 91,
+ "=" => 92,
+ "(" => 93,
+ "|" => 94,
+ "." => 95,
+ ">" => 96
},
- DEFAULT => -105
+ DEFAULT => -106
},
- {#State 125
+ {#State 113
ACTIONS => {
- "-" => 90,
- ":" => 89,
- "<" => 91,
- "+" => 93,
- "~" => 92,
- "*" => 94,
- "?" => 95,
- "{" => 96,
- "&" => 97,
- "/" => 98,
- "=" => 99,
- "(" => 100,
- "|" => 101,
- "." => 102,
- ">" => 103
+ ":" => 82,
+ "<" => 84,
+ "~" => 85,
+ "?" => 88,
+ "{" => 89,
+ "=" => 92
},
- DEFAULT => -109
+ DEFAULT => -97
},
- {#State 126
+ {#State 114
ACTIONS => {
- "-" => 90,
- ":" => 89,
- "<" => 91,
- "+" => 93,
- "~" => 92,
- "*" => 94,
- "?" => 95,
- "{" => 96,
- "&" => 97,
- "/" => 98,
- "=" => 99,
- "(" => 100,
- "|" => 101,
- "." => 102,
- ">" => 103
- },
- DEFAULT => -117
+ "-" => 83,
+ ":" => 82,
+ "<" => 84,
+ "+" => 86,
+ "~" => 85,
+ "*" => 87,
+ "?" => 88,
+ "{" => 89,
+ "&" => 90,
+ "/" => 91,
+ "=" => 92,
+ "(" => 93,
+ "|" => 94,
+ "." => 95,
+ ">" => 96
+ },
+ DEFAULT => -101
},
- {#State 127
+ {#State 115
ACTIONS => {
- ":" => 89,
- "<" => 91,
- "~" => 92,
- "?" => 95,
- "{" => 96,
- "=" => 99
+ "-" => 83,
+ ":" => 82,
+ "<" => 84,
+ "+" => 86,
+ "~" => 85,
+ "*" => 87,
+ "?" => 88,
+ "{" => 89,
+ "&" => 90,
+ "/" => 91,
+ "=" => 92,
+ "(" => 93,
+ "|" => 94,
+ "." => 95,
+ ">" => 96
},
- DEFAULT => -116
+ DEFAULT => -109
},
- {#State 128
+ {#State 116
ACTIONS => {
- ":" => 89,
- "<" => 91,
- "~" => 92,
- "?" => 95,
- "{" => 96,
- "=" => 99
+ ":" => 82,
+ "<" => 84,
+ "~" => 85,
+ "?" => 88,
+ "{" => 89,
+ "=" => 92
},
- DEFAULT => -107
+ DEFAULT => -108
},
- {#State 129
+ {#State 117
ACTIONS => {
- "-" => 90,
- ":" => 89,
- "<" => 91,
- "+" => 93,
- "~" => 92,
- "*" => 94,
- "?" => 95,
- "{" => 96,
- "&" => 97,
- "/" => 98,
- "=" => 99,
- "(" => 100,
- "|" => 101,
- "." => 102,
- ">" => 103
+ ":" => 82,
+ "<" => 84,
+ "~" => 85,
+ "?" => 88,
+ "{" => 89,
+ "=" => 92
},
- DEFAULT => -113
+ DEFAULT => -99
},
- {#State 130
+ {#State 118
ACTIONS => {
- "-" => 90,
- ":" => 89,
- "<" => 91,
- "+" => 93,
- "~" => 92,
- "*" => 94,
- "?" => 95,
- "{" => 96,
- "&" => 97,
- "/" => 98,
- "=" => 99,
- "(" => 100,
- "|" => 101,
- "." => 102,
- ">" => 103
+ "-" => 83,
+ ":" => 82,
+ "<" => 84,
+ "+" => 86,
+ "~" => 85,
+ "*" => 87,
+ "?" => 88,
+ "{" => 89,
+ "&" => 90,
+ "/" => 91,
+ "=" => 92,
+ "(" => 93,
+ "|" => 94,
+ "." => 95,
+ ">" => 96
},
- DEFAULT => -99
+ DEFAULT => -105
},
- {#State 131
+ {#State 119
ACTIONS => {
- "}" => 158,
- "," => 159
+ "-" => 83,
+ ":" => 82,
+ "<" => 84,
+ "+" => 86,
+ "~" => 85,
+ "*" => 87,
+ "?" => 88,
+ "{" => 89,
+ "&" => 90,
+ "/" => 91,
+ "=" => 92,
+ "(" => 93,
+ "|" => 94,
+ "." => 95,
+ ">" => 96
+ },
+ DEFAULT => -91
+ },
+ {#State 120
+ ACTIONS => {
+ "}" => 146,
+ "," => 147
}
},
- {#State 132
+ {#State 121
ACTIONS => {
- ":" => 89,
- "<" => 91,
- "~" => 92,
- "?" => 95,
- "{" => 96,
- "=" => 99
+ ":" => 82,
+ "<" => 84,
+ "~" => 85,
+ "?" => 88,
+ "{" => 89,
+ "=" => 92
},
- DEFAULT => -111
+ DEFAULT => -103
},
- {#State 133
+ {#State 122
ACTIONS => {
- ":" => 89,
- "<" => 91,
- "~" => 92,
- "?" => 95,
- "{" => 96,
- "=" => 99
+ ":" => 82,
+ "<" => 84,
+ "~" => 85,
+ "?" => 88,
+ "{" => 89,
+ "=" => 92
},
- DEFAULT => -112
+ DEFAULT => -104
},
- {#State 134
+ {#State 123
ACTIONS => {
- "-" => 90,
- ":" => 89,
- "<" => 91,
- "+" => 93,
- "~" => 92,
- "*" => 94,
- "?" => 95,
- "{" => 96,
- "&" => 97,
- "/" => 98,
- "=" => 99,
- "(" => 100,
- "|" => 101,
- "." => 102,
- ">" => 103
+ "-" => 83,
+ ":" => 82,
+ "<" => 84,
+ "+" => 86,
+ "~" => 85,
+ "*" => 87,
+ "?" => 88,
+ "{" => 89,
+ "&" => 90,
+ "/" => 91,
+ "=" => 92,
+ "(" => 93,
+ "|" => 94,
+ "." => 95,
+ ">" => 96
},
- DEFAULT => -115
+ DEFAULT => -107
},
- {#State 135
+ {#State 124
ACTIONS => {
- "," => 159,
- ")" => 160
+ "," => 147,
+ ")" => 148
}
},
- {#State 136
+ {#State 125
ACTIONS => {
- ":" => 89,
- "<" => 91,
- "~" => 92,
- "?" => 95,
- "{" => 96,
- "=" => 99
+ ":" => 82,
+ "<" => 84,
+ "~" => 85,
+ "?" => 88,
+ "{" => 89,
+ "=" => 92
},
- DEFAULT => -110
+ DEFAULT => -102
},
- {#State 137
+ {#State 126
ACTIONS => {
- ":" => 89,
- "<" => 91,
- "~" => 92,
- "?" => 95,
- "{" => 96,
- "=" => 99
+ ":" => 82,
+ "<" => 84,
+ "~" => 85,
+ "?" => 88,
+ "{" => 89,
+ "=" => 92
},
- DEFAULT => -106
+ DEFAULT => -98
},
- {#State 138
+ {#State 127
ACTIONS => {
- ":" => 89,
- "<" => 91,
- "~" => 92,
- "?" => 95,
- "{" => 96,
- "=" => 99
+ ":" => 82,
+ "<" => 84,
+ "~" => 85,
+ "?" => 88,
+ "{" => 89,
+ "=" => 92
},
- DEFAULT => -108
+ DEFAULT => -100
},
- {#State 139
+ {#State 128
ACTIONS => {
- "-" => 90,
- ":" => 89,
- "<" => 91,
- "+" => 93,
- "~" => 92,
- "*" => 94,
- "?" => 95,
- "{" => 96,
- "&" => 97,
- "/" => 98,
- "=" => 99,
- "(" => 100,
- "|" => 101,
- "." => 102,
- ">" => 103
+ "-" => 83,
+ ":" => 82,
+ "<" => 84,
+ "+" => 86,
+ "~" => 85,
+ "*" => 87,
+ "?" => 88,
+ "{" => 89,
+ "&" => 90,
+ "/" => 91,
+ "=" => 92,
+ "(" => 93,
+ "|" => 94,
+ "." => 95,
+ ">" => 96
},
- DEFAULT => -98
+ DEFAULT => -90
},
- {#State 140
+ {#State 129
DEFAULT => -15
},
- {#State 141
+ {#State 130
ACTIONS => {
- "[" => 161
+ "[" => 149
},
- DEFAULT => -88,
+ DEFAULT => -80,
GOTOS => {
- 'array_len' => 162
+ 'array_len' => 150
}
},
- {#State 142
- DEFAULT => -78
+ {#State 131
+ DEFAULT => -70
},
- {#State 143
- DEFAULT => -73,
+ {#State 132
+ DEFAULT => -65,
GOTOS => {
- 'union_elements' => 163
+ 'union_elements' => 151
}
},
- {#State 144
- DEFAULT => -77
+ {#State 133
+ DEFAULT => -69
},
- {#State 145
- DEFAULT => -67
+ {#State 134
+ DEFAULT => -59
},
- {#State 146
- DEFAULT => -82,
+ {#State 135
+ DEFAULT => -74,
GOTOS => {
- 'element_list1' => 164
+ 'element_list1' => 152
}
},
- {#State 147
- DEFAULT => -68
+ {#State 136
+ DEFAULT => -60
},
- {#State 148
+ {#State 137
ACTIONS => {
'IDENTIFIER' => 26
},
GOTOS => {
- 'identifier' => 165,
- 'enum_element' => 166,
- 'enum_elements' => 167
+ 'identifier' => 153,
+ 'enum_element' => 154,
+ 'enum_elements' => 155
}
},
- {#State 149
- DEFAULT => -50
+ {#State 138
+ DEFAULT => -42
},
- {#State 150
- DEFAULT => -51
+ {#State 139
+ DEFAULT => -43
},
- {#State 151
- DEFAULT => -59
+ {#State 140
+ DEFAULT => -51
},
- {#State 152
+ {#State 141
ACTIONS => {
'IDENTIFIER' => 26
},
- DEFAULT => -62,
+ DEFAULT => -54,
GOTOS => {
- 'identifier' => 170,
- 'bitmap_element' => 169,
- 'bitmap_elements' => 168,
- 'opt_bitmap_elements' => 171
+ 'identifier' => 158,
+ 'bitmap_element' => 157,
+ 'bitmap_elements' => 156,
+ 'opt_bitmap_elements' => 159
}
},
- {#State 153
- DEFAULT => -58
+ {#State 142
+ DEFAULT => -50
},
- {#State 154
+ {#State 143
ACTIONS => {
- "," => -84,
- "void" => 175,
- ")" => -84
+ "," => -76,
+ "void" => 163,
+ ")" => -76
},
- DEFAULT => -91,
+ DEFAULT => -83,
GOTOS => {
- 'base_element' => 172,
- 'element_list2' => 174,
- 'property_list' => 173
+ 'base_element' => 160,
+ 'element_list2' => 162,
+ 'property_list' => 161
}
},
- {#State 155
- DEFAULT => -28
- },
- {#State 156
+ {#State 144
ACTIONS => {
- "[" => 161,
- "=" => 177
+ "[" => 149,
+ "=" => 165
},
GOTOS => {
- 'array_len' => 176
+ 'array_len' => 164
}
},
- {#State 157
- DEFAULT => -81
+ {#State 145
+ DEFAULT => -73
},
- {#State 158
+ {#State 146
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 178,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 166,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 159
+ {#State 147
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 179,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 167,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 160
+ {#State 148
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 180,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 168,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 161
+ {#State 149
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
- "]" => 181,
+ "]" => 169,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 182,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 170,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 162
+ {#State 150
ACTIONS => {
- ";" => 183
+ ";" => 171
}
},
- {#State 163
+ {#State 151
ACTIONS => {
- "}" => 184
+ "}" => 172
},
- DEFAULT => -91,
+ DEFAULT => -83,
GOTOS => {
- 'optional_base_element' => 186,
- 'property_list' => 185
+ 'optional_base_element' => 174,
+ 'property_list' => 173
}
},
- {#State 164
+ {#State 152
ACTIONS => {
- "}" => 187
+ "}" => 175
},
- DEFAULT => -91,
+ DEFAULT => -83,
GOTOS => {
- 'base_element' => 188,
- 'property_list' => 173
+ 'base_element' => 176,
+ 'property_list' => 161
}
},
- {#State 165
+ {#State 153
ACTIONS => {
- "=" => 189
+ "=" => 177
},
- DEFAULT => -54
+ DEFAULT => -46
},
- {#State 166
- DEFAULT => -52
+ {#State 154
+ DEFAULT => -44
},
- {#State 167
+ {#State 155
ACTIONS => {
- "}" => 190,
- "," => 191
+ "}" => 178,
+ "," => 179
}
},
- {#State 168
+ {#State 156
ACTIONS => {
- "," => 192
+ "," => 180
},
- DEFAULT => -63
+ DEFAULT => -55
},
- {#State 169
- DEFAULT => -60
+ {#State 157
+ DEFAULT => -52
},
- {#State 170
+ {#State 158
ACTIONS => {
- "=" => 193
+ "=" => 181
}
},
- {#State 171
+ {#State 159
ACTIONS => {
- "}" => 194
+ "}" => 182
}
},
- {#State 172
- DEFAULT => -86
+ {#State 160
+ DEFAULT => -78
},
- {#State 173
+ {#State 161
ACTIONS => {
'IDENTIFIER' => 26,
- "signed" => 77,
- 'void' => 71,
- "unsigned" => 81,
+ "signed" => 75,
+ 'void' => 69,
+ "unsigned" => 79,
"[" => 20
},
- DEFAULT => -91,
+ DEFAULT => -83,
GOTOS => {
- 'existingtype' => 78,
+ 'existingtype' => 76,
'bitmap' => 44,
- 'usertype' => 73,
- 'property_list' => 72,
- 'identifier' => 74,
- 'struct' => 50,
- 'enum' => 54,
- 'type' => 195,
- 'union' => 56,
- 'sign' => 75
+ 'usertype' => 71,
+ 'property_list' => 70,
+ 'identifier' => 72,
+ 'struct' => 49,
+ 'enum' => 52,
+ 'type' => 183,
+ 'union' => 54,
+ 'sign' => 73
}
},
- {#State 174
+ {#State 162
ACTIONS => {
- "," => 196,
- ")" => 197
+ "," => 184,
+ ")" => 185
}
},
- {#State 175
- DEFAULT => -85
+ {#State 163
+ DEFAULT => -77
},
- {#State 176
+ {#State 164
ACTIONS => {
- "=" => 198
+ "=" => 186
}
},
- {#State 177
+ {#State 165
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 199,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 187,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 178
+ {#State 166
ACTIONS => {
- "-" => 90,
- ":" => 89,
- "<" => 91,
- "+" => 93,
- "~" => 92,
- "*" => 94,
- "?" => 95,
- "{" => 96,
- "&" => 97,
- "/" => 98,
- "=" => 99,
- "(" => 100,
- "|" => 101,
- "." => 102,
- ">" => 103
- },
- DEFAULT => -119
+ "-" => 83,
+ ":" => 82,
+ "<" => 84,
+ "+" => 86,
+ "~" => 85,
+ "*" => 87,
+ "?" => 88,
+ "{" => 89,
+ "&" => 90,
+ "/" => 91,
+ "=" => 92,
+ "(" => 93,
+ "|" => 94,
+ "." => 95,
+ ">" => 96
+ },
+ DEFAULT => -111
},
- {#State 179
+ {#State 167
ACTIONS => {
- "-" => 90,
- ":" => 89,
- "<" => 91,
- "+" => 93,
- "~" => 92,
- "*" => 94,
- "?" => 95,
- "{" => 96,
- "&" => 97,
- "/" => 98,
- "=" => 99,
- "(" => 100,
- "|" => 101,
- "." => 102,
- ">" => 103
+ "-" => 83,
+ ":" => 82,
+ "<" => 84,
+ "+" => 86,
+ "~" => 85,
+ "*" => 87,
+ "?" => 88,
+ "{" => 89,
+ "&" => 90,
+ "/" => 91,
+ "=" => 92,
+ "(" => 93,
+ "|" => 94,
+ "." => 95,
+ ">" => 96
},
- DEFAULT => -100
+ DEFAULT => -92
},
- {#State 180
+ {#State 168
ACTIONS => {
- ":" => 89,
- "<" => 91,
- "~" => 92,
- "?" => 95,
- "{" => 96,
- "=" => 99
+ ":" => 82,
+ "<" => 84,
+ "~" => 85,
+ "?" => 88,
+ "{" => 89,
+ "=" => 92
},
- DEFAULT => -118
+ DEFAULT => -110
},
- {#State 181
+ {#State 169
ACTIONS => {
- "[" => 161
+ "[" => 149
},
- DEFAULT => -88,
+ DEFAULT => -80,
GOTOS => {
- 'array_len' => 200
+ 'array_len' => 188
}
},
- {#State 182
+ {#State 170
ACTIONS => {
- "-" => 90,
- ":" => 89,
- "?" => 95,
- "<" => 91,
- "+" => 93,
- "~" => 92,
- "&" => 97,
- "{" => 96,
- "/" => 98,
- "=" => 99,
- "|" => 101,
- "(" => 100,
- "*" => 94,
- "." => 102,
- "]" => 201,
- ">" => 103
+ "-" => 83,
+ ":" => 82,
+ "?" => 88,
+ "<" => 84,
+ "+" => 86,
+ "~" => 85,
+ "&" => 90,
+ "{" => 89,
+ "/" => 91,
+ "=" => 92,
+ "|" => 94,
+ "(" => 93,
+ "*" => 87,
+ "." => 95,
+ "]" => 189,
+ ">" => 96
}
},
- {#State 183
- DEFAULT => -35
+ {#State 171
+ DEFAULT => -27
},
- {#State 184
- DEFAULT => -75
+ {#State 172
+ DEFAULT => -67
},
- {#State 185
+ {#State 173
ACTIONS => {
"[" => 20
},
- DEFAULT => -91,
+ DEFAULT => -83,
GOTOS => {
- 'base_or_empty' => 202,
- 'base_element' => 203,
- 'empty_element' => 204,
- 'property_list' => 205
+ 'base_or_empty' => 190,
+ 'base_element' => 191,
+ 'empty_element' => 192,
+ 'property_list' => 193
}
},
- {#State 186
- DEFAULT => -74
+ {#State 174
+ DEFAULT => -66
},
- {#State 187
- DEFAULT => -65
+ {#State 175
+ DEFAULT => -57
},
- {#State 188
+ {#State 176
ACTIONS => {
- ";" => 206
+ ";" => 194
}
},
- {#State 189
+ {#State 177
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 207,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 195,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 190
- DEFAULT => -48
+ {#State 178
+ DEFAULT => -40
},
- {#State 191
+ {#State 179
ACTIONS => {
'IDENTIFIER' => 26
},
GOTOS => {
- 'identifier' => 165,
- 'enum_element' => 208
+ 'identifier' => 153,
+ 'enum_element' => 196
}
},
- {#State 192
+ {#State 180
ACTIONS => {
'IDENTIFIER' => 26
},
GOTOS => {
- 'identifier' => 170,
- 'bitmap_element' => 209
+ 'identifier' => 158,
+ 'bitmap_element' => 197
}
},
- {#State 193
+ {#State 181
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 210,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 198,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 194
- DEFAULT => -56
+ {#State 182
+ DEFAULT => -48
},
- {#State 195
- DEFAULT => -80,
+ {#State 183
+ DEFAULT => -72,
GOTOS => {
- 'pointers' => 211
+ 'pointers' => 199
}
},
- {#State 196
- DEFAULT => -91,
+ {#State 184
+ DEFAULT => -83,
GOTOS => {
- 'base_element' => 212,
- 'property_list' => 173
+ 'base_element' => 200,
+ 'property_list' => 161
}
},
- {#State 197
+ {#State 185
ACTIONS => {
- ";" => 213
+ ";" => 201
}
},
- {#State 198
+ {#State 186
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 214,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 202,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 199
+ {#State 187
ACTIONS => {
- "-" => 90,
- ":" => 89,
- "?" => 95,
- "<" => 91,
- ";" => 215,
- "+" => 93,
- "~" => 92,
- "&" => 97,
- "{" => 96,
- "/" => 98,
- "=" => 99,
- "|" => 101,
- "(" => 100,
- "*" => 94,
- "." => 102,
- ">" => 103
+ "-" => 83,
+ ":" => 82,
+ "?" => 88,
+ "<" => 84,
+ ";" => 203,
+ "+" => 86,
+ "~" => 85,
+ "&" => 90,
+ "{" => 89,
+ "/" => 91,
+ "=" => 92,
+ "|" => 94,
+ "(" => 93,
+ "*" => 87,
+ "." => 95,
+ ">" => 96
}
},
- {#State 200
- DEFAULT => -89
+ {#State 188
+ DEFAULT => -81
},
- {#State 201
+ {#State 189
ACTIONS => {
- "[" => 161
+ "[" => 149
},
- DEFAULT => -88,
+ DEFAULT => -80,
GOTOS => {
- 'array_len' => 216
+ 'array_len' => 204
}
},
- {#State 202
- DEFAULT => -72
+ {#State 190
+ DEFAULT => -64
},
- {#State 203
+ {#State 191
ACTIONS => {
- ";" => 217
+ ";" => 205
}
},
- {#State 204
- DEFAULT => -71
+ {#State 192
+ DEFAULT => -63
},
- {#State 205
+ {#State 193
ACTIONS => {
'IDENTIFIER' => 26,
- "signed" => 77,
- ";" => 218,
- 'void' => 71,
- "unsigned" => 81,
+ "signed" => 75,
+ ";" => 206,
+ 'void' => 69,
+ "unsigned" => 79,
"[" => 20
},
- DEFAULT => -91,
+ DEFAULT => -83,
GOTOS => {
- 'existingtype' => 78,
+ 'existingtype' => 76,
'bitmap' => 44,
- 'usertype' => 73,
- 'property_list' => 72,
- 'identifier' => 74,
- 'struct' => 50,
- 'enum' => 54,
- 'type' => 195,
- 'union' => 56,
- 'sign' => 75
+ 'usertype' => 71,
+ 'property_list' => 70,
+ 'identifier' => 72,
+ 'struct' => 49,
+ 'enum' => 52,
+ 'type' => 183,
+ 'union' => 54,
+ 'sign' => 73
}
},
- {#State 206
- DEFAULT => -83
+ {#State 194
+ DEFAULT => -75
},
- {#State 207
+ {#State 195
ACTIONS => {
- "-" => 90,
- ":" => 89,
- "<" => 91,
- "+" => 93,
- "~" => 92,
- "*" => 94,
- "?" => 95,
- "{" => 96,
- "&" => 97,
- "/" => 98,
- "=" => 99,
- "(" => 100,
- "|" => 101,
- "." => 102,
- ">" => 103
+ "-" => 83,
+ ":" => 82,
+ "<" => 84,
+ "+" => 86,
+ "~" => 85,
+ "*" => 87,
+ "?" => 88,
+ "{" => 89,
+ "&" => 90,
+ "/" => 91,
+ "=" => 92,
+ "(" => 93,
+ "|" => 94,
+ "." => 95,
+ ">" => 96
},
- DEFAULT => -55
+ DEFAULT => -47
},
- {#State 208
- DEFAULT => -53
+ {#State 196
+ DEFAULT => -45
},
- {#State 209
- DEFAULT => -61
+ {#State 197
+ DEFAULT => -53
},
- {#State 210
- ACTIONS => {
- "-" => 90,
- ":" => 89,
- "<" => 91,
- "+" => 93,
- "~" => 92,
- "*" => 94,
- "?" => 95,
- "{" => 96,
- "&" => 97,
- "/" => 98,
- "=" => 99,
- "(" => 100,
- "|" => 101,
- "." => 102,
- ">" => 103
+ {#State 198
+ ACTIONS => {
+ "-" => 83,
+ ":" => 82,
+ "<" => 84,
+ "+" => 86,
+ "~" => 85,
+ "*" => 87,
+ "?" => 88,
+ "{" => 89,
+ "&" => 90,
+ "/" => 91,
+ "=" => 92,
+ "(" => 93,
+ "|" => 94,
+ "." => 95,
+ ">" => 96
},
- DEFAULT => -64
+ DEFAULT => -56
},
- {#State 211
+ {#State 199
ACTIONS => {
'IDENTIFIER' => 26,
- "*" => 157
+ "*" => 145
},
GOTOS => {
- 'identifier' => 219
+ 'identifier' => 207
}
},
- {#State 212
- DEFAULT => -87
+ {#State 200
+ DEFAULT => -79
},
- {#State 213
- DEFAULT => -27
+ {#State 201
+ DEFAULT => -26
},
- {#State 214
- ACTIONS => {
- "-" => 90,
- ":" => 89,
- "?" => 95,
- "<" => 91,
- ";" => 220,
- "+" => 93,
- "~" => 92,
- "&" => 97,
- "{" => 96,
- "/" => 98,
- "=" => 99,
- "|" => 101,
- "(" => 100,
- "*" => 94,
- "." => 102,
- ">" => 103
- }
- },
- {#State 215
- DEFAULT => -25
+ {#State 202
+ ACTIONS => {
+ "-" => 83,
+ ":" => 82,
+ "?" => 88,
+ "<" => 84,
+ ";" => 208,
+ "+" => 86,
+ "~" => 85,
+ "&" => 90,
+ "{" => 89,
+ "/" => 91,
+ "=" => 92,
+ "|" => 94,
+ "(" => 93,
+ "*" => 87,
+ "." => 95,
+ ">" => 96
+ }
},
- {#State 216
- DEFAULT => -90
+ {#State 203
+ DEFAULT => -24
},
- {#State 217
- DEFAULT => -70
+ {#State 204
+ DEFAULT => -82
},
- {#State 218
- DEFAULT => -69
+ {#State 205
+ DEFAULT => -62
+ },
+ {#State 206
+ DEFAULT => -61
},
- {#State 219
+ {#State 207
ACTIONS => {
- "[" => 161
+ "[" => 149
},
- DEFAULT => -88,
+ DEFAULT => -80,
GOTOS => {
- 'array_len' => 221
+ 'array_len' => 209
}
},
- {#State 220
- DEFAULT => -26
+ {#State 208
+ DEFAULT => -25
},
- {#State 221
- DEFAULT => -79
+ {#State 209
+ DEFAULT => -71
}
],
yyrules =>
@@ -1952,9 +1893,6 @@ sub
'definition', 1, undef
],
[#Rule 24
- 'definition', 1, undef
- ],
- [#Rule 25
'const', 7,
sub
#line 100 "idl.yp"
@@ -1968,7 +1906,7 @@ sub
"LINE" => $_[0]->YYData->{LINE},
}}
],
- [#Rule 26
+ [#Rule 25
'const', 8,
sub
#line 110 "idl.yp"
@@ -1983,7 +1921,7 @@ sub
"LINE" => $_[0]->YYData->{LINE},
}}
],
- [#Rule 27
+ [#Rule 26
'function', 7,
sub
#line 124 "idl.yp"
@@ -1997,58 +1935,10 @@ sub
"LINE" => $_[0]->YYData->{LINE},
}}
],
- [#Rule 28
- 'declare', 4,
-sub
-#line 136 "idl.yp"
-{{
- "TYPE" => "DECLARE",
- "NAME" => $_[3],
- "DATA" => $_[2],
- "FILE" => $_[0]->YYData->{FILE},
- "LINE" => $_[0]->YYData->{LINE},
- }}
- ],
- [#Rule 29
- 'decl_type', 1, undef
- ],
- [#Rule 30
- 'decl_type', 1, undef
- ],
- [#Rule 31
- 'decl_type', 1, undef
- ],
- [#Rule 32
- 'decl_enum', 2,
-sub
-#line 149 "idl.yp"
-{{
- "TYPE" => "ENUM",
- "PROPERTIES" => $_[1]
- }}
- ],
- [#Rule 33
- 'decl_bitmap', 2,
-sub
-#line 156 "idl.yp"
-{{
- "TYPE" => "BITMAP",
- "PROPERTIES" => $_[1]
- }}
- ],
- [#Rule 34
- 'decl_union', 2,
-sub
-#line 163 "idl.yp"
-{{
- "TYPE" => "UNION",
- "PROPERTIES" => $_[1]
- }}
- ],
- [#Rule 35
+ [#Rule 27
'typedef', 6,
sub
-#line 170 "idl.yp"
+#line 136 "idl.yp"
{{
"TYPE" => "TYPEDEF",
"PROPERTIES" => $_[1],
@@ -2059,67 +1949,67 @@ sub
"LINE" => $_[0]->YYData->{LINE},
}}
],
- [#Rule 36
+ [#Rule 28
'usertype', 1, undef
],
- [#Rule 37
+ [#Rule 29
'usertype', 1, undef
],
- [#Rule 38
+ [#Rule 30
'usertype', 1, undef
],
- [#Rule 39
+ [#Rule 31
'usertype', 1, undef
],
- [#Rule 40
+ [#Rule 32
'typedecl', 2,
sub
-#line 183 "idl.yp"
+#line 149 "idl.yp"
{ $_[1] }
],
- [#Rule 41
+ [#Rule 33
'sign', 1, undef
],
- [#Rule 42
+ [#Rule 34
'sign', 1, undef
],
- [#Rule 43
+ [#Rule 35
'existingtype', 2,
sub
-#line 188 "idl.yp"
+#line 154 "idl.yp"
{ ($_[1]?$_[1]:"signed") ." $_[2]" }
],
- [#Rule 44
+ [#Rule 36
'existingtype', 1, undef
],
- [#Rule 45
+ [#Rule 37
'type', 1, undef
],
- [#Rule 46
+ [#Rule 38
'type', 1, undef
],
- [#Rule 47
+ [#Rule 39
'type', 1,
sub
-#line 192 "idl.yp"
+#line 158 "idl.yp"
{ "void" }
],
- [#Rule 48
+ [#Rule 40
'enum_body', 3,
sub
-#line 194 "idl.yp"
+#line 160 "idl.yp"
{ $_[2] }
],
- [#Rule 49
+ [#Rule 41
'opt_enum_body', 0, undef
],
- [#Rule 50
+ [#Rule 42
'opt_enum_body', 1, undef
],
- [#Rule 51
+ [#Rule 43
'enum', 4,
sub
-#line 197 "idl.yp"
+#line 163 "idl.yp"
{{
"TYPE" => "ENUM",
"PROPERTIES" => $_[1],
@@ -2127,43 +2017,43 @@ sub
"ELEMENTS" => $_[4]
}}
],
- [#Rule 52
+ [#Rule 44
'enum_elements', 1,
sub
-#line 206 "idl.yp"
+#line 172 "idl.yp"
{ [ $_[1] ] }
],
- [#Rule 53
+ [#Rule 45
'enum_elements', 3,
sub
-#line 207 "idl.yp"
+#line 173 "idl.yp"
{ push(@{$_[1]}, $_[3]); $_[1] }
],
- [#Rule 54
+ [#Rule 46
'enum_element', 1, undef
],
- [#Rule 55
+ [#Rule 47
'enum_element', 3,
sub
-#line 211 "idl.yp"
+#line 177 "idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 56
+ [#Rule 48
'bitmap_body', 3,
sub
-#line 214 "idl.yp"
+#line 180 "idl.yp"
{ $_[2] }
],
- [#Rule 57
+ [#Rule 49
'opt_bitmap_body', 0, undef
],
- [#Rule 58
+ [#Rule 50
'opt_bitmap_body', 1, undef
],
- [#Rule 59
+ [#Rule 51
'bitmap', 4,
sub
-#line 217 "idl.yp"
+#line 183 "idl.yp"
{{
"TYPE" => "BITMAP",
"PROPERTIES" => $_[1],
@@ -2171,46 +2061,46 @@ sub
"ELEMENTS" => $_[4]
}}
],
- [#Rule 60
+ [#Rule 52
'bitmap_elements', 1,
sub
-#line 226 "idl.yp"
+#line 192 "idl.yp"
{ [ $_[1] ] }
],
- [#Rule 61
+ [#Rule 53
'bitmap_elements', 3,
sub
-#line 227 "idl.yp"
+#line 193 "idl.yp"
{ push(@{$_[1]}, $_[3]); $_[1] }
],
- [#Rule 62
+ [#Rule 54
'opt_bitmap_elements', 0, undef
],
- [#Rule 63
+ [#Rule 55
'opt_bitmap_elements', 1, undef
],
- [#Rule 64
+ [#Rule 56
'bitmap_element', 3,
sub
-#line 232 "idl.yp"
+#line 198 "idl.yp"
{ "$_[1] ( $_[3] )" }
],
- [#Rule 65
+ [#Rule 57
'struct_body', 3,
sub
-#line 235 "idl.yp"
+#line 201 "idl.yp"
{ $_[2] }
],
- [#Rule 66
+ [#Rule 58
'opt_struct_body', 0, undef
],
- [#Rule 67
+ [#Rule 59
'opt_struct_body', 1, undef
],
- [#Rule 68
+ [#Rule 60
'struct', 4,
sub
-#line 239 "idl.yp"
+#line 205 "idl.yp"
{{
"TYPE" => "STRUCT",
"PROPERTIES" => $_[1],
@@ -2218,10 +2108,10 @@ sub
"ELEMENTS" => $_[4]
}}
],
- [#Rule 69
+ [#Rule 61
'empty_element', 2,
sub
-#line 248 "idl.yp"
+#line 214 "idl.yp"
{{
"NAME" => "",
"TYPE" => "EMPTY",
@@ -2232,43 +2122,43 @@ sub
"LINE" => $_[0]->YYData->{LINE},
}}
],
- [#Rule 70
+ [#Rule 62
'base_or_empty', 2, undef
],
- [#Rule 71
+ [#Rule 63
'base_or_empty', 1, undef
],
- [#Rule 72
+ [#Rule 64
'optional_base_element', 2,
sub
-#line 262 "idl.yp"
+#line 228 "idl.yp"
{ $_[2]->{PROPERTIES} = FlattenHash([$_[1],$_[2]->{PROPERTIES}]); $_[2] }
],
- [#Rule 73
+ [#Rule 65
'union_elements', 0, undef
],
- [#Rule 74
+ [#Rule 66
'union_elements', 2,
sub
-#line 267 "idl.yp"
+#line 233 "idl.yp"
{ push(@{$_[1]}, $_[2]); $_[1] }
],
- [#Rule 75
+ [#Rule 67
'union_body', 3,
sub
-#line 270 "idl.yp"
+#line 236 "idl.yp"
{ $_[2] }
],
- [#Rule 76
+ [#Rule 68
'opt_union_body', 0, undef
],
- [#Rule 77
+ [#Rule 69
'opt_union_body', 1, undef
],
- [#Rule 78
+ [#Rule 70
'union', 4,
sub
-#line 274 "idl.yp"
+#line 240 "idl.yp"
{{
"TYPE" => "UNION",
"PROPERTIES" => $_[1],
@@ -2276,10 +2166,10 @@ sub
"ELEMENTS" => $_[4]
}}
],
- [#Rule 79
+ [#Rule 71
'base_element', 5,
sub
-#line 283 "idl.yp"
+#line 249 "idl.yp"
{{
"NAME" => $_[4],
"TYPE" => $_[2],
@@ -2290,241 +2180,241 @@ sub
"LINE" => $_[0]->YYData->{LINE},
}}
],
- [#Rule 80
+ [#Rule 72
'pointers', 0,
sub
-#line 297 "idl.yp"
+#line 263 "idl.yp"
{ 0 }
],
- [#Rule 81
+ [#Rule 73
'pointers', 2,
sub
-#line 298 "idl.yp"
+#line 264 "idl.yp"
{ $_[1]+1 }
],
- [#Rule 82
+ [#Rule 74
'element_list1', 0,
sub
-#line 302 "idl.yp"
+#line 268 "idl.yp"
{ [] }
],
- [#Rule 83
+ [#Rule 75
'element_list1', 3,
sub
-#line 303 "idl.yp"
+#line 269 "idl.yp"
{ push(@{$_[1]}, $_[2]); $_[1] }
],
- [#Rule 84
+ [#Rule 76
'element_list2', 0, undef
],
- [#Rule 85
+ [#Rule 77
'element_list2', 1, undef
],
- [#Rule 86
+ [#Rule 78
'element_list2', 1,
sub
-#line 309 "idl.yp"
+#line 275 "idl.yp"
{ [ $_[1] ] }
],
- [#Rule 87
+ [#Rule 79
'element_list2', 3,
sub
-#line 310 "idl.yp"
+#line 276 "idl.yp"
{ push(@{$_[1]}, $_[3]); $_[1] }
],
- [#Rule 88
+ [#Rule 80
'array_len', 0, undef
],
- [#Rule 89
+ [#Rule 81
'array_len', 3,
sub
-#line 315 "idl.yp"
+#line 281 "idl.yp"
{ push(@{$_[3]}, "*"); $_[3] }
],
- [#Rule 90
+ [#Rule 82
'array_len', 4,
sub
-#line 316 "idl.yp"
+#line 282 "idl.yp"
{ push(@{$_[4]}, "$_[2]"); $_[4] }
],
- [#Rule 91
+ [#Rule 83
'property_list', 0, undef
],
- [#Rule 92
+ [#Rule 84
'property_list', 4,
sub
-#line 322 "idl.yp"
+#line 288 "idl.yp"
{ FlattenHash([$_[1],$_[3]]); }
],
- [#Rule 93
+ [#Rule 85
'properties', 1,
sub
-#line 325 "idl.yp"
+#line 291 "idl.yp"
{ $_[1] }
],
- [#Rule 94
+ [#Rule 86
'properties', 3,
sub
-#line 326 "idl.yp"
+#line 292 "idl.yp"
{ FlattenHash([$_[1], $_[3]]); }
],
- [#Rule 95
+ [#Rule 87
'property', 1,
sub
-#line 329 "idl.yp"
+#line 295 "idl.yp"
{{ "$_[1]" => "1" }}
],
- [#Rule 96
+ [#Rule 88
'property', 4,
sub
-#line 330 "idl.yp"
+#line 296 "idl.yp"
{{ "$_[1]" => "$_[3]" }}
],
- [#Rule 97
+ [#Rule 89
'listtext', 1, undef
],
- [#Rule 98
+ [#Rule 90
'listtext', 3,
sub
-#line 335 "idl.yp"
+#line 301 "idl.yp"
{ "$_[1] $_[3]" }
],
- [#Rule 99
+ [#Rule 91
'commalisttext', 1, undef
],
- [#Rule 100
+ [#Rule 92
'commalisttext', 3,
sub
-#line 340 "idl.yp"
+#line 306 "idl.yp"
{ "$_[1],$_[3]" }
],
- [#Rule 101
+ [#Rule 93
'anytext', 0,
sub
-#line 344 "idl.yp"
+#line 310 "idl.yp"
{ "" }
],
- [#Rule 102
+ [#Rule 94
'anytext', 1, undef
],
- [#Rule 103
+ [#Rule 95
'anytext', 1, undef
],
- [#Rule 104
+ [#Rule 96
'anytext', 1, undef
],
- [#Rule 105
+ [#Rule 97
'anytext', 3,
sub
-#line 346 "idl.yp"
+#line 312 "idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 106
+ [#Rule 98
'anytext', 3,
sub
-#line 347 "idl.yp"
+#line 313 "idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 107
+ [#Rule 99
'anytext', 3,
sub
-#line 348 "idl.yp"
+#line 314 "idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 108
+ [#Rule 100
'anytext', 3,
sub
-#line 349 "idl.yp"
+#line 315 "idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 109
+ [#Rule 101
'anytext', 3,
sub
-#line 350 "idl.yp"
+#line 316 "idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 110
+ [#Rule 102
'anytext', 3,
sub
-#line 351 "idl.yp"
+#line 317 "idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 111
+ [#Rule 103
'anytext', 3,
sub
-#line 352 "idl.yp"
+#line 318 "idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 112
+ [#Rule 104
'anytext', 3,
sub
-#line 353 "idl.yp"
+#line 319 "idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 113
+ [#Rule 105
'anytext', 3,
sub
-#line 354 "idl.yp"
+#line 320 "idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 114
+ [#Rule 106
'anytext', 3,
sub
-#line 355 "idl.yp"
+#line 321 "idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 115
+ [#Rule 107
'anytext', 3,
sub
-#line 356 "idl.yp"
+#line 322 "idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 116
+ [#Rule 108
'anytext', 3,
sub
-#line 357 "idl.yp"
+#line 323 "idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 117
+ [#Rule 109
'anytext', 3,
sub
-#line 358 "idl.yp"
+#line 324 "idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 118
+ [#Rule 110
'anytext', 5,
sub
-#line 359 "idl.yp"
+#line 325 "idl.yp"
{ "$_[1]$_[2]$_[3]$_[4]$_[5]" }
],
- [#Rule 119
+ [#Rule 111
'anytext', 5,
sub
-#line 360 "idl.yp"
+#line 326 "idl.yp"
{ "$_[1]$_[2]$_[3]$_[4]$_[5]" }
],
- [#Rule 120
+ [#Rule 112
'identifier', 1, undef
],
- [#Rule 121
+ [#Rule 113
'optional_identifier', 1, undef
],
- [#Rule 122
+ [#Rule 114
'optional_identifier', 0, undef
],
- [#Rule 123
+ [#Rule 115
'constant', 1, undef
],
- [#Rule 124
+ [#Rule 116
'text', 1,
sub
-#line 374 "idl.yp"
+#line 340 "idl.yp"
{ "\"$_[1]\"" }
],
- [#Rule 125
+ [#Rule 117
'optional_semicolon', 0, undef
],
- [#Rule 126
+ [#Rule 118
'optional_semicolon', 1, undef
]
],
@@ -2532,7 +2422,7 @@ sub
bless($self,$class);
}
-#line 385 "idl.yp"
+#line 351 "idl.yp"
use Parse::Pidl qw(error);
@@ -2627,7 +2517,7 @@ again:
if (s/^([\w_]+)//) {
$parser->YYData->{LAST_TOKEN} = $1;
if ($1 =~
- /^(coclass|interface|const|typedef|declare|union|cpp_quote
+ /^(coclass|interface|const|typedef|union|cpp_quote
|struct|enum|bitmap|void|unsigned|signed|import|include
|importlib)$/x) {
return $1;
diff --git a/source4/pidl/lib/Parse/Pidl/NDR.pm b/source4/pidl/lib/Parse/Pidl/NDR.pm
index f624d2bdc0..fc6bfe4c96 100644
--- a/source4/pidl/lib/Parse/Pidl/NDR.pm
+++ b/source4/pidl/lib/Parse/Pidl/NDR.pm
@@ -35,7 +35,7 @@ use vars qw($VERSION);
$VERSION = '0.01';
@ISA = qw(Exporter);
@EXPORT = qw(GetPrevLevel GetNextLevel ContainsDeferred ContainsString);
-@EXPORT_OK = qw(GetElementLevelTable ParseElement ValidElement align_type mapToScalar ParseType can_contain_deferred);
+@EXPORT_OK = qw(GetElementLevelTable ParseElement ValidElement align_type mapToScalar ParseType can_contain_deferred is_charset_array);
use strict;
use Parse::Pidl qw(warning fatal);
@@ -287,8 +287,6 @@ sub can_contain_deferred($)
return 0 if (Parse::Pidl::Typelist::is_scalar($type));
- return 1 if ($type->{TYPE} eq "DECLARE"); # assume the worst
-
return can_contain_deferred($type->{DATA}) if ($type->{TYPE} eq "TYPEDEF");
return 0 unless defined($type->{ELEMENTS});
@@ -354,21 +352,25 @@ sub align_type($)
return $scalar_alignment->{$e->{NAME}};
}
+ return 0 if ($e eq "EMPTY");
+
unless (hasType($e)) {
# it must be an external type - all we can do is guess
- # print "Warning: assuming alignment of unknown type '$e' is 4\n";
+ # warning($e, "assuming alignment of unknown type '$e' is 4");
return 4;
}
my $dt = getType($e);
- if ($dt->{TYPE} eq "TYPEDEF" or $dt->{TYPE} eq "DECLARE") {
+ if ($dt->{TYPE} eq "TYPEDEF") {
return align_type($dt->{DATA});
} elsif ($dt->{TYPE} eq "ENUM") {
return align_type(Parse::Pidl::Typelist::enum_type_fn($dt));
} elsif ($dt->{TYPE} eq "BITMAP") {
return align_type(Parse::Pidl::Typelist::bitmap_type_fn($dt));
} elsif (($dt->{TYPE} eq "STRUCT") or ($dt->{TYPE} eq "UNION")) {
+ # Struct/union without body: assume 4
+ return 4 unless (defined($dt->{ELEMENTS}));
return find_largest_alignment($dt);
}
@@ -631,7 +633,7 @@ sub FindNestedTypes($$)
sub FindNestedTypes($$);
my ($l, $t) = @_;
- return if not defined($t->{ELEMENTS});
+ return unless defined($t->{ELEMENTS});
return if ($t->{TYPE} eq "ENUM");
return if ($t->{TYPE} eq "BITMAP");
@@ -650,7 +652,6 @@ sub ParseInterface($)
my @consts = ();
my @functions = ();
my @endpoints;
- my @declares = ();
my $opnum = 0;
my $version;
@@ -667,9 +668,7 @@ sub ParseInterface($)
}
foreach my $d (@{$idl->{DATA}}) {
- if ($d->{TYPE} eq "DECLARE") {
- push (@declares, $d);
- } elsif ($d->{TYPE} eq "FUNCTION") {
+ if ($d->{TYPE} eq "FUNCTION") {
push (@functions, ParseFunction($idl, $d, \$opnum));
} elsif ($d->{TYPE} eq "CONST") {
push (@consts, ParseConst($idl, $d));
@@ -701,7 +700,6 @@ sub ParseInterface($)
FUNCTIONS => \@functions,
CONSTS => \@consts,
TYPES => \@types,
- DECLARES => \@declares,
ENDPOINTS => \@endpoints
};
}
@@ -1183,4 +1181,19 @@ sub Validate($)
}
}
+sub is_charset_array($$)
+{
+ my ($e,$l) = @_;
+
+ return 0 if ($l->{TYPE} ne "ARRAY");
+
+ my $nl = GetNextLevel($e,$l);
+
+ return 0 unless ($nl->{TYPE} eq "DATA");
+
+ return has_property($e, "charset");
+}
+
+
+
1;
diff --git a/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm b/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
index b7372a802a..86b8951026 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
@@ -9,7 +9,7 @@ package Parse::Pidl::Samba3::ClientNDR;
use Exporter;
@ISA = qw(Exporter);
-@EXPORT_OK = qw(GenerateFunctionInEnv ParseFunction $res $res_hdr);
+@EXPORT_OK = qw(ParseFunction $res $res_hdr);
use strict;
use Parse::Pidl qw(fatal warning);
@@ -17,7 +17,7 @@ use Parse::Pidl::Typelist qw(hasType getType mapTypeName scalar_is_reference);
use Parse::Pidl::Util qw(has_property is_constant ParseExpr);
use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel ContainsDeferred);
use Parse::Pidl::Samba4 qw(DeclLong);
-use Parse::Pidl::Samba4::NDR::Parser qw(GenerateFunctionInEnv);
+use Parse::Pidl::Samba4::Header qw(GenerateFunctionInEnv);
use vars qw($VERSION);
$VERSION = '0.01';
diff --git a/source4/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm b/source4/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm
index 47312bc83d..ca9e7d15db 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm
@@ -6,13 +6,17 @@
package Parse::Pidl::Samba3::ServerNDR;
+use Exporter;
+@ISA = qw(Exporter);
+@EXPORT_OK = qw(DeclLevel);
+
use strict;
use Parse::Pidl qw(warning fatal);
use Parse::Pidl::Typelist qw(mapTypeName scalar_is_reference);
use Parse::Pidl::Util qw(ParseExpr has_property is_constant);
use Parse::Pidl::NDR qw(GetNextLevel);
use Parse::Pidl::Samba4 qw(ElementStars DeclLong);
-use Parse::Pidl::Samba4::NDR::Parser qw(GenerateFunctionOutEnv);
+use Parse::Pidl::Samba4::Header qw(GenerateFunctionOutEnv);
use vars qw($VERSION);
$VERSION = '0.01';
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4.pm b/source4/pidl/lib/Parse/Pidl/Samba4.pm
index 5848543a60..d42e01cdb0 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4.pm
@@ -12,6 +12,7 @@ require Exporter;
use Parse::Pidl::Util qw(has_property is_constant);
use Parse::Pidl::NDR qw(GetNextLevel);
use Parse::Pidl::Typelist qw(mapTypeName scalar_is_reference);
+use Parse::Pidl qw(fatal);
use strict;
use vars qw($VERSION);
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm b/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm
index 2e9bc0953c..efb3f2858d 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm
@@ -8,13 +8,14 @@ package Parse::Pidl::Samba4::EJS;
use Exporter;
@ISA = qw(Exporter);
-@EXPORT_OK = qw(get_pointer_to get_value_of check_null_pointer fn_declare TypeFunctionName);
+@EXPORT_OK = qw(check_null_pointer fn_declare TypeFunctionName);
use strict;
-use Parse::Pidl::Typelist;
+use Parse::Pidl::Typelist qw(typeHasBody);
+use Parse::Pidl::CUtil qw(get_pointer_to get_value_of);
use Parse::Pidl::Util qw(has_property ParseExpr);
use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel);
-use Parse::Pidl::Samba4::NDR::Parser qw(GenerateStructEnv GenerateFunctionInEnv
+use Parse::Pidl::Samba4::Header qw(GenerateStructEnv GenerateFunctionInEnv
GenerateFunctionOutEnv);
use vars qw($VERSION);
@@ -54,30 +55,6 @@ sub deindent($)
$self->{tabs} = substr($self->{tabs}, 0, -1);
}
-sub get_pointer_to($)
-{
- my $var_name = shift;
-
- if ($var_name =~ /^\*(.*)$/) {
- return $1;
- } elsif ($var_name =~ /^\&(.*)$/) {
- return "&($var_name)";
- } else {
- return "&$var_name";
- }
-}
-
-sub get_value_of($)
-{
- my $var_name = shift;
-
- if ($var_name =~ /^\&(.*)$/) {
- return $1;
- } else {
- return "*$var_name";
- }
-}
-
#####################################################################
# check that a variable we get from ParseExpr isn't a null pointer
sub check_null_pointer($$)
@@ -297,6 +274,7 @@ sub EjsUnionPull($$$)
sub EjsEnumConstant($$)
{
my ($self, $d) = @_;
+ return unless (defined($d->{ELEMENTS}));
my $v = 0;
foreach my $e (@{$d->{ELEMENTS}}) {
my $el = $e;
@@ -595,6 +573,7 @@ sub EjsEnumPush($$$)
sub EjsBitmapPush($$$)
{
my ($self, $d, $varname) = @_;
+ return unless (defined($d->{ELEMENTS}));
my $type_fn = $d->{BASE_TYPE};
# put the bitmap elements in the constants array
foreach my $e (@{$d->{ELEMENTS}}) {
@@ -733,6 +712,7 @@ sub EjsInterface($$$)
$self->pidl_hdr("\n");
foreach my $d (@{$interface->{TYPES}}) {
+ next unless (typeHasBody($d));
($needed->{TypeFunctionName("ejs_push", $d)}) && $self->EjsTypePushFunction($d, $d->{NAME});
($needed->{TypeFunctionName("ejs_pull", $d)}) && $self->EjsTypePullFunction($d, $d->{NAME});
}
@@ -846,8 +826,9 @@ sub NeededType($$$)
NeededType($t->{DATA}, $needed, $req) if ($t->{TYPE} eq "TYPEDEF");
- return if (($t->{TYPE} ne "STRUCT") and
- ($t->{TYPE} ne "UNION"));
+ return unless (($t->{TYPE} eq "STRUCT") or ($t->{TYPE} eq "UNION"));
+
+ return unless(typeHasBody($t));
foreach (@{$t->{ELEMENTS}}) {
next if (has_property($_, "subcontext")); #FIXME: Support subcontexts
@@ -883,7 +864,7 @@ sub TypeFunctionName($$)
my ($prefix, $t) = @_;
return "$prefix\_$t->{NAME}" if (ref($t) eq "HASH" and
- ($t->{TYPE} eq "TYPEDEF" or $t->{TYPE} eq "DECLARE"));
+ $t->{TYPE} eq "TYPEDEF");
return "$prefix\_$t->{TYPE}_$t->{NAME}" if (ref($t) eq "HASH");
return "$prefix\_$t";
}
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/Header.pm b/source4/pidl/lib/Parse/Pidl/Samba4/Header.pm
index 7a6ffa46d6..2b3a9df80f 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/Header.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/Header.pm
@@ -6,10 +6,15 @@
package Parse::Pidl::Samba4::Header;
+require Exporter;
+
+@ISA = qw(Exporter);
+@EXPORT_OK = qw(GenerateFunctionInEnv GenerateFunctionOutEnv EnvSubstituteValue GenerateStructEnv);
+
use strict;
use Parse::Pidl qw(fatal);
use Parse::Pidl::Typelist qw(mapTypeName scalar_is_reference);
-use Parse::Pidl::Util qw(has_property is_constant unmake_str);
+use Parse::Pidl::Util qw(has_property is_constant unmake_str ParseExpr);
use Parse::Pidl::Samba4 qw(is_intree ElementStars ArrayBrackets choose_header);
use vars qw($VERSION);
@@ -107,47 +112,49 @@ sub HeaderEnum($$)
my($enum,$name) = @_;
my $first = 1;
- pidl "#ifndef USE_UINT_ENUMS\n";
- pidl "enum $name {\n";
- $tab_depth++;
+ pidl "enum $name";
if (defined($enum->{ELEMENTS})) {
+ pidl "\n#ifndef USE_UINT_ENUMS\n";
+ pidl " {\n";
+ $tab_depth++;
foreach my $e (@{$enum->{ELEMENTS}}) {
unless ($first) { pidl ",\n"; }
$first = 0;
pidl tabs();
pidl $e;
}
- }
- pidl "\n";
- $tab_depth--;
- pidl "}\n";
- pidl "#else\n";
- my $count = 0;
- pidl "enum $name { __donnot_use_enum_$name=0x7FFFFFFF}\n";
- my $with_val = 0;
- my $without_val = 0;
- if (defined($enum->{ELEMENTS})) {
- foreach my $e (@{$enum->{ELEMENTS}}) {
- my $t = "$e";
- my $name;
- my $value;
- if ($t =~ /(.*)=(.*)/) {
- $name = $1;
- $value = $2;
- $with_val = 1;
- fatal($e->{ORIGINAL}, "you can't mix enum member with values and without values!")
- unless ($without_val == 0);
- } else {
- $name = $t;
- $value = $count++;
- $without_val = 1;
- fatal($e->{ORIGINAL}, "you can't mix enum member with values and without values!")
- unless ($with_val == 0);
+ pidl "\n";
+ $tab_depth--;
+ pidl "}";
+ pidl "\n";
+ pidl "#else\n";
+ 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 "#define $name ( $value )\n";
}
+ pidl "#endif\n";
}
- pidl "#endif\n";
}
#####################################################################
@@ -215,7 +222,7 @@ sub HeaderType($$$)
sub HeaderTypedef($)
{
my($typedef) = shift;
- HeaderType($typedef, $typedef->{DATA}, $typedef->{NAME});
+ HeaderType($typedef, $typedef->{DATA}, $typedef->{NAME}) if defined ($typedef->{DATA});
}
#####################################################################
@@ -404,4 +411,66 @@ sub Parse($)
return $res;
}
+sub GenerateStructEnv($$)
+{
+ my ($x, $v) = @_;
+ my %env;
+
+ foreach my $e (@{$x->{ELEMENTS}}) {
+ $env{$e->{NAME}} = "$v->$e->{NAME}";
+ }
+
+ $env{"this"} = $v;
+
+ return \%env;
+}
+
+sub EnvSubstituteValue($$)
+{
+ my ($env,$s) = @_;
+
+ # Substitute the value() values in the env
+ foreach my $e (@{$s->{ELEMENTS}}) {
+ next unless (defined(my $v = has_property($e, "value")));
+
+ $env->{$e->{NAME}} = ParseExpr($v, $env, $e);
+ }
+
+ return $env;
+}
+
+sub GenerateFunctionInEnv($;$)
+{
+ my ($fn, $base) = @_;
+ my %env;
+
+ $base = "r->" unless defined($base);
+
+ foreach my $e (@{$fn->{ELEMENTS}}) {
+ if (grep (/in/, @{$e->{DIRECTION}})) {
+ $env{$e->{NAME}} = $base."in.$e->{NAME}";
+ }
+ }
+
+ return \%env;
+}
+
+sub GenerateFunctionOutEnv($;$)
+{
+ my ($fn, $base) = @_;
+ my %env;
+
+ $base = "r->" unless defined($base);
+
+ foreach my $e (@{$fn->{ELEMENTS}}) {
+ if (grep (/out/, @{$e->{DIRECTION}})) {
+ $env{$e->{NAME}} = $base."out.$e->{NAME}";
+ } elsif (grep (/in/, @{$e->{DIRECTION}})) {
+ $env{$e->{NAME}} = $base."in.$e->{NAME}";
+ }
+ }
+
+ return \%env;
+}
+
1;
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index c9b48b017c..02d3a80992 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -9,13 +9,15 @@ package Parse::Pidl::Samba4::NDR::Parser;
require Exporter;
@ISA = qw(Exporter);
-@EXPORT_OK = qw(check_null_pointer GenerateFunctionInEnv GenerateFunctionOutEnv EnvSubstituteValue GenerateStructEnv NeededFunction NeededElement NeededType $res NeededInterface TypeFunctionName ParseElementPrint);
+@EXPORT_OK = qw(check_null_pointer NeededFunction NeededElement NeededType $res NeededInterface TypeFunctionName ParseElementPrint);
use strict;
-use Parse::Pidl::Typelist qw(hasType getType mapTypeName);
+use Parse::Pidl::Typelist qw(hasType getType mapTypeName typeHasBody);
use Parse::Pidl::Util qw(has_property ParseExpr ParseExprExt print_uuid);
-use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel ContainsDeferred);
+use Parse::Pidl::CUtil qw(get_pointer_to get_value_of);
+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);
use Parse::Pidl qw(warning);
use vars qw($VERSION);
@@ -76,42 +78,6 @@ sub has_fast_array($$)
return ($t->{NAME} eq "uint8") or ($t->{NAME} eq "string");
}
-sub is_charset_array($$)
-{
- my ($e,$l) = @_;
-
- return 0 if ($l->{TYPE} ne "ARRAY");
-
- my $nl = GetNextLevel($e,$l);
-
- return 0 unless ($nl->{TYPE} eq "DATA");
-
- return has_property($e, "charset");
-}
-
-sub get_pointer_to($)
-{
- my $var_name = shift;
-
- if ($var_name =~ /^\*(.*)$/) {
- return $1;
- } elsif ($var_name =~ /^\&(.*)$/) {
- return "&($var_name)";
- } else {
- return "&$var_name";
- }
-}
-
-sub get_value_of($)
-{
- my $var_name = shift;
-
- if ($var_name =~ /^\&(.*)$/) {
- return $1;
- } else {
- return "*$var_name";
- }
-}
####################################
# pidl() is our basic output routine
@@ -215,68 +181,6 @@ sub end_flags($$)
}
}
-sub GenerateStructEnv($$)
-{
- my ($x, $v) = @_;
- my %env;
-
- foreach my $e (@{$x->{ELEMENTS}}) {
- $env{$e->{NAME}} = "$v->$e->{NAME}";
- }
-
- $env{"this"} = $v;
-
- return \%env;
-}
-
-sub EnvSubstituteValue($$)
-{
- my ($env,$s) = @_;
-
- # Substitute the value() values in the env
- foreach my $e (@{$s->{ELEMENTS}}) {
- next unless (defined(my $v = has_property($e, "value")));
-
- $env->{$e->{NAME}} = ParseExpr($v, $env, $e);
- }
-
- return $env;
-}
-
-sub GenerateFunctionInEnv($;$)
-{
- my ($fn, $base) = @_;
- my %env;
-
- $base = "r->" unless defined($base);
-
- foreach my $e (@{$fn->{ELEMENTS}}) {
- if (grep (/in/, @{$e->{DIRECTION}})) {
- $env{$e->{NAME}} = $base."in.$e->{NAME}";
- }
- }
-
- return \%env;
-}
-
-sub GenerateFunctionOutEnv($;$)
-{
- my ($fn, $base) = @_;
- my %env;
-
- $base = "r->" unless defined($base);
-
- foreach my $e (@{$fn->{ELEMENTS}}) {
- if (grep (/out/, @{$e->{DIRECTION}})) {
- $env{$e->{NAME}} = $base."out.$e->{NAME}";
- } elsif (grep (/in/, @{$e->{DIRECTION}})) {
- $env{$e->{NAME}} = $base."in.$e->{NAME}";
- }
- }
-
- return \%env;
-}
-
#####################################################################
# parse the data of an array - push side
sub ParseArrayPushHeader($$$$$$)
@@ -2565,6 +2469,8 @@ sub ParseInterface($$$)
# Typedefs
foreach my $d (@{$interface->{TYPES}}) {
+ next unless(typeHasBody($d));
+
($needed->{TypeFunctionName("ndr_push", $d)}) && $self->ParseTypePushFunction($d, "r");
($needed->{TypeFunctionName("ndr_pull", $d)}) && $self->ParseTypePullFunction($d, "r");
($needed->{TypeFunctionName("ndr_print", $d)}) && $self->ParseTypePrintFunction($d, "r");
@@ -2708,6 +2614,7 @@ sub NeededType($$$)
NeededType($t->{DATA}, $needed, $req) if ($t->{TYPE} eq "TYPEDEF");
if ($t->{TYPE} eq "STRUCT" or $t->{TYPE} eq "UNION") {
+ return unless defined($t->{ELEMENTS});
for my $e (@{$t->{ELEMENTS}}) {
$e->{PARENT} = $t;
if (has_property($e, "compression")) {
@@ -2745,7 +2652,7 @@ sub TypeFunctionName($$)
my ($prefix, $t) = @_;
return "$prefix\_$t->{NAME}" if (ref($t) eq "HASH" and
- ($t->{TYPE} eq "TYPEDEF" or $t->{TYPE} eq "DECLARE"));
+ $t->{TYPE} eq "TYPEDEF");
return "$prefix\_$t->{TYPE}_$t->{NAME}" if (ref($t) eq "HASH");
return "$prefix\_$t";
}
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm
index 8effff9d5e..2475925377 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm
@@ -1,6 +1,6 @@
###################################################
# Python function wrapper generator
-# Copyright jelmer@samba.org 2007
+# Copyright jelmer@samba.org 2007-2008
# released under the GNU GPL
package Parse::Pidl::Samba4::Python;
@@ -9,15 +9,19 @@ use Exporter;
@ISA = qw(Exporter);
use strict;
-use Parse::Pidl::Typelist;
+use Parse::Pidl::Typelist qw(hasType resolveType getType mapTypeName expandAlias);
use Parse::Pidl::Util qw(has_property ParseExpr);
+use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel ContainsDeferred is_charset_array);
+use Parse::Pidl::CUtil qw(get_value_of get_pointer_to);
+use Parse::Pidl::Samba4::Header qw(GenerateFunctionInEnv GenerateFunctionOutEnv EnvSubstituteValue GenerateStructEnv);
use vars qw($VERSION);
$VERSION = '0.01';
sub new($) {
my ($class) = @_;
- my $self = { res => "", res_hdr => "", tabs => "", constants => {}};
+ my $self = { res => "", res_hdr => "", tabs => "", constants => {},
+ module_methods => []};
bless($self, $class);
}
@@ -63,121 +67,371 @@ sub Import
sub Const($$)
{
my ($self, $const) = @_;
- $self->{constants}->{$const->{NAME}} = [$const->{DATA}->{TYPE}, $const->{VALUE}];
+ $self->register_constant($const->{NAME}, $const->{DTYPE}, $const->{VALUE});
}
-sub FromTypeToPythonFunction($$)
+sub register_constant($$$$)
{
- my ($self, $type) = @_;
+ my ($self, $name, $type, $value) = @_;
- #FIXME
+ $self->{constants}->{$name} = [$type, $value];
}
-sub FromPythonToTypeFunction($$)
+sub EnumAndBitmapConsts($$$)
{
- my ($self, $type) = @_;
+ my ($self, $name, $d) = @_;
- #FIXME
+ return unless (defined($d->{ELEMENTS}));
+
+ foreach my $e (@{$d->{ELEMENTS}}) {
+ $e =~ /^([A-Za-z0-9_]+)/;
+ my $cname = $1;
+
+ $self->register_constant($cname, $d, $cname);
+ }
}
-sub TypeConstructor($$)
+sub FromUnionToPythonFunction($$$$)
{
- my ($self, $type) = @_;
+ my ($self, $mem_ctx, $type, $switch, $name) = @_;
+
+ $self->pidl("PyObject *ret;");
+ $self->pidl("");
- $self->pidl("staticforward PyTypeObject $type->{NAME}_ObjectType;");
- $self->pidl("typedef struct {");
+ $self->pidl("switch ($switch) {");
$self->indent;
- $self->pidl("PyObject_HEAD");
- $self->pidl("void *object;"); # FIXME: Use real type rather than void
+
+ foreach my $e (@{$type->{ELEMENTS}}) {
+ $self->pidl("$e->{CASE}:");
+
+ $self->indent;
+
+ if ($e->{NAME}) {
+ $self->ConvertObjectToPython($mem_ctx, {}, $e, "$name->$e->{NAME}", "ret");
+ } else {
+ $self->pidl("ret = Py_None;");
+ }
+
+ $self->pidl("return ret;");
+ $self->pidl("");
+
+ $self->deindent;
+ }
+
$self->deindent;
- $self->pidl("} $type->{NAME}_Object;");
+ $self->pidl("}");
- $self->pidl("");
+ $self->pidl("PyErr_SetString(PyExc_TypeError, \"unknown union level\");");
+ $self->pidl("return NULL;");
+}
- $self->pidl("static PyObject *py_$type->{NAME}_getattr(PyTypeObject *obj, char *name)");
- $self->pidl("{");
+sub FromPythonToUnionFunction($$$$$)
+{
+ my ($self, $type, $typename, $switch, $mem_ctx, $name) = @_;
+
+ my $has_default = 0;
+
+ $self->pidl("$typename *ret = talloc_zero($mem_ctx, $typename);");
+
+ $self->pidl("switch ($switch) {");
$self->indent;
- $self->pidl("return Py_None;");
+
+ foreach my $e (@{$type->{ELEMENTS}}) {
+ $self->pidl("$e->{CASE}:");
+ if ($e->{CASE} eq "default") { $has_default = 1; }
+ $self->indent;
+ if ($e->{NAME}) {
+ $self->ConvertObjectFromPython({}, $mem_ctx, $e, $name, "ret->$e->{NAME}", "talloc_free(ret); return NULL;");
+ }
+ $self->pidl("break;");
+ $self->deindent;
+ $self->pidl("");
+ }
+
+ if (!$has_default) {
+ $self->pidl("default:");
+ $self->indent;
+ $self->pidl("PyErr_SetString(PyExc_TypeError, \"invalid union level value\");");
+ $self->pidl("talloc_free(ret);");
+ $self->pidl("ret = NULL;");
+ $self->deindent;
+ }
+
$self->deindent;
$self->pidl("}");
$self->pidl("");
+ $self->pidl("return ret;");
+}
+
+sub PythonStruct($$$$)
+{
+ my ($self, $name, $cname, $d) = @_;
+
+ my $env = GenerateStructEnv($d, "object");
+
+ $self->pidl("");
- $self->pidl("static void py_$type->{NAME}_dealloc(PyObject* self)");
+ $self->pidl("static PyObject *py_$name\_getattr(PyObject *obj, char *name)");
$self->pidl("{");
$self->indent;
- $self->pidl("$type->{NAME}_Object *obj = ($type->{NAME}_Object *)self;");
- $self->pidl("talloc_free(obj->object);");
- $self->pidl("PyObject_Del(self);");
+ if ($#{$d->{ELEMENTS}} > -1) {
+ $self->pidl("$cname *object = py_talloc_get_ptr(obj);");
+ foreach my $e (@{$d->{ELEMENTS}}) {
+ $self->pidl("if (!strcmp(name, \"$e->{NAME}\")) {");
+ my $varname = "object->$e->{NAME}";
+ $self->indent;
+ $self->pidl("PyObject *py_$e->{NAME};");
+ $self->ConvertObjectToPython("py_talloc_get_mem_ctx(obj)", $env, $e, $varname, "py_$e->{NAME}");
+ $self->pidl("return py_$e->{NAME};");
+ $self->deindent;
+ $self->pidl("}");
+ }
+ }
+ $self->pidl("PyErr_SetString(PyExc_AttributeError, \"no such attribute\");");
+ $self->pidl("return NULL;");
$self->deindent;
$self->pidl("}");
$self->pidl("");
- $self->pidl("static PyObject *py_$type->{NAME}_setattr(PyTypeObject *obj, char *name, PyObject *value)");
+ $self->pidl("static int py_$name\_setattr(PyObject *py_obj, char *name, PyObject *value)");
$self->pidl("{");
$self->indent;
- $self->pidl("return Py_None;");
+ if ($#{$d->{ELEMENTS}} > -1) {
+ $self->pidl("$cname *object = py_talloc_get_ptr(py_obj);");
+ my $mem_ctx = "py_talloc_get_mem_ctx(py_obj)";
+ foreach my $e (@{$d->{ELEMENTS}}) {
+ $self->pidl("if (!strcmp(name, \"$e->{NAME}\")) {");
+ my $varname = "object->$e->{NAME}";
+ $self->indent;
+ my $l = $e->{LEVELS}[0];
+ my $nl = GetNextLevel($e, $l);
+ if ($l->{TYPE} eq "POINTER" and
+ not ($nl->{TYPE} eq "ARRAY" and ($nl->{IS_FIXED} or is_charset_array($e, $nl))) and
+ not ($nl->{TYPE} eq "DATA" and Parse::Pidl::Typelist::scalar_is_reference($nl->{DATA_TYPE}))) {
+ $self->pidl("talloc_free($varname);");
+ }
+ $self->ConvertObjectFromPython($env, $mem_ctx, $e, "value", $varname, "return -1;");
+ $self->pidl("return 0;");
+ $self->deindent;
+ $self->pidl("}");
+ }
+ }
+ $self->pidl("PyErr_SetString(PyExc_AttributeError, \"no such attribute\");");
+ $self->pidl("return -1;");
$self->deindent;
$self->pidl("}");
$self->pidl("");
- $self->pidl("static PyTypeObject $type->{NAME}_ObjectType = {");
+ $self->pidl_hdr("PyAPI_DATA(PyTypeObject) $name\_Type;\n");
+ $self->pidl_hdr("#define $name\_Check(op) PyObject_TypeCheck(op, &$name\_Type)\n");
+ $self->pidl_hdr("#define $name\_CheckExact(op) ((op)->ob_type == &$name\_Type)\n");
+ $self->pidl_hdr("\n");
+ $self->pidl("PyTypeObject $name\_Type = {");
$self->indent;
$self->pidl("PyObject_HEAD_INIT(NULL) 0,");
- $self->pidl(".tp_name = \"$type->{NAME}\",");
- $self->pidl(".tp_basicsize = sizeof($type->{NAME}_Object),");
- $self->pidl(".tp_dealloc = (destructor)py_$type->{NAME}_dealloc,");
- $self->pidl(".tp_getattr = (getattrfunc)py_$type->{NAME}_getattr,");
- $self->pidl(".tp_setattr = (setattrfunc)py_$type->{NAME}_setattr,");
+ $self->pidl(".tp_name = \"$name\",");
+ $self->pidl(".tp_basicsize = sizeof(py_talloc_Object),");
+ $self->pidl(".tp_dealloc = py_talloc_dealloc,");
+ $self->pidl(".tp_getattr = py_$name\_getattr,");
+ $self->pidl(".tp_setattr = py_$name\_setattr,");
+ $self->pidl(".tp_repr = py_talloc_default_repr,");
$self->deindent;
$self->pidl("};");
$self->pidl("");
- $self->pidl("static PyObject *py_$type->{NAME}(PyObject *self, PyObject *args)");
+ my $py_fnname = "py_$name";
+ $self->pidl("static PyObject *$py_fnname(PyObject *self, PyObject *args)");
$self->pidl("{");
$self->indent;
- $self->pidl("$type->{NAME}\_Object *ret;");
- $self->pidl("ret = PyObject_New($type->{NAME}_Object, &$type->{NAME}_ObjectType);");
- $self->pidl("return (PyObject *) ret;");
+ $self->pidl("$cname *ret = talloc_zero(NULL, $cname);");
+ $self->pidl("return py_talloc_import(&$name\_Type, ret);");
$self->deindent;
$self->pidl("}");
$self->pidl("");
+
+ return $py_fnname;
}
sub PythonFunction($$$)
{
my ($self, $fn, $iface) = @_;
- $self->pidl("static PyObject *py_$fn->{NAME}(PyObject *self, PyObject *args)");
+ $self->pidl("static PyObject *py_$fn->{NAME}(PyObject *self, PyObject *args, PyObject *kwargs)");
$self->pidl("{");
$self->indent;
$self->pidl("$iface\_InterfaceObject *iface = ($iface\_InterfaceObject *)self;");
$self->pidl("NTSTATUS status;");
+ $self->pidl("TALLOC_CTX *mem_ctx = talloc_new(NULL);");
+ $self->pidl("struct $fn->{NAME} *r = talloc_zero(mem_ctx, struct $fn->{NAME});");
+ $self->pidl("PyObject *result = Py_None;");
+
+ my $env = GenerateFunctionInEnv($fn, "r->");
+ my $result_size = 0;
+
+ my $args_format = "";
+ my $args_string = "";
+ my $args_names = "";
+
+ foreach my $e (@{$fn->{ELEMENTS}}) {
+ $self->pidl("PyObject *py_$e->{NAME};");
+ if (grep(/out/,@{$e->{DIRECTION}})) {
+ $result_size++;
+ }
+ if (grep(/in/,@{$e->{DIRECTION}})) {
+ $args_format .= "O";
+ $args_string .= ", &py_$e->{NAME}";
+ $args_names .= "\"$e->{NAME}\", ";
+ }
+ }
+ $self->pidl("const char *kwnames[] = {");
+ $self->indent;
+ $self->pidl($args_names . "NULL");
+ $self->deindent;
+ $self->pidl("};");
+
$self->pidl("");
- # FIXME
- $self->handle_ntstatus("status", "NULL");
- $self->pidl("return Py_None;");
+ $self->pidl("if (!PyArg_ParseTupleAndKeywords(args, kwargs, \"$args_format:$fn->{NAME}\", discard_const_p(char *, kwnames)$args_string)) {");
+ $self->indent;
+ $self->pidl("return NULL;");
+ $self->deindent;
+ $self->pidl("}");
+
+ if ($fn->{RETURN_TYPE}) {
+ $result_size++ unless ($fn->{RETURN_TYPE} eq "WERROR" or $fn->{RETURN_TYPE} eq "NTSTATUS");
+ }
+
+ foreach my $e (@{$fn->{ELEMENTS}}) {
+ if (grep(/in/,@{$e->{DIRECTION}})) {
+ $self->ConvertObjectFromPython($env, "mem_ctx", $e, "py_$e->{NAME}", "r->in.$e->{NAME}", "talloc_free(mem_ctx); return NULL;");
+ }
+ }
+ $self->pidl("status = dcerpc_$fn->{NAME}(iface->pipe, mem_ctx, r);");
+ $self->handle_ntstatus("status", "NULL", "mem_ctx");
+
+ $env = GenerateFunctionOutEnv($fn, "r->");
+ my $i = 0;
+
+ if ($result_size > 1) {
+ $self->pidl("result = PyTuple_New($result_size);");
+ }
+
+ foreach my $e (@{$fn->{ELEMENTS}}) {
+ my $py_name = "py_$e->{NAME}";
+ if (grep(/out/,@{$e->{DIRECTION}})) {
+ $self->ConvertObjectToPython("r", $env, $e, "r->out.$e->{NAME}", $py_name);
+ if ($result_size > 1) {
+ $self->pidl("PyTuple_SetItem(result, $i, $py_name);");
+ $i++;
+ } else {
+ $self->pidl("result = $py_name;");
+ }
+ }
+ }
+
+ if (defined($fn->{RETURN_TYPE}) and $fn->{RETURN_TYPE} eq "NTSTATUS") {
+ $self->handle_ntstatus("r->out.result", "NULL", "mem_ctx");
+ } elsif (defined($fn->{RETURN_TYPE}) and $fn->{RETURN_TYPE} eq "WERROR") {
+ $self->handle_werror("r->out.result", "NULL", "mem_ctx");
+ } elsif (defined($fn->{RETURN_TYPE})) {
+ my $conv = $self->ConvertObjectToPythonData("r", $fn->{RETURN_TYPE}, "r->out.result");
+ if ($result_size > 1) {
+ $self->pidl("PyTuple_SetItem(result, $i, $conv);");
+ } else {
+ $self->pidl("result = $conv;");
+ }
+ }
+
+ $self->pidl("talloc_free(mem_ctx);");
+ $self->pidl("return result;");
+ $self->deindent;
+ $self->pidl("}");
+ $self->pidl("");
+}
+
+sub handle_werror($$$$)
+{
+ my ($self, $var, $retval, $mem_ctx) = @_;
+
+ $self->pidl("if (!W_ERROR_IS_OK($var)) {");
+ $self->indent;
+ $self->pidl("PyErr_SetString(PyExc_RuntimeError, win_errstr($var));");
+ $self->pidl("talloc_free($mem_ctx);") if ($mem_ctx);
+ $self->pidl("return $retval;");
$self->deindent;
$self->pidl("}");
$self->pidl("");
}
-sub handle_ntstatus($$$)
+sub handle_ntstatus($$$$)
{
- my ($self, $var, $retval) = @_;
+ my ($self, $var, $retval, $mem_ctx) = @_;
$self->pidl("if (NT_STATUS_IS_ERR($var)) {");
$self->indent;
$self->pidl("PyErr_SetString(PyExc_RuntimeError, nt_errstr($var));");
+ $self->pidl("talloc_free($mem_ctx);") if ($mem_ctx);
$self->pidl("return $retval;");
$self->deindent;
$self->pidl("}");
$self->pidl("");
}
-sub Interface($$)
+sub PythonType($$$)
{
- my($self,$interface) = @_;
+ my ($self, $d, $interface, $basename) = @_;
+
+ my $actual_ctype = $d;
+ if ($actual_ctype->{TYPE} eq "TYPEDEF") {
+ $actual_ctype = $actual_ctype->{DATA};
+ }
+
+ if ($actual_ctype->{TYPE} eq "STRUCT") {
+ my $py_fnname;
+ if ($d->{TYPE} eq "STRUCT") {
+ $py_fnname = $self->PythonStruct($d->{NAME}, mapTypeName($d), $d);
+ } else {
+ $py_fnname = $self->PythonStruct($d->{NAME}, mapTypeName($d), $d->{DATA});
+ }
+
+ my $fn_name = $d->{NAME};
+
+ $fn_name =~ s/^$interface->{NAME}_//;
+ $fn_name =~ s/^$basename\_//;
+
+ $self->register_module_method($fn_name, $py_fnname, "METH_NOARGS", "NULL");
+ }
+
+ if ($d->{TYPE} eq "ENUM" or $d->{TYPE} eq "BITMAP") {
+ $self->EnumAndBitmapConsts($d->{NAME}, $d);
+ }
+
+ if ($d->{TYPE} eq "TYPEDEF" and ($d->{DATA}->{TYPE} eq "ENUM" or $d->{DATA}->{TYPE} eq "BITMAP")) {
+ $self->EnumAndBitmapConsts($d->{NAME}, $d->{DATA});
+ }
+
+ if ($actual_ctype->{TYPE} eq "UNION" and defined($actual_ctype->{ELEMENTS})) {
+ $self->pidl("PyObject *py_import_$d->{NAME}(TALLOC_CTX *mem_ctx, int level, " .mapTypeName($d) . " *in)");
+ $self->pidl("{");
+ $self->indent;
+ $self->FromUnionToPythonFunction("mem_ctx", $actual_ctype, "level", "in") if ($actual_ctype->{TYPE} eq "UNION");
+ $self->deindent;
+ $self->pidl("}");
+ $self->pidl("");
+
+ $self->pidl(mapTypeName($d) . " *py_export_$d->{NAME}(TALLOC_CTX *mem_ctx, int level, PyObject *in)");
+ $self->pidl("{");
+ $self->indent;
+ $self->FromPythonToUnionFunction($actual_ctype, mapTypeName($d), "level", "mem_ctx", "in") if ($actual_ctype->{TYPE} eq "UNION");
+ $self->deindent;
+ $self->pidl("}");
+ $self->pidl("");
+ }
+}
+
+sub Interface($$$)
+{
+ my($self,$interface,$basename) = @_;
$self->pidl_hdr("#ifndef _HEADER_PYTHON_$interface->{NAME}\n");
$self->pidl_hdr("#define _HEADER_PYTHON_$interface->{NAME}\n\n");
@@ -186,108 +440,454 @@ sub Interface($$)
$self->Const($_) foreach (@{$interface->{CONSTS}});
- foreach (@{$interface->{TYPES}}) {
- $self->FromTypeToPythonFunction($_);
- $self->FromPythonToTypeFunction($_);
- $self->TypeConstructor($_);
+ foreach my $d (@{$interface->{TYPES}}) {
+ next if has_property($d, "nopython");
+
+ $self->PythonType($d, $interface, $basename);
}
- $self->pidl("staticforward PyTypeObject $interface->{NAME}_InterfaceType;");
- $self->pidl("typedef struct {");
- $self->indent;
- $self->pidl("PyObject_HEAD");
- $self->pidl("struct dcerpc_pipe *pipe;");
- $self->deindent;
- $self->pidl("} $interface->{NAME}_InterfaceObject;");
+ if (defined $interface->{PROPERTIES}->{uuid}) {
+ $self->pidl_hdr("PyAPI_DATA(PyTypeObject) $interface->{NAME}_InterfaceType;\n");
+ $self->pidl("typedef struct {");
+ $self->indent;
+ $self->pidl("PyObject_HEAD");
+ $self->pidl("struct dcerpc_pipe *pipe;");
+ $self->deindent;
+ $self->pidl("} $interface->{NAME}_InterfaceObject;");
- $self->pidl("");
+ $self->pidl("");
- foreach my $d (@{$interface->{FUNCTIONS}}) {
- next if not defined($d->{OPNUM});
- next if has_property($d, "nopython");
+ foreach my $d (@{$interface->{FUNCTIONS}}) {
+ next if not defined($d->{OPNUM});
+ next if has_property($d, "nopython");
+
+ $self->PythonFunction($d, $interface->{NAME});
+ }
+
+ $self->pidl("static PyMethodDef interface_$interface->{NAME}\_methods[] = {");
+ $self->indent;
+ foreach my $d (@{$interface->{FUNCTIONS}}) {
+ next if not defined($d->{OPNUM});
+ next if has_property($d, "nopython");
- $self->PythonFunction($d, $interface->{NAME});
+ my $fn_name = $d->{NAME};
+
+ $fn_name =~ s/^$interface->{NAME}_//;
+ $fn_name =~ s/^$basename\_//;
+
+ $self->pidl("{ \"$fn_name\", (PyCFunction)py_$d->{NAME}, METH_VARARGS|METH_KEYWORDS, NULL },");
+ }
+ $self->pidl("{ NULL, NULL, 0, NULL }");
+ $self->deindent;
+ $self->pidl("};");
+ $self->pidl("");
+
+ $self->pidl("static void interface_$interface->{NAME}_dealloc(PyObject* self)");
+ $self->pidl("{");
+ $self->indent;
+ $self->pidl("$interface->{NAME}_InterfaceObject *interface = ($interface->{NAME}_InterfaceObject *)self;");
+ $self->pidl("talloc_free(interface->pipe);");
+ $self->pidl("PyObject_Del(self);");
+ $self->deindent;
+ $self->pidl("}");
+ $self->pidl("");
+
+ $self->pidl("static PyObject *interface_$interface->{NAME}_getattr(PyObject *obj, char *name)");
+ $self->pidl("{");
+ $self->indent;
+ $self->pidl("return Py_FindMethod(interface_$interface->{NAME}\_methods, obj, name);");
+ $self->deindent;
+ $self->pidl("}");
+
+ $self->pidl("");
+
+ $self->pidl("PyTypeObject $interface->{NAME}_InterfaceType = {");
+ $self->indent;
+ $self->pidl("PyObject_HEAD_INIT(NULL) 0,");
+ $self->pidl(".tp_name = \"$interface->{NAME}\",");
+ $self->pidl(".tp_basicsize = sizeof($interface->{NAME}_InterfaceObject),");
+ $self->pidl(".tp_dealloc = interface_$interface->{NAME}_dealloc,");
+ $self->pidl(".tp_getattr = interface_$interface->{NAME}_getattr,");
+ $self->deindent;
+ $self->pidl("};");
+
+ $self->pidl("");
+
+ $self->register_module_method($interface->{NAME}, "interface_$interface->{NAME}", "METH_VARARGS|METH_KEYWORDS", "NULL");
+ $self->pidl("static PyObject *interface_$interface->{NAME}(PyObject *self, PyObject *args, PyObject *kwargs)");
+ $self->pidl("{");
+ $self->indent;
+ $self->pidl("$interface->{NAME}_InterfaceObject *ret;");
+ $self->pidl("const char *binding_string;");
+ $self->pidl("struct cli_credentials *credentials;");
+ $self->pidl("struct loadparm_context *lp_ctx = NULL;");
+ $self->pidl("PyObject *py_lp_ctx = NULL, *py_credentials = Py_None;");
+ $self->pidl("TALLOC_CTX *mem_ctx = NULL;");
+ $self->pidl("NTSTATUS status;");
+ $self->pidl("");
+ $self->pidl("const char *kwnames[] = {");
+ $self->indent;
+ $self->pidl("\"binding\", \"lp_ctx\", \"credentials\", NULL");
+ $self->deindent;
+ $self->pidl("};");
+ $self->pidl("extern struct loadparm_context *lp_from_py_object(PyObject *py_obj);");
+ $self->pidl("extern struct cli_credentials *cli_credentials_from_py_object(PyObject *py_obj);");
+ $self->pidl("");
+ $self->pidl("if (!PyArg_ParseTupleAndKeywords(args, kwargs, \"sO|O:$interface->{NAME}\", discard_const_p(char *, kwnames), &binding_string, &py_lp_ctx, &py_credentials)) {");
+ $self->indent;
+ $self->pidl("return NULL;");
+ $self->deindent;
+ $self->pidl("}");
+ $self->pidl("");
+ $self->pidl("if (py_lp_ctx != NULL) {");
+ $self->indent;
+ $self->pidl("lp_ctx = lp_from_py_object(py_lp_ctx);");
+ $self->pidl("if (lp_ctx == NULL) {");
+ $self->indent;
+ $self->pidl("PyErr_SetString(PyExc_TypeError, \"Expected loadparm context\");");
+ $self->pidl("return NULL;");
+ $self->deindent;
+ $self->pidl("}");
+ $self->deindent;
+ $self->pidl("}");
+ $self->pidl("");
+
+ $self->pidl("credentials = cli_credentials_from_py_object(py_credentials);");
+ $self->pidl("if (credentials == NULL) {");
+ $self->indent;
+ $self->pidl("PyErr_SetString(PyExc_TypeError, \"Expected credentials\");");
+ $self->pidl("return NULL;");
+ $self->deindent;
+ $self->pidl("}");
+
+ $self->pidl("ret = PyObject_New($interface->{NAME}_InterfaceObject, &$interface->{NAME}_InterfaceType);");
+ $self->pidl("");
+
+ $self->pidl("status = dcerpc_pipe_connect(NULL, &ret->pipe, binding_string, ");
+ $self->pidl(" &ndr_table_$interface->{NAME}, credentials, NULL, lp_ctx);");
+ $self->handle_ntstatus("status", "NULL", "mem_ctx");
+
+ $self->pidl("ret->pipe->conn->flags |= DCERPC_NDR_REF_ALLOC;");
+
+ $self->pidl("return (PyObject *)ret;");
+ $self->deindent;
+ $self->pidl("}");
+
+ $self->pidl("");
}
- $self->pidl("static PyMethodDef interface_$interface->{NAME}\_methods[] = {");
- $self->indent;
- foreach my $d (@{$interface->{FUNCTIONS}}) {
- next if not defined($d->{OPNUM});
- next if has_property($d, "nopython");
+ $self->pidl_hdr("\n");
+ $self->pidl_hdr("#endif /* _HEADER_NDR_$interface->{NAME} */\n");
+}
- my $fn_name = $d->{NAME};
+sub register_module_method($$$$$)
+{
+ my ($self, $fn_name, $pyfn_name, $flags, $doc) = @_;
- $fn_name =~ s/^$interface->{NAME}_//;
+ push (@{$self->{module_methods}}, [$fn_name, $pyfn_name, $flags, $doc])
+}
- $self->pidl("{ \"$fn_name\", (PyCFunction)py_$d->{NAME}, METH_VARARGS|METH_KEYWORDS, NULL },");
+sub assign($$$)
+{
+ my ($self, $dest, $src) = @_;
+ if ($dest =~ /^\&/) {
+ $self->pidl("memcpy($dest, $src, sizeof(" . get_value_of($dest) . "));");
+ } else {
+ $self->pidl("$dest = $src;");
}
- $self->pidl("{ NULL, NULL, 0, NULL }");
- $self->deindent;
- $self->pidl("};");
- $self->pidl("");
+}
- $self->pidl("static void interface_$interface->{NAME}_dealloc(PyObject* self)");
- $self->pidl("{");
- $self->indent;
- $self->pidl("$interface->{NAME}_InterfaceObject *interface = ($interface->{NAME}_InterfaceObject *)self;");
- $self->pidl("talloc_free(interface->pipe);");
- $self->pidl("PyObject_Del(self);");
- $self->deindent;
- $self->pidl("}");
- $self->pidl("");
+sub ConvertObjectFromPythonData($$$$$$)
+{
+ my ($self, $mem_ctx, $cvar, $ctype, $target, $fail) = @_;
- $self->pidl("static PyObject *interface_$interface->{NAME}_getattr(PyTypeObject *obj, char *name)");
- $self->pidl("{");
- $self->indent;
- $self->pidl("return Py_FindMethod(interface_$interface->{NAME}\_methods, (PyObject *)obj, name);");
- $self->deindent;
- $self->pidl("}");
+ die("undef type for $cvar") unless(defined($ctype));
- $self->pidl("");
+ $ctype = resolveType($ctype);
- $self->pidl("static PyTypeObject $interface->{NAME}_InterfaceType = {");
- $self->indent;
- $self->pidl("PyObject_HEAD_INIT(NULL) 0,");
- $self->pidl(".tp_name = \"$interface->{NAME}\",");
- $self->pidl(".tp_basicsize = sizeof($interface->{NAME}_InterfaceObject),");
- $self->pidl(".tp_dealloc = interface_$interface->{NAME}_dealloc,");
- $self->pidl(".tp_getattr = interface_$interface->{NAME}_getattr,");
- $self->deindent;
- $self->pidl("};");
+ my $actual_ctype = $ctype;
+ if ($ctype->{TYPE} eq "TYPEDEF") {
+ $actual_ctype = $ctype->{DATA};
+ }
- $self->pidl("");
+ if ($actual_ctype->{TYPE} eq "ENUM" or $actual_ctype->{TYPE} eq "BITMAP" or
+ $actual_ctype->{TYPE} eq "SCALAR" and (
+ expandAlias($actual_ctype->{NAME}) =~ /^(u?int[0-9]*|hyper|NTTIME|time_t|NTTIME_hyper|NTTIME_1sec|dlong|udlong|udlongr)$/)) {
+ $self->pidl("PY_CHECK_TYPE(PyInt, $cvar, $fail);");
+ $self->pidl("$target = PyInt_AsLong($cvar);");
+ return;
+ }
- $self->pidl("static PyObject *interface_$interface->{NAME}(PyObject *self, PyObject *args)");
- $self->pidl("{");
- $self->indent;
- $self->pidl("$interface->{NAME}_InterfaceObject *ret;");
- $self->pidl("const char *binding_string;");
- $self->pidl("struct cli_credentials *credentials;");
- $self->pidl("struct loadparm_context *lp_ctx;");
- $self->pidl("NTSTATUS status;");
- $self->pidl("");
+ if ($actual_ctype->{TYPE} eq "STRUCT") {
+ $self->pidl("PY_CHECK_TYPE($ctype->{NAME}, $cvar, $fail);");
+ $self->assign($target, "py_talloc_get_ptr($cvar)");
+ return;
+ }
- # FIXME: Arguments: binding string, credentials, loadparm context
- $self->pidl("ret = PyObject_New($interface->{NAME}_InterfaceObject, &$interface->{NAME}_InterfaceType);");
- $self->pidl("");
+ if ($actual_ctype->{TYPE} eq "SCALAR" and $actual_ctype->{NAME} eq "DATA_BLOB") {
+ $self->pidl("$target = data_blob_talloc($mem_ctx, PyString_AsString($cvar), PyString_Size($cvar));");
+ return;
+ }
- $self->pidl("status = dcerpc_pipe_connect(NULL, &ret->pipe, binding_string, ");
- $self->pidl(" &ndr_table_$interface->{NAME}, credentials, NULL, lp_ctx);");
- $self->handle_ntstatus("status", "NULL");
+ if ($actual_ctype->{TYPE} eq "SCALAR" and
+ ($actual_ctype->{NAME} eq "string" or $actual_ctype->{NAME} eq "nbt_string" or $actual_ctype->{NAME} eq "nbt_name" or $actual_ctype->{NAME} eq "wrepl_nbt_name")) {
+ $self->pidl("$target = talloc_strdup($mem_ctx, PyString_AsString($cvar));");
+ return;
+ }
- $self->pidl("return (PyObject *)ret;");
- $self->deindent;
- $self->pidl("}");
+ if ($actual_ctype->{TYPE} eq "SCALAR" and $actual_ctype->{NAME} eq "ipv4address") {
+ $self->pidl("$target = PyString_AsString($cvar);");
+ return;
+ }
+
+
+ if ($actual_ctype->{TYPE} eq "SCALAR" and $actual_ctype->{NAME} eq "NTSTATUS") {
+ $self->pidl("$target = NT_STATUS(PyInt_AsLong($cvar));");
+ return;
+ }
+
+ if ($actual_ctype->{TYPE} eq "SCALAR" and $actual_ctype->{NAME} eq "WERROR") {
+ $self->pidl("$target = W_ERROR(PyInt_AsLong($cvar));");
+ return;
+ }
+
+ if ($actual_ctype->{TYPE} eq "SCALAR" and $actual_ctype->{NAME} eq "string_array") {
+ $self->pidl("$target = PyCObject_AsVoidPtr($cvar);");
+ return;
+ }
+
+ if ($actual_ctype->{TYPE} eq "SCALAR" and $actual_ctype->{NAME} eq "pointer") {
+ $self->assign($target, "PyCObject_AsVoidPtr($cvar)");
+ return;
+ }
+
+ die("unknown type ".mapTypeName($ctype) . ": $cvar");
+
+}
+
+sub ConvertObjectFromPythonLevel($$$$$$$$)
+{
+ my ($self, $env, $mem_ctx, $py_var, $e, $l, $var_name, $fail) = @_;
+ my $nl = GetNextLevel($e, $l);
+
+ if ($l->{TYPE} eq "POINTER") {
+ if ($nl->{TYPE} eq "DATA" and Parse::Pidl::Typelist::scalar_is_reference($nl->{DATA_TYPE})) {
+ $self->ConvertObjectFromPythonLevel($env, $mem_ctx, $py_var, $e, $nl, $var_name, $fail);
+ return;
+ }
+ if ($l->{POINTER_TYPE} ne "ref") {
+ $self->pidl("if ($py_var == Py_None) {");
+ $self->indent;
+ $self->pidl("$var_name = NULL;");
+ $self->deindent;
+ $self->pidl("} else {");
+ $self->indent;
+ }
+ $self->pidl("$var_name = talloc_ptrtype($mem_ctx, $var_name);");
+ $self->ConvertObjectFromPythonLevel($env, $mem_ctx, $py_var, $e, $nl, get_value_of($var_name), $fail);
+ if ($l->{POINTER_TYPE} ne "ref") {
+ $self->deindent;
+ $self->pidl("}");
+ }
+ } elsif ($l->{TYPE} eq "ARRAY") {
+ my $pl = GetPrevLevel($e, $l);
+ if ($pl && $pl->{TYPE} eq "POINTER") {
+ $var_name = get_pointer_to($var_name);
+ }
+
+ if (is_charset_array($e, $l)) {
+ $self->pidl("PY_CHECK_TYPE(PyUnicode, $py_var, $fail);");
+ # FIXME: Use Unix charset setting rather than utf-8
+ $self->pidl($var_name . " = PyString_AsString(PyUnicode_AsEncodedString($py_var, \"utf-8\", \"ignore\"));");
+ } else {
+ my $counter = "$e->{NAME}_cntr_$l->{LEVEL_INDEX}";
+ $self->pidl("PY_CHECK_TYPE(PyList, $py_var, $fail);");
+ $self->pidl("{");
+ $self->indent;
+ $self->pidl("int $counter;");
+ if (!$l->{IS_FIXED}) {
+ $self->pidl("$var_name = talloc_array_ptrtype($mem_ctx, $var_name, PyList_Size($py_var));");
+ }
+ $self->pidl("for ($counter = 0; $counter < PyList_Size($py_var); $counter++) {");
+ $self->indent;
+ $self->ConvertObjectFromPythonLevel($env, $var_name, "PyList_GetItem($py_var, $counter)", $e, GetNextLevel($e, $l), $var_name."[$counter]", $fail);
+ $self->deindent;
+ $self->pidl("}");
+ $self->deindent;
+ $self->pidl("}");
+ }
+ } elsif ($l->{TYPE} eq "DATA") {
+
+ if (not Parse::Pidl::Typelist::is_scalar($l->{DATA_TYPE})) {
+ $var_name = get_pointer_to($var_name);
+ }
+ $self->ConvertObjectFromPythonData($mem_ctx, $py_var, $l->{DATA_TYPE}, $var_name, $fail);
+ } elsif ($l->{TYPE} eq "SWITCH") {
+ $var_name = get_pointer_to($var_name);
+ my $switch = ParseExpr($l->{SWITCH_IS}, $env, $e);
+ $self->assign($var_name, "py_export_" . GetNextLevel($e, $l)->{DATA_TYPE} . "($mem_ctx, $switch, $py_var)");
+ } elsif ($l->{TYPE} eq "SUBCONTEXT") {
+ $self->ConvertObjectFromPythonLevel($env, $mem_ctx, $py_var, $e, GetNextLevel($e, $l), $var_name, $fail);
+ } else {
+ die("unknown level type $l->{TYPE}");
+ }
+}
+
+sub ConvertObjectFromPython($$$$$$$)
+{
+ my ($self, $env, $mem_ctx, $ctype, $cvar, $target, $fail) = @_;
+
+ $self->ConvertObjectFromPythonLevel($env, $mem_ctx, $cvar, $ctype, $ctype->{LEVELS}[0], $target, $fail);
+}
+
+sub ConvertScalarToPython($$$)
+{
+ my ($self, $ctypename, $cvar) = @_;
+
+ die("expected string for $cvar, not $ctypename") if (ref($ctypename) eq "HASH");
+
+ $ctypename = expandAlias($ctypename);
+
+ if ($ctypename =~ /^(char|u?int[0-9]*|hyper|dlong|udlong|udlongr|time_t|NTTIME_hyper|NTTIME|NTTIME_1sec)$/) {
+ return "PyInt_FromLong($cvar)";
+ }
+
+ if ($ctypename eq "DATA_BLOB") {
+ return "PyString_FromStringAndSize((char *)($cvar).data, ($cvar).length)";
+ }
+
+ if ($ctypename eq "NTSTATUS") {
+ return "PyInt_FromLong(NT_STATUS_V($cvar))";
+ }
+
+ if ($ctypename eq "WERROR") {
+ return "PyInt_FromLong(W_ERROR_V($cvar))";
+ }
+
+ if (($ctypename eq "string" or $ctypename eq "nbt_string" or $ctypename eq "nbt_name" or $ctypename eq "wrepl_nbt_name")) {
+ return "PyString_FromString($cvar)";
+ }
+
+ # Not yet supported
+ if ($ctypename eq "string_array") { return "PyCObject_FromVoidPtr($cvar)"; }
+ if ($ctypename eq "ipv4address") { return "PyString_FromString($cvar)"; }
+ if ($ctypename eq "pointer") {
+ return "PyCObject_FromVoidPtr($cvar, talloc_free)";
+ }
+
+ die("Unknown scalar type $ctypename");
+}
+
+sub ConvertObjectToPythonData($$$$$)
+{
+ my ($self, $mem_ctx, $ctype, $cvar) = @_;
+
+ die("undef type for $cvar") unless(defined($ctype));
+
+ $ctype = resolveType($ctype);
+
+ my $actual_ctype = $ctype;
+ if ($ctype->{TYPE} eq "TYPEDEF") {
+ $actual_ctype = $ctype->{DATA};
+ }
- $self->pidl("");
+ if ($actual_ctype->{TYPE} eq "ENUM") {
+ return $self->ConvertScalarToPython(Parse::Pidl::Typelist::enum_type_fn($actual_ctype), $cvar);
+ } elsif ($actual_ctype->{TYPE} eq "BITMAP") {
+ return $self->ConvertScalarToPython(Parse::Pidl::Typelist::bitmap_type_fn($actual_ctype), $cvar);
+ } elsif ($actual_ctype->{TYPE} eq "SCALAR") {
+ return $self->ConvertScalarToPython($actual_ctype->{NAME}, $cvar);
+ } elsif ($actual_ctype->{TYPE} eq "STRUCT") {
+ return "py_talloc_import_ex(&$ctype->{NAME}_Type, $mem_ctx, $cvar)";
+ }
- $self->pidl_hdr("\n");
- $self->pidl_hdr("#endif /* _HEADER_NDR_$interface->{NAME} */\n");
+ die("unknown type ".mapTypeName($ctype) . ": $cvar");
}
-sub Parse($$$$)
+sub ConvertObjectToPythonLevel($$$$$)
{
- my($self,$basename,$ndr,$hdr) = @_;
+ my ($self, $mem_ctx, $env, $e, $l, $var_name, $py_var) = @_;
+ my $nl = GetNextLevel($e, $l);
+
+ if ($l->{TYPE} eq "POINTER") {
+ if ($nl->{TYPE} eq "DATA" and Parse::Pidl::Typelist::scalar_is_reference($nl->{DATA_TYPE})) {
+ $self->ConvertObjectToPythonLevel($var_name, $env, $e, $nl, $var_name, $py_var);
+ return;
+ }
+ if ($l->{POINTER_TYPE} ne "ref") {
+ $self->pidl("if ($var_name == NULL) {");
+ $self->indent;
+ $self->pidl("$py_var = Py_None;");
+ $self->deindent;
+ $self->pidl("} else {");
+ $self->indent;
+ }
+ $self->ConvertObjectToPythonLevel($var_name, $env, $e, $nl, get_value_of($var_name), $py_var);
+ if ($l->{POINTER_TYPE} ne "ref") {
+ $self->deindent;
+ $self->pidl("}");
+ }
+ } elsif ($l->{TYPE} eq "ARRAY") {
+ if (is_charset_array($e, $l)) {
+ $var_name = get_pointer_to($var_name);
+ # FIXME: Use Unix charset setting rather than utf-8
+ $self->pidl("$py_var = PyUnicode_Decode($var_name, strlen($var_name), \"utf-8\", \"ignore\");");
+ } else {
+ my $pl = GetPrevLevel($e, $l);
+ if ($pl && $pl->{TYPE} eq "POINTER") {
+ $var_name = get_pointer_to($var_name);
+ }
+
+ die("No SIZE_IS for array $var_name") unless (defined($l->{SIZE_IS}));
+ my $length = $l->{SIZE_IS};
+ if (defined($l->{LENGTH_IS})) {
+ $length = $l->{LENGTH_IS};
+ }
+
+ $length = ParseExpr($length, $env, $e);
+ $self->pidl("$py_var = PyList_New($length);");
+ $self->pidl("{");
+ $self->indent;
+ my $counter = "$e->{NAME}_cntr_$l->{LEVEL_INDEX}";
+ $self->pidl("int $counter;");
+ $self->pidl("for ($counter = 0; $counter < $length; $counter++) {");
+ $self->indent;
+ my $member_var = "py_$e->{NAME}_$l->{LEVEL_INDEX}";
+ $self->pidl("PyObject *$member_var;");
+ $self->ConvertObjectToPythonLevel($var_name, $env, $e, GetNextLevel($e, $l), $var_name."[$counter]", $member_var);
+ $self->pidl("PyList_SetItem($py_var, $counter, $member_var);");
+ $self->deindent;
+ $self->pidl("}");
+ $self->deindent;
+ $self->pidl("}");
+ }
+ } elsif ($l->{TYPE} eq "SWITCH") {
+ $var_name = get_pointer_to($var_name);
+ my $switch = ParseExpr($l->{SWITCH_IS}, $env, $e);
+ $self->pidl("$py_var = py_import_" . GetNextLevel($e, $l)->{DATA_TYPE} . "($mem_ctx, $switch, $var_name);");
+ } elsif ($l->{TYPE} eq "DATA") {
+ if (not Parse::Pidl::Typelist::is_scalar($l->{DATA_TYPE})) {
+ $var_name = get_pointer_to($var_name);
+ }
+ my $conv = $self->ConvertObjectToPythonData($mem_ctx, $l->{DATA_TYPE}, $var_name);
+ $self->pidl("$py_var = $conv;");
+ } elsif ($l->{TYPE} eq "SUBCONTEXT") {
+ $self->ConvertObjectToPythonLevel($mem_ctx, $env, $e, GetNextLevel($e, $l), $var_name, $py_var);
+ } else {
+ die("Unknown level type $l->{TYPE} $var_name");
+ }
+}
+
+sub ConvertObjectToPython($$$$$$)
+{
+ my ($self, $mem_ctx, $env, $ctype, $cvar, $py_var) = @_;
+
+ $self->ConvertObjectToPythonLevel($mem_ctx, $env, $ctype, $ctype->{LEVELS}[0], $cvar, $py_var);
+}
+
+sub Parse($$$$$)
+{
+ my($self,$basename,$ndr,$ndr_hdr,$hdr) = @_;
my $py_hdr = $hdr;
$py_hdr =~ s/ndr_([^\/]+)$/py_$1/g;
@@ -299,33 +899,24 @@ sub Parse($$$$)
#include \"includes.h\"
#include <Python.h>
#include \"librpc/rpc/dcerpc.h\"
+#include \"scripting/python/pytalloc.h\"
+#include \"scripting/python/pyrpc.h\"
#include \"$hdr\"
+#include \"$ndr_hdr\"
#include \"$py_hdr\"
");
foreach my $x (@$ndr) {
- ($x->{TYPE} eq "INTERFACE") && $self->Interface($x);
($x->{TYPE} eq "IMPORT") && $self->Import(@{$x->{PATHS}});
+ ($x->{TYPE} eq "INTERFACE") && $self->Interface($x, $basename);
}
$self->pidl("static PyMethodDef $basename\_methods[] = {");
$self->indent;
- foreach my $x (@$ndr) {
- next if ($x->{TYPE} ne "INTERFACE");
- $self->pidl("{ \"$x->{NAME}\", (PyCFunction)interface_$x->{NAME}, METH_VARARGS|METH_KEYWORDS, NULL },");
-
- foreach my $d (@{$x->{TYPES}}) {
- next if has_property($d, "nopython");
- next if ($d->{TYPE} eq "ENUM" or $d->{TYPE} eq "BITMAP");
-
- my $fn_name = $d->{NAME};
-
- $fn_name =~ s/^$x->{NAME}_//;
- $fn_name =~ s/^$basename\_//;
-
- $self->pidl("{ \"$fn_name\", (PyCFunction)py_$d->{NAME}, METH_VARARGS|METH_KEYWORDS, NULL },");
- }
+ foreach (@{$self->{module_methods}}) {
+ my ($fn_name, $pyfn_name, $flags, $doc) = @$_;
+ $self->pidl("{ \"$fn_name\", (PyCFunction)$pyfn_name, $flags, $doc },");
}
$self->pidl("{ NULL, NULL, 0, NULL }");
@@ -339,9 +930,18 @@ sub Parse($$$$)
$self->indent;
$self->pidl("PyObject *m;");
$self->pidl("m = Py_InitModule(\"$basename\", $basename\_methods);");
- foreach (keys %{$self->{constants}}) {
- # FIXME: Handle non-string constants
- $self->pidl("PyModule_AddObject(m, \"$_\", PyString_FromString(" . $self->{constants}->{$_}->[1] . "));");
+ foreach my $name (keys %{$self->{constants}}) {
+ my $py_obj;
+ my ($ctype, $cvar) = @{$self->{constants}->{$name}};
+ if ($cvar =~ /^[0-9]+$/ or $cvar =~ /^0x[0-9a-fA-F]+$/) {
+ $py_obj = "PyInt_FromLong($cvar)";
+ } elsif ($cvar =~ /^".*"$/) {
+ $py_obj = "PyString_FromString($cvar)";
+ } else {
+ $py_obj = $self->ConvertObjectToPythonData("NULL", expandAlias($ctype), $cvar);
+ }
+
+ $self->pidl("PyModule_AddObject(m, \"$name\", $py_obj);");
}
$self->deindent;
$self->pidl("}");
diff --git a/source4/pidl/lib/Parse/Pidl/Typelist.pm b/source4/pidl/lib/Parse/Pidl/Typelist.pm
index b2069c784b..8ba1ae47af 100644
--- a/source4/pidl/lib/Parse/Pidl/Typelist.pm
+++ b/source4/pidl/lib/Parse/Pidl/Typelist.pm
@@ -7,9 +7,9 @@ package Parse::Pidl::Typelist;
require Exporter;
@ISA = qw(Exporter);
-@EXPORT_OK = qw(hasType getType mapTypeName scalar_is_reference expandAlias
+@EXPORT_OK = qw(hasType getType resolveType mapTypeName scalar_is_reference expandAlias
mapScalarType addType typeIs is_scalar enum_type_fn
- bitmap_type_fn mapType
+ bitmap_type_fn mapType typeHasBody
);
use vars qw($VERSION);
$VERSION = '0.01';
@@ -59,6 +59,7 @@ my %aliases = (
"boolean8" => "uint8",
"boolean32" => "uint32",
"DWORD" => "uint32",
+ "uint" => "uint32",
"int" => "int32",
"WORD" => "uint16",
"char" => "uint8",
@@ -95,6 +96,20 @@ sub addType($)
$types{$t->{NAME}} = $t;
}
+sub resolveType($)
+{
+ my ($ctype) = @_;
+
+ if (not hasType($ctype)) {
+ # assume struct typedef
+ return { TYPE => "TYPEDEF", NAME => $ctype, DATA => { TYPE => "STRUCT" } };
+ } else {
+ return getType($ctype);
+ }
+
+ return $ctype;
+}
+
sub getType($)
{
my $t = shift;
@@ -135,11 +150,12 @@ sub is_scalar($)
sub is_scalar($);
my $type = shift;
- return 1 if (ref($type) eq "HASH" and $type->{TYPE} eq "SCALAR");
+ return 1 if (ref($type) eq "HASH" and
+ ($type->{TYPE} eq "SCALAR" or $type->{TYPE} eq "ENUM" or
+ $type->{TYPE} eq "BITMAP"));
if (my $dt = getType($type)) {
- return is_scalar($dt->{DATA}) if ($dt->{TYPE} eq "TYPEDEF" or
- $dt->{TYPE} eq "DECLARE");
+ return is_scalar($dt->{DATA}) if ($dt->{TYPE} eq "TYPEDEF");
return 1 if ($dt->{TYPE} eq "SCALAR" or $dt->{TYPE} eq "ENUM" or
$dt->{TYPE} eq "BITMAP");
}
@@ -150,7 +166,7 @@ sub is_scalar($)
sub scalar_is_reference($)
{
my $name = shift;
-
+
return 1 if (grep(/^$name$/, @reference_scalars));
return 0;
}
@@ -208,13 +224,25 @@ sub bitmap_type_fn($)
return "uint32";
}
+sub typeHasBody($)
+{
+ sub typeHasBody($);
+ my ($e) = @_;
+
+ if ($e->{TYPE} eq "TYPEDEF") {
+ return 0 unless(defined($e->{DATA}));
+ return typeHasBody($e->{DATA});
+ }
+
+ return defined($e->{ELEMENTS});
+}
+
sub mapType($$)
{
sub mapType($$);
my ($t, $n) = @_;
return mapType($t->{DATA}, $n) if ($t->{TYPE} eq "TYPEDEF");
- return mapType($t->{DATA}, $n) if ($t->{TYPE} eq "DECLARE");
return mapScalarType($n) if ($t->{TYPE} eq "SCALAR");
return "enum $n" if ($t->{TYPE} eq "ENUM");
return "struct $n" if ($t->{TYPE} eq "STRUCT");
@@ -240,7 +268,7 @@ sub mapTypeName($)
sub LoadIdl($)
{
- my $idl = shift;
+ my ($idl) = @_;
foreach my $x (@{$idl}) {
next if $x->{TYPE} ne "INTERFACE";
@@ -248,7 +276,6 @@ sub LoadIdl($)
foreach my $y (@{$x->{DATA}}) {
addType($y) if (
$y->{TYPE} eq "TYPEDEF"
- or $y->{TYPE} eq "DECLARE"
or $y->{TYPE} eq "UNION"
or $y->{TYPE} eq "STRUCT"
or $y->{TYPE} eq "ENUM"
@@ -257,6 +284,11 @@ sub LoadIdl($)
}
}
+sub GenerateTypeLib()
+{
+ return Parse::Pidl::Util::MyDumper(\%types);
+}
+
RegisterScalars();
1;