home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / cpm / help / helper.lbr / HELPER.DZC / HELPER.DOC
Encoding:
Text File  |  1988-08-30  |  14.1 KB  |  361 lines

  1.                    HELPER--AN INTERACTIVE TEXT PRESENTER
  2.  
  3.     HELPER is a small (<2k) program that enables you to "menu" a document.  
  4. It combines the function of programs like the TXT__ series which let you 
  5. turn documents into .COM files with that of programs like HELP__ which let 
  6. you divide documents into user-selectable sections.
  7.  
  8.     HELPER itself is a small .COM file which you tack on to the beginning 
  9. of your document to create a new .COM file.  The default behavior when the 
  10. new file is run is to display the document, pausing every 23 lines.  Two 
  11. special characters can be embedded in the document; their default values 
  12. (changeable by assembly-time equate are ^(known as the control prefix) and 
  13. ~(the command prefix).  The control prefix causes the following character 
  14. to be output as its control equivalent; the command prefix causes the 
  15. following characters to be treated as a statement in a small programming 
  16. language.  These statements enable you to control the presentation of the 
  17. document.  They fall into five categories:
  18.  
  19.  
  20.                                 SELECTIONS
  21. ~S            Select: get menu response and select section
  22. ~C            Choice: mark section corresponding to menu selection
  23. ~D            Default: mark section for choice not on menu
  24. ~E            End: mark end of menu choices
  25.  
  26.                                    LOOPS
  27. ~B            Begin: start of loop
  28. ~A            Again: end of loop
  29. ~X            Exit: break out of loop
  30.  
  31.                                TEXT SHARING
  32. ~U            Use: "call" section of text
  33. ~R            Return: return from section called by ~U
  34.  
  35.                                FLOW CONTROL
  36. ~Q            Quit: return to operating system
  37. ~T            Top: restart display from start of document
  38. ~L            Label: give internal name to section of text
  39. ~G            Goto: jump to internally-named position
  40.  
  41.                                   OTHERS
  42. ~P            Pause: force "any key" pause
  43. ~O            Output: display last selection response
  44.  
  45.                           EXPLANATION OF COMMANDS
  46.  
  47. SELECTIONS
  48.  
  49.     These commands let you divide a portion of a document into sections 
  50. such that the user is prompted for a choice, responds, and is shown the 
  51. appropriate section.  To create a selection section, put a list of possible 
  52. choices in the text, and follow it with ~S.  For each possible response, 
  53. put in a line beginning with ~C followed by the response (responses can be 
  54. strings of up to 16 characters).  Then put in the text corresponding to 
  55. that choice.  To display text when the user enters an invalid response, put 
  56. in a line consisting of ~D and follow it by whatever error message you want 
  57. (on separate lines).  At the end of all these sections, put a line 
  58. consisting of ~E.
  59.  
  60.     The commands work as follows: when HELPER encounters a ~S, it waits for 
  61. the user to type in a string followed by CR.  The ~S by itself does not 
  62. cause any output, so it can be placed immediately following a prompt.  When 
  63. the string has been typed, HELPER skips through the text attempting to find 
  64. a ~C followed by that string.  If a match occurs, HELPER resumes displaying 
  65. text from that point on until it sees another ~C, a ~D, or a ~E.  It then 
  66. skips to the ~E and resumes display.  If HELPER sees a ~D while searching 
  67. for a match, it resumes display at that point, continuing to the ~E.
  68.  
  69.     Selection sections can be nested up to 8 levels deep, allowing you to 
  70. create submenus.  Note that HELPER never tries to assign numbers or letters 
  71. to sections the way the HELP__ programs do: you have complete control of 
  72. what menus look like.
  73.  
  74. LOOPS
  75.  
  76.     Frequently you want to show a menu, let the user make a choice, show 
  77. the appropriate section, and then show the menu again.  You can do this by 
  78. using the loop commands.  Whenever HELPER sees a ~B, it marks the current 
  79. position in the document as the beginning of a loop.  When it encounters a 
  80. ~A, it repositions itself to the loop beginning.  If it encounters a ~X, it 
  81. skips down past the ~A.  Normally the ~X will be part of a selection 
  82. section for going back to a previous menu or something similar.
  83.  
  84.     Loops can also be nested up to 8 levels deep.  Selections can be nested 
  85. within loops and vice versa.
  86.  
  87. TEXT SHARING
  88.  
  89.     If you have a portion of text that you need to display at several 
  90. points in a document, you can turn it into a "subroutine" by labeling it 
  91. with ~L and ending it with ~R.  Whenever HELPER sees ~U followed by a 
  92. string, it will save the current postion and search (starting at the top of 
  93. the document) for ~L followed by the same string.  It will then display 
  94. until it sees a ~R, at which point it will resume display after the ~U.
  95.  
  96.     "Subroutines" can also be nested up to 8 levels deep.
  97.  
  98. FLOW CONTROL
  99.  
  100.     A ~Q causes HELPER to immediately return to the operating system (which 
  101. also happens if HELPER "falls off" the end of the document.  A ~T sends you 
  102. back to the top of the document, and ~G followed by a string jumps you to 
  103. the position marked by ~L followed by the same string.
  104.  
  105. OTHER COMMANDS
  106.  
  107.     ~P forces an "any key" pause when it is encountered.  However, it will 
  108. not cause a pause if no text has been displayed since the last pause 
  109. (triggered either by 23 lines or by another ~P), so the user will never see 
  110. two pauses in a row.
  111.  
  112.     ~O displays the string the user typed in response to the last ~S 
  113. command executed.  This can be used for error messages.
  114.  
  115.                           POSITIONING OF COMMANDS
  116.  
  117.     Some of the commands can be located anywhere within a line of text; 
  118. others need a line of their own:
  119.  
  120. ~S            Must be at end of line
  121. ~C<choice>    Must stand alone
  122. ~D            Must stand alone
  123. ~E            Must stand alone
  124. ~B            Anywhere on line
  125. ~A            Anywhere on line
  126. ~X            Anywhere on line
  127. ~U<label>     Must be at end of line 
  128. ~R            Must be at end of line
  129. ~Q            Anywhere on line
  130. ~T            Anywhere on line
  131. ~L<label>     Must stand alone
  132. ~G<label>     Must be at end of line
  133. ~P            End of line or alone
  134. ~O            Anywhere in line
  135.  
  136.                         ESCAPING COMMAND CHARACTERS
  137.  
  138.     If you need to display a literal ^ or ~, simply double it, e.g. ^^ or 
  139. ~~.
  140.  
  141.                                    CASE
  142.  
  143.     Command letters are case-insensitive, as are match strings used with ~C 
  144. and labels used with ~L, ~U and ~G.
  145.  
  146.                          APPLYING HELPER TO A FILE
  147.  
  148. 1) Create the file with your favorite text editor or word processor, making 
  149. sure to create a standard ASCII file.
  150.  
  151. 2) Create a one-byte file called 0.DAT, consisting of one zero byte 
  152. (ASCII NULL).
  153.  
  154. 3) Use PIP as follows:
  155.     PIP <yourname>.COM=HELPER.COM,<yourname>,0.DAT
  156.  
  157.                                EXAMPLE FILE
  158.  
  159.     The following is a (partially complete) documentation file for the 
  160. SEARCH program.  It illustrates how to use commands.  Lines that begin with 
  161. ";" are comments which are not part of the actual file (which is included 
  162. in this library as SRCHHELP.TXT).
  163.  
  164. ;the ^Z is used to clear the screen on a Kaypro
  165. ^Z                              SEARCH topics:
  166. ;here's the text of the top-level menu
  167. 1)  Files, items and separators
  168. 2)  Search phrases
  169. 3)  Specifying arguments
  170. 4)  The search process
  171. 5)  Sending output to a file
  172. 6)  Customizing SEARCH
  173.  
  174. ;we put a label here for use later
  175. ~l0
  176. ;now here's the actual prompt for selection
  177. Which would you like help with (Q to quit)? ~s
  178. ;come here if response was "1"
  179. ~c1
  180. ;we have a submenu, so put a loop around it
  181. ~b
  182. ^z                        Files, items and separators
  183.  
  184.     SEARCH works with line-oriented ASCII text files.  SEARCH treats the 
  185. file as being made up of ITEMS, where an item is one or more lines that 
  186. "logically" belong together.  An item could be a single line, a paragraph, 
  187. or some other grouping.  A file is broken up into items by a SEPARATOR; 
  188. this is a line that occurs at the end of each item in the file.  An example 
  189. would be a blank line between paragraphs.  A separator is always a whole 
  190. line.
  191.  
  192.                    More information is available about:
  193.  
  194. 1)  File types
  195. 2)  Examples of items
  196. ;"call" the piece of text labeled "choose"
  197. ~uchoose
  198. ;this is a nested selection command
  199. ~s
  200. ;choice 1 in this submenu
  201. ~c1
  202. ^z    To be usable with SEARCH, a file must be pure ASCII (no embedded word 
  203. processor codes) and have a CR/LF pair at the end of each line.
  204.  
  205.     Squeezed and crunched versions of such a file are also usable.  SEARCH 
  206. determines whether a file is plain-text, squeezed or crunched by looking at 
  207. the first few bytes of the file rather than by looking for a C or Q in the 
  208. filename extension.  This means that a plain-text file called MYPROG.AZM 
  209. would be correctly read, and a crunched file called RCPM.LST would be 
  210. correctly identified.
  211.  
  212.     SEARCH can also read files out of libraries.
  213. ;second choice in this submenu
  214. ~c2
  215.     An item can be a single line:
  216.  
  217. John Doe      1221 Main St.       Hometown, IL  60000  (312)555-1988
  218. ...
  219. Jane Roe      13 Plymouth Ct.     Providence, RI ?     (800)111-1111
  220.  
  221.     It could be a paragraph:
  222.  
  223.        Text retrieval software can be divided into two categories: programs 
  224. based on directly searching the text and programs based on preparing an 
  225. index to the text..........
  226.  
  227.        SEARCH falls into the first category.  Like all such programs, it is 
  228. slower than an index-based program, but it requires no setup.....
  229.  
  230.     Or it could be a sequence of lines separated by an arbitrary line:
  231.  
  232. SEARCH21.LBR (CP/M)
  233.   A free-format text retrieval system.
  234.  
  235.   Uploaded by Eric Bohlman
  236.  
  237. ----
  238. VDE266.LBR (CP/M)
  239.   The final version of the public-domain text editor.
  240. ----
  241.  
  242.  
  243.     In the first example, there is really no separator; we call this 
  244. "line-by-line."  In the second one, the separator is a blank line and in 
  245. the third, the separator is a line consisting of four dashes.
  246.  
  247.     A separator is always a line by itself (except for line-by-line).  You 
  248. cannot use a period as a separator in order to make each sentence an item; 
  249. items must consist of whole lines.
  250. ;choice for "Q"; we simply exit
  251. ~cq
  252. ~q
  253. ;choice for "P"; we go back to top of document
  254. ~cp
  255. ~t
  256. ;end of choices for this submenu
  257. ~e
  258. ;at end of any selection, pause and repeat loop
  259. ~p~a
  260. ;now this is choice 2 from the top-level menu
  261. ;it's also a submenu
  262. ~c2
  263. ~b
  264. ^z                              Search phrases
  265.  
  266.     SEARCH can look for any sequence of characters within the text.  You 
  267. can search for a word, a phrase, a punctuation character, or any logical 
  268. combination of these.  You can specify whether a word must stand alone or 
  269. whether it can be embedded in another word.  Comparison is 
  270. case-insensitive.  SEARCH always treats a sequence of spaces in the text as 
  271. being equal to a single space.  A line-ending is treated as a space, unless 
  272. it's immediately preceded by a hyphen, in which case both the hyphen and 
  273. the line end are ignored.  SEARCH also ignores leading spaces on a line.  
  274. This means that a word will be matched even if it was hyphenated at the end 
  275. of a line, and a multiple-word phrase will match across line boundaries, 
  276. even if there's a left margin.
  277.  
  278.                    More information is available about:
  279.  
  280. 1)  Phrases
  281. 2)  Embedding control
  282. 3)  Logical combinations
  283. ~uchoose
  284. ~s
  285. ~c1
  286. ^z
  287.     A word or phrase is any sequence of characters that is to be searched 
  288. for in the text.  The total length of all unique words or phrases that you 
  289. wish to search for must be less than 256 characters, and you can use at 
  290. most 16 unique words or phrases in a logical combination of search phrases.
  291. ~c2
  292. ^z
  293.     By default, a word will be matched ANYWHERE in the text.  For example, 
  294. "ion" would match itself.  It would also match "emotion," "ionic" and 
  295. "emotionally."  Sometimes it is desirable to restrict the matching of 
  296. embedded words.  You can do this by putting the special character "^^" at 
  297. the beginning or end of a word or phrase.  When this character is present, 
  298. it signifies that the match can occur only at a word boundary.  For 
  299. example, "^^ion" would match only those words beginning with "ion" and 
  300. "ion^^" would match only words ending with "ion."  "^^ion^^" would match 
  301. only the word "ion."
  302. ~c3
  303. ^z
  304.     SEARCH can do more than detect the mere presence of a single word or 
  305. phrase.  It can also check for the presence of LOGICAL COMBINATIONS of 
  306. words or phrases.  There are three kinds of logical combinations.  First, 
  307. you can specify that a word or phrase must NOT be present in an item.  
  308. Second, you can require that two or more phrases BOTH be present in an 
  309. item.  This is known as an AND combination.  Finally, you can require that 
  310. EITHER of several phrases be present.  This is an OR combination.
  311.  
  312.     To require that a word or phrase NOT be present, you simply precede it 
  313. with the NOT character, which is an exclamation mark.  If you need to match 
  314. a phrase that begins with a literal exclamation mark, you precede it with a 
  315. backslash.  The exclamation mark has special significance only when it is 
  316. at the very beginning of a word or phrase; otherwise it is treated 
  317. literally.
  318.  
  319.     How you specify an AND combination or an OR combination depends on 
  320. whether you are entering arguments by the command line or by prompt.  This 
  321. is covered in the section on how to specify arguments, and examples of 
  322. logical combinations are available there.
  323. ~cq
  324. ~q
  325. ~cp
  326. ~t
  327. ~e
  328. ~p~a
  329. ;the rest of the top-level choices haven't been filled in yet
  330. ~c3
  331. ~c4
  332. ~c5
  333. ~c6
  334. ~cq
  335. ~q
  336. ;this gets executed if the response didn't match one of the
  337. ;allowable top-level choices
  338. ~d
  339. ~ubadchoice
  340. ;this sends us back to the top level prompt.  Note that in the submenus,
  341. ;an invalid response simply recycled the menu with no output
  342. ~g0
  343. ;end of top-level menu
  344. ~e
  345. ;send us back to the beginning
  346. ~t
  347. ;this is a subroutine
  348. ~lchoose
  349.  
  350. Pick one or press Q to quit, P to see the previous section: ~r
  351. ;this is another subroutine.  Note the use of ~o to echo the invalid 
  352. ;response
  353. ~lbadchoice
  354. "~o" isn't on the menu.  Try again
  355. ~r
  356. ;end of example file
  357.  
  358.  
  359.                                   Eric Bohlman
  360.                                   August 5, 1988
  361.