diff options
Diffstat (limited to 'pidl')
-rw-r--r-- | pidl/expr.yp | 202 | ||||
-rw-r--r-- | pidl/idl.yp | 708 | ||||
-rw-r--r-- | pidl/lib/Parse/Pidl/Expr.pm | 116 | ||||
-rw-r--r-- | pidl/lib/Parse/Pidl/IDL.pm | 2137 | ||||
-rw-r--r-- | pidl/lib/Parse/Pidl/NDR.pm | 46 | ||||
-rw-r--r-- | pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm | 278 | ||||
-rw-r--r-- | pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm | 11 | ||||
-rw-r--r-- | pidl/lib/Parse/Pidl/Samba4.pm | 7 | ||||
-rw-r--r-- | pidl/lib/Parse/Pidl/Samba4/Header.pm | 12 | ||||
-rw-r--r-- | pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm | 17 | ||||
-rw-r--r-- | pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm | 42 | ||||
-rw-r--r-- | pidl/lib/Parse/Pidl/Samba4/Python.pm | 46 | ||||
-rw-r--r-- | pidl/lib/Parse/Pidl/Samba4/TDR.pm | 8 | ||||
-rw-r--r-- | pidl/lib/Parse/Pidl/Typelist.pm | 12 | ||||
-rw-r--r-- | pidl/lib/Parse/Pidl/Wireshark/NDR.pm | 24 | ||||
-rw-r--r-- | pidl/tests/Util.pm | 13 | ||||
-rwxr-xr-x | pidl/tests/ndr.pl | 3 | ||||
-rwxr-xr-x | pidl/tests/ndr_string.pl | 110 | ||||
-rwxr-xr-x | pidl/tests/parse_idl.pl | 131 | ||||
-rwxr-xr-x | pidl/tests/samba-ndr.pl | 2 | ||||
-rwxr-xr-x | pidl/tests/samba3-cli.pl | 214 | ||||
-rwxr-xr-x | pidl/tests/typelist.pl | 11 |
22 files changed, 1553 insertions, 2597 deletions
diff --git a/pidl/expr.yp b/pidl/expr.yp index ef8eee36db..a8074875ff 100644 --- a/pidl/expr.yp +++ b/pidl/expr.yp @@ -2,120 +2,70 @@ # Copyright (C) 2006 Jelmer Vernooij <jelmer@samba.org> # Published under the GNU GPL # -%left '->' -%right '!' '~' -%left '*' '/' '%' -%left '+' '-' +%left '->' +%right '!' '~' +%left '*' '/' '%' +%left '+' '-' %left '<<' '>>' -%left '>' '<' -%left '==' '!=' -%left '&' -%left '|' -%left '&&' -%left '||' +%left '>' '<' +%left '==' '!=' +%left '&' +%left '|' +%left '&&' +%left '||' %left '?' ':' -%left NEG DEREF ADDROF INV -%left '.' +%left NEG DEREF ADDROF INV +%left '.' %% -exp: - NUM - | - TEXT { "\"$_[1]\"" } - | - func - | - var - | - '~' exp %prec INV { "~$_[2]" } - | - exp '+' exp { "$_[1] + $_[3]" } - | - exp '-' exp { "$_[1] - $_[3]" } - | - exp '*' exp { "$_[1] * $_[3]" } - | - exp '%' exp { "$_[1] % $_[3]" } - | - exp '<' exp { "$_[1] < $_[3]" } - | - exp '>' exp { "$_[1] > $_[3]" } - | - exp '|' exp { "$_[1] | $_[3]" } - | - exp '==' exp { "$_[1] == $_[3]" } - | - exp '<=' exp { "$_[1] <= $_[3]" } - | - exp '=>' exp { "$_[1] => $_[3]" } - | - exp '<<' exp { "$_[1] << $_[3]" } - | - exp '>>' exp { "$_[1] >> $_[3]" } - | - exp '!=' exp { "$_[1] != $_[3]" } - | - exp '||' exp { "$_[1] || $_[3]" } - | - exp '&&' exp { "$_[1] && $_[3]" } - | - exp '&' exp { "$_[1] & $_[3]" } - | - exp '?' exp ':' exp { "$_[1]?$_[3]:$_[5]" } - | - '~' exp { "~$_[1]" } - | - '!' exp { "not $_[1]" } - | - exp '/' exp { "$_[1] / $_[3]" } - | - '-' exp %prec NEG { "-$_[2]" } - | - '&' exp %prec ADDROF { "&$_[2]" } - | - exp '^' exp { "$_[1]^$_[3]" } - | - '(' exp ')' { "($_[2])" } +exp: NUM + | TEXT { "\"$_[1]\"" } + | func + | var + | '~' exp %prec INV { "~$_[2]" } + | exp '+' exp { "$_[1] + $_[3]" } + | exp '-' exp { "$_[1] - $_[3]" } + | exp '*' exp { "$_[1] * $_[3]" } + | exp '%' exp { "$_[1] % $_[3]" } + | exp '<' exp { "$_[1] < $_[3]" } + | exp '>' exp { "$_[1] > $_[3]" } + | exp '|' exp { "$_[1] | $_[3]" } + | exp '==' exp { "$_[1] == $_[3]" } + | exp '<=' exp { "$_[1] <= $_[3]" } + | exp '=>' exp { "$_[1] => $_[3]" } + | exp '<<' exp { "$_[1] << $_[3]" } + | exp '>>' exp { "$_[1] >> $_[3]" } + | exp '!=' exp { "$_[1] != $_[3]" } + | exp '||' exp { "$_[1] || $_[3]" } + | exp '&&' exp { "$_[1] && $_[3]" } + | exp '&' exp { "$_[1] & $_[3]" } + | exp '?' exp ':' exp { "$_[1]?$_[3]:$_[5]" } + | '~' exp { "~$_[1]" } + | '!' exp { "not $_[1]" } + | exp '/' exp { "$_[1] / $_[3]" } + | '-' exp %prec NEG { "-$_[2]" } + | '&' exp %prec ADDROF { "&$_[2]" } + | exp '^' exp { "$_[1]^$_[3]" } + | '(' exp ')' { "($_[2])" } ; -possible_pointer: - VAR { $_[0]->_Lookup($_[1]) } - | - '*' possible_pointer %prec DEREF { $_[0]->_Dereference($_[2]); "*$_[2]" } -; - -var: - possible_pointer { $_[0]->_Use($_[1]) } - | - var '.' VAR { $_[0]->_Use("$_[1].$_[3]") } - | - '(' var ')' { "($_[2])" } - | - var '->' VAR { $_[0]->_Use("*$_[1]"); $_[1]."->".$_[3] } -; - - -func: - VAR '(' opt_args ')' { "$_[1]($_[3])" } -; +possible_pointer: + VAR { $_[0]->_Lookup($_[1]) } + | '*' possible_pointer %prec DEREF { $_[0]->_Dereference($_[2]); "*$_[2]" } + ; -opt_args: - #empty - { "" } - | - args +var: possible_pointer { $_[0]->_Use($_[1]) } + | var '.' VAR { $_[0]->_Use("$_[1].$_[3]") } + | '(' var ')' { "($_[2])" } + | var '->' VAR { $_[0]->_Use("*$_[1]"); $_[1]."->".$_[3] } ; -exp_or_possible_pointer: - exp - | - possible_pointer -; -args: - exp_or_possible_pointer - | - exp_or_possible_pointer ',' args { "$_[1], $_[3]" } +func: VAR '(' opt_args ')' { "$_[1]($_[3])" }; +opt_args: { "" } | args; +exp_or_possible_pointer: exp | possible_pointer; +args: exp_or_possible_pointer + | exp_or_possible_pointer ',' args { "$_[1], $_[3]" } ; %% @@ -123,22 +73,22 @@ args: package Parse::Pidl::Expr; sub _Lexer { - my($parser)=shift; + my($parser)=shift; - $parser->YYData->{INPUT}=~s/^[ \t]//; + $parser->YYData->{INPUT}=~s/^[ \t]//; - for ($parser->YYData->{INPUT}) { - if (s/^(0x[0-9A-Fa-f]+)//) { + for ($parser->YYData->{INPUT}) { + if (s/^(0x[0-9A-Fa-f]+)//) { $parser->YYData->{LAST_TOKEN} = $1; - return('NUM',$1); + return('NUM',$1); } - if (s/^([0-9]+(?:\.[0-9]+)?)//) { + if (s/^([0-9]+(?:\.[0-9]+)?)//) { $parser->YYData->{LAST_TOKEN} = $1; - return('NUM',$1); + return('NUM',$1); } - if (s/^([A-Za-z_][A-Za-z0-9_]*)//) { + if (s/^([A-Za-z_][A-Za-z0-9_]*)//) { $parser->YYData->{LAST_TOKEN} = $1; - return('VAR',$1); + return('VAR',$1); } if (s/^\"(.*?)\"//) { $parser->YYData->{LAST_TOKEN} = $1; @@ -146,13 +96,13 @@ sub _Lexer { } if (s/^(==|!=|<=|>=|->|\|\||<<|>>|&&)//s) { $parser->YYData->{LAST_TOKEN} = $1; - return($1,$1); + return($1,$1); } - if (s/^(.)//s) { + if (s/^(.)//s) { $parser->YYData->{LAST_TOKEN} = $1; - return($1,$1); + return($1,$1); } - } + } } sub _Use($$) @@ -189,14 +139,12 @@ sub _Error($) } sub Run { - my($self, $data, $error, $lookup, $deref, $use) = @_; - - $self->YYData->{FULL_INPUT} = $data; - $self->YYData->{INPUT} = $data; - $self->YYData->{LOOKUP} = $lookup; - $self->YYData->{DEREFERENCE} = $deref; - $self->YYData->{ERROR} = $error; - $self->YYData->{USE} = $use; - - return $self->YYParse( yylex => \&_Lexer, yyerror => \&_Error); + my($self, $data, $error, $lookup, $deref, $use) = @_; + $self->YYData->{FULL_INPUT} = $data; + $self->YYData->{INPUT} = $data; + $self->YYData->{LOOKUP} = $lookup; + $self->YYData->{DEREFERENCE} = $deref; + $self->YYData->{ERROR} = $error; + $self->YYData->{USE} = $use; + return $self->YYParse( yylex => \&_Lexer, yyerror => \&_Error); } diff --git a/pidl/idl.yp b/pidl/idl.yp index dc8e293f76..d557590494 100644 --- a/pidl/idl.yp +++ b/pidl/idl.yp @@ -16,148 +16,119 @@ %% idl: #empty { {} } - | - idl interface { push(@{$_[1]}, $_[2]); $_[1] } - | - idl coclass { push(@{$_[1]}, $_[2]); $_[1] } - | - idl import { push(@{$_[1]}, $_[2]); $_[1] } - | - idl include { push(@{$_[1]}, $_[2]); $_[1] } - | - idl importlib { push(@{$_[1]}, $_[2]); $_[1] } - | - idl cpp_quote { push(@{$_[1]}, $_[2]); $_[1] } -; - -import: - 'import' commalist ';' - {{ - "TYPE" => "IMPORT", - "PATHS" => $_[2], - "FILE" => $_[0]->YYData->{FILE}, - "LINE" => $_[0]->YYData->{LINE}, - }} -; - -include: - 'include' commalist ';' - {{ - "TYPE" => "INCLUDE", - "PATHS" => $_[2], - "FILE" => $_[0]->YYData->{FILE}, - "LINE" => $_[0]->YYData->{LINE}, - }} -; - -importlib: - 'importlib' commalist ';' - {{ - "TYPE" => "IMPORTLIB", - "PATHS" => $_[2], - "FILE" => $_[0]->YYData->{FILE}, - "LINE" => $_[0]->YYData->{LINE}, - }} -; - -commalist: - text { [ $_[1] ] } - | - commalist ',' text { push(@{$_[1]}, $_[3]); $_[1] } -; - -coclass: - property_list 'coclass' identifier '{' interface_names '}' optional_semicolon - {{ - "TYPE" => "COCLASS", - "PROPERTIES" => $_[1], - "NAME" => $_[3], - "DATA" => $_[5], - "FILE" => $_[0]->YYData->{FILE}, - "LINE" => $_[0]->YYData->{LINE}, - }} + | idl interface { push(@{$_[1]}, $_[2]); $_[1] } + | idl coclass { push(@{$_[1]}, $_[2]); $_[1] } + | idl import { push(@{$_[1]}, $_[2]); $_[1] } + | idl include { push(@{$_[1]}, $_[2]); $_[1] } + | idl importlib { push(@{$_[1]}, $_[2]); $_[1] } + | idl cpp_quote { push(@{$_[1]}, $_[2]); $_[1] } +; + +import: 'import' commalist ';' {{ + "TYPE" => "IMPORT", + "PATHS" => $_[2], + "FILE" => $_[0]->YYData->{FILE}, + "LINE" => $_[0]->YYData->{LINE} + }} +; +include: 'include' commalist ';' {{ + "TYPE" => "INCLUDE", + "PATHS" => $_[2], + "FILE" => $_[0]->YYData->{FILE}, + "LINE" => $_[0]->YYData->{LINE} + }} +; +importlib: 'importlib' commalist ';' {{ + "TYPE" => "IMPORTLIB", + "PATHS" => $_[2], + "FILE" => $_[0]->YYData->{FILE}, + "LINE" => $_[0]->YYData->{LINE} + }} +; + +commalist: + text { [ $_[1] ] } + | commalist ',' text { push(@{$_[1]}, $_[3]); $_[1] } +; + +coclass: property_list 'coclass' identifier '{' interface_names '}' optional_semicolon + {{ + "TYPE" => "COCLASS", + "PROPERTIES" => $_[1], + "NAME" => $_[3], + "DATA" => $_[5], + "FILE" => $_[0]->YYData->{FILE}, + "LINE" => $_[0]->YYData->{LINE}, + }} ; interface_names: #empty { {} } - | - interface_names 'interface' identifier ';' { push(@{$_[1]}, $_[2]); $_[1] } + | interface_names 'interface' identifier ';' { push(@{$_[1]}, $_[2]); $_[1] } ; -interface: - property_list 'interface' identifier base_interface '{' definitions '}' optional_semicolon - {{ - "TYPE" => "INTERFACE", - "PROPERTIES" => $_[1], - "NAME" => $_[3], - "BASE" => $_[4], - "DATA" => $_[6], - "FILE" => $_[0]->YYData->{FILE}, - "LINE" => $_[0]->YYData->{LINE}, - }} +interface: property_list 'interface' identifier base_interface '{' definitions '}' optional_semicolon + {{ + "TYPE" => "INTERFACE", + "PROPERTIES" => $_[1], + "NAME" => $_[3], + "BASE" => $_[4], + "DATA" => $_[6], + "FILE" => $_[0]->YYData->{FILE}, + "LINE" => $_[0]->YYData->{LINE}, + }} ; base_interface: - #empty - | - ':' identifier { $_[2] } + #empty + | ':' identifier { $_[2] } ; -cpp_quote: - 'cpp_quote' '(' text ')' +cpp_quote: 'cpp_quote' '(' text ')' {{ "TYPE" => "CPP_QUOTE", - "DATA" => $_[3], "FILE" => $_[0]->YYData->{FILE}, "LINE" => $_[0]->YYData->{LINE}, + "DATA" => $_[3] }} ; -definitions: - definition { [ $_[1] ] } - | - definitions definition { push(@{$_[1]}, $_[2]); $_[1] } -; +definitions: + definition { [ $_[1] ] } + | definitions definition { push(@{$_[1]}, $_[2]); $_[1] } +; + -definition: - function - | - const - | - typedef - | - typedecl +definition: function | const | typedef | typedecl ; -const: - 'const' identifier pointers identifier '=' anytext ';' - {{ - "TYPE" => "CONST", - "DTYPE" => $_[2], - "POINTERS" => $_[3], - "NAME" => $_[4], - "VALUE" => $_[6], - "FILE" => $_[0]->YYData->{FILE}, - "LINE" => $_[0]->YYData->{LINE}, - }} - | - 'const' identifier pointers identifier array_len '=' anytext ';' - {{ - "TYPE" => "CONST", - "DTYPE" => $_[2], - "POINTERS" => $_[3], - "NAME" => $_[4], - "ARRAY_LEN" => $_[5], - "VALUE" => $_[7], - "FILE" => $_[0]->YYData->{FILE}, - "LINE" => $_[0]->YYData->{LINE}, - }} +const: 'const' identifier pointers identifier '=' anytext ';' + {{ + "TYPE" => "CONST", + "DTYPE" => $_[2], + "POINTERS" => $_[3], + "NAME" => $_[4], + "VALUE" => $_[6], + "FILE" => $_[0]->YYData->{FILE}, + "LINE" => $_[0]->YYData->{LINE}, + }} + | 'const' identifier pointers identifier array_len '=' anytext ';' + {{ + "TYPE" => "CONST", + "DTYPE" => $_[2], + "POINTERS" => $_[3], + "NAME" => $_[4], + "ARRAY_LEN" => $_[5], + "VALUE" => $_[7], + "FILE" => $_[0]->YYData->{FILE}, + "LINE" => $_[0]->YYData->{LINE}, + }} ; -function: - property_list type identifier '(' element_list2 ')' ';' - {{ + +function: property_list type identifier '(' element_list2 ')' ';' + {{ "TYPE" => "FUNCTION", "NAME" => $_[3], "RETURN_TYPE" => $_[2], @@ -165,351 +136,220 @@ function: "ELEMENTS" => $_[5], "FILE" => $_[0]->YYData->{FILE}, "LINE" => $_[0]->YYData->{LINE}, - }} -; - -typedef: - property_list 'typedef' type identifier array_len ';' - {{ - "TYPE" => "TYPEDEF", - "PROPERTIES" => $_[1], - "NAME" => $_[4], - "DATA" => $_[3], - "ARRAY_LEN" => $_[5], - "FILE" => $_[0]->YYData->{FILE}, - "LINE" => $_[0]->YYData->{LINE}, + }} +; + +typedef: property_list 'typedef' type identifier array_len ';' + {{ + "TYPE" => "TYPEDEF", + "PROPERTIES" => $_[1], + "NAME" => $_[4], + "DATA" => $_[3], + "ARRAY_LEN" => $_[5], + "FILE" => $_[0]->YYData->{FILE}, + "LINE" => $_[0]->YYData->{LINE}, }} ; -usertype: - struct - | - union - | - enum - | - bitmap - | - pipe -; +usertype: struct | union | enum | bitmap; -typedecl: - usertype ';' { $_[1] } -; +typedecl: usertype ';' { $_[1] }; -sign: - 'signed' - | - 'unsigned' -; +sign: 'signed' | 'unsigned'; -existingtype: +existingtype: sign identifier { ($_[1]?$_[1]:"signed") ." $_[2]" } - | - identifier -; - -type: - usertype - | - existingtype - | - void { "void" } -; - -enum_body: - '{' enum_elements '}' { $_[2] } -; - -opt_enum_body: - #empty - | - enum_body -; - -enum: - property_list 'enum' optional_identifier opt_enum_body - {{ - "TYPE" => "ENUM", - "PROPERTIES" => $_[1], - "NAME" => $_[3], - "ELEMENTS" => $_[4], - "FILE" => $_[0]->YYData->{FILE}, - "LINE" => $_[0]->YYData->{LINE}, - }} -; - -enum_elements: - enum_element { [ $_[1] ] } - | - enum_elements ',' enum_element { push(@{$_[1]}, $_[3]); $_[1] } + | identifier ; -enum_element: - identifier - | - identifier '=' anytext { "$_[1]$_[2]$_[3]" } -; +type: usertype | existingtype | void { "void" } ; -bitmap_body: - '{' opt_bitmap_elements '}' { $_[2] } +enum_body: '{' enum_elements '}' { $_[2] }; +opt_enum_body: | enum_body; +enum: property_list 'enum' optional_identifier opt_enum_body + {{ + "TYPE" => "ENUM", + "PROPERTIES" => $_[1], + "NAME" => $_[3], + "ELEMENTS" => $_[4] + }} ; -opt_bitmap_body: - #empty - | - bitmap_body +enum_elements: + enum_element { [ $_[1] ] } + | enum_elements ',' enum_element { push(@{$_[1]}, $_[3]); $_[1] } ; -bitmap: - property_list 'bitmap' optional_identifier opt_bitmap_body - {{ - "TYPE" => "BITMAP", - "PROPERTIES" => $_[1], - "NAME" => $_[3], - "ELEMENTS" => $_[4], - "FILE" => $_[0]->YYData->{FILE}, - "LINE" => $_[0]->YYData->{LINE}, - }} +enum_element: identifier + | identifier '=' anytext { "$_[1]$_[2]$_[3]" } ; -bitmap_elements: - bitmap_element { [ $_[1] ] } - | - bitmap_elements ',' bitmap_element { push(@{$_[1]}, $_[3]); $_[1] } +bitmap_body: '{' opt_bitmap_elements '}' { $_[2] }; +opt_bitmap_body: | bitmap_body; +bitmap: property_list 'bitmap' optional_identifier opt_bitmap_body + {{ + "TYPE" => "BITMAP", + "PROPERTIES" => $_[1], + "NAME" => $_[3], + "ELEMENTS" => $_[4] + }} ; -opt_bitmap_elements: - #empty - | - bitmap_elements +bitmap_elements: + bitmap_element { [ $_[1] ] } + | bitmap_elements ',' bitmap_element { push(@{$_[1]}, $_[3]); $_[1] } ; -bitmap_element: - identifier '=' anytext { "$_[1] ( $_[3] )" } -; +opt_bitmap_elements: | bitmap_elements; -struct_body: - '{' element_list1 '}' { $_[2] } +bitmap_element: identifier '=' anytext { "$_[1] ( $_[3] )" } ; -opt_struct_body: - #empty - | - struct_body -; +struct_body: '{' element_list1 '}' { $_[2] }; +opt_struct_body: | struct_body; -struct: - property_list 'struct' optional_identifier opt_struct_body - {{ - "TYPE" => "STRUCT", - "PROPERTIES" => $_[1], - "NAME" => $_[3], - "ELEMENTS" => $_[4], - "FILE" => $_[0]->YYData->{FILE}, - "LINE" => $_[0]->YYData->{LINE}, - }} +struct: property_list 'struct' optional_identifier opt_struct_body + {{ + "TYPE" => "STRUCT", + "PROPERTIES" => $_[1], + "NAME" => $_[3], + "ELEMENTS" => $_[4] + }} ; -empty_element: - property_list ';' +empty_element: property_list ';' {{ - "NAME" => "", - "TYPE" => "EMPTY", - "PROPERTIES" => $_[1], - "POINTERS" => 0, - "ARRAY_LEN" => [], - "FILE" => $_[0]->YYData->{FILE}, - "LINE" => $_[0]->YYData->{LINE}, - }} + "NAME" => "", + "TYPE" => "EMPTY", + "PROPERTIES" => $_[1], + "POINTERS" => 0, + "ARRAY_LEN" => [], + "FILE" => $_[0]->YYData->{FILE}, + "LINE" => $_[0]->YYData->{LINE}, + }} ; -base_or_empty: - base_element ';' - | - empty_element; +base_or_empty: base_element ';' | empty_element; optional_base_element: property_list base_or_empty { $_[2]->{PROPERTIES} = FlattenHash([$_[1],$_[2]->{PROPERTIES}]); $_[2] } ; -union_elements: - #empty - | - union_elements optional_base_element { push(@{$_[1]}, $_[2]); $_[1] } -; - -union_body: - '{' union_elements '}' { $_[2] } +union_elements: + #empty + | union_elements optional_base_element { push(@{$_[1]}, $_[2]); $_[1] } ; -opt_union_body: - #empty - | - union_body -; +union_body: '{' union_elements '}' { $_[2] }; +opt_union_body: | union_body; -union: - property_list 'union' optional_identifier opt_union_body - {{ - "TYPE" => "UNION", - "PROPERTIES" => $_[1], - "NAME" => $_[3], - "ELEMENTS" => $_[4], - "FILE" => $_[0]->YYData->{FILE}, - "LINE" => $_[0]->YYData->{LINE}, - }} +union: property_list 'union' optional_identifier opt_union_body + {{ + "TYPE" => "UNION", + "PROPERTIES" => $_[1], + "NAME" => $_[3], + "ELEMENTS" => $_[4] + }} ; -base_element: - property_list type pointers identifier array_len - {{ - "NAME" => $_[4], - "TYPE" => $_[2], - "PROPERTIES" => $_[1], - "POINTERS" => $_[3], - "ARRAY_LEN" => $_[5], - "FILE" => $_[0]->YYData->{FILE}, - "LINE" => $_[0]->YYData->{LINE}, - }} +base_element: property_list type pointers identifier array_len + {{ + "NAME" => $_[4], + "TYPE" => $_[2], + "PROPERTIES" => $_[1], + "POINTERS" => $_[3], + "ARRAY_LEN" => $_[5], + "FILE" => $_[0]->YYData->{FILE}, + "LINE" => $_[0]->YYData->{LINE}, + }} ; -pointers: - #empty - { 0 } - | - pointers '*' { $_[1]+1 } -; -pipe: - property_list 'pipe' type - {{ - "TYPE" => "PIPE", - "PROPERTIES" => $_[1], - "DATA" => $_[3], - "FILE" => $_[0]->YYData->{FILE}, - "LINE" => $_[0]->YYData->{LINE}, - }} +pointers: + #empty + { 0 } + | pointers '*' { $_[1]+1 } ; -element_list1: - #empty +element_list1: { [] } - | - element_list1 base_element ';' { push(@{$_[1]}, $_[2]); $_[1] } + | element_list1 base_element ';' { push(@{$_[1]}, $_[2]); $_[1] } ; -optional_const: +optional_const: #empty - | - 'const' + | 'const' ; -element_list2: - #empty - | - 'void' - | - optional_const base_element { [ $_[2] ] } - | - element_list2 ',' optional_const base_element { push(@{$_[1]}, $_[4]); $_[1] } +element_list2: + #empty + | 'void' + | optional_const base_element { [ $_[2] ] } + | element_list2 ',' optional_const base_element { push(@{$_[1]}, $_[4]); $_[1] } ; -array_len: - #empty { [] } - | - '[' ']' array_len { push(@{$_[3]}, "*"); $_[3] } - | - '[' anytext ']' array_len { push(@{$_[4]}, "$_[2]"); $_[4] } +array_len: + #empty { [] } + | '[' ']' array_len { push(@{$_[3]}, "*"); $_[3] } + | '[' anytext ']' array_len { push(@{$_[4]}, "$_[2]"); $_[4] } ; -property_list: - #empty - | - property_list '[' properties ']' { FlattenHash([$_[1],$_[3]]); } -; -properties: - property { $_[1] } - | - properties ',' property { FlattenHash([$_[1], $_[3]]); } +property_list: + #empty + | property_list '[' properties ']' { FlattenHash([$_[1],$_[3]]); } ; -property: - identifier {{ "$_[1]" => "1" }} - | - identifier '(' commalisttext ')' {{ "$_[1]" => "$_[3]" }} +properties: property { $_[1] } + | properties ',' property { FlattenHash([$_[1], $_[3]]); } ; -commalisttext: - anytext - | - commalisttext ',' anytext { "$_[1],$_[3]" } +property: identifier {{ "$_[1]" => "1" }} + | identifier '(' commalisttext ')' {{ "$_[1]" => "$_[3]" }} ; -anytext: - #empty - { "" } - | - identifier - | - constant - | - text - | - anytext '-' anytext { "$_[1]$_[2]$_[3]" } - | - anytext '.' anytext { "$_[1]$_[2]$_[3]" } - | - anytext '*' anytext { "$_[1]$_[2]$_[3]" } - | - anytext '>' anytext { "$_[1]$_[2]$_[3]" } - | - anytext '<' anytext { "$_[1]$_[2]$_[3]" } - | - anytext '|' anytext { "$_[1]$_[2]$_[3]" } - | - anytext '&' anytext { "$_[1]$_[2]$_[3]" } - | - anytext '/' anytext { "$_[1]$_[2]$_[3]" } - | - anytext '?' anytext { "$_[1]$_[2]$_[3]" } - | - anytext ':' anytext { "$_[1]$_[2]$_[3]" } - | - anytext '=' anytext { "$_[1]$_[2]$_[3]" } - | - anytext '+' anytext { "$_[1]$_[2]$_[3]" } - | - anytext '~' anytext { "$_[1]$_[2]$_[3]" } - | - anytext '(' commalisttext ')' anytext { "$_[1]$_[2]$_[3]$_[4]$_[5]" } - | - anytext '{' commalisttext '}' anytext { "$_[1]$_[2]$_[3]$_[4]$_[5]" } -; - -identifier: - IDENTIFIER -; - -optional_identifier: - #empty { undef } - | +commalisttext: + anytext + | commalisttext ',' anytext { "$_[1],$_[3]" } +; + +anytext: #empty + { "" } + | identifier | constant | text + | anytext '-' anytext { "$_[1]$_[2]$_[3]" } + | anytext '.' anytext { "$_[1]$_[2]$_[3]" } + | anytext '*' anytext { "$_[1]$_[2]$_[3]" } + | anytext '>' anytext { "$_[1]$_[2]$_[3]" } + | anytext '<' anytext { "$_[1]$_[2]$_[3]" } + | anytext '|' anytext { "$_[1]$_[2]$_[3]" } + | anytext '&' anytext { "$_[1]$_[2]$_[3]" } + | anytext '/' anytext { "$_[1]$_[2]$_[3]" } + | anytext '?' anytext { "$_[1]$_[2]$_[3]" } + | anytext ':' anytext { "$_[1]$_[2]$_[3]" } + | anytext '=' anytext { "$_[1]$_[2]$_[3]" } + | anytext '+' anytext { "$_[1]$_[2]$_[3]" } + | anytext '~' anytext { "$_[1]$_[2]$_[3]" } + | anytext '(' commalisttext ')' anytext { "$_[1]$_[2]$_[3]$_[4]$_[5]" } + | anytext '{' commalisttext '}' anytext { "$_[1]$_[2]$_[3]$_[4]$_[5]" } +; + +identifier: IDENTIFIER +; + +optional_identifier: IDENTIFIER + | #empty { undef } ; -constant: - CONSTANT +constant: CONSTANT ; -text: - TEXT { "\"$_[1]\"" } +text: TEXT { "\"$_[1]\"" } ; -optional_semicolon: +optional_semicolon: #empty - | - ';' + | ';' ; @@ -521,56 +361,51 @@ use Parse::Pidl qw(error); ##################################################################### # flatten an array of hashes into a single hash -sub FlattenHash($) -{ - my $a = shift; - my %b; - for my $d (@{$a}) { - for my $k (keys %{$d}) { - $b{$k} = $d->{$k}; - } +sub FlattenHash($) +{ + my $a = shift; + my %b; + for my $d (@{$a}) { + for my $k (keys %{$d}) { + $b{$k} = $d->{$k}; } - return \%b; + } + return \%b; } + + ##################################################################### # traverse a perl data structure removing any empty arrays or # hashes and any hash elements that map to undef sub CleanData($) { - sub CleanData($); - my($v) = shift; - + sub CleanData($); + my($v) = shift; return undef if (not defined($v)); - - if (ref($v) eq "ARRAY") { - foreach my $i (0 .. $#{$v}) { - CleanData($v->[$i]); - } - # this removes any undefined elements from the array - @{$v} = grep { defined $_ } @{$v}; - } elsif (ref($v) eq "HASH") { - foreach my $x (keys %{$v}) { - CleanData($v->{$x}); - if (!defined $v->{$x}) { - delete($v->{$x}); - next; - } - } + if (ref($v) eq "ARRAY") { + foreach my $i (0 .. $#{$v}) { + CleanData($v->[$i]); } - + # this removes any undefined elements from the array + @{$v} = grep { defined $_ } @{$v}; + } elsif (ref($v) eq "HASH") { + foreach my $x (keys %{$v}) { + CleanData($v->{$x}); + if (!defined $v->{$x}) { delete($v->{$x}); next; } + } + } return $v; } sub _Error { - if (exists $_[0]->YYData->{ERRMSG}) { + if (exists $_[0]->YYData->{ERRMSG}) { error($_[0]->YYData, $_[0]->YYData->{ERRMSG}); delete $_[0]->YYData->{ERRMSG}; return; } - my $last_token = $_[0]->YYData->{LAST_TOKEN}; - + error($_[0]->YYData, "Syntax error near '$last_token'"); } @@ -578,7 +413,7 @@ sub _Lexer($) { my($parser)=shift; - $parser->YYData->{INPUT} or return('',undef); + $parser->YYData->{INPUT} or return('',undef); again: $parser->YYData->{INPUT} =~ s/^[ \t]*//; @@ -605,19 +440,18 @@ again: } if (s/^\"(.*?)\"//) { $parser->YYData->{LAST_TOKEN} = $1; - return('TEXT',$1); + return('TEXT',$1); } if (s/^(\d+)(\W|$)/$2/) { $parser->YYData->{LAST_TOKEN} = $1; - return('CONSTANT',$1); + return('CONSTANT',$1); } if (s/^([\w_]+)//) { $parser->YYData->{LAST_TOKEN} = $1; - if ($1 =~ - /^(coclass|interface|import|importlib - |include|cpp_quote|typedef - |union|struct|enum|bitmap|pipe - |void|const|unsigned|signed)$/x) { + if ($1 =~ + /^(coclass|interface|const|typedef|union|cpp_quote + |struct|enum|bitmap|void|unsigned|signed|import|include + |importlib)$/x) { return $1; } return('IDENTIFIER',$1); @@ -635,10 +469,10 @@ sub parse_string my $self = new Parse::Pidl::IDL; - $self->YYData->{FILE} = $filename; - $self->YYData->{INPUT} = $data; - $self->YYData->{LINE} = 0; - $self->YYData->{LAST_TOKEN} = "NONE"; + $self->YYData->{FILE} = $filename; + $self->YYData->{INPUT} = $data; + $self->YYData->{LINE} = 0; + $self->YYData->{LAST_TOKEN} = "NONE"; my $idl = $self->YYParse( yylex => \&_Lexer, yyerror => \&_Error ); diff --git a/pidl/lib/Parse/Pidl/Expr.pm b/pidl/lib/Parse/Pidl/Expr.pm index 1230a71a2b..5524374fae 100644 --- a/pidl/lib/Parse/Pidl/Expr.pm +++ b/pidl/lib/Parse/Pidl/Expr.pm @@ -1127,7 +1127,7 @@ sub new { [#Rule 2 'exp', 1, sub -#line 24 "./../pidl/expr.yp" +#line 22 "./pidl/expr.yp" { "\"$_[1]\"" } ], [#Rule 3 @@ -1139,199 +1139,199 @@ sub [#Rule 5 'exp', 2, sub -#line 30 "./../pidl/expr.yp" +#line 25 "./pidl/expr.yp" { "~$_[2]" } ], [#Rule 6 'exp', 3, sub -#line 32 "./../pidl/expr.yp" +#line 26 "./pidl/expr.yp" { "$_[1] + $_[3]" } ], [#Rule 7 'exp', 3, sub -#line 34 "./../pidl/expr.yp" +#line 27 "./pidl/expr.yp" { "$_[1] - $_[3]" } ], [#Rule 8 'exp', 3, sub -#line 36 "./../pidl/expr.yp" +#line 28 "./pidl/expr.yp" { "$_[1] * $_[3]" } ], [#Rule 9 'exp', 3, sub -#line 38 "./../pidl/expr.yp" +#line 29 "./pidl/expr.yp" { "$_[1] % $_[3]" } ], [#Rule 10 'exp', 3, sub -#line 40 "./../pidl/expr.yp" +#line 30 "./pidl/expr.yp" { "$_[1] < $_[3]" } ], [#Rule 11 'exp', 3, sub -#line 42 "./../pidl/expr.yp" +#line 31 "./pidl/expr.yp" { "$_[1] > $_[3]" } ], [#Rule 12 'exp', 3, sub -#line 44 "./../pidl/expr.yp" +#line 32 "./pidl/expr.yp" { "$_[1] | $_[3]" } ], [#Rule 13 'exp', 3, sub -#line 46 "./../pidl/expr.yp" +#line 33 "./pidl/expr.yp" { "$_[1] == $_[3]" } ], [#Rule 14 'exp', 3, sub -#line 48 "./../pidl/expr.yp" +#line 34 "./pidl/expr.yp" { "$_[1] <= $_[3]" } ], [#Rule 15 'exp', 3, sub -#line 50 "./../pidl/expr.yp" +#line 35 "./pidl/expr.yp" { "$_[1] => $_[3]" } ], [#Rule 16 'exp', 3, sub -#line 52 "./../pidl/expr.yp" +#line 36 "./pidl/expr.yp" { "$_[1] << $_[3]" } ], [#Rule 17 'exp', 3, sub -#line 54 "./../pidl/expr.yp" +#line 37 "./pidl/expr.yp" { "$_[1] >> $_[3]" } ], [#Rule 18 'exp', 3, sub -#line 56 "./../pidl/expr.yp" +#line 38 "./pidl/expr.yp" { "$_[1] != $_[3]" } ], [#Rule 19 'exp', 3, sub -#line 58 "./../pidl/expr.yp" +#line 39 "./pidl/expr.yp" { "$_[1] || $_[3]" } ], [#Rule 20 'exp', 3, sub -#line 60 "./../pidl/expr.yp" +#line 40 "./pidl/expr.yp" { "$_[1] && $_[3]" } ], [#Rule 21 'exp', 3, sub -#line 62 "./../pidl/expr.yp" +#line 41 "./pidl/expr.yp" { "$_[1] & $_[3]" } ], [#Rule 22 'exp', 5, sub -#line 64 "./../pidl/expr.yp" +#line 42 "./pidl/expr.yp" { "$_[1]?$_[3]:$_[5]" } ], [#Rule 23 'exp', 2, sub -#line 66 "./../pidl/expr.yp" +#line 43 "./pidl/expr.yp" { "~$_[1]" } ], [#Rule 24 'exp', 2, sub -#line 68 "./../pidl/expr.yp" +#line 44 "./pidl/expr.yp" { "not $_[1]" } ], [#Rule 25 'exp', 3, sub -#line 70 "./../pidl/expr.yp" +#line 45 "./pidl/expr.yp" { "$_[1] / $_[3]" } ], [#Rule 26 'exp', 2, sub -#line 72 "./../pidl/expr.yp" +#line 46 "./pidl/expr.yp" { "-$_[2]" } ], [#Rule 27 'exp', 2, sub -#line 74 "./../pidl/expr.yp" +#line 47 "./pidl/expr.yp" { "&$_[2]" } ], [#Rule 28 'exp', 3, sub -#line 76 "./../pidl/expr.yp" +#line 48 "./pidl/expr.yp" { "$_[1]^$_[3]" } ], [#Rule 29 'exp', 3, sub -#line 78 "./../pidl/expr.yp" +#line 49 "./pidl/expr.yp" { "($_[2])" } ], [#Rule 30 'possible_pointer', 1, sub -#line 82 "./../pidl/expr.yp" +#line 53 "./pidl/expr.yp" { $_[0]->_Lookup($_[1]) } ], [#Rule 31 'possible_pointer', 2, sub -#line 84 "./../pidl/expr.yp" +#line 54 "./pidl/expr.yp" { $_[0]->_Dereference($_[2]); "*$_[2]" } ], [#Rule 32 'var', 1, sub -#line 88 "./../pidl/expr.yp" +#line 57 "./pidl/expr.yp" { $_[0]->_Use($_[1]) } ], [#Rule 33 'var', 3, sub -#line 90 "./../pidl/expr.yp" +#line 58 "./pidl/expr.yp" { $_[0]->_Use("$_[1].$_[3]") } ], [#Rule 34 'var', 3, sub -#line 92 "./../pidl/expr.yp" +#line 59 "./pidl/expr.yp" { "($_[2])" } ], [#Rule 35 'var', 3, sub -#line 94 "./../pidl/expr.yp" +#line 60 "./pidl/expr.yp" { $_[0]->_Use("*$_[1]"); $_[1]."->".$_[3] } ], [#Rule 36 'func', 4, sub -#line 99 "./../pidl/expr.yp" +#line 64 "./pidl/expr.yp" { "$_[1]($_[3])" } ], [#Rule 37 'opt_args', 0, sub -#line 104 "./../pidl/expr.yp" +#line 65 "./pidl/expr.yp" { "" } ], [#Rule 38 @@ -1349,7 +1349,7 @@ sub [#Rule 42 'args', 3, sub -#line 118 "./../pidl/expr.yp" +#line 68 "./pidl/expr.yp" { "$_[1], $_[3]" } ] ], @@ -1357,28 +1357,28 @@ sub bless($self,$class); } -#line 121 "./../pidl/expr.yp" +#line 71 "./pidl/expr.yp" package Parse::Pidl::Expr; sub _Lexer { - my($parser)=shift; + my($parser)=shift; - $parser->YYData->{INPUT}=~s/^[ \t]//; + $parser->YYData->{INPUT}=~s/^[ \t]//; - for ($parser->YYData->{INPUT}) { - if (s/^(0x[0-9A-Fa-f]+)//) { + for ($parser->YYData->{INPUT}) { + if (s/^(0x[0-9A-Fa-f]+)//) { $parser->YYData->{LAST_TOKEN} = $1; - return('NUM',$1); + return('NUM',$1); } - if (s/^([0-9]+(?:\.[0-9]+)?)//) { + if (s/^([0-9]+(?:\.[0-9]+)?)//) { $parser->YYData->{LAST_TOKEN} = $1; - return('NUM',$1); + return('NUM',$1); } - if (s/^([A-Za-z_][A-Za-z0-9_]*)//) { + if (s/^([A-Za-z_][A-Za-z0-9_]*)//) { $parser->YYData->{LAST_TOKEN} = $1; - return('VAR',$1); + return('VAR',$1); } if (s/^\"(.*?)\"//) { $parser->YYData->{LAST_TOKEN} = $1; @@ -1386,13 +1386,13 @@ sub _Lexer { } if (s/^(==|!=|<=|>=|->|\|\||<<|>>|&&)//s) { $parser->YYData->{LAST_TOKEN} = $1; - return($1,$1); + return($1,$1); } - if (s/^(.)//s) { + if (s/^(.)//s) { $parser->YYData->{LAST_TOKEN} = $1; - return($1,$1); + return($1,$1); } - } + } } sub _Use($$) @@ -1429,16 +1429,14 @@ sub _Error($) } sub Run { - my($self, $data, $error, $lookup, $deref, $use) = @_; - - $self->YYData->{FULL_INPUT} = $data; - $self->YYData->{INPUT} = $data; - $self->YYData->{LOOKUP} = $lookup; - $self->YYData->{DEREFERENCE} = $deref; - $self->YYData->{ERROR} = $error; - $self->YYData->{USE} = $use; - - return $self->YYParse( yylex => \&_Lexer, yyerror => \&_Error); + my($self, $data, $error, $lookup, $deref, $use) = @_; + $self->YYData->{FULL_INPUT} = $data; + $self->YYData->{INPUT} = $data; + $self->YYData->{LOOKUP} = $lookup; + $self->YYData->{DEREFERENCE} = $deref; + $self->YYData->{ERROR} = $error; + $self->YYData->{USE} = $use; + return $self->YYParse( yylex => \&_Lexer, yyerror => \&_Error); } 1; diff --git a/pidl/lib/Parse/Pidl/IDL.pm b/pidl/lib/Parse/Pidl/IDL.pm index 1a3c59d35c..06d54fb4b5 100644 --- a/pidl/lib/Parse/Pidl/IDL.pm +++ b/pidl/lib/Parse/Pidl/IDL.pm @@ -38,7 +38,7 @@ sub new { "import" => 7, "include" => 13 }, - DEFAULT => -89, + DEFAULT => -85, GOTOS => { 'cpp_quote' => 11, 'importlib' => 10, @@ -124,7 +124,7 @@ sub new { } }, {#State 16 - DEFAULT => -120 + DEFAULT => -116 }, {#State 17 DEFAULT => -11 @@ -184,7 +184,7 @@ sub new { } }, {#State 26 - DEFAULT => -116 + DEFAULT => -112 }, {#State 27 ACTIONS => { @@ -210,10 +210,10 @@ sub new { ACTIONS => { "(" => 41 }, - DEFAULT => -93 + DEFAULT => -89 }, {#State 31 - DEFAULT => -91 + DEFAULT => -87 }, {#State 32 DEFAULT => -8 @@ -256,7 +256,7 @@ sub new { } }, {#State 40 - DEFAULT => -90 + DEFAULT => -86 }, {#State 41 ACTIONS => { @@ -264,7 +264,7 @@ sub new { 'TEXT' => 16, 'IDENTIFIER' => 26 }, - DEFAULT => -97, + DEFAULT => -93, GOTOS => { 'identifier' => 50, 'text' => 51, @@ -284,73 +284,72 @@ sub new { }, {#State 44 ACTIONS => { - "const" => 64 + "const" => 63 }, - DEFAULT => -89, + DEFAULT => -85, GOTOS => { 'typedecl' => 54, 'function' => 55, - 'pipe' => 56, - 'definitions' => 58, - 'bitmap' => 57, - 'definition' => 61, - 'property_list' => 60, - 'usertype' => 59, - 'const' => 63, - 'struct' => 62, - 'typedef' => 66, - 'enum' => 65, - 'union' => 67 + 'definitions' => 57, + 'bitmap' => 56, + 'definition' => 60, + 'property_list' => 59, + 'usertype' => 58, + 'const' => 62, + 'struct' => 61, + 'typedef' => 65, + 'enum' => 64, + 'union' => 66 } }, {#State 45 - DEFAULT => -92 + DEFAULT => -88 }, {#State 46 ACTIONS => { - "-" => 69, - ":" => 68, - "<" => 71, - "+" => 73, - "~" => 72, - "*" => 80, - "?" => 70, - "{" => 74, - "&" => 75, - "/" => 76, - "=" => 77, - "(" => 78, - "|" => 79, - "." => 81, - ">" => 82 + "-" => 68, + ":" => 67, + "<" => 70, + "+" => 72, + "~" => 71, + "*" => 79, + "?" => 69, + "{" => 73, + "&" => 74, + "/" => 75, + "=" => 76, + "(" => 77, + "|" => 78, + "." => 80, + ">" => 81 }, - DEFAULT => -95 + DEFAULT => -91 }, {#State 47 - DEFAULT => -99 + DEFAULT => -95 }, {#State 48 - DEFAULT => -119 + DEFAULT => -115 }, {#State 49 ACTIONS => { - "," => 83, - ")" => 84 + "," => 82, + ")" => 83 } }, {#State 50 - DEFAULT => -98 + DEFAULT => -94 }, {#State 51 - DEFAULT => -100 + DEFAULT => -96 }, {#State 52 ACTIONS => { - ";" => 86 + ";" => 85 }, - DEFAULT => -121, + DEFAULT => -117, GOTOS => { - 'optional_semicolon' => 85 + 'optional_semicolon' => 84 } }, {#State 53 @@ -358,7 +357,7 @@ sub new { 'IDENTIFIER' => 26 }, GOTOS => { - 'identifier' => 87 + 'identifier' => 86 } }, {#State 54 @@ -368,1390 +367,1336 @@ sub new { DEFAULT => -22 }, {#State 56 - DEFAULT => -34 - }, - {#State 57 DEFAULT => -33 }, - {#State 58 + {#State 57 ACTIONS => { - "}" => 88, - "const" => 64 + "}" => 87, + "const" => 63 }, - DEFAULT => -89, + DEFAULT => -85, GOTOS => { 'typedecl' => 54, 'function' => 55, - 'pipe' => 56, - 'bitmap' => 57, - 'definition' => 89, - 'property_list' => 60, - 'usertype' => 59, - 'const' => 63, - 'struct' => 62, - 'typedef' => 66, - 'enum' => 65, - 'union' => 67 + 'bitmap' => 56, + 'definition' => 88, + 'property_list' => 59, + 'usertype' => 58, + 'struct' => 61, + 'const' => 62, + 'typedef' => 65, + 'enum' => 64, + 'union' => 66 } }, - {#State 59 + {#State 58 ACTIONS => { - ";" => 90 + ";" => 89 } }, - {#State 60 + {#State 59 ACTIONS => { - "typedef" => 91, + "typedef" => 90, 'IDENTIFIER' => 26, - "signed" => 100, - "union" => 92, - "enum" => 101, - "bitmap" => 102, - 'void' => 93, - "pipe" => 103, - "unsigned" => 104, + "signed" => 98, + "union" => 91, + "enum" => 100, + "bitmap" => 101, + 'void' => 92, + "unsigned" => 102, "[" => 20, - "struct" => 98 + "struct" => 97 }, GOTOS => { 'existingtype' => 99, - 'pipe' => 56, - 'bitmap' => 57, - 'usertype' => 95, - 'property_list' => 94, - 'identifier' => 96, - 'struct' => 62, - 'enum' => 65, - 'type' => 105, - 'union' => 67, - 'sign' => 97 + 'bitmap' => 56, + 'usertype' => 94, + 'property_list' => 93, + 'identifier' => 95, + 'struct' => 61, + 'enum' => 64, + 'type' => 103, + 'union' => 66, + 'sign' => 96 } }, - {#State 61 + {#State 60 DEFAULT => -20 }, - {#State 62 + {#State 61 DEFAULT => -30 }, - {#State 63 + {#State 62 DEFAULT => -23 }, - {#State 64 + {#State 63 ACTIONS => { 'IDENTIFIER' => 26 }, GOTOS => { - 'identifier' => 106 + 'identifier' => 104 } }, - {#State 65 + {#State 64 DEFAULT => -32 }, - {#State 66 + {#State 65 DEFAULT => -24 }, - {#State 67 + {#State 66 DEFAULT => -31 }, - {#State 68 + {#State 67 ACTIONS => { 'CONSTANT' => 48, 'TEXT' => 16, 'IDENTIFIER' => 26 }, - DEFAULT => -97, + DEFAULT => -93, GOTOS => { 'identifier' => 50, - 'anytext' => 107, + 'anytext' => 105, 'text' => 51, 'constant' => 47 } }, - {#State 69 + {#State 68 ACTIONS => { 'CONSTANT' => 48, 'TEXT' => 16, 'IDENTIFIER' => 26 }, - DEFAULT => -97, + DEFAULT => -93, GOTOS => { 'identifier' => 50, - 'anytext' => 108, + 'anytext' => 106, 'text' => 51, 'constant' => 47 } }, - {#State 70 + {#State 69 ACTIONS => { 'CONSTANT' => 48, 'TEXT' => 16, 'IDENTIFIER' => 26 }, - DEFAULT => -97, + DEFAULT => -93, GOTOS => { 'identifier' => 50, - 'anytext' => 109, + 'anytext' => 107, 'text' => 51, 'constant' => 47 } }, - {#State 71 + {#State 70 ACTIONS => { 'CONSTANT' => 48, 'TEXT' => 16, 'IDENTIFIER' => 26 }, - DEFAULT => -97, + DEFAULT => -93, GOTOS => { 'identifier' => 50, - 'anytext' => 110, + 'anytext' => 108, 'text' => 51, 'constant' => 47 } }, - {#State 72 + {#State 71 ACTIONS => { 'CONSTANT' => 48, 'TEXT' => 16, 'IDENTIFIER' => 26 }, - DEFAULT => -97, + DEFAULT => -93, GOTOS => { 'identifier' => 50, - 'anytext' => 111, + 'anytext' => 109, 'text' => 51, 'constant' => 47 } }, - {#State 73 + {#State 72 ACTIONS => { 'CONSTANT' => 48, 'TEXT' => 16, 'IDENTIFIER' => 26 }, - DEFAULT => -97, + DEFAULT => -93, GOTOS => { 'identifier' => 50, - 'anytext' => 112, + 'anytext' => 110, 'text' => 51, 'constant' => 47 } }, - {#State 74 + {#State 73 ACTIONS => { 'CONSTANT' => 48, 'TEXT' => 16, 'IDENTIFIER' => 26 }, - DEFAULT => -97, + DEFAULT => -93, GOTOS => { 'identifier' => 50, 'anytext' => 46, 'text' => 51, 'constant' => 47, - 'commalisttext' => 113 + 'commalisttext' => 111 } }, - {#State 75 + {#State 74 ACTIONS => { 'CONSTANT' => 48, 'TEXT' => 16, 'IDENTIFIER' => 26 }, - DEFAULT => -97, + DEFAULT => -93, GOTOS => { 'identifier' => 50, - 'anytext' => 114, + 'anytext' => 112, 'text' => 51, 'constant' => 47 } }, - {#State 76 + {#State 75 ACTIONS => { 'CONSTANT' => 48, 'TEXT' => 16, 'IDENTIFIER' => 26 }, - DEFAULT => -97, + DEFAULT => -93, GOTOS => { 'identifier' => 50, - 'anytext' => 115, + 'anytext' => 113, 'text' => 51, 'constant' => 47 } }, - {#State 77 + {#State 76 ACTIONS => { 'CONSTANT' => 48, 'TEXT' => 16, 'IDENTIFIER' => 26 }, - DEFAULT => -97, + DEFAULT => -93, GOTOS => { 'identifier' => 50, - 'anytext' => 116, + 'anytext' => 114, 'text' => 51, 'constant' => 47 } }, - {#State 78 + {#State 77 ACTIONS => { 'CONSTANT' => 48, 'TEXT' => 16, 'IDENTIFIER' => 26 }, - DEFAULT => -97, + DEFAULT => -93, GOTOS => { 'identifier' => 50, 'anytext' => 46, 'text' => 51, 'constant' => 47, - 'commalisttext' => 117 + 'commalisttext' => 115 } }, - {#State 79 + {#State 78 ACTIONS => { 'CONSTANT' => 48, 'TEXT' => 16, 'IDENTIFIER' => 26 }, - DEFAULT => -97, + DEFAULT => -93, GOTOS => { 'identifier' => 50, - 'anytext' => 118, + 'anytext' => 116, 'text' => 51, 'constant' => 47 } }, - {#State 80 + {#State 79 ACTIONS => { 'CONSTANT' => 48, 'TEXT' => 16, 'IDENTIFIER' => 26 }, - DEFAULT => -97, + DEFAULT => -93, GOTOS => { 'identifier' => 50, - 'anytext' => 119, + 'anytext' => 117, 'text' => 51, 'constant' => 47 } }, - {#State 81 + {#State 80 ACTIONS => { 'CONSTANT' => 48, 'TEXT' => 16, 'IDENTIFIER' => 26 }, - DEFAULT => -97, + DEFAULT => -93, GOTOS => { 'identifier' => 50, - 'anytext' => 120, + 'anytext' => 118, 'text' => 51, 'constant' => 47 } }, - {#State 82 + {#State 81 ACTIONS => { 'CONSTANT' => 48, 'TEXT' => 16, 'IDENTIFIER' => 26 }, - DEFAULT => -97, + DEFAULT => -93, GOTOS => { 'identifier' => 50, - 'anytext' => 121, + 'anytext' => 119, 'text' => 51, 'constant' => 47 } }, - {#State 83 + {#State 82 ACTIONS => { 'CONSTANT' => 48, 'TEXT' => 16, 'IDENTIFIER' => 26 }, - DEFAULT => -97, + DEFAULT => -93, GOTOS => { 'identifier' => 50, - 'anytext' => 122, + 'anytext' => 120, 'text' => 51, 'constant' => 47 } }, + {#State 83 + DEFAULT => -90 + }, {#State 84 - DEFAULT => -94 + DEFAULT => -13 }, {#State 85 - DEFAULT => -13 + DEFAULT => -118 }, {#State 86 - DEFAULT => -122 - }, - {#State 87 ACTIONS => { - ";" => 123 + ";" => 121 } }, - {#State 88 + {#State 87 ACTIONS => { - ";" => 86 + ";" => 85 }, - DEFAULT => -121, + DEFAULT => -117, GOTOS => { - 'optional_semicolon' => 124 + 'optional_semicolon' => 122 } }, - {#State 89 + {#State 88 DEFAULT => -21 }, - {#State 90 - DEFAULT => -35 + {#State 89 + DEFAULT => -34 }, - {#State 91 + {#State 90 ACTIONS => { 'IDENTIFIER' => 26, - "signed" => 100, - 'void' => 93, - "unsigned" => 104 + "signed" => 98, + 'void' => 92, + "unsigned" => 102 }, - DEFAULT => -89, + DEFAULT => -85, GOTOS => { 'existingtype' => 99, - 'pipe' => 56, - 'bitmap' => 57, - 'usertype' => 95, - 'property_list' => 94, - 'identifier' => 96, - 'struct' => 62, - 'enum' => 65, - 'type' => 125, - 'union' => 67, - 'sign' => 97 + 'bitmap' => 56, + 'usertype' => 94, + 'property_list' => 93, + 'identifier' => 95, + 'struct' => 61, + 'enum' => 64, + 'type' => 123, + 'union' => 66, + 'sign' => 96 } }, - {#State 92 + {#State 91 ACTIONS => { - 'IDENTIFIER' => 126 + 'IDENTIFIER' => 124 }, - DEFAULT => -117, + DEFAULT => -114, GOTOS => { - 'optional_identifier' => 127 + 'optional_identifier' => 125 } }, - {#State 93 - DEFAULT => -42 + {#State 92 + DEFAULT => -41 }, - {#State 94 + {#State 93 ACTIONS => { - "pipe" => 103, - "union" => 92, - "enum" => 101, - "bitmap" => 102, + "union" => 91, + "enum" => 100, + "bitmap" => 101, "[" => 20, - "struct" => 98 + "struct" => 97 } }, + {#State 94 + DEFAULT => -39 + }, {#State 95 - DEFAULT => -40 + DEFAULT => -38 }, {#State 96 - DEFAULT => -39 - }, - {#State 97 ACTIONS => { 'IDENTIFIER' => 26 }, GOTOS => { - 'identifier' => 128 + 'identifier' => 126 } }, - {#State 98 + {#State 97 ACTIONS => { - 'IDENTIFIER' => 126 + 'IDENTIFIER' => 124 }, - DEFAULT => -117, + DEFAULT => -114, GOTOS => { - 'optional_identifier' => 129 + 'optional_identifier' => 127 } }, + {#State 98 + DEFAULT => -35 + }, {#State 99 - DEFAULT => -41 + DEFAULT => -40 }, {#State 100 - DEFAULT => -36 - }, - {#State 101 ACTIONS => { - 'IDENTIFIER' => 126 + 'IDENTIFIER' => 124 }, - DEFAULT => -117, + DEFAULT => -114, GOTOS => { - 'optional_identifier' => 130 + 'optional_identifier' => 128 } }, - {#State 102 + {#State 101 ACTIONS => { - 'IDENTIFIER' => 126 + 'IDENTIFIER' => 124 }, - DEFAULT => -117, + DEFAULT => -114, GOTOS => { - 'optional_identifier' => 131 + 'optional_identifier' => 129 } }, + {#State 102 + DEFAULT => -36 + }, {#State 103 ACTIONS => { - 'IDENTIFIER' => 26, - "signed" => 100, - 'void' => 93, - "unsigned" => 104 + 'IDENTIFIER' => 26 }, - DEFAULT => -89, GOTOS => { - 'existingtype' => 99, - 'pipe' => 56, - 'bitmap' => 57, - 'usertype' => 95, - 'property_list' => 94, - 'identifier' => 96, - 'struct' => 62, - 'enum' => 65, - 'type' => 132, - 'union' => 67, - 'sign' => 97 + 'identifier' => 130 } }, {#State 104 - DEFAULT => -37 + DEFAULT => -74, + GOTOS => { + 'pointers' => 131 + } }, {#State 105 ACTIONS => { - 'IDENTIFIER' => 26 + "-" => 68, + ":" => 67, + "<" => 70, + "+" => 72, + "~" => 71, + "*" => 79, + "?" => 69, + "{" => 73, + "&" => 74, + "/" => 75, + "=" => 76, + "(" => 77, + "|" => 78, + "." => 80, + ">" => 81 }, - GOTOS => { - 'identifier' => 133 - } + DEFAULT => -106 }, {#State 106 - DEFAULT => -75, - GOTOS => { - 'pointers' => 134 - } + ACTIONS => { + ":" => 67, + "<" => 70, + "~" => 71, + "?" => 69, + "{" => 73, + "=" => 76 + }, + DEFAULT => -97 }, {#State 107 ACTIONS => { - "-" => 69, - ":" => 68, - "<" => 71, - "+" => 73, - "~" => 72, - "*" => 80, - "?" => 70, - "{" => 74, - "&" => 75, - "/" => 76, - "=" => 77, - "(" => 78, - "|" => 79, - "." => 81, - ">" => 82 + "-" => 68, + ":" => 67, + "<" => 70, + "+" => 72, + "~" => 71, + "*" => 79, + "?" => 69, + "{" => 73, + "&" => 74, + "/" => 75, + "=" => 76, + "(" => 77, + "|" => 78, + "." => 80, + ">" => 81 }, - DEFAULT => -110 + DEFAULT => -105 }, {#State 108 ACTIONS => { - ":" => 68, - "<" => 71, - "~" => 72, - "?" => 70, - "{" => 74, - "=" => 77 + "-" => 68, + ":" => 67, + "<" => 70, + "+" => 72, + "~" => 71, + "*" => 79, + "?" => 69, + "{" => 73, + "&" => 74, + "/" => 75, + "=" => 76, + "(" => 77, + "|" => 78, + "." => 80, + ">" => 81 }, DEFAULT => -101 }, {#State 109 ACTIONS => { - "-" => 69, - ":" => 68, - "<" => 71, - "+" => 73, - "~" => 72, - "*" => 80, - "?" => 70, - "{" => 74, - "&" => 75, - "/" => 76, - "=" => 77, - "(" => 78, - "|" => 79, - "." => 81, - ">" => 82 + "-" => 68, + ":" => 67, + "<" => 70, + "+" => 72, + "~" => 71, + "*" => 79, + "?" => 69, + "{" => 73, + "&" => 74, + "/" => 75, + "=" => 76, + "(" => 77, + "|" => 78, + "." => 80, + ">" => 81 }, DEFAULT => -109 }, {#State 110 ACTIONS => { - "-" => 69, - ":" => 68, - "<" => 71, - "+" => 73, - "~" => 72, - "*" => 80, - "?" => 70, - "{" => 74, - "&" => 75, - "/" => 76, - "=" => 77, - "(" => 78, - "|" => 79, - "." => 81, - ">" => 82 + ":" => 67, + "<" => 70, + "~" => 71, + "?" => 69, + "{" => 73, + "=" => 76 }, - DEFAULT => -105 + DEFAULT => -108 }, {#State 111 ACTIONS => { - "-" => 69, - ":" => 68, - "<" => 71, - "+" => 73, - "~" => 72, - "*" => 80, - "?" => 70, - "{" => 74, - "&" => 75, - "/" => 76, - "=" => 77, - "(" => 78, - "|" => 79, - "." => 81, - ">" => 82 - }, - DEFAULT => -113 + "}" => 132, + "," => 82 + } }, {#State 112 ACTIONS => { - ":" => 68, - "<" => 71, - "~" => 72, - "?" => 70, - "{" => 74, - "=" => 77 + ":" => 67, + "<" => 70, + "~" => 71, + "?" => 69, + "{" => 73, + "=" => 76 }, - DEFAULT => -112 + DEFAULT => -103 }, {#State 113 ACTIONS => { - "}" => 135, - "," => 83 - } + ":" => 67, + "<" => 70, + "~" => 71, + "?" => 69, + "{" => 73, + "=" => 76 + }, + DEFAULT => -104 }, {#State 114 ACTIONS => { - ":" => 68, - "<" => 71, - "~" => 72, - "?" => 70, - "{" => 74, - "=" => 77 + "-" => 68, + ":" => 67, + "<" => 70, + "+" => 72, + "~" => 71, + "*" => 79, + "?" => 69, + "{" => 73, + "&" => 74, + "/" => 75, + "=" => 76, + "(" => 77, + "|" => 78, + "." => 80, + ">" => 81 }, DEFAULT => -107 }, {#State 115 ACTIONS => { - ":" => 68, - "<" => 71, - "~" => 72, - "?" => 70, - "{" => 74, - "=" => 77 - }, - DEFAULT => -108 + "," => 82, + ")" => 133 + } }, {#State 116 ACTIONS => { - "-" => 69, - ":" => 68, - "<" => 71, - "+" => 73, - "~" => 72, - "*" => 80, - "?" => 70, - "{" => 74, - "&" => 75, - "/" => 76, - "=" => 77, - "(" => 78, - "|" => 79, - "." => 81, - ">" => 82 + ":" => 67, + "<" => 70, + "~" => 71, + "?" => 69, + "{" => 73, + "=" => 76 }, - DEFAULT => -111 + DEFAULT => -102 }, {#State 117 ACTIONS => { - "," => 83, - ")" => 136 - } + ":" => 67, + "<" => 70, + "~" => 71, + "?" => 69, + "{" => 73, + "=" => 76 + }, + DEFAULT => -99 }, {#State 118 ACTIONS => { - ":" => 68, - "<" => 71, - "~" => 72, - "?" => 70, - "{" => 74, - "=" => 77 + ":" => 67, + "<" => 70, + "~" => 71, + "?" => 69, + "{" => 73, + "=" => 76 }, - DEFAULT => -106 + DEFAULT => -98 }, {#State 119 ACTIONS => { - ":" => 68, - "<" => 71, - "~" => 72, - "?" => 70, - "{" => 74, - "=" => 77 + ":" => 67, + "<" => 70, + "~" => 71, + "?" => 69, + "{" => 73, + "=" => 76 }, - DEFAULT => -103 + DEFAULT => -100 }, {#State 120 ACTIONS => { - ":" => 68, - "<" => 71, - "~" => 72, - "?" => 70, - "{" => 74, - "=" => 77 + "-" => 68, + ":" => 67, + "<" => 70, + "+" => 72, + "~" => 71, + "*" => 79, + "?" => 69, + "{" => 73, + "&" => 74, + "/" => 75, + "=" => 76, + "(" => 77, + "|" => 78, + "." => 80, + ">" => 81 }, - DEFAULT => -102 + DEFAULT => -92 }, {#State 121 - ACTIONS => { - ":" => 68, - "<" => 71, - "~" => 72, - "?" => 70, - "{" => 74, - "=" => 77 - }, - DEFAULT => -104 + DEFAULT => -15 }, {#State 122 - ACTIONS => { - "-" => 69, - ":" => 68, - "<" => 71, - "+" => 73, - "~" => 72, - "*" => 80, - "?" => 70, - "{" => 74, - "&" => 75, - "/" => 76, - "=" => 77, - "(" => 78, - "|" => 79, - "." => 81, - ">" => 82 - }, - DEFAULT => -96 + DEFAULT => -16 }, {#State 123 - DEFAULT => -15 + ACTIONS => { + 'IDENTIFIER' => 26 + }, + GOTOS => { + 'identifier' => 134 + } }, {#State 124 - DEFAULT => -16 + DEFAULT => -113 }, {#State 125 ACTIONS => { - 'IDENTIFIER' => 26 + "{" => 136 }, + DEFAULT => -70, GOTOS => { - 'identifier' => 137 + 'union_body' => 137, + 'opt_union_body' => 135 } }, {#State 126 - DEFAULT => -118 + DEFAULT => -37 }, {#State 127 ACTIONS => { "{" => 139 }, - DEFAULT => -71, + DEFAULT => -60, GOTOS => { - 'union_body' => 140, - 'opt_union_body' => 138 + 'struct_body' => 138, + 'opt_struct_body' => 140 } }, {#State 128 - DEFAULT => -38 - }, - {#State 129 ACTIONS => { - "{" => 142 + "{" => 141 }, - DEFAULT => -61, + DEFAULT => -43, GOTOS => { - 'struct_body' => 141, - 'opt_struct_body' => 143 + 'opt_enum_body' => 143, + 'enum_body' => 142 } }, - {#State 130 - ACTIONS => { - "{" => 144 - }, - DEFAULT => -44, - GOTOS => { - 'opt_enum_body' => 146, - 'enum_body' => 145 - } - }, - {#State 131 + {#State 129 ACTIONS => { - "{" => 148 + "{" => 145 }, - DEFAULT => -52, + DEFAULT => -51, GOTOS => { - 'bitmap_body' => 149, - 'opt_bitmap_body' => 147 + 'bitmap_body' => 146, + 'opt_bitmap_body' => 144 } }, - {#State 132 - DEFAULT => -77 - }, - {#State 133 + {#State 130 ACTIONS => { - "(" => 150 + "(" => 147 } }, - {#State 134 + {#State 131 ACTIONS => { 'IDENTIFIER' => 26, - "*" => 152 + "*" => 149 }, GOTOS => { - 'identifier' => 151 + 'identifier' => 148 } }, - {#State 135 + {#State 132 ACTIONS => { 'CONSTANT' => 48, 'TEXT' => 16, 'IDENTIFIER' => 26 }, - DEFAULT => -97, + DEFAULT => -93, GOTOS => { 'identifier' => 50, - 'anytext' => 153, + 'anytext' => 150, 'text' => 51, 'constant' => 47 } }, - {#State 136 + {#State 133 ACTIONS => { 'CONSTANT' => 48, 'TEXT' => 16, 'IDENTIFIER' => 26 }, - DEFAULT => -97, + DEFAULT => -93, GOTOS => { 'identifier' => 50, - 'anytext' => 154, + 'anytext' => 151, 'text' => 51, 'constant' => 47 } }, - {#State 137 + {#State 134 ACTIONS => { - "[" => 155 + "[" => 152 }, - DEFAULT => -86, + DEFAULT => -82, GOTOS => { - 'array_len' => 156 + 'array_len' => 153 } }, - {#State 138 - DEFAULT => -73 + {#State 135 + DEFAULT => -72 }, - {#State 139 - DEFAULT => -68, + {#State 136 + DEFAULT => -67, GOTOS => { - 'union_elements' => 157 + 'union_elements' => 154 } }, - {#State 140 - DEFAULT => -72 + {#State 137 + DEFAULT => -71 }, - {#State 141 - DEFAULT => -62 + {#State 138 + DEFAULT => -61 }, - {#State 142 - DEFAULT => -78, + {#State 139 + DEFAULT => -76, GOTOS => { - 'element_list1' => 158 + 'element_list1' => 155 } }, - {#State 143 - DEFAULT => -63 + {#State 140 + DEFAULT => -62 }, - {#State 144 + {#State 141 ACTIONS => { 'IDENTIFIER' => 26 }, GOTOS => { - 'identifier' => 159, - 'enum_element' => 160, - 'enum_elements' => 161 + 'identifier' => 156, + 'enum_element' => 157, + 'enum_elements' => 158 } }, - {#State 145 - DEFAULT => -45 + {#State 142 + DEFAULT => -44 }, - {#State 146 - DEFAULT => -46 + {#State 143 + DEFAULT => -45 }, - {#State 147 - DEFAULT => -54 + {#State 144 + DEFAULT => -53 }, - {#State 148 + {#State 145 ACTIONS => { 'IDENTIFIER' => 26 }, - DEFAULT => -57, + DEFAULT => -56, GOTOS => { - 'identifier' => 164, - 'bitmap_element' => 163, - 'bitmap_elements' => 162, - 'opt_bitmap_elements' => 165 + 'identifier' => 161, + 'bitmap_element' => 160, + 'bitmap_elements' => 159, + 'opt_bitmap_elements' => 162 } }, - {#State 149 - DEFAULT => -53 + {#State 146 + DEFAULT => -52 }, - {#State 150 + {#State 147 ACTIONS => { - "," => -82, - "void" => 169, - "const" => 167, - ")" => -82 + "," => -78, + "void" => 166, + ")" => -78 }, - DEFAULT => -80, + DEFAULT => -85, GOTOS => { - 'optional_const' => 166, - 'element_list2' => 168 + 'base_element' => 163, + 'element_list2' => 165, + 'property_list' => 164 } }, - {#State 151 + {#State 148 ACTIONS => { - "[" => 155, - "=" => 171 + "[" => 152, + "=" => 168 }, GOTOS => { - 'array_len' => 170 + 'array_len' => 167 } }, - {#State 152 - DEFAULT => -76 + {#State 149 + DEFAULT => -75 }, - {#State 153 + {#State 150 ACTIONS => { - "-" => 69, - ":" => 68, - "<" => 71, - "+" => 73, - "~" => 72, - "*" => 80, - "?" => 70, - "{" => 74, - "&" => 75, - "/" => 76, - "=" => 77, - "(" => 78, - "|" => 79, - "." => 81, - ">" => 82 + "-" => 68, + ":" => 67, + "<" => 70, + "+" => 72, + "~" => 71, + "*" => 79, + "?" => 69, + "{" => 73, + "&" => 74, + "/" => 75, + "=" => 76, + "(" => 77, + "|" => 78, + "." => 80, + ">" => 81 }, - DEFAULT => -115 + DEFAULT => -111 }, - {#State 154 + {#State 151 ACTIONS => { - ":" => 68, - "<" => 71, - "~" => 72, - "?" => 70, - "{" => 74, - "=" => 77 + ":" => 67, + "<" => 70, + "~" => 71, + "?" => 69, + "{" => 73, + "=" => 76 }, - DEFAULT => -114 + DEFAULT => -110 }, - {#State 155 + {#State 152 ACTIONS => { 'CONSTANT' => 48, 'TEXT' => 16, - "]" => 172, + "]" => 169, 'IDENTIFIER' => 26 }, - DEFAULT => -97, + DEFAULT => -93, GOTOS => { 'identifier' => 50, - 'anytext' => 173, + 'anytext' => 170, 'text' => 51, 'constant' => 47 } }, - {#State 156 + {#State 153 ACTIONS => { - ";" => 174 + ";" => 171 } }, - {#State 157 + {#State 154 ACTIONS => { - "}" => 175 + "}" => 172 }, - DEFAULT => -89, + DEFAULT => -85, GOTOS => { - 'optional_base_element' => 177, - 'property_list' => 176 + 'optional_base_element' => 174, + 'property_list' => 173 } }, - {#State 158 + {#State 155 ACTIONS => { - "}" => 178 + "}" => 175 }, - DEFAULT => -89, + DEFAULT => -85, GOTOS => { - 'base_element' => 179, - 'property_list' => 180 + 'base_element' => 176, + 'property_list' => 164 + } + }, + {#State 156 + ACTIONS => { + "=" => 177 + }, + DEFAULT => -48 + }, + {#State 157 + DEFAULT => -46 + }, + {#State 158 + ACTIONS => { + "}" => 178, + "," => 179 } }, {#State 159 ACTIONS => { - "=" => 181 + "," => 180 }, - DEFAULT => -49 + DEFAULT => -57 }, {#State 160 - DEFAULT => -47 + DEFAULT => -54 }, {#State 161 ACTIONS => { - "}" => 182, - "," => 183 + "=" => 181 } }, {#State 162 ACTIONS => { - "," => 184 - }, - DEFAULT => -58 + "}" => 182 + } }, {#State 163 - DEFAULT => -55 + DEFAULT => -80 }, {#State 164 ACTIONS => { - "=" => 185 + 'IDENTIFIER' => 26, + "signed" => 98, + 'void' => 92, + "unsigned" => 102, + "[" => 20 + }, + DEFAULT => -85, + GOTOS => { + 'existingtype' => 99, + 'bitmap' => 56, + 'usertype' => 94, + 'property_list' => 93, + 'identifier' => 95, + 'struct' => 61, + 'enum' => 64, + 'type' => 183, + 'union' => 66, + 'sign' => 96 } }, {#State 165 ACTIONS => { - "}" => 186 + "," => 184, + ")" => 185 } }, {#State 166 - DEFAULT => -89, - GOTOS => { - 'base_element' => 187, - 'property_list' => 180 - } + DEFAULT => -79 }, {#State 167 - DEFAULT => -81 - }, - {#State 168 - ACTIONS => { - "," => 188, - ")" => 189 - } - }, - {#State 169 - DEFAULT => -83 - }, - {#State 170 ACTIONS => { - "=" => 190 + "=" => 186 } }, - {#State 171 + {#State 168 ACTIONS => { 'CONSTANT' => 48, 'TEXT' => 16, 'IDENTIFIER' => 26 }, - DEFAULT => -97, + DEFAULT => -93, GOTOS => { 'identifier' => 50, - 'anytext' => 191, + 'anytext' => 187, 'text' => 51, 'constant' => 47 } }, - {#State 172 + {#State 169 ACTIONS => { - "[" => 155 + "[" => 152 }, - DEFAULT => -86, + DEFAULT => -82, GOTOS => { - 'array_len' => 192 + 'array_len' => 188 } }, - {#State 173 + {#State 170 ACTIONS => { - "-" => 69, - ":" => 68, - "?" => 70, - "<" => 71, - "+" => 73, - "~" => 72, - "&" => 75, - "{" => 74, - "/" => 76, - "=" => 77, - "|" => 79, - "(" => 78, - "*" => 80, - "." => 81, - "]" => 193, - ">" => 82 + "-" => 68, + ":" => 67, + "?" => 69, + "<" => 70, + "+" => 72, + "~" => 71, + "&" => 74, + "{" => 73, + "/" => 75, + "=" => 76, + "|" => 78, + "(" => 77, + "*" => 79, + "." => 80, + "]" => 189, + ">" => 81 } }, - {#State 174 + {#State 171 DEFAULT => -29 }, - {#State 175 - DEFAULT => -70 + {#State 172 + DEFAULT => -69 }, - {#State 176 + {#State 173 ACTIONS => { "[" => 20 }, - DEFAULT => -89, + DEFAULT => -85, GOTOS => { - 'base_or_empty' => 194, - 'base_element' => 195, - 'empty_element' => 196, - 'property_list' => 197 + 'base_or_empty' => 190, + 'base_element' => 191, + 'empty_element' => 192, + 'property_list' => 193 } }, - {#State 177 - DEFAULT => -69 - }, - {#State 178 - DEFAULT => -60 + {#State 174 + DEFAULT => -68 }, - {#State 179 - ACTIONS => { - ";" => 198 - } + {#State 175 + DEFAULT => -59 }, - {#State 180 + {#State 176 ACTIONS => { - 'IDENTIFIER' => 26, - "signed" => 100, - 'void' => 93, - "unsigned" => 104, - "[" => 20 - }, - DEFAULT => -89, - GOTOS => { - 'existingtype' => 99, - 'pipe' => 56, - 'bitmap' => 57, - 'usertype' => 95, - 'property_list' => 94, - 'identifier' => 96, - 'struct' => 62, - 'enum' => 65, - 'type' => 199, - 'union' => 67, - 'sign' => 97 + ";" => 194 } }, - {#State 181 + {#State 177 ACTIONS => { 'CONSTANT' => 48, 'TEXT' => 16, 'IDENTIFIER' => 26 }, - DEFAULT => -97, + DEFAULT => -93, GOTOS => { 'identifier' => 50, - 'anytext' => 200, + 'anytext' => 195, 'text' => 51, 'constant' => 47 } }, - {#State 182 - DEFAULT => -43 + {#State 178 + DEFAULT => -42 }, - {#State 183 + {#State 179 ACTIONS => { 'IDENTIFIER' => 26 }, GOTOS => { - 'identifier' => 159, - 'enum_element' => 201 + 'identifier' => 156, + 'enum_element' => 196 } }, - {#State 184 + {#State 180 ACTIONS => { 'IDENTIFIER' => 26 }, GOTOS => { - 'identifier' => 164, - 'bitmap_element' => 202 + 'identifier' => 161, + 'bitmap_element' => 197 } }, - {#State 185 + {#State 181 ACTIONS => { 'CONSTANT' => 48, 'TEXT' => 16, 'IDENTIFIER' => 26 }, - DEFAULT => -97, + DEFAULT => -93, GOTOS => { 'identifier' => 50, - 'anytext' => 203, + 'anytext' => 198, 'text' => 51, 'constant' => 47 } }, - {#State 186 - DEFAULT => -51 + {#State 182 + DEFAULT => -50 }, - {#State 187 - DEFAULT => -84 + {#State 183 + DEFAULT => -74, + GOTOS => { + 'pointers' => 199 + } }, - {#State 188 - ACTIONS => { - "const" => 167 - }, - DEFAULT => -80, + {#State 184 + DEFAULT => -85, GOTOS => { - 'optional_const' => 204 + 'base_element' => 200, + 'property_list' => 164 } }, - {#State 189 + {#State 185 ACTIONS => { - ";" => 205 + ";" => 201 } }, - {#State 190 + {#State 186 ACTIONS => { 'CONSTANT' => 48, 'TEXT' => 16, 'IDENTIFIER' => 26 }, - DEFAULT => -97, + DEFAULT => -93, GOTOS => { 'identifier' => 50, - 'anytext' => 206, + 'anytext' => 202, 'text' => 51, 'constant' => 47 } }, - {#State 191 + {#State 187 ACTIONS => { - "-" => 69, - ":" => 68, - "?" => 70, - "<" => 71, - ";" => 207, - "+" => 73, - "~" => 72, - "&" => 75, - "{" => 74, - "/" => 76, - "=" => 77, - "|" => 79, - "(" => 78, - "*" => 80, - "." => 81, - ">" => 82 + "-" => 68, + ":" => 67, + "?" => 69, + "<" => 70, + ";" => 203, + "+" => 72, + "~" => 71, + "&" => 74, + "{" => 73, + "/" => 75, + "=" => 76, + "|" => 78, + "(" => 77, + "*" => 79, + "." => 80, + ">" => 81 } }, - {#State 192 - DEFAULT => -87 + {#State 188 + DEFAULT => -83 }, - {#State 193 + {#State 189 ACTIONS => { - "[" => 155 + "[" => 152 }, - DEFAULT => -86, + DEFAULT => -82, GOTOS => { - 'array_len' => 208 + 'array_len' => 204 } }, - {#State 194 - DEFAULT => -67 + {#State 190 + DEFAULT => -66 }, - {#State 195 + {#State 191 ACTIONS => { - ";" => 209 + ";" => 205 } }, - {#State 196 - DEFAULT => -66 + {#State 192 + DEFAULT => -65 }, - {#State 197 + {#State 193 ACTIONS => { 'IDENTIFIER' => 26, - "signed" => 100, - ";" => 210, - 'void' => 93, - "unsigned" => 104, + "signed" => 98, + ";" => 206, + 'void' => 92, + "unsigned" => 102, "[" => 20 }, - DEFAULT => -89, + DEFAULT => -85, GOTOS => { 'existingtype' => 99, - 'pipe' => 56, - 'bitmap' => 57, - 'usertype' => 95, - 'property_list' => 94, - 'identifier' => 96, - 'struct' => 62, - 'enum' => 65, - 'type' => 199, - 'union' => 67, - 'sign' => 97 + 'bitmap' => 56, + 'usertype' => 94, + 'property_list' => 93, + 'identifier' => 95, + 'struct' => 61, + 'enum' => 64, + 'type' => 183, + 'union' => 66, + 'sign' => 96 } }, - {#State 198 - DEFAULT => -79 - }, - {#State 199 - DEFAULT => -75, - GOTOS => { - 'pointers' => 211 - } + {#State 194 + DEFAULT => -77 }, - {#State 200 + {#State 195 ACTIONS => { - "-" => 69, - ":" => 68, - "<" => 71, - "+" => 73, - "~" => 72, - "*" => 80, - "?" => 70, - "{" => 74, - "&" => 75, - "/" => 76, - "=" => 77, - "(" => 78, - "|" => 79, - "." => 81, - ">" => 82 + "-" => 68, + ":" => 67, + "<" => 70, + "+" => 72, + "~" => 71, + "*" => 79, + "?" => 69, + "{" => 73, + "&" => 74, + "/" => 75, + "=" => 76, + "(" => 77, + "|" => 78, + "." => 80, + ">" => 81 }, - DEFAULT => -50 + DEFAULT => -49 }, - {#State 201 - DEFAULT => -48 + {#State 196 + DEFAULT => -47 }, - {#State 202 - DEFAULT => -56 + {#State 197 + DEFAULT => -55 }, - {#State 203 + {#State 198 ACTIONS => { - "-" => 69, - ":" => 68, - "<" => 71, - "+" => 73, - "~" => 72, - "*" => 80, - "?" => 70, - "{" => 74, - "&" => 75, - "/" => 76, - "=" => 77, - "(" => 78, - "|" => 79, - "." => 81, - ">" => 82 + "-" => 68, + ":" => 67, + "<" => 70, + "+" => 72, + "~" => 71, + "*" => 79, + "?" => 69, + "{" => 73, + "&" => 74, + "/" => 75, + "=" => 76, + "(" => 77, + "|" => 78, + "." => 80, + ">" => 81 }, - DEFAULT => -59 + DEFAULT => -58 }, - {#State 204 - DEFAULT => -89, + {#State 199 + ACTIONS => { + 'IDENTIFIER' => 26, + "*" => 149 + }, GOTOS => { - 'base_element' => 212, - 'property_list' => 180 + 'identifier' => 207 } }, - {#State 205 + {#State 200 + DEFAULT => -81 + }, + {#State 201 DEFAULT => -28 }, - {#State 206 + {#State 202 ACTIONS => { - "-" => 69, - ":" => 68, - "?" => 70, - "<" => 71, - ";" => 213, - "+" => 73, - "~" => 72, - "&" => 75, - "{" => 74, - "/" => 76, - "=" => 77, - "|" => 79, - "(" => 78, - "*" => 80, - "." => 81, - ">" => 82 + "-" => 68, + ":" => 67, + "?" => 69, + "<" => 70, + ";" => 208, + "+" => 72, + "~" => 71, + "&" => 74, + "{" => 73, + "/" => 75, + "=" => 76, + "|" => 78, + "(" => 77, + "*" => 79, + "." => 80, + ">" => 81 } }, - {#State 207 + {#State 203 DEFAULT => -26 }, - {#State 208 - DEFAULT => -88 - }, - {#State 209 - DEFAULT => -65 + {#State 204 + DEFAULT => -84 }, - {#State 210 + {#State 205 DEFAULT => -64 }, - {#State 211 + {#State 206 + DEFAULT => -63 + }, + {#State 207 ACTIONS => { - 'IDENTIFIER' => 26, - "*" => 152 + "[" => 152 }, + DEFAULT => -82, GOTOS => { - 'identifier' => 214 + 'array_len' => 209 } }, - {#State 212 - DEFAULT => -85 - }, - {#State 213 + {#State 208 DEFAULT => -27 }, - {#State 214 - ACTIONS => { - "[" => 155 - }, - DEFAULT => -86, - GOTOS => { - 'array_len' => 215 - } - }, - {#State 215 - DEFAULT => -74 + {#State 209 + DEFAULT => -73 } ], yyrules => @@ -1765,96 +1710,96 @@ sub new { [#Rule 2 'idl', 2, sub -#line 20 "./../pidl/idl.yp" +#line 19 "pidl/idl.yp" { push(@{$_[1]}, $_[2]); $_[1] } ], [#Rule 3 'idl', 2, sub -#line 22 "./../pidl/idl.yp" +#line 20 "pidl/idl.yp" { push(@{$_[1]}, $_[2]); $_[1] } ], [#Rule 4 'idl', 2, sub -#line 24 "./../pidl/idl.yp" +#line 21 "pidl/idl.yp" { push(@{$_[1]}, $_[2]); $_[1] } ], [#Rule 5 'idl', 2, sub -#line 26 "./../pidl/idl.yp" +#line 22 "pidl/idl.yp" { push(@{$_[1]}, $_[2]); $_[1] } ], [#Rule 6 'idl', 2, sub -#line 28 "./../pidl/idl.yp" +#line 23 "pidl/idl.yp" { push(@{$_[1]}, $_[2]); $_[1] } ], [#Rule 7 'idl', 2, sub -#line 30 "./../pidl/idl.yp" +#line 24 "pidl/idl.yp" { push(@{$_[1]}, $_[2]); $_[1] } ], [#Rule 8 'import', 3, sub -#line 35 "./../pidl/idl.yp" +#line 27 "pidl/idl.yp" {{ - "TYPE" => "IMPORT", - "PATHS" => $_[2], - "FILE" => $_[0]->YYData->{FILE}, - "LINE" => $_[0]->YYData->{LINE}, - }} + "TYPE" => "IMPORT", + "PATHS" => $_[2], + "FILE" => $_[0]->YYData->{FILE}, + "LINE" => $_[0]->YYData->{LINE} + }} ], [#Rule 9 'include', 3, sub -#line 45 "./../pidl/idl.yp" -{{ - "TYPE" => "INCLUDE", - "PATHS" => $_[2], - "FILE" => $_[0]->YYData->{FILE}, - "LINE" => $_[0]->YYData->{LINE}, - }} +#line 34 "pidl/idl.yp" +{{ + "TYPE" => "INCLUDE", + "PATHS" => $_[2], + "FILE" => $_[0]->YYData->{FILE}, + "LINE" => $_[0]->YYData->{LINE} + }} ], [#Rule 10 'importlib', 3, sub -#line 55 "./../pidl/idl.yp" -{{ - "TYPE" => "IMPORTLIB", - "PATHS" => $_[2], - "FILE" => $_[0]->YYData->{FILE}, - "LINE" => $_[0]->YYData->{LINE}, - }} +#line 41 "pidl/idl.yp" +{{ + "TYPE" => "IMPORTLIB", + "PATHS" => $_[2], + "FILE" => $_[0]->YYData->{FILE}, + "LINE" => $_[0]->YYData->{LINE} + }} ], [#Rule 11 'commalist', 1, sub -#line 64 "./../pidl/idl.yp" +#line 50 "pidl/idl.yp" { [ $_[1] ] } ], [#Rule 12 'commalist', 3, sub -#line 66 "./../pidl/idl.yp" +#line 51 "pidl/idl.yp" { push(@{$_[1]}, $_[3]); $_[1] } ], [#Rule 13 'coclass', 7, sub -#line 71 "./../pidl/idl.yp" +#line 55 "pidl/idl.yp" {{ - "TYPE" => "COCLASS", - "PROPERTIES" => $_[1], - "NAME" => $_[3], - "DATA" => $_[5], - "FILE" => $_[0]->YYData->{FILE}, - "LINE" => $_[0]->YYData->{LINE}, - }} + "TYPE" => "COCLASS", + "PROPERTIES" => $_[1], + "NAME" => $_[3], + "DATA" => $_[5], + "FILE" => $_[0]->YYData->{FILE}, + "LINE" => $_[0]->YYData->{LINE}, + }} ], [#Rule 14 'interface_names', 0, undef @@ -1862,22 +1807,22 @@ sub [#Rule 15 'interface_names', 4, sub -#line 84 "./../pidl/idl.yp" +#line 67 "pidl/idl.yp" { push(@{$_[1]}, $_[2]); $_[1] } ], [#Rule 16 'interface', 8, sub -#line 89 "./../pidl/idl.yp" +#line 71 "pidl/idl.yp" {{ - "TYPE" => "INTERFACE", - "PROPERTIES" => $_[1], - "NAME" => $_[3], - "BASE" => $_[4], - "DATA" => $_[6], - "FILE" => $_[0]->YYData->{FILE}, - "LINE" => $_[0]->YYData->{LINE}, - }} + "TYPE" => "INTERFACE", + "PROPERTIES" => $_[1], + "NAME" => $_[3], + "BASE" => $_[4], + "DATA" => $_[6], + "FILE" => $_[0]->YYData->{FILE}, + "LINE" => $_[0]->YYData->{LINE}, + }} ], [#Rule 17 'base_interface', 0, undef @@ -1885,30 +1830,30 @@ sub [#Rule 18 'base_interface', 2, sub -#line 103 "./../pidl/idl.yp" +#line 84 "pidl/idl.yp" { $_[2] } ], [#Rule 19 'cpp_quote', 4, sub -#line 109 "./../pidl/idl.yp" +#line 89 "pidl/idl.yp" {{ "TYPE" => "CPP_QUOTE", - "DATA" => $_[3], "FILE" => $_[0]->YYData->{FILE}, "LINE" => $_[0]->YYData->{LINE}, + "DATA" => $_[3] }} ], [#Rule 20 'definitions', 1, sub -#line 118 "./../pidl/idl.yp" +#line 98 "pidl/idl.yp" { [ $_[1] ] } ], [#Rule 21 'definitions', 2, sub -#line 120 "./../pidl/idl.yp" +#line 99 "pidl/idl.yp" { push(@{$_[1]}, $_[2]); $_[1] } ], [#Rule 22 @@ -1926,36 +1871,36 @@ sub [#Rule 26 'const', 7, sub -#line 135 "./../pidl/idl.yp" +#line 107 "pidl/idl.yp" {{ - "TYPE" => "CONST", - "DTYPE" => $_[2], - "POINTERS" => $_[3], - "NAME" => $_[4], - "VALUE" => $_[6], - "FILE" => $_[0]->YYData->{FILE}, - "LINE" => $_[0]->YYData->{LINE}, - }} + "TYPE" => "CONST", + "DTYPE" => $_[2], + "POINTERS" => $_[3], + "NAME" => $_[4], + "VALUE" => $_[6], + "FILE" => $_[0]->YYData->{FILE}, + "LINE" => $_[0]->YYData->{LINE}, + }} ], [#Rule 27 'const', 8, sub -#line 146 "./../pidl/idl.yp" +#line 117 "pidl/idl.yp" {{ - "TYPE" => "CONST", - "DTYPE" => $_[2], - "POINTERS" => $_[3], - "NAME" => $_[4], - "ARRAY_LEN" => $_[5], - "VALUE" => $_[7], - "FILE" => $_[0]->YYData->{FILE}, - "LINE" => $_[0]->YYData->{LINE}, - }} + "TYPE" => "CONST", + "DTYPE" => $_[2], + "POINTERS" => $_[3], + "NAME" => $_[4], + "ARRAY_LEN" => $_[5], + "VALUE" => $_[7], + "FILE" => $_[0]->YYData->{FILE}, + "LINE" => $_[0]->YYData->{LINE}, + }} ], [#Rule 28 'function', 7, sub -#line 160 "./../pidl/idl.yp" +#line 131 "pidl/idl.yp" {{ "TYPE" => "FUNCTION", "NAME" => $_[3], @@ -1964,20 +1909,20 @@ sub "ELEMENTS" => $_[5], "FILE" => $_[0]->YYData->{FILE}, "LINE" => $_[0]->YYData->{LINE}, - }} + }} ], [#Rule 29 'typedef', 6, sub -#line 173 "./../pidl/idl.yp" +#line 143 "pidl/idl.yp" {{ - "TYPE" => "TYPEDEF", - "PROPERTIES" => $_[1], - "NAME" => $_[4], - "DATA" => $_[3], - "ARRAY_LEN" => $_[5], - "FILE" => $_[0]->YYData->{FILE}, - "LINE" => $_[0]->YYData->{LINE}, + "TYPE" => "TYPEDEF", + "PROPERTIES" => $_[1], + "NAME" => $_[4], + "DATA" => $_[3], + "ARRAY_LEN" => $_[5], + "FILE" => $_[0]->YYData->{FILE}, + "LINE" => $_[0]->YYData->{LINE}, }} ], [#Rule 30 @@ -1993,480 +1938,450 @@ sub 'usertype', 1, undef ], [#Rule 34 - 'usertype', 1, undef - ], - [#Rule 35 'typedecl', 2, sub -#line 197 "./../pidl/idl.yp" +#line 156 "pidl/idl.yp" { $_[1] } ], - [#Rule 36 + [#Rule 35 'sign', 1, undef ], - [#Rule 37 + [#Rule 36 'sign', 1, undef ], - [#Rule 38 + [#Rule 37 'existingtype', 2, sub -#line 207 "./../pidl/idl.yp" +#line 161 "pidl/idl.yp" { ($_[1]?$_[1]:"signed") ." $_[2]" } ], - [#Rule 39 + [#Rule 38 'existingtype', 1, undef ], - [#Rule 40 + [#Rule 39 'type', 1, undef ], - [#Rule 41 + [#Rule 40 'type', 1, undef ], - [#Rule 42 + [#Rule 41 'type', 1, sub -#line 217 "./../pidl/idl.yp" +#line 165 "pidl/idl.yp" { "void" } ], - [#Rule 43 + [#Rule 42 'enum_body', 3, sub -#line 221 "./../pidl/idl.yp" +#line 167 "pidl/idl.yp" { $_[2] } ], - [#Rule 44 + [#Rule 43 'opt_enum_body', 0, undef ], - [#Rule 45 + [#Rule 44 'opt_enum_body', 1, undef ], - [#Rule 46 + [#Rule 45 'enum', 4, sub -#line 232 "./../pidl/idl.yp" +#line 170 "pidl/idl.yp" {{ - "TYPE" => "ENUM", - "PROPERTIES" => $_[1], - "NAME" => $_[3], - "ELEMENTS" => $_[4], - "FILE" => $_[0]->YYData->{FILE}, - "LINE" => $_[0]->YYData->{LINE}, - }} + "TYPE" => "ENUM", + "PROPERTIES" => $_[1], + "NAME" => $_[3], + "ELEMENTS" => $_[4] + }} ], - [#Rule 47 + [#Rule 46 'enum_elements', 1, sub -#line 243 "./../pidl/idl.yp" +#line 179 "pidl/idl.yp" { [ $_[1] ] } ], - [#Rule 48 + [#Rule 47 'enum_elements', 3, sub -#line 245 "./../pidl/idl.yp" +#line 180 "pidl/idl.yp" { push(@{$_[1]}, $_[3]); $_[1] } ], - [#Rule 49 + [#Rule 48 'enum_element', 1, undef ], - [#Rule 50 + [#Rule 49 'enum_element', 3, sub -#line 251 "./../pidl/idl.yp" +#line 184 "pidl/idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 51 + [#Rule 50 'bitmap_body', 3, sub -#line 255 "./../pidl/idl.yp" +#line 187 "pidl/idl.yp" { $_[2] } ], - [#Rule 52 + [#Rule 51 'opt_bitmap_body', 0, undef ], - [#Rule 53 + [#Rule 52 'opt_bitmap_body', 1, undef ], - [#Rule 54 + [#Rule 53 'bitmap', 4, sub -#line 266 "./../pidl/idl.yp" +#line 190 "pidl/idl.yp" {{ - "TYPE" => "BITMAP", - "PROPERTIES" => $_[1], - "NAME" => $_[3], - "ELEMENTS" => $_[4], - "FILE" => $_[0]->YYData->{FILE}, - "LINE" => $_[0]->YYData->{LINE}, - }} + "TYPE" => "BITMAP", + "PROPERTIES" => $_[1], + "NAME" => $_[3], + "ELEMENTS" => $_[4] + }} ], - [#Rule 55 + [#Rule 54 'bitmap_elements', 1, sub -#line 277 "./../pidl/idl.yp" +#line 199 "pidl/idl.yp" { [ $_[1] ] } ], - [#Rule 56 + [#Rule 55 'bitmap_elements', 3, sub -#line 279 "./../pidl/idl.yp" +#line 200 "pidl/idl.yp" { push(@{$_[1]}, $_[3]); $_[1] } ], - [#Rule 57 + [#Rule 56 'opt_bitmap_elements', 0, undef ], - [#Rule 58 + [#Rule 57 'opt_bitmap_elements', 1, undef ], - [#Rule 59 + [#Rule 58 'bitmap_element', 3, sub -#line 289 "./../pidl/idl.yp" +#line 205 "pidl/idl.yp" { "$_[1] ( $_[3] )" } ], - [#Rule 60 + [#Rule 59 'struct_body', 3, sub -#line 293 "./../pidl/idl.yp" +#line 208 "pidl/idl.yp" { $_[2] } ], - [#Rule 61 + [#Rule 60 'opt_struct_body', 0, undef ], - [#Rule 62 + [#Rule 61 'opt_struct_body', 1, undef ], - [#Rule 63 + [#Rule 62 'struct', 4, sub -#line 304 "./../pidl/idl.yp" +#line 212 "pidl/idl.yp" {{ - "TYPE" => "STRUCT", - "PROPERTIES" => $_[1], - "NAME" => $_[3], - "ELEMENTS" => $_[4], - "FILE" => $_[0]->YYData->{FILE}, - "LINE" => $_[0]->YYData->{LINE}, - }} + "TYPE" => "STRUCT", + "PROPERTIES" => $_[1], + "NAME" => $_[3], + "ELEMENTS" => $_[4] + }} ], - [#Rule 64 + [#Rule 63 'empty_element', 2, sub -#line 316 "./../pidl/idl.yp" +#line 221 "pidl/idl.yp" {{ - "NAME" => "", - "TYPE" => "EMPTY", - "PROPERTIES" => $_[1], - "POINTERS" => 0, - "ARRAY_LEN" => [], - "FILE" => $_[0]->YYData->{FILE}, - "LINE" => $_[0]->YYData->{LINE}, - }} + "NAME" => "", + "TYPE" => "EMPTY", + "PROPERTIES" => $_[1], + "POINTERS" => 0, + "ARRAY_LEN" => [], + "FILE" => $_[0]->YYData->{FILE}, + "LINE" => $_[0]->YYData->{LINE}, + }} ], - [#Rule 65 + [#Rule 64 'base_or_empty', 2, undef ], - [#Rule 66 + [#Rule 65 'base_or_empty', 1, undef ], - [#Rule 67 + [#Rule 66 'optional_base_element', 2, sub -#line 333 "./../pidl/idl.yp" +#line 235 "pidl/idl.yp" { $_[2]->{PROPERTIES} = FlattenHash([$_[1],$_[2]->{PROPERTIES}]); $_[2] } ], - [#Rule 68 + [#Rule 67 'union_elements', 0, undef ], - [#Rule 69 + [#Rule 68 'union_elements', 2, sub -#line 339 "./../pidl/idl.yp" +#line 240 "pidl/idl.yp" { push(@{$_[1]}, $_[2]); $_[1] } ], - [#Rule 70 + [#Rule 69 'union_body', 3, sub -#line 343 "./../pidl/idl.yp" +#line 243 "pidl/idl.yp" { $_[2] } ], - [#Rule 71 + [#Rule 70 'opt_union_body', 0, undef ], - [#Rule 72 + [#Rule 71 'opt_union_body', 1, undef ], - [#Rule 73 + [#Rule 72 'union', 4, sub -#line 354 "./../pidl/idl.yp" +#line 247 "pidl/idl.yp" {{ - "TYPE" => "UNION", - "PROPERTIES" => $_[1], - "NAME" => $_[3], - "ELEMENTS" => $_[4], - "FILE" => $_[0]->YYData->{FILE}, - "LINE" => $_[0]->YYData->{LINE}, - }} + "TYPE" => "UNION", + "PROPERTIES" => $_[1], + "NAME" => $_[3], + "ELEMENTS" => $_[4] + }} ], - [#Rule 74 + [#Rule 73 'base_element', 5, sub -#line 366 "./../pidl/idl.yp" +#line 256 "pidl/idl.yp" {{ - "NAME" => $_[4], - "TYPE" => $_[2], - "PROPERTIES" => $_[1], - "POINTERS" => $_[3], - "ARRAY_LEN" => $_[5], - "FILE" => $_[0]->YYData->{FILE}, - "LINE" => $_[0]->YYData->{LINE}, - }} + "NAME" => $_[4], + "TYPE" => $_[2], + "PROPERTIES" => $_[1], + "POINTERS" => $_[3], + "ARRAY_LEN" => $_[5], + "FILE" => $_[0]->YYData->{FILE}, + "LINE" => $_[0]->YYData->{LINE}, + }} ], - [#Rule 75 + [#Rule 74 'pointers', 0, sub -#line 379 "./../pidl/idl.yp" +#line 270 "pidl/idl.yp" { 0 } ], - [#Rule 76 + [#Rule 75 'pointers', 2, sub -#line 381 "./../pidl/idl.yp" +#line 271 "pidl/idl.yp" { $_[1]+1 } ], - [#Rule 77 - 'pipe', 3, -sub -#line 386 "./../pidl/idl.yp" -{{ - "TYPE" => "PIPE", - "PROPERTIES" => $_[1], - "NAME" => $_[4], - "DATA" => $_[3], - "FILE" => $_[0]->YYData->{FILE}, - "LINE" => $_[0]->YYData->{LINE}, - }} - ], - [#Rule 78 + [#Rule 76 'element_list1', 0, sub -#line 398 "./../pidl/idl.yp" +#line 275 "pidl/idl.yp" { [] } ], - [#Rule 79 + [#Rule 77 'element_list1', 3, sub -#line 400 "./../pidl/idl.yp" +#line 276 "pidl/idl.yp" { push(@{$_[1]}, $_[2]); $_[1] } ], - [#Rule 80 - 'optional_const', 0, undef - ], - [#Rule 81 - 'optional_const', 1, undef - ], - [#Rule 82 + [#Rule 78 'element_list2', 0, undef ], - [#Rule 83 + [#Rule 79 'element_list2', 1, undef ], - [#Rule 84 - 'element_list2', 2, + [#Rule 80 + 'element_list2', 1, sub -#line 414 "./../pidl/idl.yp" -{ [ $_[2] ] } +#line 282 "pidl/idl.yp" +{ [ $_[1] ] } ], - [#Rule 85 - 'element_list2', 4, + [#Rule 81 + 'element_list2', 3, sub -#line 416 "./../pidl/idl.yp" -{ push(@{$_[1]}, $_[4]); $_[1] } +#line 283 "pidl/idl.yp" +{ push(@{$_[1]}, $_[3]); $_[1] } ], - [#Rule 86 + [#Rule 82 'array_len', 0, undef ], - [#Rule 87 + [#Rule 83 'array_len', 3, sub -#line 422 "./../pidl/idl.yp" +#line 288 "pidl/idl.yp" { push(@{$_[3]}, "*"); $_[3] } ], - [#Rule 88 + [#Rule 84 'array_len', 4, sub -#line 424 "./../pidl/idl.yp" +#line 289 "pidl/idl.yp" { push(@{$_[4]}, "$_[2]"); $_[4] } ], - [#Rule 89 + [#Rule 85 'property_list', 0, undef ], - [#Rule 90 + [#Rule 86 'property_list', 4, sub -#line 430 "./../pidl/idl.yp" +#line 295 "pidl/idl.yp" { FlattenHash([$_[1],$_[3]]); } ], - [#Rule 91 + [#Rule 87 'properties', 1, sub -#line 434 "./../pidl/idl.yp" +#line 298 "pidl/idl.yp" { $_[1] } ], - [#Rule 92 + [#Rule 88 'properties', 3, sub -#line 436 "./../pidl/idl.yp" +#line 299 "pidl/idl.yp" { FlattenHash([$_[1], $_[3]]); } ], - [#Rule 93 + [#Rule 89 'property', 1, sub -#line 440 "./../pidl/idl.yp" +#line 302 "pidl/idl.yp" {{ "$_[1]" => "1" }} ], - [#Rule 94 + [#Rule 90 'property', 4, sub -#line 442 "./../pidl/idl.yp" +#line 303 "pidl/idl.yp" {{ "$_[1]" => "$_[3]" }} ], - [#Rule 95 + [#Rule 91 'commalisttext', 1, undef ], - [#Rule 96 + [#Rule 92 'commalisttext', 3, sub -#line 448 "./../pidl/idl.yp" +#line 308 "pidl/idl.yp" { "$_[1],$_[3]" } ], - [#Rule 97 + [#Rule 93 'anytext', 0, sub -#line 453 "./../pidl/idl.yp" +#line 312 "pidl/idl.yp" { "" } ], - [#Rule 98 + [#Rule 94 'anytext', 1, undef ], - [#Rule 99 + [#Rule 95 'anytext', 1, undef ], - [#Rule 100 + [#Rule 96 'anytext', 1, undef ], - [#Rule 101 + [#Rule 97 'anytext', 3, sub -#line 461 "./../pidl/idl.yp" +#line 314 "pidl/idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 102 + [#Rule 98 'anytext', 3, sub -#line 463 "./../pidl/idl.yp" +#line 315 "pidl/idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 103 + [#Rule 99 'anytext', 3, sub -#line 465 "./../pidl/idl.yp" +#line 316 "pidl/idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 104 + [#Rule 100 'anytext', 3, sub -#line 467 "./../pidl/idl.yp" +#line 317 "pidl/idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 105 + [#Rule 101 'anytext', 3, sub -#line 469 "./../pidl/idl.yp" +#line 318 "pidl/idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 106 + [#Rule 102 'anytext', 3, sub -#line 471 "./../pidl/idl.yp" +#line 319 "pidl/idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 107 + [#Rule 103 'anytext', 3, sub -#line 473 "./../pidl/idl.yp" +#line 320 "pidl/idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 108 + [#Rule 104 'anytext', 3, sub -#line 475 "./../pidl/idl.yp" +#line 321 "pidl/idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 109 + [#Rule 105 'anytext', 3, sub -#line 477 "./../pidl/idl.yp" +#line 322 "pidl/idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 110 + [#Rule 106 'anytext', 3, sub -#line 479 "./../pidl/idl.yp" +#line 323 "pidl/idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 111 + [#Rule 107 'anytext', 3, sub -#line 481 "./../pidl/idl.yp" +#line 324 "pidl/idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 112 + [#Rule 108 'anytext', 3, sub -#line 483 "./../pidl/idl.yp" +#line 325 "pidl/idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 113 + [#Rule 109 'anytext', 3, sub -#line 485 "./../pidl/idl.yp" +#line 326 "pidl/idl.yp" { "$_[1]$_[2]$_[3]" } ], - [#Rule 114 + [#Rule 110 'anytext', 5, sub -#line 487 "./../pidl/idl.yp" +#line 327 "pidl/idl.yp" { "$_[1]$_[2]$_[3]$_[4]$_[5]" } ], - [#Rule 115 + [#Rule 111 'anytext', 5, sub -#line 489 "./../pidl/idl.yp" +#line 328 "pidl/idl.yp" { "$_[1]$_[2]$_[3]$_[4]$_[5]" } ], - [#Rule 116 + [#Rule 112 'identifier', 1, undef ], - [#Rule 117 - 'optional_identifier', 0, undef - ], - [#Rule 118 + [#Rule 113 'optional_identifier', 1, undef ], - [#Rule 119 + [#Rule 114 + 'optional_identifier', 0, undef + ], + [#Rule 115 'constant', 1, undef ], - [#Rule 120 + [#Rule 116 'text', 1, sub -#line 507 "./../pidl/idl.yp" +#line 342 "pidl/idl.yp" { "\"$_[1]\"" } ], - [#Rule 121 + [#Rule 117 'optional_semicolon', 0, undef ], - [#Rule 122 + [#Rule 118 'optional_semicolon', 1, undef ] ], @@ -2474,63 +2389,58 @@ sub bless($self,$class); } -#line 519 "./../pidl/idl.yp" +#line 353 "pidl/idl.yp" use Parse::Pidl qw(error); ##################################################################### # flatten an array of hashes into a single hash -sub FlattenHash($) -{ - my $a = shift; - my %b; - for my $d (@{$a}) { - for my $k (keys %{$d}) { - $b{$k} = $d->{$k}; - } +sub FlattenHash($) +{ + my $a = shift; + my %b; + for my $d (@{$a}) { + for my $k (keys %{$d}) { + $b{$k} = $d->{$k}; } - return \%b; + } + return \%b; } + + ##################################################################### # traverse a perl data structure removing any empty arrays or # hashes and any hash elements that map to undef sub CleanData($) { - sub CleanData($); - my($v) = shift; - + sub CleanData($); + my($v) = shift; return undef if (not defined($v)); - - if (ref($v) eq "ARRAY") { - foreach my $i (0 .. $#{$v}) { - CleanData($v->[$i]); - } - # this removes any undefined elements from the array - @{$v} = grep { defined $_ } @{$v}; - } elsif (ref($v) eq "HASH") { - foreach my $x (keys %{$v}) { - CleanData($v->{$x}); - if (!defined $v->{$x}) { - delete($v->{$x}); - next; - } - } + if (ref($v) eq "ARRAY") { + foreach my $i (0 .. $#{$v}) { + CleanData($v->[$i]); } - + # this removes any undefined elements from the array + @{$v} = grep { defined $_ } @{$v}; + } elsif (ref($v) eq "HASH") { + foreach my $x (keys %{$v}) { + CleanData($v->{$x}); + if (!defined $v->{$x}) { delete($v->{$x}); next; } + } + } return $v; } sub _Error { - if (exists $_[0]->YYData->{ERRMSG}) { + if (exists $_[0]->YYData->{ERRMSG}) { error($_[0]->YYData, $_[0]->YYData->{ERRMSG}); delete $_[0]->YYData->{ERRMSG}; return; } - my $last_token = $_[0]->YYData->{LAST_TOKEN}; - + error($_[0]->YYData, "Syntax error near '$last_token'"); } @@ -2538,7 +2448,7 @@ sub _Lexer($) { my($parser)=shift; - $parser->YYData->{INPUT} or return('',undef); + $parser->YYData->{INPUT} or return('',undef); again: $parser->YYData->{INPUT} =~ s/^[ \t]*//; @@ -2565,19 +2475,18 @@ again: } if (s/^\"(.*?)\"//) { $parser->YYData->{LAST_TOKEN} = $1; - return('TEXT',$1); + return('TEXT',$1); } if (s/^(\d+)(\W|$)/$2/) { $parser->YYData->{LAST_TOKEN} = $1; - return('CONSTANT',$1); + return('CONSTANT',$1); } if (s/^([\w_]+)//) { $parser->YYData->{LAST_TOKEN} = $1; - if ($1 =~ - /^(coclass|interface|import|importlib - |include|cpp_quote|typedef - |union|struct|enum|bitmap|pipe - |void|const|unsigned|signed)$/x) { + if ($1 =~ + /^(coclass|interface|const|typedef|union|cpp_quote + |struct|enum|bitmap|void|unsigned|signed|import|include + |importlib)$/x) { return $1; } return('IDENTIFIER',$1); @@ -2595,10 +2504,10 @@ sub parse_string my $self = new Parse::Pidl::IDL; - $self->YYData->{FILE} = $filename; - $self->YYData->{INPUT} = $data; - $self->YYData->{LINE} = 0; - $self->YYData->{LAST_TOKEN} = "NONE"; + $self->YYData->{FILE} = $filename; + $self->YYData->{INPUT} = $data; + $self->YYData->{LINE} = 0; + $self->YYData->{LAST_TOKEN} = "NONE"; my $idl = $self->YYParse( yylex => \&_Lexer, yyerror => \&_Error ); diff --git a/pidl/lib/Parse/Pidl/NDR.pm b/pidl/lib/Parse/Pidl/NDR.pm index fbd54693bc..5ee26d16b6 100644 --- a/pidl/lib/Parse/Pidl/NDR.pm +++ b/pidl/lib/Parse/Pidl/NDR.pm @@ -50,12 +50,9 @@ my $scalar_alignment = { 'uint8' => 1, 'int16' => 2, 'uint16' => 2, - 'int1632' => 3, - 'uint1632' => 3, 'int32' => 4, 'uint32' => 4, 'hyper' => 8, - 'double' => 8, 'pointer' => 8, 'dlong' => 4, 'udlong' => 4, @@ -144,13 +141,6 @@ sub GetElementLevelTable($$) $is_fixed = 1 if (not $is_conformant and Parse::Pidl::Util::is_constant($size)); $is_inline = 1 if (not $is_conformant and not Parse::Pidl::Util::is_constant($size)); - if ($i == 0 and $is_fixed and has_property($e, "string")) { - $is_fixed = 0; - $is_varying = 1; - $is_string = 1; - delete($e->{PROPERTIES}->{string}); - } - push (@$order, { TYPE => "ARRAY", SIZE_IS => $size, @@ -365,10 +355,7 @@ sub find_largest_alignment($) my $a = 1; if ($e->{POINTERS}) { - # this is a hack for NDR64 - # the NDR layer translates this into - # an alignment of 4 for NDR and 8 for NDR64 - $a = 5; + $a = 4; } elsif (has_property($e, "subcontext")) { $a = 1; } elsif (has_property($e, "transmit_as")) { @@ -511,8 +498,7 @@ sub ParseUnion($$) ELEMENTS => undef, PROPERTIES => $e->{PROPERTIES}, HAS_DEFAULT => $hasdefault, - ORIGINAL => $e, - ALIGN => undef + ORIGINAL => $e } unless defined($e->{ELEMENTS}); CheckPointerTypes($e, $pointer_default); @@ -536,11 +522,6 @@ sub ParseUnion($$) push @elements, $t; } - my $align = undef; - if ($e->{NAME}) { - $align = align_type($e->{NAME}); - } - return { TYPE => "UNION", NAME => $e->{NAME}, @@ -548,8 +529,7 @@ sub ParseUnion($$) ELEMENTS => \@elements, PROPERTIES => $e->{PROPERTIES}, HAS_DEFAULT => $hasdefault, - ORIGINAL => $e, - ALIGN => $align + ORIGINAL => $e }; } @@ -940,7 +920,7 @@ my %property_list = ( "bitmap64bit" => ["BITMAP"], # array - "range" => ["ELEMENT", "PIPE"], + "range" => ["ELEMENT"], "size_is" => ["ELEMENT"], "string" => ["ELEMENT"], "noheader" => ["ELEMENT"], @@ -1132,18 +1112,6 @@ sub ValidUnion($) } ##################################################################### -# validate a pipe -sub ValidPipe($) -{ - my ($pipe) = @_; - my $data = $pipe->{DATA}; - - ValidProperties($pipe, "PIPE"); - - fatal($pipe, $pipe->{NAME} . ": 'pipe' is not yet supported by pidl"); -} - -##################################################################### # parse a typedef sub ValidTypedef($) { @@ -1188,8 +1156,7 @@ sub ValidType($) STRUCT => \&ValidStruct, UNION => \&ValidUnion, ENUM => \&ValidEnum, - BITMAP => \&ValidBitmap, - PIPE => \&ValidPipe + BITMAP => \&ValidBitmap }->{$t->{TYPE}}->($t); } @@ -1231,8 +1198,7 @@ sub ValidInterface($) $d->{TYPE} eq "STRUCT" or $d->{TYPE} eq "UNION" or $d->{TYPE} eq "ENUM" or - $d->{TYPE} eq "BITMAP" or - $d->{TYPE} eq "PIPE") && ValidType($d); + $d->{TYPE} eq "BITMAP") && ValidType($d); } } diff --git a/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm b/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm index 68579d2c9a..a45abdbc35 100644 --- a/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm +++ b/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm @@ -71,12 +71,10 @@ sub HeaderProperties($$) } } -sub ParseOutputArgument($$$;$$) +sub ParseOutputArgument($$$) { - my ($self, $fn, $e, $r, $o) = @_; + my ($self, $fn, $e) = @_; my $level = 0; - $r = "r." unless defined($r); - $o = "" unless defined($o); if ($e->{LEVELS}[0]->{TYPE} ne "POINTER" and $e->{LEVELS}[0]->{TYPE} ne "ARRAY") { $self->pidl("return NT_STATUS_NOT_SUPPORTED;"); @@ -87,7 +85,7 @@ sub ParseOutputArgument($$$;$$) if ($e->{LEVELS}[0]->{TYPE} eq "POINTER") { $level = 1; if ($e->{LEVELS}[0]->{POINTER_TYPE} ne "ref") { - $self->pidl("if ($o$e->{NAME} && ${r}out.$e->{NAME}) {"); + $self->pidl("if ($e->{NAME} && r.out.$e->{NAME}) {"); $self->indent; } } @@ -97,21 +95,15 @@ sub ParseOutputArgument($$$;$$) # Since the data is being copied into a user-provided data # structure, the user should be able to know the size beforehand # to allocate a structure of the right size. - my $env = GenerateFunctionInEnv($fn, $r); - my $l = $e->{LEVELS}[$level]; - unless (defined($l->{SIZE_IS})) { - error($e->{ORIGINAL}, "no size known for [out] array `$e->{NAME}'"); - $self->pidl('#error No size known for [out] array `$e->{NAME}'); + my $env = GenerateFunctionInEnv($fn, "r."); + my $size_is = ParseExpr($e->{LEVELS}[$level]->{SIZE_IS}, $env, $e->{ORIGINAL}); + if (has_property($e, "charset")) { + $self->pidl("memcpy(discard_const_p(uint8_t *, $e->{NAME}), r.out.$e->{NAME}, ($size_is) * sizeof(*$e->{NAME}));"); } else { - my $size_is = ParseExpr($l->{SIZE_IS}, $env, $e->{ORIGINAL}); - if (has_property($e, "charset")) { - $self->pidl("memcpy(discard_const_p(uint8_t *, $o$e->{NAME}), ${r}out.$e->{NAME}, ($size_is) * sizeof(*$o$e->{NAME}));"); - } else { - $self->pidl("memcpy($o$e->{NAME}, ${r}out.$e->{NAME}, ($size_is) * sizeof(*$o$e->{NAME}));"); - } + $self->pidl("memcpy($e->{NAME}, r.out.$e->{NAME}, ($size_is) * sizeof(*$e->{NAME}));"); } } else { - $self->pidl("*$o$e->{NAME} = *${r}out.$e->{NAME};"); + $self->pidl("*$e->{NAME} = *r.out.$e->{NAME};"); } if ($e->{LEVELS}[0]->{TYPE} eq "POINTER") { @@ -122,233 +114,7 @@ sub ParseOutputArgument($$$;$$) } } -sub ParseFunctionAsyncState($$$) -{ - my ($self, $if, $fn) = @_; - - my $state_str = "struct rpccli_$fn->{NAME}_state"; - my $done_fn = "rpccli_$fn->{NAME}_done"; - - $self->pidl("$state_str {"); - $self->indent; - $self->pidl("struct $fn->{NAME} orig;"); - $self->pidl("struct $fn->{NAME} tmp;"); - $self->pidl("TALLOC_CTX *out_mem_ctx;"); - $self->pidl("NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);"); - $self->deindent; - $self->pidl("};"); - $self->pidl(""); - $self->pidl("static void $done_fn(struct tevent_req *subreq);"); - $self->pidl(""); -} - -sub ParseFunctionAsyncSend($$$) -{ - my ($self, $if, $fn) = @_; - - my $fn_args = ""; - my $uif = uc($if); - my $ufn = "NDR_".uc($fn->{NAME}); - my $state_str = "struct rpccli_$fn->{NAME}_state"; - my $done_fn = "rpccli_$fn->{NAME}_done"; - my $out_mem_ctx = "rpccli_$fn->{NAME}_out_memory"; - my $fn_str = "struct tevent_req *rpccli_$fn->{NAME}_send"; - my $pad = genpad($fn_str); - - $fn_args .= "TALLOC_CTX *mem_ctx"; - $fn_args .= ",\n" . $pad . "struct tevent_context *ev"; - $fn_args .= ",\n" . $pad . "struct rpc_pipe_client *cli"; - - foreach (@{$fn->{ELEMENTS}}) { - my $dir = ElementDirection($_); - my $prop = HeaderProperties($_->{PROPERTIES}, ["in", "out"]); - $fn_args .= ",\n" . $pad . DeclLong($_, "_") . " /* $dir $prop */"; - } - - $self->fn_declare("$fn_str($fn_args)"); - $self->pidl("{"); - $self->indent; - $self->pidl("struct tevent_req *req;"); - $self->pidl("$state_str *state;"); - $self->pidl("struct tevent_req *subreq;"); - $self->pidl(""); - $self->pidl("req = tevent_req_create(mem_ctx, &state,"); - $self->pidl("\t\t\t$state_str);"); - $self->pidl("if (req == NULL) {"); - $self->indent; - $self->pidl("return NULL;"); - $self->deindent; - $self->pidl("}"); - $self->pidl("state->out_mem_ctx = NULL;"); - $self->pidl("state->dispatch_recv = cli->dispatch_recv;"); - $self->pidl(""); - - $self->pidl("/* In parameters */"); - foreach (@{$fn->{ELEMENTS}}) { - if (grep(/in/, @{$_->{DIRECTION}})) { - $self->pidl("state->orig.in.$_->{NAME} = _$_->{NAME};"); - } - } - $self->pidl(""); - - my $out_params = 0; - $self->pidl("/* Out parameters */"); - foreach (@{$fn->{ELEMENTS}}) { - if (grep(/out/, @{$_->{DIRECTION}})) { - $self->pidl("state->orig.out.$_->{NAME} = _$_->{NAME};"); - $out_params++; - } - } - $self->pidl(""); - - if (defined($fn->{RETURN_TYPE})) { - $self->pidl("/* Result */"); - $self->pidl("ZERO_STRUCT(state->orig.out.result);"); - $self->pidl(""); - } - - if ($out_params > 0) { - $self->pidl("state->out_mem_ctx = talloc_named_const(state, 0,"); - $self->pidl("\t\t \"$out_mem_ctx\");"); - $self->pidl("if (tevent_req_nomem(state->out_mem_ctx, req)) {"); - $self->indent; - $self->pidl("return tevent_req_post(req, ev);"); - $self->deindent; - $self->pidl("}"); - $self->pidl(""); - } - - $self->pidl("/* make a temporary copy, that we pass to the dispatch function */"); - $self->pidl("state->tmp = state->orig;"); - $self->pidl(""); - - $self->pidl("subreq = cli->dispatch_send(state, ev, cli,"); - $self->pidl("\t\t\t &ndr_table_$if,"); - $self->pidl("\t\t\t $ufn,"); - $self->pidl("\t\t\t &state->tmp);"); - $self->pidl("if (tevent_req_nomem(subreq, req)) {"); - $self->indent; - $self->pidl("return tevent_req_post(req, ev);"); - $self->deindent; - $self->pidl("}"); - $self->pidl("tevent_req_set_callback(subreq, $done_fn, req);"); - $self->pidl("return req;"); - $self->deindent; - $self->pidl("}"); - $self->pidl(""); -} - -sub ParseFunctionAsyncDone($$$) -{ - my ($self, $if, $fn) = @_; - - my $state_str = "struct rpccli_$fn->{NAME}_state"; - my $done_fn = "rpccli_$fn->{NAME}_done"; - - $self->pidl("static void $done_fn(struct tevent_req *subreq)"); - $self->pidl("{"); - $self->indent; - $self->pidl("struct tevent_req *req = tevent_req_callback_data("); - $self->pidl("\tsubreq, struct tevent_req);"); - $self->pidl("$state_str *state = tevent_req_data("); - $self->pidl("\treq, $state_str);"); - $self->pidl("NTSTATUS status;"); - $self->pidl("TALLOC_CTX *mem_ctx;"); - $self->pidl(""); - - $self->pidl("if (state->out_mem_ctx) {"); - $self->indent; - $self->pidl("mem_ctx = state->out_mem_ctx;"); - $self->deindent; - $self->pidl("} else {"); - $self->indent; - $self->pidl("mem_ctx = state;"); - $self->deindent; - $self->pidl("}"); - $self->pidl(""); - - $self->pidl("status = state->dispatch_recv(subreq, mem_ctx);"); - $self->pidl("TALLOC_FREE(subreq);"); - $self->pidl("if (!NT_STATUS_IS_OK(status)) {"); - $self->indent; - $self->pidl("tevent_req_nterror(req, status);"); - $self->pidl("return;"); - $self->deindent; - $self->pidl("}"); - $self->pidl(""); - - $self->pidl("/* Copy out parameters */"); - foreach my $e (@{$fn->{ELEMENTS}}) { - next unless (grep(/out/, @{$e->{DIRECTION}})); - - $self->ParseOutputArgument($fn, $e, "state->tmp.", "state->orig.out."); - } - $self->pidl(""); - - if (defined($fn->{RETURN_TYPE})) { - $self->pidl("/* Copy result */"); - $self->pidl("state->orig.out.result = state->tmp.out.result;"); - $self->pidl(""); - } - - $self->pidl("/* Reset temporary structure */"); - $self->pidl("ZERO_STRUCT(state->tmp);"); - $self->pidl(""); - - $self->pidl("tevent_req_done(req);"); - $self->deindent; - $self->pidl("}"); - $self->pidl(""); -} - -sub ParseFunctionAsyncRecv($$$) -{ - my ($self, $if, $fn) = @_; - - my $fn_args = ""; - my $state_str = "struct rpccli_$fn->{NAME}_state"; - my $fn_str = "NTSTATUS rpccli_$fn->{NAME}_recv"; - my $pad = genpad($fn_str); - - $fn_args .= "struct tevent_req *req,\n" . $pad . "TALLOC_CTX *mem_ctx"; - - if (defined($fn->{RETURN_TYPE})) { - $fn_args .= ",\n" . $pad . "$fn->{RETURN_TYPE} *result"; - } - - $self->fn_declare("$fn_str($fn_args)"); - $self->pidl("{"); - $self->indent; - $self->pidl("$state_str *state = tevent_req_data("); - $self->pidl("\treq, $state_str);"); - $self->pidl("NTSTATUS status;"); - $self->pidl(""); - $self->pidl("if (tevent_req_is_nterror(req, &status)) {"); - $self->indent; - $self->pidl("tevent_req_received(req);"); - $self->pidl("return status;"); - $self->deindent; - $self->pidl("}"); - $self->pidl(""); - - $self->pidl("/* Steal possbile out parameters to the callers context */"); - $self->pidl("talloc_steal(mem_ctx, state->out_mem_ctx);"); - $self->pidl(""); - - if (defined($fn->{RETURN_TYPE})) { - $self->pidl("/* Return result */"); - $self->pidl("*result = state->orig.out.result;"); - $self->pidl(""); - } - - $self->pidl("tevent_req_received(req);"); - $self->pidl("return NT_STATUS_OK;"); - $self->deindent; - $self->pidl("}"); - $self->pidl(""); -} - -sub ParseFunctionSync($$$) +sub ParseFunction($$$) { my ($self, $if, $fn) = @_; @@ -385,6 +151,12 @@ sub ParseFunctionSync($$$) } $self->pidl(""); + $self->pidl("if (DEBUGLEVEL >= 10) {"); + $self->indent; + $self->pidl("NDR_PRINT_IN_DEBUG($fn->{NAME}, &r);"); + $self->deindent; + $self->pidl("}"); + $self->pidl(""); $self->pidl("status = cli->dispatch(cli,"); $self->pidl("\t\t\tmem_ctx,"); $self->pidl("\t\t\t&ndr_table_$if,"); @@ -399,6 +171,12 @@ sub ParseFunctionSync($$$) $self->pidl("}"); $self->pidl(""); + $self->pidl("if (DEBUGLEVEL >= 10) {"); + $self->indent; + $self->pidl("NDR_PRINT_OUT_DEBUG($fn->{NAME}, &r);"); + $self->deindent; + $self->pidl("}"); + $self->pidl(""); $self->pidl("if (NT_STATUS_IS_ERR(status)) {"); $self->indent; $self->pidl("return status;"); @@ -437,18 +215,6 @@ sub ParseFunctionSync($$$) $self->pidl(""); } -sub ParseFunction($$$) -{ - my ($self, $if, $fn) = @_; - - $self->ParseFunctionAsyncState($if, $fn); - $self->ParseFunctionAsyncSend($if, $fn); - $self->ParseFunctionAsyncDone($if, $fn); - $self->ParseFunctionAsyncRecv($if, $fn); - - $self->ParseFunctionSync($if, $fn); -} - sub ParseInterface($$) { my ($self, $if) = @_; diff --git a/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm b/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm index 5599de9d79..c9a8eea59f 100644 --- a/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm +++ b/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm @@ -11,7 +11,7 @@ use Exporter; @EXPORT_OK = qw(DeclLevel); use strict; -use Parse::Pidl qw(warning error fatal); +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); @@ -72,13 +72,8 @@ sub AllocOutVar($$$$$) } if ($l->{TYPE} eq "ARRAY") { - unless(defined($l->{SIZE_IS})) { - error($e->{ORIGINAL}, "No size known for array `$e->{NAME}'"); - pidl "#error No size known for array `$e->{NAME}'"; - } else { - my $size = ParseExpr($l->{SIZE_IS}, $env, $e); - pidl "$name = talloc_zero_array($mem_ctx, " . DeclLevel($e, 1) . ", $size);"; - } + my $size = ParseExpr($l->{SIZE_IS}, $env, $e); + pidl "$name = talloc_zero_array($mem_ctx, " . DeclLevel($e, 1) . ", $size);"; } else { pidl "$name = talloc_zero($mem_ctx, " . DeclLevel($e, 1) . ");"; } diff --git a/pidl/lib/Parse/Pidl/Samba4.pm b/pidl/lib/Parse/Pidl/Samba4.pm index 1deb708689..20c518dceb 100644 --- a/pidl/lib/Parse/Pidl/Samba4.pm +++ b/pidl/lib/Parse/Pidl/Samba4.pm @@ -102,11 +102,10 @@ sub ArrayBrackets($) return $res; } -sub DeclLong($;$) +sub DeclLong($) { - my ($e, $p) = @_; + my ($e) = shift; my $res = ""; - $p = "" unless defined($p); if (has_property($e, "represent_as")) { $res .= mapTypeName($e->{PROPERTIES}->{represent_as})." "; @@ -119,7 +118,7 @@ sub DeclLong($;$) $res .= ElementStars($e); } - $res .= $p.$e->{NAME}; + $res .= $e->{NAME}; $res .= ArrayBrackets($e); return $res; diff --git a/pidl/lib/Parse/Pidl/Samba4/Header.pm b/pidl/lib/Parse/Pidl/Samba4/Header.pm index be1df4b118..5315957946 100644 --- a/pidl/lib/Parse/Pidl/Samba4/Header.pm +++ b/pidl/lib/Parse/Pidl/Samba4/Header.pm @@ -120,20 +120,10 @@ sub HeaderEnum($$;$) pidl " {\n"; $tab_depth++; foreach my $e (@{$enum->{ELEMENTS}}) { - my @enum_els = (); unless ($first) { pidl ",\n"; } $first = 0; pidl tabs(); - @enum_els = split(/=/, $e); - if (@enum_els == 2) { - pidl $enum_els[0]; - pidl "=(int)"; - pidl "("; - pidl $enum_els[1]; - pidl ")"; - } else { - pidl $e; - } + pidl $e; } pidl "\n"; $tab_depth--; diff --git a/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm b/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm index 9d3ccaf8c8..f2a96a3037 100644 --- a/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm +++ b/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm @@ -34,9 +34,8 @@ sub ParseFunctionSend($$$) if (p->conn->flags & DCERPC_DEBUG_PRINT_IN) { NDR_PRINT_IN_DEBUG($name, r); } - - return dcerpc_ndr_request_send(p, NULL, &ndr_table_$interface->{NAME}, - NDR_$uname, true, mem_ctx, r); + + return dcerpc_ndr_request_send(p, NULL, &ndr_table_$interface->{NAME}, NDR_$uname, mem_ctx, r); "; } @@ -46,7 +45,6 @@ sub ParseFunctionSend($$$) sub ParseFunctionSync($$$) { my ($interface, $fn, $name) = @_; - my $uname = uc $name; my $proto = "NTSTATUS dcerpc_$name(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *r)"; @@ -57,14 +55,13 @@ sub ParseFunctionSync($$$) $res .= "\treturn NT_STATUS_NOT_IMPLEMENTED;\n"; } else { $res .= " + struct rpc_request *req; NTSTATUS status; + + req = dcerpc_$name\_send(p, mem_ctx, r); + if (req == NULL) return NT_STATUS_NO_MEMORY; - if (p->conn->flags & DCERPC_DEBUG_PRINT_IN) { - NDR_PRINT_IN_DEBUG($name, r); - } - - status = dcerpc_ndr_request(p, NULL, &ndr_table_$interface->{NAME}, - NDR_$uname, mem_ctx, r); + status = dcerpc_ndr_request_recv(req); if (NT_STATUS_IS_OK(status) && (p->conn->flags & DCERPC_DEBUG_PRINT_OUT)) { NDR_PRINT_OUT_DEBUG($name, r); diff --git a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm index da536beef4..c822d6746e 100644 --- a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm +++ b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm @@ -204,12 +204,12 @@ sub ParseArrayPushHeader($$$$$$) } if ((!$l->{IS_SURROUNDING}) and $l->{IS_CONFORMANT}) { - $self->pidl("NDR_CHECK(ndr_push_uint3264($ndr, NDR_SCALARS, $size));"); + $self->pidl("NDR_CHECK(ndr_push_uint32($ndr, NDR_SCALARS, $size));"); } if ($l->{IS_VARYING}) { - $self->pidl("NDR_CHECK(ndr_push_uint3264($ndr, NDR_SCALARS, 0));"); # array offset - $self->pidl("NDR_CHECK(ndr_push_uint3264($ndr, NDR_SCALARS, $length));"); + $self->pidl("NDR_CHECK(ndr_push_uint32($ndr, NDR_SCALARS, 0));"); # array offset + $self->pidl("NDR_CHECK(ndr_push_uint32($ndr, NDR_SCALARS, $length));"); } return $length; @@ -326,7 +326,7 @@ sub ParseArrayPullHeader($$$$$$) if ($l->{IS_CONFORMANT}) { $length = $size = "ndr_get_array_size($ndr, " . get_pointer_to($var_name) . ")"; - } elsif ($l->{IS_ZERO_TERMINATED} and $l->{SIZE_IS} == 0 and $l->{LENGTH_IS} == 0) { # Noheader arrays + } elsif ($l->{IS_ZERO_TERMINATED}) { # Noheader arrays $length = $size = "ndr_get_string_size($ndr, sizeof(*$var_name))"; } else { $length = $size = ParseExprExt($l->{SIZE_IS}, $env, $e->{ORIGINAL}, @@ -1069,10 +1069,6 @@ sub ParseElementPullLevel my $counter = "cntr_$e->{NAME}_$l->{LEVEL_INDEX}"; my $array_name = $var_name; - if ($l->{IS_VARYING}) { - $length = "ndr_get_array_length($ndr, " . get_pointer_to($var_name) .")"; - } - $var_name = get_array_element($var_name, $counter); $self->ParseMemCtxPullStart($e, $l, $ndr, $array_name); @@ -1224,9 +1220,9 @@ sub ParseStructPushPrimitives($$$$$) $size = ParseExpr($e->{LEVELS}[0]->{SIZE_IS}, $env, $e->{ORIGINAL}); } - $self->pidl("NDR_CHECK(ndr_push_uint3264($ndr, NDR_SCALARS, $size));"); + $self->pidl("NDR_CHECK(ndr_push_uint32($ndr, NDR_SCALARS, $size));"); } else { - $self->pidl("NDR_CHECK(ndr_push_uint3264($ndr, NDR_SCALARS, ndr_string_array_size($ndr, $varname->$e->{NAME})));"); + $self->pidl("NDR_CHECK(ndr_push_uint32($ndr, NDR_SCALARS, ndr_string_array_size($ndr, $varname->$e->{NAME})));"); } } @@ -1239,8 +1235,6 @@ sub ParseStructPushPrimitives($$$$$) } $self->ParseElementPush($_, $ndr, $env, 1, 0) foreach (@{$struct->{ELEMENTS}}); - - $self->pidl("NDR_CHECK(ndr_push_trailer_align($ndr, $struct->{ALIGN}));"); } sub ParseStructPushDeferred($$$$) @@ -1293,7 +1287,7 @@ sub ParseEnumPush($$$$) my($type_fn) = $enum->{BASE_TYPE}; $self->start_flags($enum, $ndr); - $self->pidl("NDR_CHECK(ndr_push_enum_$type_fn($ndr, NDR_SCALARS, $varname));"); + $self->pidl("NDR_CHECK(ndr_push_$type_fn($ndr, NDR_SCALARS, $varname));"); $self->end_flags($enum, $ndr); } @@ -1307,7 +1301,7 @@ sub ParseEnumPull($$$$) $self->pidl("$type_v_decl v;"); $self->start_flags($enum, $ndr); - $self->pidl("NDR_CHECK(ndr_pull_enum_$type_fn($ndr, NDR_SCALARS, &v));"); + $self->pidl("NDR_CHECK(ndr_pull_$type_fn($ndr, NDR_SCALARS, &v));"); $self->pidl("*$varname = v;"); $self->end_flags($enum, $ndr); @@ -1539,8 +1533,6 @@ sub ParseStructPullPrimitives($$$$$) $self->ParseElementPull($_, $ndr, $env, 1, 0) foreach (@{$struct->{ELEMENTS}}); $self->add_deferred(); - - $self->pidl("NDR_CHECK(ndr_pull_trailer_align($ndr, $struct->{ALIGN}));"); } sub ParseStructPullDeferred($$$$$) @@ -1652,10 +1644,6 @@ sub ParseUnionPushPrimitives($$$$) $self->pidl("NDR_CHECK(ndr_push_$e->{SWITCH_TYPE}($ndr, NDR_SCALARS, level));"); } - if (defined($e->{ALIGN})) { - $self->pidl("NDR_CHECK(ndr_push_union_align($ndr, $e->{ALIGN}));"); - } - $self->pidl("switch (level) {"); $self->indent; foreach my $el (@{$e->{ELEMENTS}}) { @@ -1681,7 +1669,7 @@ sub ParseUnionPushPrimitives($$$$) } if (! $have_default) { $self->pidl("default:"); - $self->pidl("\treturn ndr_push_error($ndr, NDR_ERR_BAD_SWITCH, \"Bad switch value \%u at \%s\", level, __location__);"); + $self->pidl("\treturn ndr_push_error($ndr, NDR_ERR_BAD_SWITCH, \"Bad switch value \%u\", level);"); } $self->deindent; $self->pidl("}"); @@ -1717,7 +1705,7 @@ sub ParseUnionPushDeferred($$$$) } if (! $have_default) { $self->pidl("default:"); - $self->pidl("\treturn ndr_push_error($ndr, NDR_ERR_BAD_SWITCH, \"Bad switch value \%u at \%s\", level, __location__);"); + $self->pidl("\treturn ndr_push_error($ndr, NDR_ERR_BAD_SWITCH, \"Bad switch value \%u\", level);"); } $self->deindent; $self->pidl("}"); @@ -1796,14 +1784,10 @@ sub ParseUnionPullPrimitives($$$$$) if (defined($switch_type)) { $self->pidl("NDR_CHECK(ndr_pull_$switch_type($ndr, NDR_SCALARS, &_level));"); $self->pidl("if (_level != level) {"); - $self->pidl("\treturn ndr_pull_error($ndr, NDR_ERR_BAD_SWITCH, \"Bad switch value %u for $varname at \%s\", _level, __location__);"); + $self->pidl("\treturn ndr_pull_error($ndr, NDR_ERR_BAD_SWITCH, \"Bad switch value %u for $varname\", _level);"); $self->pidl("}"); } - if (defined($e->{ALIGN})) { - $self->pidl("NDR_CHECK(ndr_pull_union_align($ndr, $e->{ALIGN}));"); - } - $self->pidl("switch (level) {"); $self->indent; foreach my $el (@{$e->{ELEMENTS}}) { @@ -1830,7 +1814,7 @@ sub ParseUnionPullPrimitives($$$$$) } if (! $have_default) { $self->pidl("default:"); - $self->pidl("\treturn ndr_pull_error($ndr, NDR_ERR_BAD_SWITCH, \"Bad switch value \%u at \%s\", level, __location__);"); + $self->pidl("\treturn ndr_pull_error($ndr, NDR_ERR_BAD_SWITCH, \"Bad switch value \%u\", level);"); } $self->deindent; $self->pidl("}"); @@ -1864,7 +1848,7 @@ sub ParseUnionPullDeferred($$$$) } if (! $have_default) { $self->pidl("default:"); - $self->pidl("\treturn ndr_pull_error($ndr, NDR_ERR_BAD_SWITCH, \"Bad switch value \%u at \%s\", level, __location__);"); + $self->pidl("\treturn ndr_pull_error($ndr, NDR_ERR_BAD_SWITCH, \"Bad switch value \%u\", level);"); } $self->deindent; $self->pidl("}"); diff --git a/pidl/lib/Parse/Pidl/Samba4/Python.pm b/pidl/lib/Parse/Pidl/Samba4/Python.pm index c785619adb..6099fe5cae 100644 --- a/pidl/lib/Parse/Pidl/Samba4/Python.pm +++ b/pidl/lib/Parse/Pidl/Samba4/Python.pm @@ -431,7 +431,7 @@ sub PythonFunctionUnpackOut($$$) } elsif (defined($fn->{RETURN_TYPE}) and $fn->{RETURN_TYPE} eq "WERROR") { $self->handle_werror("r->out.result", "NULL", undef); } elsif (defined($fn->{RETURN_TYPE})) { - my $conv = $self->ConvertObjectToPythonData("r", $fn->{RETURN_TYPE}, "r->out.result", $fn); + my $conv = $self->ConvertObjectToPythonData("r", $fn->{RETURN_TYPE}, "r->out.result"); if ($result_size > 1) { $self->pidl("PyTuple_SetItem(result, $i, $conv);"); } else { @@ -766,11 +766,6 @@ sub register_module_import($$) sub use_type_variable($$) { my ($self, $orig_ctype) = @_; - # FIXME: Have a global lookup table for types that look different on the - # wire than they are named in C? - if ($orig_ctype->{NAME} eq "dom_sid2") { - $orig_ctype->{NAME} = "dom_sid"; - } my $ctype = resolveType($orig_ctype); unless (defined($ctype->{BASEFILE})) { return undef; @@ -820,11 +815,11 @@ sub assign($$$) } } -sub ConvertObjectFromPythonData($$$$$$;$) +sub ConvertObjectFromPythonData($$$$$$) { - my ($self, $mem_ctx, $cvar, $ctype, $target, $fail, $location) = @_; + my ($self, $mem_ctx, $cvar, $ctype, $target, $fail) = @_; - fatal($location, "undef type for $cvar") unless(defined($ctype)); + die("undef type for $cvar") unless(defined($ctype)); $ctype = resolveType($ctype); @@ -844,12 +839,13 @@ sub ConvertObjectFromPythonData($$$$$$;$) if ($actual_ctype->{TYPE} eq "STRUCT" or $actual_ctype->{TYPE} eq "INTERFACE") { my $ctype_name = $self->use_type_variable($ctype); unless (defined ($ctype_name)) { - error($location, "Unable to determine origin of type `" . mapTypeName($ctype) . "'"); - $self->pidl("PyErr_SetString(PyExc_TypeError, \"Can not convert C Type " . mapTypeName($ctype) . " to Python\");"); + error(undef, "Unable to determine origin of type " . mapTypeName($ctype)); + $self->assign($target, "NULL"); + # FIXME: return; } $self->pidl("PY_CHECK_TYPE($ctype_name, $cvar, $fail);"); - $self->assign($target, "py_talloc_get_ptr($cvar)"); + $self->assign($target, "talloc_ptrtype(py_talloc_get_ptr($cvar), $target)"); return; } @@ -890,7 +886,7 @@ sub ConvertObjectFromPythonData($$$$$$;$) return; } - fatal($location, "unknown type `$actual_ctype->{TYPE}' for ".mapTypeName($ctype) . ": $cvar"); + fatal($ctype, "unknown type $actual_ctype->{TYPE} for ".mapTypeName($ctype) . ": $cvar"); } @@ -950,7 +946,7 @@ sub ConvertObjectFromPythonLevel($$$$$$$$) 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, $e->{ORIGINAL}); + $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); @@ -958,7 +954,7 @@ sub ConvertObjectFromPythonLevel($$$$$$$$) } elsif ($l->{TYPE} eq "SUBCONTEXT") { $self->ConvertObjectFromPythonLevel($env, $mem_ctx, $py_var, $e, GetNextLevel($e, $l), $var_name, $fail); } else { - fatal($e->{ORIGINAL}, "unknown level type $l->{TYPE}"); + die("unknown level type $l->{TYPE}"); } } @@ -998,18 +994,18 @@ sub ConvertScalarToPython($$$) } # Not yet supported - if ($ctypename eq "string_array") { return "PyCObject_FromTallocPtr($cvar)"; } + if ($ctypename eq "string_array") { return "PyCObject_FromVoidPtr($cvar)"; } if ($ctypename eq "ipv4address") { return "PyString_FromString($cvar)"; } if ($ctypename eq "pointer") { - return "PyCObject_FromTallocPtr($cvar)"; + return "PyCObject_FromVoidPtr($cvar, talloc_free)"; } die("Unknown scalar type $ctypename"); } -sub ConvertObjectToPythonData($$$$$;$) +sub ConvertObjectToPythonData($$$$$) { - my ($self, $mem_ctx, $ctype, $cvar, $location) = @_; + my ($self, $mem_ctx, $ctype, $cvar) = @_; die("undef type for $cvar") unless(defined($ctype)); @@ -1031,13 +1027,13 @@ sub ConvertObjectToPythonData($$$$$;$) } elsif ($actual_ctype->{TYPE} eq "STRUCT" or $actual_ctype->{TYPE} eq "INTERFACE") { my $ctype_name = $self->use_type_variable($ctype); unless (defined($ctype_name)) { - error($location, "Unable to determine origin of type `" . mapTypeName($ctype) . "'"); + error(undef, "Unable to determine origin of type " . mapTypeName($ctype)); return "NULL"; # FIXME! } - return "py_talloc_reference_ex($ctype_name, $mem_ctx, $cvar)"; + return "py_talloc_import_ex($ctype_name, $mem_ctx, $cvar)"; } - fatal($location, "unknown type $actual_ctype->{TYPE} for ".mapTypeName($ctype) . ": $cvar"); + fatal($ctype, "unknown type $actual_ctype->{TYPE} for ".mapTypeName($ctype) . ": $cvar"); } sub fail_on_null($$$) @@ -1117,12 +1113,12 @@ sub ConvertObjectToPythonLevel($$$$$$) 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, $e->{ORIGINAL}); + 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, $fail); } else { - fatal($e->{ORIGINAL}, "Unknown level type $l->{TYPE} $var_name"); + die("Unknown level type $l->{TYPE} $var_name"); } } @@ -1227,7 +1223,7 @@ sub Parse($$$$$) } elsif ($cvar =~ /^".*"$/) { $py_obj = "PyString_FromString($cvar)"; } else { - $py_obj = $self->ConvertObjectToPythonData("NULL", expandAlias($ctype), $cvar, undef); + $py_obj = $self->ConvertObjectToPythonData("NULL", expandAlias($ctype), $cvar); } $self->pidl("PyModule_AddObject(m, \"$name\", $py_obj);"); diff --git a/pidl/lib/Parse/Pidl/Samba4/TDR.pm b/pidl/lib/Parse/Pidl/Samba4/TDR.pm index c0749304ef..568dff5adf 100644 --- a/pidl/lib/Parse/Pidl/Samba4/TDR.pm +++ b/pidl/lib/Parse/Pidl/Samba4/TDR.pm @@ -7,7 +7,6 @@ package Parse::Pidl::Samba4::TDR; use Parse::Pidl qw(fatal); use Parse::Pidl::Util qw(has_property ParseExpr is_constant); use Parse::Pidl::Samba4 qw(is_intree choose_header); -use Parse::Pidl::Typelist qw(mapTypeName); use Exporter; @ISA = qw(Exporter); @@ -196,16 +195,15 @@ sub ParserEnum($$$$) { my ($self,$e,$t,$p) = @_; my $bt = Parse::Pidl::Typelist::enum_type_fn($e); - my $mt = mapTypeName($bt); $self->fn_declare($p, "NTSTATUS tdr_$t\_$e->{NAME} (struct tdr_$t *tdr".typearg($t).", enum $e->{NAME} *v)"); $self->pidl("{"); if ($t eq "pull") { - $self->pidl("\t$mt r;"); + $self->pidl("\t$bt\_t r;"); $self->pidl("\tTDR_CHECK(tdr_$t\_$bt(tdr, mem_ctx, \&r));"); $self->pidl("\t*v = r;"); } elsif ($t eq "push") { - $self->pidl("\tTDR_CHECK(tdr_$t\_$bt(tdr, ($mt *)v));"); + $self->pidl("\tTDR_CHECK(tdr_$t\_$bt(tdr, ($bt\_t *)v));"); } elsif ($t eq "print") { $self->pidl("\t/* FIXME */"); } @@ -273,7 +271,7 @@ sub Parser($$$$) $self->pidl(""); $self->pidl_hdr("/* autogenerated by pidl */"); $self->pidl_hdr("#include \"$baseheader\""); - $self->pidl_hdr(choose_header("lib/tdr/tdr.h", "tdr.h")); + $self->pidl_hdr(choose_header("tdr/tdr.h", "tdr.h")); $self->pidl_hdr(""); foreach (@$idl) { $self->ParserInterface($_) if ($_->{TYPE} eq "INTERFACE"); } diff --git a/pidl/lib/Parse/Pidl/Typelist.pm b/pidl/lib/Parse/Pidl/Typelist.pm index ca5ea0cfd2..4f9d982c21 100644 --- a/pidl/lib/Parse/Pidl/Typelist.pm +++ b/pidl/lib/Parse/Pidl/Typelist.pm @@ -32,15 +32,12 @@ my %scalars = ( "uint8" => "uint8_t", "int16" => "int16_t", "uint16" => "uint16_t", - "int1632" => "int16_t", - "uint1632" => "uint16_t", "int32" => "int32_t", "uint32" => "uint32_t", "hyper" => "uint64_t", "dlong" => "int64_t", "udlong" => "uint64_t", "udlongr" => "uint64_t", - "double" => "double", "pointer" => "void*", "DATA_BLOB" => "DATA_BLOB", "string" => "const char *", @@ -222,7 +219,7 @@ sub enum_type_fn($) } elsif (has_property($enum->{PARENT}, "v1_enum")) { return "uint32"; } - return "uint1632"; + return "uint16"; } sub bitmap_type_fn($) @@ -275,15 +272,12 @@ sub mapTypeName($) my $dt; $t = expandAlias($t); - if ($dt = getType($t)) { - return mapType($dt, $dt->{NAME}); - } elsif (ref($t) eq "HASH" and defined($t->{NAME})) { - return mapType($t, $t->{NAME}); - } else { + unless ($dt or ($dt = getType($t))) { # Best guess return "struct $t"; } + return mapType($dt, $dt->{NAME}); } sub LoadIdl($;$) diff --git a/pidl/lib/Parse/Pidl/Wireshark/NDR.pm b/pidl/lib/Parse/Pidl/Wireshark/NDR.pm index a9ad555cca..8846b740ab 100644 --- a/pidl/lib/Parse/Pidl/Wireshark/NDR.pm +++ b/pidl/lib/Parse/Pidl/Wireshark/NDR.pm @@ -380,7 +380,7 @@ sub Element($$$) MASK => 0, VALSSTRING => "NULL", FT_TYPE => "FT_NONE", - BASE_TYPE => "BASE_NONE" + BASE_TYPE => "BASE_HEX" }; } @@ -389,7 +389,7 @@ sub Element($$$) MASK => 0, VALSSTRING => "NULL", FT_TYPE => "FT_STRING", - BASE_TYPE => "BASE_NONE" + BASE_TYPE => "BASE_DEC" }; } @@ -874,7 +874,7 @@ sub Initialize($$) $self->register_type("policy_handle", "offset = PIDL_dissect_policy_hnd(tvb, offset, pinfo, tree, drep, \@HF\@, \@PARAM\@);","FT_BYTES", "BASE_NONE", 0, "NULL", 4); $self->register_type("NTTIME", "offset = dissect_ndr_nt_NTTIME(tvb, offset, pinfo, tree, drep, \@HF\@);","FT_ABSOLUTE_TIME", "BASE_NONE", 0, "NULL", 4); $self->register_type("NTTIME_hyper", "offset = dissect_ndr_nt_NTTIME(tvb, offset, pinfo, tree, drep, \@HF\@);","FT_ABSOLUTE_TIME", "BASE_NONE", 0, "NULL", 4); - $self->register_type("time_t", "offset = dissect_ndr_time_t(tvb, offset, pinfo,tree, drep, \@HF\@, NULL);","FT_ABSOLUTE_TIME", "BASE_NONE", 0, "NULL", 4); + $self->register_type("time_t", "offset = dissect_ndr_time_t(tvb, offset, pinfo,tree, drep, \@HF\@, NULL);","FT_ABSOLUTE_TIME", "BASE_DEC", 0, "NULL", 4); $self->register_type("NTTIME_1sec", "offset = dissect_ndr_nt_NTTIME(tvb, offset, pinfo, tree, drep, \@HF\@);", "FT_ABSOLUTE_TIME", "BASE_NONE", 0, "NULL", 4); $self->register_type("SID", " dcerpc_info *di = (dcerpc_info *)pinfo->private_data; @@ -882,7 +882,7 @@ sub Initialize($$) di->hf_index = \@HF\@; offset = dissect_ndr_nt_SID_with_options(tvb, offset, pinfo, tree, drep, param); - ","FT_STRING", "BASE_NONE", 0, "NULL", 4); + ","FT_STRING", "BASE_DEC", 0, "NULL", 4); $self->register_type("WERROR", "offset = PIDL_dissect_uint32(tvb, offset, pinfo, tree, drep, \@HF\@, \@PARAM\@);","FT_UINT32", "BASE_DEC", 0, "VALS(WERR_errors)", 4); $self->register_type("NTSTATUS", @@ -1055,20 +1055,6 @@ sub DumpHfDeclaration($) return "$res\n"; } -sub make_str_or_null($) -{ - my $str = shift; - if (substr($str, 0, 1) eq "\"") { - $str = substr($str, 1, length($str)-2); - } - $str =~ s/^\s*//; - $str =~ s/\s*$//; - if ($str eq "") { - return "NULL"; - } - return make_str($str); -} - sub DumpHfList($) { my ($self) = @_; @@ -1077,7 +1063,7 @@ sub DumpHfList($) foreach (values %{$self->{conformance}->{header_fields}}) { $res .= "\t{ &$_->{INDEX}, - { ".make_str($_->{NAME}).", ".make_str($_->{FILTER}).", $_->{FT_TYPE}, $_->{BASE_TYPE}, $_->{VALSSTRING}, $_->{MASK}, ".make_str_or_null($_->{BLURB}).", HFILL }}, + { ".make_str($_->{NAME}).", ".make_str($_->{FILTER}).", $_->{FT_TYPE}, $_->{BASE_TYPE}, $_->{VALSSTRING}, $_->{MASK}, ".make_str($_->{BLURB}).", HFILL }}, "; } diff --git a/pidl/tests/Util.pm b/pidl/tests/Util.pm index ff876ec039..4ad216a6a1 100644 --- a/pidl/tests/Util.pm +++ b/pidl/tests/Util.pm @@ -13,8 +13,6 @@ use strict; use FindBin qw($RealBin); use lib "$RealBin/../lib"; -use Parse::Pidl::Samba4 qw(is_intree); - use Parse::Pidl; my $warnings = ""; undef &Parse::Pidl::warning; @@ -68,15 +66,12 @@ sub test_samba4_ndr SKIP: { - my $flags; - if (system("pkg-config --exists ndr") == 0 and !is_intree()) { - $flags = `pkg-config --libs --cflags ndr`; - } else { - skip "no samba environment available, skipping compilation", 3; - } + skip "no samba environment available, skipping compilation", 3 + if (system("pkg-config --exists ndr") != 0); my $main = " #define uint_t unsigned int +#define _GNU_SOURCE #include <stdint.h> #include <stdlib.h> #include <stdio.h> @@ -139,6 +134,8 @@ $c $cc = "cc"; } + my $flags = `pkg-config --libs --cflags ndr`; + my $cmd = "$cc $cflags -x c - -o $outfile $flags $ldflags"; $cmd =~ s/\n//g; open CC, "|$cmd"; diff --git a/pidl/tests/ndr.pl b/pidl/tests/ndr.pl index 53b8cb89e3..504b7ec8de 100755 --- a/pidl/tests/ndr.pl +++ b/pidl/tests/ndr.pl @@ -4,7 +4,7 @@ use strict; use warnings; -use Test::More tests => 47; +use Test::More tests => 46; use FindBin qw($RealBin); use lib "$RealBin"; use Util; @@ -480,7 +480,6 @@ $ne = ParseElement($e, undef); is($ne->{REPRESENTATION_TYPE}, "uint8"); is(align_type("hyper"), 8); -is(align_type("double"), 8); is(align_type("uint32"), 4); is(align_type("uint16"), 2); is(align_type("uint8"), 1); diff --git a/pidl/tests/ndr_string.pl b/pidl/tests/ndr_string.pl index 7b76c7b295..2f2d941665 100755 --- a/pidl/tests/ndr_string.pl +++ b/pidl/tests/ndr_string.pl @@ -4,7 +4,7 @@ # Published under the GNU General Public License use strict; -use Test::More tests => 6 * 8; +use Test::More tests => 3 * 8; use FindBin qw($RealBin); use lib "$RealBin"; use Util qw(test_samba4_ndr); @@ -55,114 +55,6 @@ test_samba4_ndr("string-ascii-pull", return 4; '); -test_samba4_ndr("string-wchar-fixed-array-01", -' - typedef struct { - uint32 l1; - [string,charset(UTF16)] uint16 str[6]; - uint32 l2; - } TestStringStruct; - - [public] void TestString([in,ref] TestStringStruct *str); -', -' - uint8_t data[] = { 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, - \'f\', 0x00, \'o\', 0x00, - \'o\', 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00 - }; - DATA_BLOB b = { data, sizeof(data) }; - struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL, - smb_iconv_convenience_init(NULL, "ASCII", "UTF8", true)); - struct TestString r; - struct TestStringStruct str; - r.in.str = &str; - - if (!NDR_ERR_CODE_IS_SUCCESS(ndr_pull_TestString(ndr, NDR_IN, &r))) - return 1; - - if (r.in.str == NULL) - return 2; - - if (r.in.str->l1 != 0x00000001) - return 3; - - if (strncmp(str.str, "foo", 3) != 0) - return 4; - - if (r.in.str->str[4] != 0) - return 5; - - if (r.in.str->l2 != 0x00000002) - return 6; -'); - -test_samba4_ndr("string-wchar-fixed-array-02", -' - typedef struct { - uint32 l1; - [string,charset(UTF16)] uint16 str[6]; - uint32 l2; - } TestStringStruct; - - [public] void TestString([in,ref] TestStringStruct *str); -', -' - uint8_t data[] = { 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, - \'f\', 0x00, \'o\', 0x00, - \'o\', 0x00, \'b\', 0x00, - \'a\', 0x00, \'r\', 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00 - }; - DATA_BLOB b = { data, sizeof(data) }; - struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL, - smb_iconv_convenience_init(NULL, "ASCII", "UTF8", true)); - struct TestString r; - struct TestStringStruct str; - r.in.str = &str; - - /* the string terminator is wrong */ - if (NDR_ERR_CODE_IS_SUCCESS(ndr_pull_TestString(ndr, NDR_IN, &r))) - return 1; -'); - -test_samba4_ndr("string-wchar-fixed-array-03", -' - typedef struct { - uint32 l1; - [string,charset(UTF16)] uint16 str[6]; - uint32 l2; - } TestStringStruct; - - [public] void TestString([in,ref] TestStringStruct *str); -', -' - uint8_t data[] = { 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, - \'f\', 0x00, \'o\', 0x00, - \'o\', 0x00, \'b\', 0x00, - \'a\', 0x00, \'r\', 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00 - }; - DATA_BLOB b = { data, sizeof(data) }; - struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL, - smb_iconv_convenience_init(NULL, "ASCII", "UTF8", true)); - struct TestString r; - struct TestStringStruct str; - r.in.str = &str; - - /* the length 0x07 is to large */ - if (NDR_ERR_CODE_IS_SUCCESS(ndr_pull_TestString(ndr, NDR_IN, &r))) - return 1; -'); - SKIP: { skip "doesn't seem to work yet", 8; diff --git a/pidl/tests/parse_idl.pl b/pidl/tests/parse_idl.pl index e06526dd1e..9d43ddccc7 100755 --- a/pidl/tests/parse_idl.pl +++ b/pidl/tests/parse_idl.pl @@ -113,127 +113,52 @@ testok "cpp-quote", "cpp_quote(\"bla\")"; my $x = Parse::Pidl::IDL::parse_string("interface foo { struct x {}; }", "<foo>"); -is_deeply($x, [ { - 'TYPE' => 'INTERFACE', - 'NAME' => 'foo', - 'DATA' => [ { - 'TYPE' => 'STRUCT', - 'NAME' => 'x', - 'ELEMENTS' => [], - 'FILE' => '<foo>', - 'LINE' => 0 - } ], - 'FILE' => '<foo>', - 'LINE' => 0 -}]); +is_deeply($x, + [ { 'FILE' => '<foo>', 'NAME' => 'foo', 'DATA' => [ + { 'NAME' => 'x', 'TYPE' => 'STRUCT', ELEMENTS => [] } ], + 'TYPE' => 'INTERFACE', 'LINE' => 0 } ]); $x = Parse::Pidl::IDL::parse_string("interface foo { struct x; }", "<foo>"); -is_deeply($x, [ { - 'TYPE' => 'INTERFACE', - 'NAME' => 'foo', - 'DATA' => [ { - 'TYPE' => 'STRUCT', - 'NAME' => 'x', - 'FILE' => '<foo>', - 'LINE' => 0 - } ], - 'FILE' => '<foo>', - 'LINE' => 0 -}]); +is_deeply($x, + [ { 'FILE' => '<foo>', 'NAME' => 'foo', 'DATA' => [ + { 'NAME' => 'x', 'TYPE' => 'STRUCT' } ], + 'TYPE' => 'INTERFACE', 'LINE' => 0 } ]); $x = Parse::Pidl::IDL::parse_string("cpp_quote(\"foobar\")", "<quote>"); -is_deeply($x, [ { - 'TYPE' => 'CPP_QUOTE', - 'DATA' => '"foobar"', - 'FILE' => '<quote>', - 'LINE' => 0 -}]); +is_deeply($x, + [ { 'FILE' => '<quote>', 'DATA' => '"foobar"', + 'TYPE' => 'CPP_QUOTE', 'LINE' => 0 } ]); # A typedef of a struct without body $x = Parse::Pidl::IDL::parse_string("interface foo { typedef struct x y; }", "<foo>"); -is_deeply($x, [ { - 'TYPE' => 'INTERFACE', - 'NAME' => 'foo', - 'DATA' => [ { - 'TYPE' => 'TYPEDEF', - 'NAME' => 'y', - 'DATA' => { - 'TYPE' => 'STRUCT', - 'NAME' => 'x', - 'FILE' => '<foo>', - 'LINE' => 0, - }, - 'FILE' => '<foo>', - 'LINE' => 0, - } ], - 'FILE' => '<foo>', - 'LINE' => 0 -}]); +is_deeply($x, + [ { 'FILE' => '<foo>', 'NAME' => 'foo', 'DATA' => [ + { 'FILE' => '<foo>', 'LINE' => 0, 'NAME' => 'y', 'TYPE' => 'TYPEDEF', DATA => { + TYPE => 'STRUCT', NAME => 'x' } } ], + 'TYPE' => 'INTERFACE', 'LINE' => 0 } ]); # A typedef of a struct with empty body $x = Parse::Pidl::IDL::parse_string("interface foo { typedef struct {} y; }", "<foo>"); -is_deeply($x, [ { - 'TYPE' => 'INTERFACE', - 'NAME' => 'foo', - 'DATA' => [ { - 'TYPE' => 'TYPEDEF', - 'NAME' => 'y', - 'DATA' => { - 'TYPE' => 'STRUCT', - 'ELEMENTS' => [], - 'FILE' => '<foo>', - 'LINE' => 0 - }, - 'FILE' => '<foo>', - 'LINE' => 0 - } ], - 'FILE' => '<foo>', - 'LINE' => 0 -}]); +is_deeply($x, + [ { 'FILE' => '<foo>', 'NAME' => 'foo', 'DATA' => [ + { 'FILE' => '<foo>', 'LINE' => 0, 'NAME' => 'y', 'TYPE' => 'TYPEDEF', DATA => { TYPE => 'STRUCT', ELEMENTS => [] } } ], + 'TYPE' => 'INTERFACE', 'LINE' => 0 } ]); # A typedef of a bitmap with no body $x = Parse::Pidl::IDL::parse_string("interface foo { typedef bitmap x y; }", "<foo>"); -is_deeply($x, [ { - 'TYPE' => 'INTERFACE', - 'NAME' => 'foo', - 'DATA' => [ { - 'TYPE' => 'TYPEDEF', - 'NAME' => 'y', - 'DATA' => { - 'TYPE' => 'BITMAP', - 'NAME' => 'x', - 'FILE' => '<foo>', - 'LINE' => 0 - }, - 'FILE' => '<foo>', - 'LINE' => 0 - } ], - 'FILE' => '<foo>', - 'LINE' => 0 -}]); +is_deeply($x, + [ { 'FILE' => '<foo>', 'NAME' => 'foo', 'DATA' => [ + { 'FILE' => '<foo>', 'LINE' => 0, 'NAME' => 'y', 'TYPE' => 'TYPEDEF', DATA => { TYPE => 'BITMAP', NAME => 'x' } } ], + 'TYPE' => 'INTERFACE', 'LINE' => 0 } ]); # A typedef of a union with no body $x = Parse::Pidl::IDL::parse_string("interface foo { typedef union x y; }", "<foo>"); -is_deeply($x, [ { - 'TYPE' => 'INTERFACE', - 'NAME' => 'foo', - 'DATA' => [ { - 'TYPE' => 'TYPEDEF', - 'NAME' => 'y', - 'DATA' => { - 'TYPE' => 'UNION', - 'NAME' => 'x', - 'FILE' => '<foo>', - 'LINE' => 0 - }, - 'FILE' => '<foo>', - 'LINE' => 0 - } ], - 'FILE' => '<foo>', - 'LINE' => 0 -}]); +is_deeply($x, + [ { 'FILE' => '<foo>', 'NAME' => 'foo', 'DATA' => [ + { 'FILE' => '<foo>', 'LINE' => 0, 'NAME' => 'y', 'TYPE' => 'TYPEDEF', DATA => { TYPE => 'UNION', NAME => 'x' } } ], + 'TYPE' => 'INTERFACE', 'LINE' => 0 } ]); diff --git a/pidl/tests/samba-ndr.pl b/pidl/tests/samba-ndr.pl index 5c9c6afd85..cdfe0514f1 100755 --- a/pidl/tests/samba-ndr.pl +++ b/pidl/tests/samba-ndr.pl @@ -245,7 +245,7 @@ $generator->ParseStructPush({ SURROUNDING_ELEMENT => $e, ELEMENTS => [ $e ]}, "ndr", "x"); is($generator->{res}, "if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, ndr_string_array_size(ndr, x->el1))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_string_array_size(ndr, x->el1))); NDR_CHECK(ndr_push_align(ndr, 4)); NDR_CHECK(ndr_push_mytype(ndr, NDR_SCALARS, &x->el1)); } diff --git a/pidl/tests/samba3-cli.pl b/pidl/tests/samba3-cli.pl index 0d283a2d5a..27ab99dd34 100755 --- a/pidl/tests/samba3-cli.pl +++ b/pidl/tests/samba3-cli.pl @@ -30,107 +30,7 @@ my $x = new Parse::Pidl::Samba3::ClientNDR(); $fn = { NAME => "bar", ELEMENTS => [ ] }; $x->ParseFunction("foo", $fn); is($x->{res}, -"struct rpccli_bar_state { - struct bar orig; - struct bar tmp; - TALLOC_CTX *out_mem_ctx; - NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx); -}; - -static void rpccli_bar_done(struct tevent_req *subreq); - -struct tevent_req *rpccli_bar_send(TALLOC_CTX *mem_ctx, - struct tevent_context *ev, - struct rpc_pipe_client *cli) -{ - struct tevent_req *req; - struct rpccli_bar_state *state; - struct tevent_req *subreq; - - req = tevent_req_create(mem_ctx, &state, - struct rpccli_bar_state); - if (req == NULL) { - return NULL; - } - state->out_mem_ctx = NULL; - state->dispatch_recv = cli->dispatch_recv; - - /* In parameters */ - - /* Out parameters */ - - if (DEBUGLEVEL >= 10) { - NDR_PRINT_IN_DEBUG(bar, &state->orig); - } - - /* make a temporary copy, that we pass to the dispatch function */ - state->tmp = state->orig; - - subreq = cli->dispatch_send(state, ev, cli, - &ndr_table_foo, - NDR_BAR, - &state->tmp); - if (tevent_req_nomem(subreq, req)) { - return tevent_req_post(req, ev); - } - tevent_req_set_callback(subreq, rpccli_bar_done, req); - return req; -} - -static void rpccli_bar_done(struct tevent_req *subreq) -{ - struct tevent_req *req = tevent_req_callback_data( - subreq, struct tevent_req); - struct rpccli_bar_state *state = tevent_req_data( - req, struct rpccli_bar_state); - NTSTATUS status; - TALLOC_CTX *mem_ctx; - - if (state->out_mem_ctx) { - mem_ctx = state->out_mem_ctx; - } else { - mem_ctx = state; - } - - status = state->dispatch_recv(subreq, mem_ctx); - TALLOC_FREE(subreq); - if (!NT_STATUS_IS_OK(status)) { - tevent_req_nterror(req, status); - return; - } - - /* Copy out parameters */ - - /* Reset temporary structure */ - ZERO_STRUCT(state->tmp); - - if (DEBUGLEVEL >= 10) { - NDR_PRINT_OUT_DEBUG(bar, &state->orig); - } - - tevent_req_done(req); -} - -NTSTATUS rpccli_bar_recv(struct tevent_req *req, - TALLOC_CTX *mem_ctx) -{ - struct rpccli_bar_state *state = tevent_req_data( - req, struct rpccli_bar_state); - NTSTATUS status; - - if (tevent_req_is_nterror(req, &status)) { - tevent_req_received(req); - return status; - } - - /* Steal possbile out parameters to the callers context */ - talloc_steal(mem_ctx, state->out_mem_ctx); - - tevent_req_received(req); - return NT_STATUS_OK; -} - -NTSTATUS rpccli_bar(struct rpc_pipe_client *cli, +"NTSTATUS rpccli_bar(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) { \tstruct bar r; @@ -173,117 +73,7 @@ $x = new Parse::Pidl::Samba3::ClientNDR(); $fn = { NAME => "bar", ELEMENTS => [ ], RETURN_TYPE => "WERROR" }; $x->ParseFunction("foo", $fn); is($x->{res}, -"struct rpccli_bar_state { - struct bar orig; - struct bar tmp; - TALLOC_CTX *out_mem_ctx; - NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx); -}; - -static void rpccli_bar_done(struct tevent_req *subreq); - -struct tevent_req *rpccli_bar_send(TALLOC_CTX *mem_ctx, - struct tevent_context *ev, - struct rpc_pipe_client *cli) -{ - struct tevent_req *req; - struct rpccli_bar_state *state; - struct tevent_req *subreq; - - req = tevent_req_create(mem_ctx, &state, - struct rpccli_bar_state); - if (req == NULL) { - return NULL; - } - state->out_mem_ctx = NULL; - state->dispatch_recv = cli->dispatch_recv; - - /* In parameters */ - - /* Out parameters */ - - /* Result */ - ZERO_STRUCT(state->orig.out.result); - - if (DEBUGLEVEL >= 10) { - NDR_PRINT_IN_DEBUG(bar, &state->orig); - } - - /* make a temporary copy, that we pass to the dispatch function */ - state->tmp = state->orig; - - subreq = cli->dispatch_send(state, ev, cli, - &ndr_table_foo, - NDR_BAR, - &state->tmp); - if (tevent_req_nomem(subreq, req)) { - return tevent_req_post(req, ev); - } - tevent_req_set_callback(subreq, rpccli_bar_done, req); - return req; -} - -static void rpccli_bar_done(struct tevent_req *subreq) -{ - struct tevent_req *req = tevent_req_callback_data( - subreq, struct tevent_req); - struct rpccli_bar_state *state = tevent_req_data( - req, struct rpccli_bar_state); - NTSTATUS status; - TALLOC_CTX *mem_ctx; - - if (state->out_mem_ctx) { - mem_ctx = state->out_mem_ctx; - } else { - mem_ctx = state; - } - - status = state->dispatch_recv(subreq, mem_ctx); - TALLOC_FREE(subreq); - if (!NT_STATUS_IS_OK(status)) { - tevent_req_nterror(req, status); - return; - } - - /* Copy out parameters */ - - /* Copy result */ - state->orig.out.result = state->tmp.out.result; - - /* Reset temporary structure */ - ZERO_STRUCT(state->tmp); - - if (DEBUGLEVEL >= 10) { - NDR_PRINT_OUT_DEBUG(bar, &state->orig); - } - - tevent_req_done(req); -} - -NTSTATUS rpccli_bar_recv(struct tevent_req *req, - TALLOC_CTX *mem_ctx, - WERROR *result) -{ - struct rpccli_bar_state *state = tevent_req_data( - req, struct rpccli_bar_state); - NTSTATUS status; - - if (tevent_req_is_nterror(req, &status)) { - tevent_req_received(req); - return status; - } - - /* Steal possbile out parameters to the callers context */ - talloc_steal(mem_ctx, state->out_mem_ctx); - - /* Return result */ - *result = state->orig.out.result; - - tevent_req_received(req); - return NT_STATUS_OK; -} - -NTSTATUS rpccli_bar(struct rpc_pipe_client *cli, +"NTSTATUS rpccli_bar(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) { diff --git a/pidl/tests/typelist.pl b/pidl/tests/typelist.pl index e99b016487..80ee868f9d 100755 --- a/pidl/tests/typelist.pl +++ b/pidl/tests/typelist.pl @@ -4,7 +4,7 @@ use strict; use warnings; -use Test::More tests => 56; +use Test::More tests => 54; use FindBin qw($RealBin); use lib "$RealBin"; use Util; @@ -21,7 +21,6 @@ is("int32", expandAlias("int32")); is("uint32_t", mapScalarType("uint32")); is("void", mapScalarType("void")); is("uint64_t", mapScalarType("hyper")); -is("double", mapScalarType("double")); my $x = { TYPE => "ENUM", NAME => "foo", EXTRADATA => 1 }; addType($x); @@ -35,12 +34,6 @@ is_deeply(getType("uint16"), { TYPE => "TYPEDEF", DATA => { NAME => "uint16", TYPE => "SCALAR" }}); -is_deeply(getType("double"), { - NAME => "double", - BASEFILE => "<builtin>", - TYPE => "TYPEDEF", - DATA => { NAME => "double", TYPE => "SCALAR" }}); - is(0, typeIs("someUnknownType", "ENUM")); is(0, typeIs("foo", "ENUM")); addType({NAME => "mytypedef", TYPE => "TYPEDEF", DATA => { TYPE => "ENUM" }}); @@ -71,7 +64,7 @@ is(0, scalar_is_reference({TYPE => "STRUCT", NAME => "echo_foobar"})); is("uint8", enum_type_fn({TYPE => "ENUM", PARENT=>{PROPERTIES => {enum8bit => 1}}})); is("uint32", enum_type_fn({TYPE => "ENUM", PARENT=>{PROPERTIES => {v1_enum => 1}}})); -is("uint1632", enum_type_fn({TYPE => "ENUM", PARENT=>{PROPERTIES => {}}})); +is("uint16", enum_type_fn({TYPE => "ENUM", PARENT=>{PROPERTIES => {}}})); is("uint8", bitmap_type_fn({TYPE => "BITMAP", PROPERTIES => {bitmap8bit => 1}})); is("uint16", bitmap_type_fn({TYPE => "BITMAP", PROPERTIES => {bitmap16bit => 1}})); |