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
Text File  |  2000-06-30  |  14KB  |  254 lines

  1. *****************************************************************************
  2.  
  3.                        CRS (Carriage Return Softener)
  4.                                 Version 1.0
  5.  
  6.                           Program and Documentation
  7.                        Copyright (c) 1984 by C. Bowen
  8.  
  9.                This program is released to the public domain.
  10.     
  11. *****************************************************************************
  12.  
  13.  
  14.      Note: In the instructions that follow, control characters are
  15.      represented in two different ways: for WordStar commands, by the
  16.      WS conventional prefix "^" and for Perfect Writer by the PW
  17.      conventional prefix "Ctrl-".  Thus, WordStar "^B" denotes the
  18.      same keystrokes as Perfect Writer "Ctrl-B".
  19.  
  20.  
  21. The purpose of CRS is to facilitate the transfer of documents created with
  22. Perfect Writer (and other word-processing programs that produce more or less
  23. pure ASCII texts) to WordStar so that they can be formatted by the latter.
  24.  
  25. Like many Kaypro owners who have both Perfect Writer and WordStar, I've come
  26. to prefer Perfect Writer for editing and WordStar for formatting.  Using
  27. WordStar to format a Perfect Writer document is harder than it ought to be,
  28. however. The big problem is with the carriage returns.
  29.  
  30. Perfect Writer's word-wrap ("Fill") facility inserts the standard ASCII
  31. characters for carriage return (0D hex) and line feed (0A hex) at the end of
  32. each line.  WordStar, however, does not produce or work with standard ASCII
  33. files.  One way it differs is to distinguish between "hard" carriage
  34. returns, produced by typing the return key, and "soft" carriage returns,
  35. inserted by the word wrap facility.  The latter can be eliminated or moved
  36. around by the formatting commands, but the former cannot.
  37.  
  38. Users of WordStar are used to seeing hard carriage returns marked in the
  39. rightmost column of each line by this 'flag character': <.  Soft carriage
  40. returns are unmarked.  Like Perfect Writer's carriage returns, WordStar's
  41. consist of a pair of characters, one of which is a standard line feed (0A).
  42. The other character varies: for a hard carriage return it's the standard
  43. ASCII 0D, but for a soft one it's a non-ASCII 8D (i.e. 0DH with the eighth
  44. or high bit set).
  45.  
  46. All of this would be of esoteric interest at best if it weren't for the
  47. practical effect on efforts to format ASCII files with WordStar. WordStar
  48. expects to see soft carriage returns at the end of every line within a
  49. paragraph, and hard carriage returns only at the end of and between
  50. paragraphs, where the writer has inserted them with the return key.  This
  51. being so, the paragraph formatting command, ^B, is set to cease its labors
  52. as soon as it comes to a hard carriage return.  In a Perfect Writer
  53. document, it invariably finds one right at the end of whatever line it has
  54. started on, so it immediately lays down its tools and punches out.  You'd be
  55. surprised how little paragraph formatting gets done under this system.
  56.  
  57. One way to deal with the problem is to use WordStar's "search and replace"
  58. facility to remove all the hard carriage returns.  It can be done, but the
  59. multiplex process it requires is no less irksome and onerous than this
  60. sentence is obfuscatory and bombastic.  The technique was outlined by Ezra
  61. Shapiro in PROFILES Vol.1, No. 2 (Sept./Oct. 1983).
  62.  
  63. This program is an attempt to find a better way.  It will read through a
  64. Perfect Writer or other ASCII text looking for hard carriage returns, and
  65. will (unless otherwise directed) replace them with WordStar soft carriage
  66. returns, thus making it possible to format without first going through
  67. the lengthy routines Shapiro describes.
  68.  
  69. There will sometimes be passages (tables and the like) where you won't want
  70. the hard carriage returns removed (lest WordStar reformat them into blocks
  71. of continuous text).  Before you run CRS, you should mark all such passages
  72. by typing a bypass character AT THE BEGINNING AND THE END OF EACH.  The hard
  73. carriage returns in between will be left untouched.
  74.  
  75. The default bypass character in the program is \ (backslash), but if you
  76. want to use a different character you will be given the opportunity to enter
  77. it. Whatever you decide to use, IT MUST BE A CHARACTER THAT IS NOT USED FOR
  78. ANY OTHER PURPOSE ANYWHERE IN YOUR TEXT.  This is necessary not only to keep
  79. the program from operating erratically, but because the bypass character,
  80. wherever it appears, will be expunged from the new version of the file
  81. produced by CRS.
  82.  
  83. You must, of course, type the bypass character into your text before you run
  84. CRS.  Suppose, for example, your document contained the following
  85. passage:
  86.  
  87.           . . . and I could go on giving many, many more equally
  88.           convincing reasons.  However, the evidence can be most
  89.           effectively summarized in the following table:
  90.  
  91.                                  EVIDENCE
  92.  
  93.                      STRONG  POWERFUL  OVERWHELMING  DEVASTATING
  94.  
  95.           HITHER      122      345        250           1352
  96.  
  97.           YON          75      154        363            902
  98.  
  99.           AROUND      190      513        788           4516
  100.  
  101.           ABOUT         3       24         55         295978
  102.  
  103.              In the light of these carefully marshalled facts I'm
  104.           sure you can see that your pathetic counterarguments
  105.           utterly and completely fall to the ground, and with
  106.           serene confidence I await your abject capitulation . . .
  107.  
  108. In order to protect your table, you'd type a bypass character at the end of
  109. the preceding paragraph and the beginning of the following one, thus:
  110.  
  111.                                      . . . following table:\
  112.  
  113.                                 [table]
  114.  
  115.              \In the light . . .
  116.  
  117. Don't worry if these characters appear to mar the alignment of your text as
  118. you type them in.  CRS will read and interpret them, but won't write them
  119. into the new version of the document, so the original alignment will be
  120. restored.
  121.  
  122. Virtually all the time, of course, bypass characters will be used in pairs.
  123. The only exception is where a table (or some other passage whose hard carriage
  124. returns you don't want to disturb) comes at the end of the document.  Be
  125. careful to put in both members of each pair, or you may cause the program to
  126. change exactly the carriage returns you don't want changed, and leave the
  127. ones you don't want left.  (The bypass character is analogous to the
  128. 'toggles' WordStar uses to turn underscoring, boldface, etc. on and off.
  129. The same pitfalls threaten and the same warnings apply.)
  130.  
  131.  
  132.                     ***  AND NOW, A WORD OF CAUTION  ***
  133.  
  134. When you finish running CRS, call up the new file under WordStar, and look
  135. it over, everything will look fine at first.  All your tables, paragraphs,
  136. etc. will be just as you typed them, but there'll be no more jagged sawtooth
  137. line of <'s down the right-hand side marking the hateful hard carriage
  138. returns.  It will look safe to go right ahead and start formatting.  But it
  139. isn't!  In a regular WordStar file, you expect to see a couple of <'s in the
  140. margin between every two paragraphs.  Now, however, you won't see any.
  141.  
  142. WordStar, as we've noted, finds the boundaries of paragraphs by looking for
  143. hard carriage returns.  The reason ^B doesn't work on Perfect Writer files is
  144. that WordStar defines every line as a paragraph.  After CRS has softened all
  145. the hard carriage returns (except where it's been told not to by the
  146. placement of the bypass character), WordStar will be unable to tell where
  147. your paragraphs end.
  148.  
  149. Typing ^B before you've done something to correct this deficiency is
  150. tantamount to instructing WordStar to consider all of your text--up to the
  151. next bypass character, or the end of the file, whichever comes first--one
  152. humongous paragraph, and to format it accordingly.  (If this happens to you,
  153. you're probably best off abandoning the resultant mess.  Go back to the
  154. original file and run CRS on it all over again, and this time don't be so
  155. hasty, OK?)
  156.  
  157. What can you do to solve the paragraph-boundary problem?  Well, if your text
  158. is very short, you could, before you run CRS, type a bypass character at the
  159. end of each paragraph and the beginning of the next.  If you've got a large
  160. number of short paragraphs (maybe you write for one of those newspapers that
  161. pays by the column inch), you'd probably rather find another way.  And there
  162. is one.
  163.  
  164. You can use WordStar's search-and-replace command (in a much quicker and
  165. simpler way than the "Shapiro process").  If you've been writing with
  166. Perfect Writer (and this presumably goes for a number of other programs as
  167. well), your paragraphs are separated by blank lines, meaning that there's a
  168. sequence of two successive carriage returns between every two paragraphs.
  169. Using WordStar's ^QA (find and replace) command, you tell it to look for the
  170. string "^N^N".  (That's two carriage returns, in WordStar language.)  It
  171. asks you what to replace this with, and you reply, "^N^N".  (Trust me.)
  172.  
  173. It looks, I know, as if this would accomplish exactly nothing.  But au
  174. contraire!  When you tell WordStar to FIND a carriage return, it finds any
  175. kind of carriage return, making no distinction between hard and soft.  But
  176. tell it to WRITE a carriage return, and it only knows how to write one kind:
  177. hard.  So that redundant looking search-and-replace command will cause the
  178. program to march through the file, find every occurrence of two successive
  179. soft carriage returns (i.e. your paragraph boundaries), and replace them
  180. with a pair of hard carriage returns.  Now the margin of your file will show
  181. the two sawteeth you expect, in any self-respecting WordStar document, to
  182. see between paragraphs, and you can go ahead and issue a ^B command without
  183. fear that you're unleashing primordial chaos.
  184.  
  185. Sometimes, in the course of writing the document, you may have inadvertently
  186. left a couple of spaces after a carriage return, and if any of these spaces
  187. happen to come between the two carriage returns that mark a paragraph
  188. boundary, WordStar won't be able to find them.  You can avoid any
  189. possibility of this problem by using, before you save the Perfect Writer
  190. document for the last time, one of that program's many undocumented
  191. commands: Ctrl-X backslash (\): "Remove trailing white space."  This
  192. command, no matter where in the document it is issued from, will comb
  193. through it from beginning to end and remove any useless (and invisible)
  194. spaces that happen to follow carriage returns.
  195.  
  196.  
  197.                            How to Use the Program
  198.  
  199. (I thought you'd never ask.)  Most of it has been covered above, and there's
  200. an instruction screen available as you enter the program, but here's a
  201. straightforward rundown.
  202.  
  203. 1. Preliminary: Go through your Perfect Writer file, typing a bypass
  204.    character at the beginning and end of every passage where you want the
  205.    hard carriage returns to be left unchanged.  If you want to be extra
  206.    cautious, type Ctrl-X backslash (\) just before you save the document.
  207.  
  208. 2. It doesn't matter which disk is in which drive, or which one has which
  209.    file, but be sure one of the disks has enough room for a new copy of the
  210.    Perfect Writer file to be made.  (It's possible, but not desirable, to
  211.    overwrite the original file while running CRS.  You don't really want to
  212.    do that, because then if anything goes wrong you won't be able to start
  213.    over.)
  214.  
  215. 3. At the CP/M prompt, type "CRS<cr>".  The help screen, if you choose to
  216.    look at it, will give you a shorter and soberer version of this doc.
  217.  
  218. 4. You're asked for the name of the Perfect Writer file, which you must of
  219.    course type exactly.  If it isn't on the logged disk, don't forget to
  220.    prefix the drive indicator to the file name, or the program won't be able
  221.    to find it.
  222.  
  223. Examples:      MYFILE.MSS          [If it's on the logged drive]
  224.  
  225.                B:MYFILE.MSS        [If it's on B and that isn't the logged
  226.                                    drive.]
  227.  
  228. 5. Now you'll be asked for the name of the new file.  This is entirely up to
  229.    you.  If you use the same name (and same disk) as the original file, the
  230.    latter will be overwritten and lost forever, which as we've seen isn't
  231.    such a terrific idea.  Better use another.  Also, remember that you can
  232.    determine which disk the new file will be written on by prefixing the
  233.    appropriate letter to the file name.  If you omit the prefix, the file
  234.    will be written on the logged disk, no matter where the original and
  235.    CRS.COM are.
  236.  
  237. 6. Finally, you'll be asked if you want to change the bypass character.
  238.    The default, backslash, will be used if you don't enter a choice.
  239.  
  240. 7. The last step is to show you your choice of file names and bypass
  241.    character and give you a chance to go back and re-enter them if there's
  242.    anything wrong.  If you have cold feet, you can also exit the program at
  243.    this point.  Should you choose neither of these options, the program will
  244.    begin running its inevitable course, and you'll have nothing to do until
  245.    it tells you it's finished (the official last gasp is a Warm Boot).
  246.  
  247.  
  248. That's it.  You'll now have a new file bearing whatever name you gave it, on
  249. whatever disk you put it on.  Take a look at it with WordStar.  It should
  250. look hunky-dory.  If it doesn't, well you still have the original, don't you?
  251.  
  252. Don't you?
  253. ixing the
  254.    appropriate letter to the file name.  If you omi