mirror of
git://projects.qi-hardware.com/cae-tools.git
synced 2024-12-22 23:51:08 +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
|
||||
{
|
||||
print STDERR "usage: $0 z-start z-maxstep [file ...]\n";
|
||||
print STDERR "usage: $0 [-r] z-start z-maxstep [file ...]\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -35,6 +35,11 @@ sub issue
|
||||
}
|
||||
|
||||
|
||||
if ($ARGV[0] eq "-r") {
|
||||
shift @ARGV;
|
||||
$reverse = 1;
|
||||
}
|
||||
|
||||
$z0 = shift @ARGV;
|
||||
$zs = shift @ARGV;
|
||||
|
||||
@ -50,9 +55,18 @@ while (<>) {
|
||||
}
|
||||
$z = $3 if /^-?\d+(\.\d*)?\s+-?\d+(\.\d*)?\s+(-?\d+(\.\d*)?)/;
|
||||
$s .= $_;
|
||||
$zmax = $z if $z > $zmax || !defined $zmax;
|
||||
}
|
||||
$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;
|
||||
for $c (sort { $b <=> $a } keys %z) {
|
||||
while ($z > $c+$zs) {
|
||||
|
Loading…
Reference in New Issue
Block a user