---
chap.cfg:
Drills: 0,500,400;500,1000,1000;1000,2000,2000;2000,3000,3000
---
Pre-pre release of chap.pl (CHangeAPlotter.PerL)
#!/usr/bin/perl -w
open FH, "<chap.cfg";
chapa.cfg\n";
$totalBins=0;
print "Bin\tFrom\tTo\tNew\n";
$prev=0;
@bins=();
while (<FH>)
{
chomp();
$line=$_;
last if ($line=~s!.*Drill:\s*!!);
}
while ($line=~m!(\d+),(\d+),(\d+)!g)
{
$bins[$totalBins]=[$1, $2,$3];
print
"$totalBins\t$bins[$totalBins]->[0]\t$bins[$totalBins]->[1]\t$bins[$totalBins]->[2]\n";
$totalBins++;
}
open FH, "<lines.brd";
open FHout, ">lines.new.brd";
while (<FH>)
{
chomp();
#$PAD
#Sh "1" C 1600 1600 0 0 0
#Sh "1" R 550 550 0 0 900
#Dr 1200 0 0
# if (m!^Sh "1" (.) (\d+) (\d+) .*$!)
# {
# $t=$1; $x=$1; $y=$2;
# }
if (m!^Dr (\d+) !)
{
$i=0; $flag=0; $current=$1; $current++; $current--;
while ( ($i<$totalBins) && ($flag == 0))
{
# print "comparing $bins[$i]->[0] < $current <= $bins[$i]->[1]";
# if ($current > $bins[$i]->[0]) {print "...low match!";} ;
# if ($current < $bins[$i]->[1]) {print "...high match!";};
$new = $bins[$i]->[2];
if (($current > $bins[$i]->[0]) && ($current <= $bins[$i]->[1]) )
{
$flag=1;
#should replace here
print "Should replace <$_> to ";
s!^Dr (\d+) !Dr $new !;
print "<$_>";
print FHout "$_\n";
}
if ($flag ==1 ) {print "\n";};
$i++;
}
}
print FHout "$_\n";
}
------------------------------------
Yahoo! Groups Links