*cabe and non-*cabe editor reconciliation
Fairlight
fairlite at fairlite.com
Wed Jul 14 00:09:43 PDT 2004
Hi all,
Many people, myself included, use external editors to work on their
processing tables. However, it is possible to include processing code
whose segments are too long for editing in *cabe when imported back in.
This becomes a problem is multiple people work on the same code, or if code
is meant to be portable between external editor users, and *cabe users.
This evening I was working to revise a processing table, replacing all my
two character dummy fields with conspicuous and unique long names. This,
of course, expanded my processing line lengths, which I tend to press the
limits of in any event. However, I tend to want the code to be accessible
to anyone just using fP normally-meanining using *cabe for processing
editing.
Toward the end of fixing this problem easily, I wrote the attached program.
What it does, quite simply, is take a processing table and tell you about
every label, if, and then segment that is too long, where it would truncate
in *cabe, and which line number it's on. One can then easily go into an
editor and rectify the situation with a little slice-and-dice action,
rendering the table once again fully editable in *cabe.
The following is a brief sample report (best viewed in a fixed-width font!):
$ cabecon prc.testcabecon
------------------------------------------------------------------------------
Line Number: 1 Segment Type: Label
Line Length: 10 Maximum Segment Length: 7
Segment Content: headerinfo
Excess Content: nfo
------------------------------------------------------------------------------
Line Number: 8 Segment Type: Then
Line Length: 146 Maximum Segment Length: 120
Segment Content: declare OGIsFile(1,YESNO),OGFileName(300,*),OGOrigNam
e(300,*),OGIsCookie(1,YESNO),OGIsTA(1,YESNO),OGUpFile
Size(20,.0);declare extern OGParseResult
Excess Content: clare extern OGParseResult
------------------------------------------------------------------------------
If there are no segment length excesses, a single line of output tells you:
All segment lengths are *cabe compatible.
The attached program is freely usable by anyone who wishes to do so. It
requires perl (any 5.x version should do nicely). Anyone who doesn't have
perl but wishes to use the program is urged to install perl for their
platform. Anyone still not wishing to install perl may contact me offlist
to arrange for compilation for their platform for a nominal compilation
fee.
It's my hope that this will prove useful to someone besides myself.
mark->
--
Fairlight-> ||| "Try to resist / Then we touch, | Fairlight Consulting
__/\__ ||| hallucinate, and tranquilize / |
<__<>__> ||| She's so fine..." --Le Bon | http://www.fairlite.com
\/ ||| | info at fairlite.com
-------------- next part --------------
#!/usr/bin/perl
#
# Fairlight CABE Compatability Checker - cabecon
# Written by Fairlight <fairlite at fairlite.com>
# Copyright 2004, All rights reserved.
# Last modified: 07/14/04
# Version: 1.0
##############################################################################
#
# Usage: cabecon prc.whatever
#
##############################################################################
##### Initialise.
my ($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!)
$~ = '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