Dynapi: fix 'gendynapi.pl' script for array parameters

This commit is contained in:
Sylvain 2021-03-08 13:56:26 +01:00
parent a7938107ae
commit b6b0c908bd
No known key found for this signature in database
GPG Key ID: 5F87E02E5BC0939E
1 changed files with 7 additions and 1 deletions

View File

@ -107,13 +107,19 @@ while (my $d = readdir(HEADERS)) {
$type =~ s/\s*\*\Z/*/g; $type =~ s/\s*\*\Z/*/g;
$type =~ s/\s*(\*+)\Z/ $1/; $type =~ s/\s*(\*+)\Z/ $1/;
#print("SPLIT: ($type, $var)\n"); #print("SPLIT: ($type, $var)\n");
my $var_array_suffix = "";
# parse array suffix
if ($var =~ /\A.*(\[.*\])\Z/) {
#print("PARSED ARRAY SUFFIX: [$1] of '$var'\n");
$var_array_suffix = $1;
}
my $name = chr(ord('a') + $i); my $name = chr(ord('a') + $i);
if ($i > 0) { if ($i > 0) {
$paramstr .= ', '; $paramstr .= ', ';
$argstr .= ','; $argstr .= ',';
} }
my $spc = ($type =~ /\*\Z/) ? '' : ' '; my $spc = ($type =~ /\*\Z/) ? '' : ' ';
$paramstr .= "$type$spc$name"; $paramstr .= "$type$spc$name$var_array_suffix";
$argstr .= "$name"; $argstr .= "$name";
} }
$i++; $i++;