home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
KAYPRO
/
CRHRDSFT.LBR
/
CRSOFT.DQC
/
CRSOFT.DOC
Wrap
Text File
|
2000-06-30
|
14KB
|
254 lines
*****************************************************************************
CRS (Carriage Return Softener)
Version 1.0
Program and Documentation
Copyright (c) 1984 by C. Bowen
This program is released to the public domain.
*****************************************************************************
Note: In the instructions that follow, control characters are
represented in two different ways: for WordStar commands, by the
WS conventional prefix "^" and for Perfect Writer by the PW
conventional prefix "Ctrl-". Thus, WordStar "^B" denotes the
same keystrokes as Perfect Writer "Ctrl-B".
The purpose of CRS is to facilitate the transfer of documents created with
Perfect Writer (and other word-processing programs that produce more or less
pure ASCII texts) to WordStar so that they can be formatted by the latter.
Like many Kaypro owners who have both Perfect Writer and WordStar, I've come
to prefer Perfect Writer for editing and WordStar for formatting. Using
WordStar to format a Perfect Writer document is harder than it ought to be,
however. The big problem is with the carriage returns.
Perfect Writer's word-wrap ("Fill") facility inserts the standard ASCII
characters for carriage return (0D hex) and line feed (0A hex) at the end of
each line. WordStar, however, does not produce or work with standard ASCII
files. One way it differs is to distinguish between "hard" carriage
returns, produced by typing the return key, and "soft" carriage returns,
inserted by the word wrap facility. The latter can be eliminated or moved
around by the formatting commands, but the former cannot.
Users of WordStar are used to seeing hard carriage returns marked in the
rightmost column of each line by this 'flag character': <. Soft carriage
returns are unmarked. Like Perfect Writer's carriage returns, WordStar's
consist of a pair of characters, one of which is a standard line feed (0A).
The other character varies: for a hard carriage return it's the standard
ASCII 0D, but for a soft one it's a non-ASCII 8D (i.e. 0DH with the eighth
or high bit set).
All of this would be of esoteric interest at best if it weren't for the
practical effect on efforts to format ASCII files with WordStar. WordStar
expects to see soft carriage returns at the end of every line within a
paragraph, and hard carriage returns only at the end of and between
paragraphs, where the writer has inserted them with the return key. This
being so, the paragraph formatting command, ^B, is set to cease its labors
as soon as it comes to a hard carriage return. In a Perfect Writer
document, it invariably finds one right at the end of whatever line it has
started on, so it immediately lays down its tools and punches out. You'd be
surprised how little paragraph formatting gets done under this system.
One way to deal with the problem is to use WordStar's "search and replace"
facility to remove all the hard carriage returns. It can be done, but the
multiplex process it requires is no less irksome and onerous than this
sentence is obfuscatory and bombastic. The technique was outlined by Ezra
Shapiro in PROFILES Vol.1, No. 2 (Sept./Oct. 1983).
This program is an attempt to find a better way. It will read through a
Perfect Writer or other ASCII text looking for hard carriage returns, and
will (unless otherwise directed) replace them with WordStar soft carriage
returns, thus making it possible to format without first going through
the lengthy routines Shapiro describes.
There will sometimes be passages (tables and the like) where you won't want
the hard carriage returns removed (lest WordStar reformat them into blocks
of continuous text). Before you run CRS, you should mark all such passages
by typing a bypass character AT THE BEGINNING AND THE END OF EACH. The hard
carriage returns in between will be left untouched.
The default bypass character in the program is \ (backslash), but if you
want to use a different character you will be given the opportunity to enter
it. Whatever you decide to use, IT MUST BE A CHARACTER THAT IS NOT USED FOR
ANY OTHER PURPOSE ANYWHERE IN YOUR TEXT. This is necessary not only to keep
the program from operating erratically, but because the bypass character,
wherever it appears, will be expunged from the new version of the file
produced by CRS.
You must, of course, type the bypass character into your text before you run
CRS. Suppose, for example, your document contained the following
passage:
. . . and I could go on giving many, many more equally
convincing reasons. However, the evidence can be most
effectively summarized in the following table:
EVIDENCE
STRONG POWERFUL OVERWHELMING DEVASTATING
HITHER 122 345 250 1352
YON 75 154 363 902
AROUND 190 513 788 4516
ABOUT 3 24 55 295978
In the light of these carefully marshalled facts I'm
sure you can see that your pathetic counterarguments
utterly and completely fall to the ground, and with
serene confidence I await your abject capitulation . . .
In order to protect your table, you'd type a bypass character at the end of
the preceding paragraph and the beginning of the following one, thus:
. . . following table:\
[table]
\In the light . . .
Don't worry if these characters appear to mar the alignment of your text as
you type them in. CRS will read and interpret them, but won't write them
into the new version of the document, so the original alignment will be
restored.
Virtually all the time, of course, bypass characters will be used in pairs.
The only exception is where a table (or some other passage whose hard carriage
returns you don't want to disturb) comes at the end of the document. Be
careful to put in both members of each pair, or you may cause the program to
change exactly the carriage returns you don't want changed, and leave the
ones you don't want left. (The bypass character is analogous to the
'toggles' WordStar uses to turn underscoring, boldface, etc. on and off.
The same pitfalls threaten and the same warnings apply.)
*** AND NOW, A WORD OF CAUTION ***
When you finish running CRS, call up the new file under WordStar, and look
it over, everything will look fine at first. All your tables, paragraphs,
etc. will be just as you typed them, but there'll be no more jagged sawtooth
line of <'s down the right-hand side marking the hateful hard carriage
returns. It will look safe to go right ahead and start formatting. But it
isn't! In a regular WordStar file, you expect to see a couple of <'s in the
margin between every two paragraphs. Now, however, you won't see any.
WordStar, as we've noted, finds the boundaries of paragraphs by looking for
hard carriage returns. The reason ^B doesn't work on Perfect Writer files is
that WordStar defines every line as a paragraph. After CRS has softened all
the hard carriage returns (except where it's been told not to by the
placement of the bypass character), WordStar will be unable to tell where
your paragraphs end.
Typing ^B before you've done something to correct this deficiency is
tantamount to instructing WordStar to consider all of your text--up to the
next bypass character, or the end of the file, whichever comes first--one
humongous paragraph, and to format it accordingly. (If this happens to you,
you're probably best off abandoning the resultant mess. Go back to the
original file and run CRS on it all over again, and this time don't be so
hasty, OK?)
What can you do to solve the paragraph-boundary problem? Well, if your text
is very short, you could, before you run CRS, type a bypass character at the
end of each paragraph and the beginning of the next. If you've got a large
number of short paragraphs (maybe you write for one of those newspapers that
pays by the column inch), you'd probably rather find another way. And there
is one.
You can use WordStar's search-and-replace command (in a much quicker and
simpler way than the "Shapiro process"). If you've been writing with
Perfect Writer (and this presumably goes for a number of other programs as
well), your paragraphs are separated by blank lines, meaning that there's a
sequence of two successive carriage returns between every two paragraphs.
Using WordStar's ^QA (find and replace) command, you tell it to look for the
string "^N^N". (That's two carriage returns, in WordStar language.) It
asks you what to replace this with, and you reply, "^N^N". (Trust me.)
It looks, I know, as if this would accomplish exactly nothing. But au
contraire! When you tell WordStar to FIND a carriage return, it finds any
kind of carriage return, making no distinction between hard and soft. But
tell it to WRITE a carriage return, and it only knows how to write one kind:
hard. So that redundant looking search-and-replace command will cause the
program to march through the file, find every occurrence of two successive
soft carriage returns (i.e. your paragraph boundaries), and replace them
with a pair of hard carriage returns. Now the margin of your file will show
the two sawteeth you expect, in any self-respecting WordStar document, to
see between paragraphs, and you can go ahead and issue a ^B command without
fear that you're unleashing primordial chaos.
Sometimes, in the course of writing the document, you may have inadvertently
left a couple of spaces after a carriage return, and if any of these spaces
happen to come between the two carriage returns that mark a paragraph
boundary, WordStar won't be able to find them. You can avoid any
possibility of this problem by using, before you save the Perfect Writer
document for the last time, one of that program's many undocumented
commands: Ctrl-X backslash (\): "Remove trailing white space." This
command, no matter where in the document it is issued from, will comb
through it from beginning to end and remove any useless (and invisible)
spaces that happen to follow carriage returns.
How to Use the Program
(I thought you'd never ask.) Most of it has been covered above, and there's
an instruction screen available as you enter the program, but here's a
straightforward rundown.
1. Preliminary: Go through your Perfect Writer file, typing a bypass
character at the beginning and end of every passage where you want the
hard carriage returns to be left unchanged. If you want to be extra
cautious, type Ctrl-X backslash (\) just before you save the document.
2. It doesn't matter which disk is in which drive, or which one has which
file, but be sure one of the disks has enough room for a new copy of the
Perfect Writer file to be made. (It's possible, but not desirable, to
overwrite the original file while running CRS. You don't really want to
do that, because then if anything goes wrong you won't be able to start
over.)
3. At the CP/M prompt, type "CRS<cr>". The help screen, if you choose to
look at it, will give you a shorter and soberer version of this doc.
4. You're asked for the name of the Perfect Writer file, which you must of
course type exactly. If it isn't on the logged disk, don't forget to
prefix the drive indicator to the file name, or the program won't be able
to find it.
Examples: MYFILE.MSS [If it's on the logged drive]
B:MYFILE.MSS [If it's on B and that isn't the logged
drive.]
5. Now you'll be asked for the name of the new file. This is entirely up to
you. If you use the same name (and same disk) as the original file, the
latter will be overwritten and lost forever, which as we've seen isn't
such a terrific idea. Better use another. Also, remember that you can
determine which disk the new file will be written on by prefixing the
appropriate letter to the file name. If you omit the prefix, the file
will be written on the logged disk, no matter where the original and
CRS.COM are.
6. Finally, you'll be asked if you want to change the bypass character.
The default, backslash, will be used if you don't enter a choice.
7. The last step is to show you your choice of file names and bypass
character and give you a chance to go back and re-enter them if there's
anything wrong. If you have cold feet, you can also exit the program at
this point. Should you choose neither of these options, the program will
begin running its inevitable course, and you'll have nothing to do until
it tells you it's finished (the official last gasp is a Warm Boot).
That's it. You'll now have a new file bearing whatever name you gave it, on
whatever disk you put it on. Take a look at it with WordStar. It should
look hunky-dory. If it doesn't, well you still have the original, don't you?
Don't you?
ixing the
appropriate letter to the file name. If you omi