diff options
Diffstat (limited to 'scripts/update-geometry')
-rwxr-xr-x | scripts/update-geometry | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/scripts/update-geometry b/scripts/update-geometry new file mode 100755 index 00000000..82f961ba --- /dev/null +++ b/scripts/update-geometry @@ -0,0 +1,76 @@ +#!/usr/bin/perl -w + +use strict; + +open(FH, $ARGV[0]); + +my $done = 0; +my $cx = 0.0; +my $cy = 0.0; +my $pan = 10000000; +my $min_x; +my $min_y; + +while ( my $line = <FH> ) { + + chomp $line; + + if ( $line =~ /^([0-9]+)\/min_x\ =\ ([0-9,\.\-e]+)$/ ) { + + $pan = $1; + $min_x = $2; + printf("%i/min_fs = %i\n", $pan, $min_x); + + } elsif ( $line =~ /^([0-9]+)\/min_y\ =\ ([0-9,\.\-e]+)$/ ) { + + if ( $1 != $pan ) { + printf(STDERR "Error!\n"); + exit(1); + } + $min_y = $2; + printf("%i/min_ss = %i\n", $pan, $min_y); + + } elsif ( $line =~ /^([0-9]+)\/max_x\ =\ ([0-9,\.\-e]+)$/ ) { + + if ( $1 != $pan ) { + printf(STDERR "Error!\n"); + exit(1); + } + printf("%i/max_fs = %i\n", $pan, $2); + + } elsif ( $line =~ /^([0-9]+)\/max_y\ =\ ([0-9,\.\-e]+)$/ ) { + + if ( $1 != $pan ) { + printf(STDERR "Error!\n"); + exit(1); + } + printf("%i/max_ss = %i\n", $pan, $2); + + } elsif ( $line =~ /^([0-9]+)\/cx\ =\ ([0-9,\.\-e]+)$/ ) { + + $cx = $2; + if ( $1 != $pan ) { + printf(STDERR "Error!\n"); + exit(1); + } + + } elsif ( $line =~ /^([0-9]+)\/cy\ =\ ([0-9,\.\-e]+)$/ ) { + + $cy = $2; + if ( $1 != $pan ) { + printf(STDERR "Error!\n"); + exit(1); + } + + printf("%i/corner_x = %5.2f\n", $pan, $min_x - $cx); + printf("%i/corner_y = %5.2f\n", $pan, $min_y - $cy); + printf("%i/fs = x\n", $pan); + printf("%i/ss = y\n", $pan); + + } else { + printf("%s\n", $line); + } + +} + +exit($done); |