New version of pidl

This commit is contained in:
Wilco Baan Hofman 2016-11-15 22:10:08 +01:00
parent d595112e01
commit 2186300bd2
74 changed files with 23043 additions and 988 deletions

View file

@ -35,7 +35,7 @@ use vars qw($VERSION);
$VERSION = '0.01';
@ISA = qw(Exporter);
@EXPORT = qw(GetPrevLevel GetNextLevel ContainsDeferred ContainsPipe ContainsString);
@EXPORT_OK = qw(GetElementLevelTable ParseElement ValidElement align_type mapToScalar ParseType can_contain_deferred is_charset_array);
@EXPORT_OK = qw(GetElementLevelTable ParseElement ReturnTypeElement ValidElement align_type mapToScalar ParseType can_contain_deferred is_charset_array);
use strict;
use Parse::Pidl qw(warning fatal);
@ -805,6 +805,25 @@ sub ParseFunction($$$$)
};
}
sub ReturnTypeElement($)
{
my ($fn) = @_;
return undef unless defined($fn->{RETURN_TYPE});
my $e = {
"NAME" => "result",
"TYPE" => $fn->{RETURN_TYPE},
"PROPERTIES" => undef,
"POINTERS" => 0,
"ARRAY_LEN" => [],
"FILE" => $fn->{FILE},
"LINE" => $fn->{LINE},
};
return ParseElement($e, 0, 0);
}
sub CheckPointerTypes($$)
{
my ($s,$default) = @_;
@ -891,7 +910,8 @@ sub ParseInterface($)
FUNCTIONS => \@functions,
CONSTS => \@consts,
TYPES => \@types,
ENDPOINTS => \@endpoints
ENDPOINTS => \@endpoints,
ORIGINAL => $idl
};
}
@ -952,9 +972,19 @@ sub ContainsString($)
if (property_matches($e, "flag", ".*STR_NULLTERM.*")) {
return 1;
}
if (exists($e->{LEVELS}) and $e->{LEVELS}->[0]->{TYPE} eq "ARRAY" and
($e->{LEVELS}->[0]->{IS_FIXED} or $e->{LEVELS}->[0]->{IS_INLINE}) and
has_property($e, "charset"))
{
return 1;
}
foreach my $l (@{$e->{LEVELS}}) {
return 1 if ($l->{TYPE} eq "ARRAY" and $l->{IS_ZERO_TERMINATED});
}
if (property_matches($e, "charset", ".*DOS.*")) {
return 1;
}
return 0;
}
@ -1073,6 +1103,7 @@ my %property_list = (
"noprint" => ["FUNCTION", "TYPEDEF", "STRUCT", "UNION", "ENUM", "BITMAP", "ELEMENT", "PIPE"],
"nopython" => ["FUNCTION", "TYPEDEF", "STRUCT", "UNION", "ENUM", "BITMAP"],
"todo" => ["FUNCTION"],
"skip" => ["ELEMENT"],
# union
"switch_is" => ["ELEMENT"],