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
/
CPM
/
PROGRAMS
/
WSTAR
/
SOFTEN.LBR
/
SOFTEN.DZC
/
SOFTEN.DOC
Wrap
Text File
|
2000-06-30
|
3KB
|
110 lines
SOFTEN
A program to convert an ASCII text
file to WordStar document format.
SOFTEN is an example of a simple filter program. It reads in
characters from one file, modifies them in some way, and reads
them out to another file. In this case the modification is to
the carriage returns that occur at the ends of lines within
paragraphs.
WordStar distinguishes between "hard" and "soft" carriage
returns in order to facilitate reformatting paragraphs. A hard
return is used to designate the last line of a paragraph or a
blank line and is not altered during reformatting. A soft
return, on the other hand, is only temporary. If a soft return
is encountered during reformatting it is ignored unless it
happens to fall at the end of a reformatted line.
In an ASCII text file, all returns are hard. The job of SOFTEN
is to determine which of the carriage returns must be softened.
It does this by looking ahead and checking subsequent
characters. The next character after a return will be a line
feed. The character after that will be another return, a
letter, a space or a tab. If the character is a letter, SOFTEN
assumes that the current line is within a paragraph and the
carriage return is softened by setting the high bit (i.e.,
changing the byte from 0Dh to 8Dh). In the other cases, SOFTEN
assumes the current line is at the end of a paragraph and passes
the return unchanged as a hard return.
There is another distinguishing feature of WordStar document
files that can be considered when converting a file. That is
the use of "soft" hyphens to split a word between two lines.
WordStar prints a soft hyphen if it is the last character on a
line and ignores it within a line. The program HSOFTEN is prov-
ided to convert end-of-line hyphens in text files to soft
hyphens in addition to softening carriage returns. It should be
used with caution, however, since there are times when a hyphen
shouldn't be softened. An example is in the case of compound
adjectives (e.g., non-English-speaking countries).
Both SOFTEN and HSOFTEN are written for a generic CP/M system
and do not require a Z80 CPU. The source code is provided for
the adventurous who may wish to make other changes during a
conversion or perhaps enlarge the buffers to minimize disk
accesses. Both routines are based on a series of subroutines
from Eric Meyer's tutorial on CP/M assembly language
programming. The tutorial is available on various bulletin
boards and should be referred to for additional details.
WordStar is a registered trademark of MicroPro International
Corporation. Comments and bug report messages can be left for
the author on Znode #45 (Houston) at (713) 937-8886.
John Smaardyk
February 6, 1988