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 / ENTERPRS / CPM / UTILS / S / ZEX50.LBR / ZEX50.DZC / ZEX50.DOC
Text File  |  2000-06-30  |  13KB  |  335 lines

  1.     ZEX 5.0 LANGUAGE DOC -- revised from tcj38bmm -- 10/8/89
  2.  
  3.        by Bridger Mitchell, Plu*Perfect Systems
  4.  
  5.  
  6. Requirements.
  7.  
  8. Z-System (NZ-COM, Z3PLUS, or ZCPR3.x) with extended external
  9. environment.  NZ-COM and Z3PLUS automatically have extended environments;
  10. earlier ZCPR systems can be upgraded to have one by using JetLDR to load
  11. the environment descriptor.
  12.  
  13. ZEX (and most other RSXs) may be incompatible with a few RSXs that
  14. do not use the standard Plu*Perfect Systems RSX header and conform to
  15. the standards for interfacing an RSX to the host system.
  16.  
  17. GOTO version 1.4 is required to recognize labels in ZEX 5.0.
  18.  
  19.  
  20. Hints.
  21.  
  22. If you have difficulty terminating ZEX, run REMOVE.
  23.  
  24. Remember to quote a literal '$' -- use "$$".
  25. It's a good idea to quote a literal '<' -- use "$<".
  26.  
  27.  
  28. .h1 The ZEX Language
  29.  
  30. The ZEX script consists of lines of ascii text, each terminated by a
  31. <CR><LF> pair.  You can create the script with a text editor in ascii
  32. (non-document) mode.  For short, one-off uses, just type the lines
  33. into ZEX when prompted.
  34.  
  35. A number of reserved words, called _directives_, control the various
  36. features.  Each directive begins and ends with the verticule character
  37. '|'.  The directives may be entered in upper, lower, or mixed case; I
  38. use uppercase here to make them stand out.  All script input that is
  39. to be sent to a program begins with a '<' character in the first
  40. column; all other lines are sent to the command processor or, when
  41. specifically directed, are messages sent directly to the console
  42. output.
  43.  
  44. .h2 Command-processor input:
  45.  
  46.  - is any line of the script that doesn't begin with '<'
  47.  - is case-independent.
  48.  - spaces and tabs at the beginning of a line are ignored
  49.  - The end of a script line is the end of one command line.
  50.    Use the |JOIN| directive at the end of a script line to omit
  51.    the CR and continue the same command line on a second script line.
  52.    (The <LF> is always discarded).
  53.  - all whitespace immediately preceding a |JOIN|, and all characters on
  54.    the same line that follow the word |JOIN|, including <CR>, are discarded.
  55.  - use |SPACE| to precede a command with a space, or
  56.    to insert a space after a command and before a comment.
  57.  - begin each command on a new script line, optionally preceeded or followed
  58.    by whitespace.  Although multiple commands may appear on the same line,
  59.    each separated by a semicolon, this increases the chance that the Z-System
  60.    multiple command line buffer will overflow.
  61.  
  62. .h2 Program input:
  63.  
  64.  - is normally obtained from the console.
  65.  - begin each script line of program input with a '<' in the first column.
  66.  - input is case-sensitive.
  67.  - data from the script includes the <CR> (but not the <LF>) at the end of
  68.    a script line.  To omit the <CR>, use the |JOIN| directive.
  69.  - use |LF| for linefeed, |CRLF| for carriage-return-linefeed,
  70.    |TAB| for tab.
  71.  - if the program requests more input than is supplied in the script,
  72.    the remaining input is obtained from the console
  73.  - use |WATCHFOR string| to take further input from the console, until
  74.    the program sends "string" to the console output, then resume
  75.    input from the script
  76.  
  77.  
  78. .h2 Both:
  79.  
  80.  - use |SAY| to begin text to be printed on the console, and |END SAY| to
  81.    terminate that text
  82.  - alternately, use |"|..msg..|"| to delimit a SAY message
  83.  - use |UNTIL X| to take further input from the console,
  84.    until a keyboard 'X' is entered.  The 'X' character may be any
  85.    character; pick one that won't be needed in entering console input.
  86.  - use |UNTIL| to take further input from the console,
  87.    until a keyboard <CR> is entered.
  88.  
  89. .h2 Script Comments
  90.  
  91. A double semicolon ";;" designates the beginning of a comment.  The
  92. two semicolons, any immediately-preceding whitespace, and all text up to
  93. the <CR> of that line of script are ignored.
  94.  
  95. A left brace '{ in the first column designates the beginning of a
  96. comment field.  All text, on any number of lines, is ignored until
  97. the first right brace '}' is encountered.  That line is ignored, too,
  98. and regular input begins at the line following the '}'.
  99.  
  100.  
  101. .h2 Other Directives
  102.  
  103. Within a directive, a SPACE character is optional.  Thus, |IF TRUE|
  104. and |IFTRUE| have the identical effect.
  105.  
  106. Conditional script
  107.  
  108. |IF TRUE|    do following script if command flow state is true
  109. |IF FALSE|    do following script if flow state is false
  110. |END IF|    end conditional portion of script
  111. |'|..msg..|'|    does: IF TRUE||SAY|..msg..|END SAY||ENDIF| 
  112. |IF TRUE| <a> |ELSE| <b> |END IF|     do <a> if true, do <b> if false
  113.  
  114. |RING|        ring console bell
  115. |RING WAIT|    ring bell and wait until a <CR> is pressed
  116. |WAIT|        wait until a <CR> is pressed
  117. |PAUSE nn|    wait up to nn seconds for a keypress
  118. |RING PAUSE nn| wait up to nn seconds for a keypress, ring each second
  119. |AGAIN|        repeat the entire ZEX script
  120. |ABORT|        terminate the script
  121.  
  122. Console output is controlled by this set of directives:
  123.  
  124. |CCPCMD|   / |CCPCMD OFF|    Show/ Don't show: CCP command output
  125. |ZEXMSG|   / |ZEXMSG OFF|    Show/ Don't show: ZEX command prompt
  126. |FALSECMD| / |FALSECMD OFF|  Show/ Don't show: commands in false flow state
  127. |SILENCE|  / |SILENCE OFF|   Suppress/ resume: console output
  128.  
  129. For each of these console-output directive words (...) the following
  130. synonyms are recognized: |...| or |... ON| or |... YES|, and |... NO|
  131. or |... OFF| or |END ...|.
  132.  
  133. Special character directives:
  134.  
  135. |CR|        carriage return
  136. |LF|        linefeed
  137. |CR LF|        carriage return, line feed
  138. |TAB|        horizontal tab
  139. |NUL|        binary null
  140. |SPACE|        space character
  141. |DEL|        delete (7Fh) character
  142. |ESC|        escape (1Bh) character
  143.  
  144. .h2 Parameters
  145.  
  146. ZEX (like SUBMIT) provides for formal parameters designated $0 $1 ...
  147. $9.  When ZEX is started with a command line such as:
  148.  
  149.     A> ZEX SCRIPT1 ARG1 ARG2 ARG3
  150.  
  151. then ZEX reads and compiles the SCRIPT1.ZEX file.  In the script,
  152. any "$0" will be replaced by "SCRIPT1", any "$1" is replaced by
  153. the "first" argument "ARG1", etc.
  154.  
  155. The script may define "default parameters" for the values $1 ...
  156. $9. To do so, enter the three characters "^$n" followed (with no
  157. space) by the nth default parameter.  Put each default parameter
  158. on a separate line.  When ZEX encounters a formal parameter in
  159. the script, it substitutes the command-line parameter, if there
  160. was one on the command line, and otherwise the corresponding
  161. default parameter, if it was defined.
  162.  
  163. .h2 Control characters
  164.  
  165. You enter a control character into the script by entering a caret '^'
  166. followed by the control-character letter/symbol.  For example, "^A"
  167. will enter a Control-A (01 hex).  Control-characters may be entered in
  168. upper or lower case.
  169.  
  170. .h2 Quotation
  171.  
  172. ZEX uses a number of characters in special ways: 
  173.  
  174.     $  ^  |  {  }  <  ;  <space>  <cr>
  175.  
  176. Sometimes we might want to include these characters as ordinary input,
  177. or as output in a screen message.  For this, ZEX uses '$' as the
  178. _quotation character_.  (This is also called the _escape_ character,
  179. because it allows one to escape from the meaning reserved for a special
  180. character.)  "Quotation" means that the next character is to be taken
  181. literally; I use this term to avoid confusion with the control code 1B
  182. hex generated by the _escape key_.
  183.  
  184. If '$' is followed by any character other than the digits from '0' to
  185. '9', that character is taken literally.  Thus, if we want a caret in
  186. the text and not a control character, we use '$^'.  If we want a '<'
  187. in the first column of a line that is for the command processor and
  188. not for program input, then we use '$<' there instead.  And don't
  189. forget that if we want a '$' in our script, we must use '$$'.  There
  190. are some cases, like '$a', where the '$' is not necessary, but it can
  191. always be used.
  192.  
  193. To pass a ZEX directive to a program, or the command processor, use
  194. the quotation character with the verticule.  For example, to echo the
  195. string "|RING|", the zex script should be:
  196.  
  197.         echo $|RING$|
  198.  
  199. .h2 Cancelling ZEX
  200.  
  201. If ZEX is configured with the "flow control" option to YES then
  202. ZEX will monitor the real keyboard while an application program
  203. is sending console output.  You can type a Control-S to halt
  204. output.  If you then type Control-C, ZEX will ask whether you
  205. wish to cancel the current application, or the entire script.
  206.  
  207. If you type anything other than Control-C following a Control-S, the
  208. application will resume its output.
  209.  
  210. .h2 Labels
  211.  
  212. A line that begins with ";=" defines a label.  The GOTO (vers. 1.4)
  213. tool can be used to jump to that point in the script.
  214.  
  215. ;=LABEL1
  216.  
  217.  
  218. .h2 Some examples
  219.  
  220. Figure 2 provides several examples of how the new script language
  221. should work.  You will note a number of differences from the current
  222. dialect used, for example, in Rick Charnes' article in this issue.
  223. And, no doubt, further improvements will emerge from your suggestions
  224. and the actual implementation of the new batch processor.
  225.  
  226.  
  227.              Figure 1.  ZEX Script Examples
  228.  
  229.  
  230. ZEX SCRIPT        INPUT SOURCE/EXECUTION SEQUENCE
  231.  
  232. cmd1    ;;comment    The CCP receives "cmd1<cr>".  The spaces before
  233.                 the comment are stripped, and the <cr> at the
  234.             end of the line is passed to the CCP.
  235.             The cmd1 program gets its input from the console.
  236.  
  237. cmd2 |UNTIL|        The CCP receives "cmd2 " and then gets additional
  238.             input from the console, including a <cr>.
  239.             The cmd2 program gets its input from the console.
  240. |SAY|ccp msg|ENDSAY|cmd3
  241.             When the CCP prompts for the next command,
  242.             "ccp msg" is printed on the console.  The CCP
  243.             then receives "cmd3<cr>"
  244. <text|JOIN|        The cmd3 program gets "textmore text<cr>new
  245. <more text        line of text"
  246. <new line of text    If the program requests more input, it comes from
  247.             the console.
  248.  
  249. cmd4 cmd4tail        The CCP receives "cmd4 cmd4tail<cr>"
  250. <|UNTIL ~|text        The cmd4 program receives console input until
  251.             the user types a '~'.  Then the program receives
  252.             "text"
  253.             If the program requests more input, it comes
  254.             from the console.  If the program doesn't use all
  255.             of the input, it is discarded.
  256.  
  257. cmd5 |UNTIL ~| tail    The CCP receives "cmd5 " and then gets additional
  258.             input from the console, until the user types '~'.
  259.             The CCP then receives " tail<cr>".
  260.             The program receives input from the console.
  261.  
  262. |UNTIL|            The CCP receives a command line of input from the
  263.             console.
  264.             The program receives input from the console.
  265.  
  266. |UNTIL|            The CCP receives a command line of input from the
  267.             console.
  268. <|SAY|message|ENDSAY|    When the program first calls for console input,
  269. <text            "message" is printed on the console.  Then the
  270.             program receives "<cr>text".
  271.             Additional program input is received from the console.
  272.  
  273.  
  274. cmd6            The CCP gets "cmd6<cr>"
  275. <|WATCHFOR string|    The cmd6 program gets input from the console, until
  276. <|"|message|JOIN||"|    the characters "string" appear at the console output.
  277. <text            Then "message" appears on the console output, and
  278.             the program gets "text".  Further input comes
  279.             from the console.
  280.             If "string" never appears, all of this is
  281.             discarded.
  282.  
  283. alias1            The CCP gets "alias1<cr>".  That program, a Z-System
  284.             alias, puts "cmd1;cmd2" into the multiple
  285.             command line buffer.  The CCP then obtains "cmd1"
  286.             from mcl
  287. <|UNTIL ~|        The cmd1 program gets any input from the
  288. <cmd2text        console.  If a '~' is typed, it gets "cmd2text<cr>".
  289.  
  290. cmd3            The CCP gets "cmd3<cr>".
  291. <text|JOIN|        The cmd3 program gets "text".  Further input
  292.             comes from the console.
  293.  
  294. .h2 Summary -- ZEX Help Screen
  295.  
  296. The command "ZEX //" will display this terse summary.  The current
  297. default values for CCPCMD, ZEXMSG, and SILENCE are shown in upper case,
  298. and their opposites in lower case:
  299.  
  300. **  ZEX v.X.X    Syntax:  ZEX [[dir:]subfile[.typ][ parameters]  **
  301. $N            N-th command-line param.    '{' (col. 1) thru '}'  Comment lines  
  302. $$, $| ...    Becomes '$','|'...          ;;    Remainder of line is a comment
  303. '<' (1st char.)  Input line to program    ^X    Control-char 'X' (any char.)
  304. |ABORT|  Quit script if true flow state   |AGAIN|     Repeat script  
  305. |WAIT|   Wait until a <CR> is typed       |RING WAIT| Ring bell, wait for <CR>
  306. |PAUSE nn| or |RING PAUSE nn|        Wait up to nn secs. for keypress   
  307.  
  308. |RING| or |BELL|     Ring console bell    
  309. |UNTIL X|           Use console input until 'X' (any char.) is typed
  310. |WATCHFOR string|    Use console input until "string" is output, then use script
  311. |JOIN|             Omit <CR> and continue on next line
  312. |CR|, |LF|, |CR LF|, |NUL|, |SPACE|, |TAB|  The character(s) 
  313.  
  314. |CCPCMD|   / |ccpcmd off|    Show/ Don't show: CCP command output
  315. |ZEXMSG|   / |zexmsg off|    Show/ Don't show: ZEX command prompt
  316. |FALSECMD| / |FALSECMD OFF|  Show/ Don't show: commands in false flow state
  317. |SILENCE|  / |silence off|   Suppress/ resume: console output
  318. |SAY|      / |END SAY|         Begin/ end:       direct message to console output
  319. |"| = toggle |SAY|                  |'| = toggle |IF TRUE||SAY|
  320. |IF TRUE| or |IF FALSE| / |END IF|  Do script if true(false) flow state
  321. |IF TRUE| .. |ELSE| .. |END IF|     Do script per command flow state
  322. synonyms: |... ON| or |... YES|  /  |... NO| or |... OFF| or |END ...|
  323.  
  324.  
  325.  
  326.                 Bridger Mitchell
  327.                 Plu*Perfect Systems
  328.                 410 23rd St.
  329.                 Santa Monica CA 90402
  330.                 c/o Ladera Z-Node (213)-670-9465
  331.  
  332.                 October 8, 1989
  333.  
  334. ntil 'X' (any char.) is typed
  335. |WATCHFOR string|    Use console input until "string" is o