Provide a mechanism for renaming symbols in the opposite direction - i.e., #define prefix_foo[suffix] foo.
Этот коммит содержится в:
родитель
c788d7bf88
Коммит
f2805fb0f9
@ -22,6 +22,8 @@ my $CHECK_ONLY = 0;
|
|||||||
my $QUIET = 0;
|
my $QUIET = 0;
|
||||||
# Set to true if we just want to see the help message
|
# Set to true if we just want to see the help message
|
||||||
my $HELP = 0;
|
my $HELP = 0;
|
||||||
|
# Set to true if we want to reverse the hiding direction
|
||||||
|
my $REVERSE = 0;
|
||||||
|
|
||||||
|
|
||||||
GetOptions(
|
GetOptions(
|
||||||
@ -32,6 +34,7 @@ GetOptions(
|
|||||||
"suffix=s" => \$mysuffix,
|
"suffix=s" => \$mysuffix,
|
||||||
"lib=s" => \$mylib,
|
"lib=s" => \$mylib,
|
||||||
"file=s" => \$myfile,
|
"file=s" => \$myfile,
|
||||||
|
"reverse" => \$REVERSE,
|
||||||
) or die "unable to parse options, stopped";
|
) or die "unable to parse options, stopped";
|
||||||
|
|
||||||
if ($HELP) {
|
if ($HELP) {
|
||||||
@ -45,6 +48,7 @@ $0 [options]
|
|||||||
--suffix=NAME Add NAME to the end of all found symbols
|
--suffix=NAME Add NAME to the end of all found symbols
|
||||||
--lib=NAME Library containing symbols that are to be "hidden"
|
--lib=NAME Library containing symbols that are to be "hidden"
|
||||||
--file=NAME Output file for results, or existing file to be updated
|
--file=NAME Output file for results, or existing file to be updated
|
||||||
|
--reverse Reverse the direction of hiding (i.e., #define prefix_foo to be foo)
|
||||||
EOT
|
EOT
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
@ -97,12 +101,21 @@ if ($myfile ne "") {
|
|||||||
open FILE, ">$myfile" || die "file could not be opened";
|
open FILE, ">$myfile" || die "file could not be opened";
|
||||||
}
|
}
|
||||||
foreach my $sym (@symbols) {
|
foreach my $sym (@symbols) {
|
||||||
my $out = "#define " . $sym;
|
my $out;
|
||||||
|
if ($REVERSE) {
|
||||||
|
$out = "#define " . $myprefix . $sym . $mysuffix;
|
||||||
|
} else {
|
||||||
|
$out = "#define " . $sym;
|
||||||
|
}
|
||||||
my $diff = $len - length($sym);
|
my $diff = $len - length($sym);
|
||||||
for (my $i=0; $i < $diff; $i++) {
|
for (my $i=0; $i < $diff; $i++) {
|
||||||
$out = $out . " ";
|
$out = $out . " ";
|
||||||
}
|
}
|
||||||
$out = $out . $myprefix . $sym . $mysuffix . "\n";
|
if ($REVERSE) {
|
||||||
|
$out = $out . $sym . "\n";
|
||||||
|
} else {
|
||||||
|
$out = $out . $myprefix . $sym . $mysuffix . "\n";
|
||||||
|
}
|
||||||
if ($myfile ne "") {
|
if ($myfile ne "") {
|
||||||
print FILE $out;
|
print FILE $out;
|
||||||
} else {
|
} else {
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user