*cabe and non-*cabe editor reconciliation

Fairlight fairlite at fairlite.com
Wed Jul 14 10:20:02 PDT 2004


On Wed, Jul 14, 2004 at 10:33:14AM -0400, after drawing runes in goat's blood,
Walter Vaughan cast forth these immortal, mystical words:
> 
> ... The only "feature" that I see needs fixin' for 1.01 is that
> if the prc table does not exist, it should not echo out a
> "all segments...compatible", which while true, seems wrong.

Fixed.  It also only lets you specify one filename at a time as an
argument.  In addition, if you try piping to STDIN -and- specifying an
argument, the argument takes precedence and the STDIN input is simply
ignored.  Verified that.

That should do it.  Sorry I had to make you wait that long.  Had an
emergency call, a run to replace a device, and had to bring systems back
up after a power outage that took out power for 100,000 in Louisville last
night--once I got back home.  Did a hotel...damned if I was staying home,
in the dark, in 90F weather.  I think -not-.  :)  But boy, a 14.4 modem is 
harsh after DSL!

I also fixed an annoyance of my own making.  I have written the program
twice, actually.  Once before the power outage, and once at the hotel from
the laptop, since our system here that I had originally written it on was
lifeless all night.  It was trivial enough to just bang out again.  Well I
somehow kept mis-typing the 'm' at the end.  It was supposed to be cabecom
for coMpatability, and somehow it managed to accumulate three separate
typos of the filename. :)

At any rate, the v1.1 is attached.  Enjoy!

And if you want more changes...tomorrow.  I've been up about 24hrs now,
and I'm officially zapped.  Sleep beckons.  Actually, it begs, pleads, and
pounds its hands and feet.  Yes, I'm tired.  :)

Hasta...

mark->
-- 
Fairlight->   ||| "Erradicate the facists..." --     | Fairlight Consulting
  __/\__      ||| Tate/Queensryche                   |
 <__<>__>     |||                                    | http://www.fairlite.com
    \/        |||                                    | info at fairlite.com
-------------- next part --------------
#!/usr/bin/perl
#
# Fairlight CABE Compatability Checker - cabecom
# Written by Fairlight <fairlite at fairlite.com>
# Copyright 2004, All rights reserved.
# Last modified:  07/14/04
# Version:  1.1
##############################################################################
#
# Usage:  cabecom prc.whatever
#
##############################################################################

##### Initialise.
my ($file,$length,$label_max,$other_max,$max,$line,$test,$chopped,$errfound);

##### Tunable.
$label_max = 7;
$other_max = 120;

##### Touch nothing below this point.  (Keepa your mitza offa!)
die("Only process one file at a time!\n") if scalar(@ARGV) > 1;
$file = undef;
$file = shift(@ARGV) if scalar(@ARGV);
unshift(@ARGV,${file}) if defined(${file});
die("File '${file}' does not exist or is unreadable!\n") if defined(${file}) and scalar(@ARGV) and not -r ${file};
$~ = 'EXCESS';
$^ = 'EXCESS_TOP';
$- = 0;
$: = '';
$length = $counter = $max = $errfound = 0;

while ($line = <>) {
     $counter++;
     chomp(${line});
     ($Label,$If,$Then,undef) = split(/:/,${line});
     foreach $test (qw(Label If Then)) {
          if (${test} eq 'Label') {
               $max = ${label_max};
          } else {
               $max = ${other_max};
          }
          $length = length(${${test}});
          if (${length} > ${max}) {
               $chopped = substr(${${test}},${length}-(${length}-${max}),${length}-${max});
               write;
               $- = 59;
               $errfound++ unless ${errfound};
          } 
     }
}
print("All segment lengths are *cabe compatible.\n") unless ${errfound};
exit;

##### Formats.
format EXCESS_TOP = 
------------------------------------------------------------------------------
.

format EXCESS =
           Line Number:  @<<<                Segment Type:  @<<<<
${counter},${test}
           Line Length:  @<<<      Maximum Segment Length:  @<<
${length},${max}
       Segment Content:  ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
${${test}}
~~                       ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
${${test}}
        Excess Content:  ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
${chopped}
~~                       ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
${chopped}
------------------------------------------------------------------------------
.


More information about the Filepro-list mailing list