1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
#!/usr/bin/perl
if (@ARGV != 2) {
die "Usage: $0 <in> <out>";
}
open DAT, "<$ARGV[0]" or die $!;
open OUT, ">$ARGV[1]" or die $!;
$| = 1;
system("stty -icanon eol \001");
while (defined($_ = <DAT>)) {
/\[(\w+)\]/ and print "\nNew Section: $1\n\n";
/^Item=(\w+),/ and do {
$i = $1;
/,x1=(\d+)[,;]/ and do {
$x1 = $1;
print "Item $i, x1 (left)? ([l]/r) > ";
read STDIN, $c, 1;
print "\n";
$nx1 = $x1 - 624;
s/,x1=$x1/,x1=$nx1/ if $c eq 'r';
};
/,y1=(\d+)[,;]/ and do {
$y1 = $1;
print "Item $i, y1 (top)? ([l]/r) > ";
read STDIN, $c, 1;
print "\n";
$ny1 = $y1 - 486;
s/,y1=$y1/,y1=$ny1/ if $c eq 'r';
};
/,x2=(\d+)[,;]/ and do {
$x2 = $1;
print "Item $i, x2 (right)? ([l]/r) > ";
read STDIN, $c, 1;
print "\n";
$nx2 = $x2 - 624;
s/,x2=$x2/,x2=$nx2/ if $c eq 'r';
};
/,y2=(\d+)[,;]/ and do {
$y2 = $1;
print "Item $i, y2 (bottom)? ([l]/r) > ";
read STDIN, $c, 1;
print "\n";
$ny2 = $y2 - 486;
s/,y2=$y2/,y2=$ny2/ if $c eq 'r';
};
};
print OUT $_;
}
system("stty icanon eol ^@");
|