
==============================================================================
[   THE KAY*FOG RBBS  |  CPM-CC05.ART  |  posted 01/18/86  |  303 lines 17k  ]

          The CP/M Connection                   Originally published in    
                  by                               Computer Currents       
             Ted Silveira                           2550 9th Street        
  (copyright and all rights reserved)             Berkeley, CA  94710      


                                 May 7, 1985
                              WORDSTAR UTILITIES

     If the most common thing people do with computers is shuffle disks, 
then the second-most common thing they do is shuffle text--word-processing 
and all its related activities.  In the CP/M public domain, there are 
enough text-handling programs to fill several columns, but since WordStar 
is word-processing to most CP/M users, let's start with a batch of 
utilities made especially for WordStar.


MAGE31, RESQ12

     It was almost midnight, and I had a deadline.  Outside it was windy 
and raining.  The work was going so slowly and I was so tired that I 
stupidly hadn't saved anything for at least an hour.  Suddenly the lights 
dimmed, only briefly but long enough.  When I hit the next key, nothing 
happened--the screen still showed my text, intact, but the computer was 
frozen, locked up, out to lunch, total amnesia.  The results:  two minutes 
of frantic pounding on the keyboard, five minutes of stunned silence, a 
resigned push of the reset button, and an hour spent redoing my lost work.

     Even if you've never been struck by this disaster, don't push your 
luck.  Anyone who works with WordStar needs either MAGE31 or RESQ12, two 
programs that recover text after disk errors, locked-up computers, or 
almost any disaster short of a complete power failure.  A few months after 
my midnight disaster, I was hit by the same problem, but this time, I had 
MAGE31.  Total time lost:  2 minutes.

     The secret is that when you have to restart your computer by hitting 
^C or even the reset button, your computer doesn't erase the part of your 
text that's in memory.  It just forgets the text is there.  So MAGE31 and 
RESQ12 go to the section of memory where your text should be and save what 
they find into a disk file.  You can then combine that file with the 
incomplete text file (filetype $$$) you'll find on your disk or with your 
latest complete version.

     MAGE31 is slightly easier to use than RESQ12 but also slightly harder 
to set up because it must be adapted to the different versions of WordStar 
(3.3, 3.0, 2.26).  If you find a copy of MAGE31.COM that's set for your 
WordStar, you're in business.  Otherwise, you must get the assembly 
language file (MAGE31.ASM) and adapt it to your WordStar by changing an 
address in the file and reassembling it.  The ASM file includes directions.  
Once it's set, MAGE31 is quick, simple, and foolproof.

     RESQ12 does the same job in a slightly different way.  When you run 
RESQ12, it asks for a string (a combination of characters or words) from 
your lost text.  It searches upward in memory until it finds that string, 
moves back downward to what it thinks is the start of your text, and then 
saves everything from that point to the end of your text.  In practice, it 
works quickly and pretty accurately (assuming the string really is in your 
text).  Unlike MAGE31, RESQ12 comes ready-to-run and also works with 
programs other than WordStar.

     If you use WordStar, make sure you have one or the other of these 
programs.


PAIRX

     WordStar nightmare #2:  You start printing a long file.  You watch the 
first half-page come out, just to make sure everything's OK, then wander 
off to do something else.  You return half an hour later to discover your 
printer has been underlining every word from page 2 on--you left out a 
single ^S needed to stop the underlining.

     PAIRX, by Eric Gans, is a simple, fast solution to that problem.  It 
checks WordStar files to make sure that the commands for underlining (^S), 
boldface (^B), double-strike (^D), strike-out (^X), superscript (^T), and 
subscript (^V) all come in matched pairs.  If it finds any of these 
characters unmatched (turned on without being turned off), it gives you the 
page and line number of the isolated character.  As it comes, PAIRX expects 
to find a match within one line, but the documentation explains how to 
increase this range, if you want to.

     PAIRX isn't as essential as MAGE31 or RESQ12, but it saves time, 
frustration, and tractor-feed paper.


FILTER PROGRAMS

     WordStar document files are not just ordinary files--they have many 
special characters in them to represent the soft carriage returns, soft 
hyphens, soft spaces, and print control characters that make WordStar's 
formatting so versatile.  These special characters can cause problems if 
you transfer a WordStar file to another word processor, an unprepared 
typesetter, or many bulletin boards and information services.  So there are 
many programs available to "harden" WordStar's soft format by filtering out 
the special characters, resulting in a file (often called a standard ASCII 
file) acceptable in even the most conservative circles.  And because there 
are so many WordStar users, there are also filter programs to "soften" 
standard ASCII files, converting them to WordStar document files so they 
can be reformatted with all WordStar's tricks.

     HRDSFT, by Kenneth Toy, is a lovely program.  It's small (2K) and 
fast, and it can either harden or soften a file.  It does the standard job 
of hardening, converting all soft characters to normal ones and removing 
all control characters except carriage returns, line feeds, and tabs.  

     It also does a good job of softening a hard file, converting all hard 
carriage returns to soft ones unless followed by a space, a tab, a period 
(dot commands), or another carriage return.  This method works pretty well 
on single-spaced text, though some things, like columns of numbers at the 
left margin can trip it up (that's true of all softeners).  HRDSFT has two 
weak points, which it shares with similar programs:  it doesn't soften 
double-spaced text properly, and it doesn't harden soft hyphens but simply 
removes them.  HRDSFT also can't handle files larger than will fit in 
memory, about 48K or so (but I rarely have files that long).

     ENSOFT and UNSOFT are a matched set of filters; ENSOFT softens and 
UNSOFT hardens.  Both work well but have problems with the same things 
HRDSFT does:  double-spaced text, soft hyphens, and occasional odd formats.  
They are bigger (about 8K each) than HRDSFT but can handle files of any 
length.

     FILT6, by Irv Hoff, is a hardener only; it turns any text file into a 
standard ASCII file by cleaning out all special characters and all control 
characters except carriage returns, line feeds, and tabs.  It works with 
any word processor's files but has special WordStar options, such as 
retaining or removing dot commands.  You can also have it replace spaces 
with tabs wherever possible (which saves space in long files) or replace 
tabs with spaces (some programs choke on tabs).  FILT6 also has special 
options for handling assembly language files, which make it handy for 
programmers.

     I keep HRDSFT on my word processing disks, because it's smaller and 
faster than ENSOFT/UNSOFT, and FILT6 on my programming and communications 
disks, because of it extra options.


REPCS, CHGCHR

     These two programs solve one of WordStar's nagging problems--how to 
search and replace ^S.  WordStar's find and find/replace functions can 
search for almost any character, including control characters.  
Unfortunately, they can't search for the ^S WordStar uses for underlining 
because the search command uses ^S as its match-any-character wildcard.  So 
you can't, for example, use the search command to find every word in a file 
that you've underlined.

     REPCS (sometimes called REPLACE), by Maryanne Weston and Donald Hay, 
solves that problem.  It will search a WordStar file and replace every ^S 
with the character @.  You can then use WordStar's search command to find 
the @ and either delete it or change it to something else.  That's all 
REPCS does, though you can use DDT to patch the search and replacement 
characters to new values.

     The more versatile CHGCHR, by Al de la Torre, will search a file for 
any character and replace it with any other, including non-printing control 
characters like ^S.  You specify the search character and replacement 
character on the command line when you run the program, and CHGCHR does the 
rest.  CHGCHR is not limited to working on WordStar files.

     You probably won't need these programs often, but I've known people 
driven to distraction trying to find every ^S in a long WordStar file 
without them.


FTNT14 

     Unlike Perfect Writer and some other word processors, WordStar can't 
do footnotes on its own.  There is, however, a public domain footnoting 
program, FTNT14 by Eric Meyer.  FTNT14 has so many features and subtleties 
I can't cover them all, but here's a quick rundown.

     FTNT14 will extract notes from a WordStar file and print them as 
either footnotes or endnotes.  It will number them automatically (even 
starting over on each page, if you want), format them in various ways, 
carry long footnotes over to the bottom of the next page, and allow you to 
use separate print commands (like condensed printing) in the notes.

     FTNT14 will also handle internal page references for up to 52 
locations within your text.  You can refer to a chapter, table, or other 
location from any point in the text and have FTNT14 insert the correct page 
reference when it finally formats your text.

     FTNT14 also does what Meyer calls "figure block" formatting.  This 
command allows you to specify a certain number of lines of text (a table, 
perhaps, or an example) as a figure block.  When FTNT14 encounters this 
command, it will print the figure block at the top of the following page, 
but unlike WordStar's .CP command, FTNT14 will fill in the rest of the 
space on the current page with text from after the block.  In other words, 
there won't be any gaping whole at the bottom of the page the figure block 
came from.  That's neat.

     FTNT14 works in two passes, one to extract the notes and one to create 
a formatted file for final printing.  It obeys all WordStar control 
characters and most dot commands.  It makes minor changes in the behavior 
of a few dot commands (to accommodate the notes) and won't let you use dot 
commands that affect vertical page format:  top and bottom margins, heading 
and footing margins, line height.  

     Formatting footnotes, especially in a long file, is a touchy, complex 
business, but FTNT14 does its job well.  It's a class program.


INDEX PROGRAMS

     Along with footnotes, go indexes.  There are three public domain 
indexing programs available for WordStar, and though none is as classy as 
FTNT14, all can save you some drudgery.

     WINDEX12, by Eric Gans, is the newest and slickest of the three.  It 
works on WordStar document files only, can index both words and phrases, 
and correctly handles words divided by soft hyphens.  It can index up to 
254 keywords, handles files of any length and references up to 9999 pages, 
and, like the other programs, alphabetizes the index.

     Unlike the following two programs, WINDEX12 doesn't require you to 
mark the words to be indexed in your text.  Instead, you build a separate 
file containing the keywords (up to 254 of them) you want indexed, or you 
enter the keywords from your keyboard at indexing time.  That does make 
your job easier, but it also means you may miss some phrases you waned to 
index, unless you search through the file on your own.  It also means that 
you can't make WINDEX12 ignore certain occurrences of a word.

     INDEX101, by Tom Jennings, has you mark the words and phrases you want 
indexed by using the unused WordStar control characters ^PK and ^PP.  
(Actually, ^PP is used if you're trying out WordStar's undocumented and 
very buggy proportional spacing, in which case you'll have to remove the 
^PP characters after you index.)

     INDEX101 adds the index to the end of your WordStar file, unlike the 
other two programs, which write the index to a separate file.  It also 
erases the old index each time you run the program.  

     GENINDEX also has you mark the words to be indexed in your text, using 
^PQ for major references (printed boldface) and ^PW for minor references 
(printed normally).  These control characters are two of WordStar's user-
definable print control characters; you'll have conflicts if you're already 
using these (to control a dot matrix printer, for example).

     GENINDEX writes its index into a separate file and updates (rather 
than erases) any old index it finds.  However, GENINDEX doesn't work on 
normal WordStar document files, only on files that have been printed-to-
disk using the "disk file output" option of WordStar's print command.

     I rarely index anything, so my experience is limited, but WINDEX12 is 
the easiest program to use.  It's also the program to use if you want to 
index every occurrence of a keyword.  INDEX101 gives you more control if 
you don't want to index every occurrence of a keyword and probably also if 
you're going to index many phrases.  None of the three programs puts out an 
index that's really ready to print; you'll want to do some cleaning up.  


[FTNT14]

     Unlike Perfect Writer and some other word processors, WordStar can't 
do footnotes on its own.  There is, however, a public domain footnoting 
program, FTNT14 by Eric Meyer.  FTNT14 has so many features and subtleties 
I can't cover them all, but here's a quick rundown.

     FTNT14 will extract notes from a WordStar file and print them as 
either footnotes or endnotes.  It will number them automatically (even 
starting over on each page, if you want), format them in various ways, 
carry long footnotes over to the bottom of the next page, and allow you to 
use separate print commands (like condensed printing) in the notes.

     FTNT14 will also handle internal page references for up to 52 
locations within your text.  You can refer to a chapter, table, or other 
location from any point in the text and have FTNT14 insert the correct page 
reference when it finally formats your text.

     In addition, FTNT14 does what Meyer calls "figure block" formatting, 
which allows you to specify a certain number of lines of text (a table, 
perhaps, or an example) as a block.  This command causes FTNT14 to print 
the block at the top of the following page, but unlike WordStar's .CP 
command, FTNT14's figure block command fills in the rest of the space on 
the current page with text from after the block.  In other words, there 
won't be any gaping hole at the bottom of the page the figure block came 
from.  That's neat.

     FTNT14 works in two passes, one to extract the notes and one to create 
a formatted file for final printing.  It obeys all WordStar control 
characters and most dot commands.  It makes minor changes in the behavior 
of a few dot commands (to accommodate the notes) and won't let you use dot 
commands that affect vertical page format:  top and bottom margins, heading 
and footing margins, line height.  

     Formatting footnotes, especially in a long file, is a touchy, complex 
business, but FTNT14 does its job well.  It's a class program.
 

     All these programs are available in the usual channels, except 
WINDEX12, which is so new that it's only available on RCP/Ms at the moment.  
Next issue, I'll cover some text utilities for use with any word processor.

------------------------------------------------------------------------------
      Ted Silveira is a freelance writer and contributing editor to several
   computer-oriented publications.  He appreciates suggestions or feedback
   and can be reached through the KAY*FOG RBBS (415)285-2687 and CompuServe
   (72135,1447) or by mail to 2756 Mattison Lane, Santa Cruz, CA 95065.

-------------------------  End of CPM-CC05.ART Text  -------------------------

