home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
basic
/
tools
/
squish
/
squish.doc
next >
Wrap
Text File
|
1983-02-09
|
6KB
|
113 lines
SS SS SS SS SS SS SS SS SS SS SS
SS SS
SS IBM PC Basic SS
SS "Squish" SS
SS Author: Dave Archibald SS
SS Translation: Alan J. Zett SS
SS Copyright (c) 1982 SS
SS SoftSide Publications, Inc SS
SS SS
SS SS SS SS SS SS SS SS SS SS SS
"Squish" is a utility program for the IBM PC with 32K,
color/graphics adapter, 1 disk drive, and Basic.
(The following is condensed from SoftSide magazine, issue no. 34.)
Programmers tend to use quite a few REMarks when
programming, add extra spaces to make listings more readable, as
well as putting only a few statements on each line. The result
is a program that is easier to read and debug, but not very space
or memory efficient. The ideal utility would remove extra spaces
and REMs, and combine lines, when possible without altering the
structure of the BASIC program.
Enter the TRS-80 program Squish...if only it were translated
to the IBM PC. We've done so, and it is presented here for the
benefit of all our IBM subscribers.
TO USE SQUISH:
First LOAD the program you wish to pack. After it is
loaded, SAVE it with the ASCII option to a new file. For example:
LOAD "MYPROG.BAS" and then reSAVE it as "MYPROG.ASC",A. After
the program has been saved with the ASCII option, LOAD in
"Squish" and type RUN.
Answer the first question with the name of the file saved
with the ASCII option ("MYPROG.ASC" in the example above).
You will then be given a series of options. You can remove
extra spaces, delete REMarks, and combine lines. The fourth
option gives you the ability to protect a line or group of lines
from being "Squished." Lines entered under this option are
totally ignored by "Squish."
"Squish" will then read in the program to check for lines
that are referenced and proceed to work on it. The display will
update constantly to show, in color (or monochrome), what
"Squish" is doing, and where.
When "Squish" is done, it will allow you to enter the
"Squished" program for examination. I suggest you then do a
quick RENUMber and reSAVE the program under another filename.
When you are finished, you will have a neatly renumbered
program that is not only much shorter than the original (usually
by a few K), but will execute faster. All in all, "Squish" is
quite a useful utility.
VARIABLES;
A: Temporary numeric storage.
A$: Current program line being Squished.
AZ: Screen line on which current program line is displayed.
C$: Contains lines that have been combined.
D: Length of a reserved word being searched for.
DS: The maximum number of user protected lines.
DT: Set to 1 if current line contains a DATA statement.
G1 - G6: A position in A$ at which INSTR starts searching.
HH: Miscellaneous.
I$: Name of a DEF FN to convert a string input into a single upper
case letter.
IP$: Set to "Y" if REM statements are to be deleted.
J$: Storage for A$ as it is being reconstructed.
LN: Current line number being processed.
L$, L1$: Current character of A$ being processed.
N$: Set to STR$(LN).
P: Set to 1 the first time a quote is encountered in a PRINT
statement. Set to 0 when second quote or end of
line is encountered. While P equals 1, all
compression functions are cancelled.
PJ: Points to the current line in PRO(*) being tested.
PP: Set to 1 minus the location of the first character in a
program line following the line number.
PV: Number of protected lines entered.
PRO(*): Optional protected line numbers specified by user.
Q$: Used in an INKEY$ loop.
R: Number of line numbers referenced in REF(*).
RD: Total number of REM statements deleted.
RE: Total number of lines combined.
REF(*): Number of program lines that can be referenced.
S,S1: Miscellaneous. Used in sort routine.
SD: Total number of spaces deleted.
SQ$: SAVE filename for Squished program.
SV$: SAVE filename for Squished program.
T,T1-T2: Miscellaneous.
V$: The current program line stripped of its line number.
X: Set equal to PP.
XC$: Set to "Y" if lines are to be combined.
XS$: Set to "Y" if extra spaces are to be deleted.
XP$: Set to "Y" if user wishes to protect lines.
ZC: Position on line AZ to print L$.
2/9/83 Patches, enhancements, etc. by Herb Shear
The R pointer can no longer lag behind allowing referenced REM and '
statements to be deleted.
Trailing ' no longer added on nonnull referenced lines.
RESTORE & RETURN references to a line now protect the line.
Constructs like X=IGOTO+35 no longer protects line 35.
Indentation was preserved even when combining.
The deblanking tests were extended to close up constructs such as
A( I ), etc.
Goofs in naming the input file are now handled in a friendly fashion
instead of repeating the entire input session over again.
Users should take note of the instructions to use SAVE"-----",A
files as input. Squish is tuned to the interpreter's output which is a
subset of valid input forms. Lowercase, blanks preceding line numbers
and `GO TO xxx' are not handled properly by Squish.