mirror of
git://projects.qi-hardware.com/cae-tools.git
synced 2024-12-23 09:55:32 +02:00
cameo/zstack.pl: option -r to reverse the stack
This commit is contained in:
parent
219e0a5c2d
commit
5ecce7de9e
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
sub usage
|
sub usage
|
||||||
{
|
{
|
||||||
print STDERR "usage: $0 z-start z-maxstep [file ...]\n";
|
print STDERR "usage: $0 [-r] z-start z-maxstep [file ...]\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,6 +35,11 @@ sub issue
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($ARGV[0] eq "-r") {
|
||||||
|
shift @ARGV;
|
||||||
|
$reverse = 1;
|
||||||
|
}
|
||||||
|
|
||||||
$z0 = shift @ARGV;
|
$z0 = shift @ARGV;
|
||||||
$zs = shift @ARGV;
|
$zs = shift @ARGV;
|
||||||
|
|
||||||
@ -50,9 +55,18 @@ while (<>) {
|
|||||||
}
|
}
|
||||||
$z = $3 if /^-?\d+(\.\d*)?\s+-?\d+(\.\d*)?\s+(-?\d+(\.\d*)?)/;
|
$z = $3 if /^-?\d+(\.\d*)?\s+-?\d+(\.\d*)?\s+(-?\d+(\.\d*)?)/;
|
||||||
$s .= $_;
|
$s .= $_;
|
||||||
|
$zmax = $z if $z > $zmax || !defined $zmax;
|
||||||
}
|
}
|
||||||
$z{$z} .= "$s\n";
|
$z{$z} .= "$s\n";
|
||||||
|
|
||||||
|
if ($reverse) {
|
||||||
|
for (keys %z) {
|
||||||
|
($t{$zmax-$_} = $z{$_}) =~
|
||||||
|
s/^(-?\d+(\.\d*)?)\s+(-?\d+(\.\d*)?)\s+/$3 $1 /mg;
|
||||||
|
}
|
||||||
|
%z = %t;
|
||||||
|
}
|
||||||
|
|
||||||
$z = $z0;
|
$z = $z0;
|
||||||
for $c (sort { $b <=> $a } keys %z) {
|
for $c (sort { $b <=> $a } keys %z) {
|
||||||
while ($z > $c+$zs) {
|
while ($z > $c+$zs) {
|
||||||
|
Loading…
Reference in New Issue
Block a user