ENSOFT Version 2.0 documentation                       p. 1

ENSOFT   converts  "hard  formatted"  text  files  to  Wordstar's 
"document" format.

Version  1.0 was written by Gordon Brandly of Fort  Saskatchewan, 
Alberta, Canada for Ron Cain's Small-C compiler.  It did the job, 
but handled errors by exiting to CP/M.

Version  2.0,  a complete rewrite for Walt Bilofsky's C/80  (Ver. 
3.0)  C compiler by Harvey G.  Lord,  is highly error  resistant.  
I've been unable to crash it, try as I might.

Purpose:

Ever  downloaded a file from a bulletin board and wanted  to  re-
format it?  Ever printed a Wordstar file to  disk,  stripped  off 
the  high bits,   then lost  the  original?    ENSOFT converts  a 
regular   CP/M   text  file,  one with "hard" spaces  and  "hard" 
carriage  returns  to Wordstar's "document"  mode.   This  allows  
painlessly reforming the text to different column widths.

Operation:

ENSOFT2 has two modes of operation:  command mode and interactive 
mode.

Command mode requires that you present the names of the input and 
output files on the command line, thus:

ENSOFT2 d:input.fil d:output.fil<cr>

If  you've  specified both files correctly  (ENSOFT2  checks  for 
that),  the program proceeds to change the "hard" formatted input 
file  into a "softened" output file.   This is the fastest way to 
execute the program.

Interactive  mode  is completely prompted and each  keystroke  is 
checked  to  make sure its character is permitted in a  filename.  
Execute  interactive mode by entering the program's name  on  the 
command line:

ENSOFT2<cr>

It  then asks you for the drive on which to find the input  file, 
it's  name and it's filetype.   In each case,  the  program  only 
accepts  permissible  characters and no more than eight  for  the 
filename,  no more than three for the filetype.  If you type nine 
characters for the filename or four for the filetype,  you'll get 
an  error message and the extra characters are ignored.   If  you 
type a character that's not allowed in a filename,  you'll get an 
explanatory  error  message and be asked to start over  from  the 
beginning of that entry.
ENSOFT Version 2.0 documentation                       p. 2

After  getting the input and output names,  program operation for 
command and interactive modes is the same.   ENSOFT2 first checks 
to see if the files are identically named on the same  disk.   If 
they are, the "softening" process can't take place.  CP/M doesn't 
allow two files of the same name and type on the same disk.   You 
are  so  notified and permitted to start the  file  specification 
over again, in interactive mode.

If  the files have different names,  ENSOFT2 checks for the input 
file's existence.   If it doesn't exist in this user area on  the 
designated disk,  you are so notified and permitted to re-specify 
the  input file.   You MAY,  when it asks you to press any key to 
continue,  change any disks you like.   ENSOFT2 resets the drives 
to avoid CP/M's R/O BDOS error.

If the input file does indeed,  exist,  ENSOFT2 checks to see  if 
the  output file can be opened.   If the disk directory is  full, 
you'll  be told and the whole process starts over again,  in  in-
teractive  mode.   Again,  you may change any disks you like when 
the "Press any key" prompt appears.  ENSOFT2 resets the drives.

If  both input and output files are acceptable,  ENSOFT2  creates 
the "softened" output file you need.  It also tells you what it's 
doing and when it's done.

NOTES:

The only error I can think of that ENSOFT2 doesn't trap is a disk 
full  error  while writing the output file.   You must make  sure 
there's  enough room on the output disk for a file the same  size 
as the input file.

Also,  ENSOFT2 is set for a two-drive system.  If you've got more 
drives, you'll have to change the error trap in getdrv to include 
your system's drives, then recompile and assemble.

If you want to go the other way (document file to text file),  an 
easy way is to use my program T.COM:

T d:input.fil >d:output.fil<cr>

On some CP/M systems (DEC Rainbow 100 for one), the output file's 
drive designator,  name,  and type must be in upper case.   Those 
systems' CCP doesn't read beyond the ">"  and,  therefore,  can't 
convert the characters into upper case.

Another way to strip off WordStar's high bits is with PIP:

PIP d:output.fil=d:input.fil[z]<cr>

Unless  you  want to lose your input file,  never give input  and 
output files the same names.
ENSOFT Version 2.0 documentation                       p. 3

How It Works:

Gordon Brandly's explanation:

     Wordstar represents 'soft' carriage returns and spaces (i.e. 
     those  that can appear or disappear when you reform a  para-
     graph)  by  turning  on the highest bit of  the  appropriate 
     return  or space code.   ENSOFT makes some educated  guesses 
     about which returns and spaces it should make  'soft'.   For 
     instance,  if  there are multiple spaces between  words,  it 
     leaves  the first one after the word 'hard',  and  'softens' 
     the others up to the beginning of the next word.

In  fact,  WordStar also turns on the high bit in the last  char-
acter of every word.   Fortunately,  ENSOFT doesn't need to mimic 
that  detail.   WordStar  will  reform paragraphs in  which  each 
word's last letter is in standard ASCII.   ENSOFT2 does not  turn 
on the high bit of each word's last letter.

ENSOFT2 is a complete rewrite, including the algorithm with which 
text  is processed.   Brandly's program only remains in name  and 
function.

Test ENSOFT2 by running this documentation file through it.  Then 
reform the file with WordStar.   You should not have any  garbage 
characters and everything should look good.

Running  non-ASCII  (non-text)  files  through  ENSOFT2  produces 
nonsense, but leaves the original file intact so no harm's done.

Possible bugs are the same as Brandly's:

     I've  only  used  this program on my  own  Wordstar-produced 
     files and some public domain documentation files.   I  don't 
     know  how  well  it  will stand up if you  run  weird  files 
     through  it (e.g.  100 carriage returns in  a  row,  strange 
     embedded control characters,  etc.).  If by mistake you pro-
     cess  a  file that's already in document format the  program 
     won't  mess  it up too badly.   The original  file  is  left 
     alone,  so  you can always recover if things don't work  out 
     right.

I believe,  however,  that ENSOFT2 will work fine with all of the 
above.

Ownership Notice:

ENSOFT2  was completed on 02/19/84 by Harvey  G.  Lord.   It  was 
placed  in the public domain by the author.  You may do with this 
as you please; use it, sell it, eat it for breakfast.  I ask that 
you do not delete my name.   If you find ENSOFT2 useful,   please 
give it to friends.
ENSOFT Version 2.0 documentation                       p. 4

Please  report  any bugs or improvements to  me  at  203-429-8044 
after 5:00 P.M. EST, or on weekends.

Harvey G. Lord
P.O. Box 183
Storrs, CT  06268

Enjoy.
