1
1
Этот коммит содержится в:
Ralph Castain 2015-12-21 20:48:56 -08:00
родитель e918d75fae
Коммит 079ea14dab

Просмотреть файл

@ -12,6 +12,7 @@ my $myfile;
my $mylib; my $mylib;
my $myprefix; my $myprefix;
my $mysuffix; my $mysuffix;
my $mycapprefix;
# Set to true if the script should merely check for symbols in # Set to true if the script should merely check for symbols in
# the library that are not in the provided output file - useful # the library that are not in the provided output file - useful
@ -63,6 +64,8 @@ sub quiet_print {
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
$mycapprefix = uc $myprefix;
# get the symbol output for this lib # get the symbol output for this lib
my $output = qx(nm $mylib); my $output = qx(nm $mylib);
@ -84,8 +87,7 @@ foreach my $line (split /[\r\n]+/, $output) {
# next token indicates a public symbol by # next token indicates a public symbol by
# being a 'T' or a 'B' # being a 'T' or a 'B'
$val = shift(@values); $val = shift(@values);
if ("T" eq $val || "B" eq $val || "D" eq $val || if ("T" eq $val || "B" eq $val || "D" eq $val) {
"t" eq $val || "b" eq $val || "d" eq $val) {
$val = shift(@values); $val = shift(@values);
# if this symbol contains a '.', then we # if this symbol contains a '.', then we
# need to ignore it # need to ignore it
@ -105,10 +107,24 @@ $len = $len + 5;
if ($myfile ne "") { if ($myfile ne "") {
open FILE, ">$myfile" || die "file could not be opened"; open FILE, ">$myfile" || die "file could not be opened";
} }
sub checkCase {
if ($_[0] =~ /^[[:upper:]]/) {
return 1;
}
else {
return 0;
}
}
foreach my $sym (@symbols) { foreach my $sym (@symbols) {
my $out; my $out;
if ($REVERSE) { if ($REVERSE) {
$out = "#define " . $myprefix . $sym . $mysuffix; # if the first char is a cap, then use the cap prefix
if (checkCase($sym)) {
$out = "#define " . $mycapprefix . $sym . $mysuffix;
} else {
$out = "#define " . $myprefix . $sym . $mysuffix;
}
} else { } else {
$out = "#define " . $sym; $out = "#define " . $sym;
} }
@ -119,7 +135,12 @@ foreach my $sym (@symbols) {
if ($REVERSE) { if ($REVERSE) {
$out = $out . $sym . "\n"; $out = $out . $sym . "\n";
} else { } else {
$out = $out . $myprefix . $sym . $mysuffix . "\n"; # if the first char is a cap, then use the cap prefix
if (checkCase($sym)) {
$out = $out . $mycapprefix . $sym . $mysuffix . "\n";
} else {
$out = $out . $myprefix . $sym . $mysuffix . "\n";
}
} }
if ($myfile ne "") { if ($myfile ne "") {
print FILE $out; print FILE $out;