@EXPORT_OK = qw(check_null_pointer fn_declare TypeFunctionName);
use strict;
-use Parse::Pidl::Typelist;
+use Parse::Pidl::Typelist qw(typeHasBody);
use Parse::Pidl::CUtil qw(get_pointer_to get_value_of);
use Parse::Pidl::Util qw(has_property ParseExpr);
use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel);
sub EjsEnumConstant($$)
{
my ($self, $d) = @_;
+ return unless (defined($d->{ELEMENTS}));
my $v = 0;
foreach my $e (@{$d->{ELEMENTS}}) {
my $el = $e;
sub EjsBitmapPush($$$)
{
my ($self, $d, $varname) = @_;
+ return unless (defined($d->{ELEMENTS}));
my $type_fn = $d->{BASE_TYPE};
# put the bitmap elements in the constants array
foreach my $e (@{$d->{ELEMENTS}}) {
$self->pidl_hdr("\n");
foreach my $d (@{$interface->{TYPES}}) {
+ next unless (typeHasBody($d));
($needed->{TypeFunctionName("ejs_push", $d)}) && $self->EjsTypePushFunction($d, $d->{NAME});
($needed->{TypeFunctionName("ejs_pull", $d)}) && $self->EjsTypePullFunction($d, $d->{NAME});
}
NeededType($t->{DATA}, $needed, $req) if ($t->{TYPE} eq "TYPEDEF");
- return if (($t->{TYPE} ne "STRUCT") and
- ($t->{TYPE} ne "UNION"));
+ return unless (($t->{TYPE} eq "STRUCT") or ($t->{TYPE} eq "UNION"));
+
+ return unless(typeHasBody($t));
foreach (@{$t->{ELEMENTS}}) {
next if (has_property($_, "subcontext")); #FIXME: Support subcontexts
# Typedefs
foreach my $d (@{$interface->{TYPES}}) {
- next unless typeHasBody($d);
+ next unless(typeHasBody($d));
+
($needed->{TypeFunctionName("ndr_push", $d)}) && $self->ParseTypePushFunction($d, "r");
($needed->{TypeFunctionName("ndr_pull", $d)}) && $self->ParseTypePullFunction($d, "r");
($needed->{TypeFunctionName("ndr_print", $d)}) && $self->ParseTypePrintFunction($d, "r");
# Published under the GNU General Public License
use strict;
-use Test::More tests => 65 * 2 + 5;
+use Test::More tests => 65 * 2 + 6;
use FindBin qw($RealBin);
use lib "$RealBin";
use Util qw(test_errors);
is_deeply($x,
[ { 'FILE' => '<foo>', 'NAME' => 'foo', 'DATA' => [
- { 'FILE' => '<foo>', 'LINE' => 0, 'NAME' => 'y', 'TYPE' => 'TYPEDEF', DATA => {
- TYPE => 'STRUCT', ELEMENTS => [] } } ],
+ { '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,
+ [ { 'FILE' => '<foo>', 'NAME' => 'foo', 'DATA' => [
+ { 'FILE' => '<foo>', 'LINE' => 0, 'NAME' => 'y', 'TYPE' => 'TYPEDEF', DATA => { TYPE => 'BITMAP', NAME => 'x' } } ],
'TYPE' => 'INTERFACE', 'LINE' => 0 } ]);