home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / cpmug / cpmug004.ark / ACT.DOC next >
Encoding:
Text File  |  1984-04-29  |  16.0 KB  |  487 lines

  1.  
  2.                                                   ACT version 31
  3.                                 1                     10/17/77
  4.  
  5.  
  6.                 Summary of Actor (ACT) functions
  7.  
  8.  
  9.  
  10. I_n_t_r_o_d_u_c_t_i_o_n_
  11.  
  12. ACT is a macro text interpreter which runs under a CP/M system
  13. with more than 16K bytes of RAM.  ACT uses the same algorithm as
  14. TRAC ("TRAC" is a registered trademark of Rockford Research
  15. Institute) and a set of primitive functions which are similar to
  16. those in the TRIX interpreter.  ACT also uses the special
  17. characters @{|} in place of TRAC's #(,).  ACT has been used to
  18. control jobs on a large time sharing system and to format
  19. diskette files; it is generally too slow for efficient human
  20. interaction.
  21.  
  22. Logically (but not necessarly psychologically), the syntax is
  23. very simple.  Program and data are character strings which are
  24. handled by the same rules.  There are three structures:
  25.  
  26.         {...}
  27.        @{op|arg1|arg2|...|argn}
  28.       @@{op|arg1|arg2|...|argn}
  29.  
  30. The first is a literal quote; the contents are passed on as the
  31. value.  The second performs the indicated operation on the
  32. argument strings and immediately rescannes the resulting value.
  33. The last form performs the operation and passes the value to the
  34. next higher level function.  Any op or argument may have any of
  35. the three forms.  For more information on the scanning algorithm
  36. see any of the published descriptions of TRAC.
  37.  
  38. There is a version of ACT which uses upper case letters for the
  39. command names and the special characters ^[,]' instead of @{|}`.
  40. Also, the meta-character is the exclaim (!).
  41.  
  42.  
  43. R_e_f_e_r_e_n_c_e_s_
  44.  
  45. 1. Moll, H; TRIX - An interactive, interpretive language for
  46.    manipulating strings of characters.  Lawrence Livermore Lab
  47.    report UCID-30100.
  48.  
  49. 2. Moors, C. N.; TRAC, a Procedure describing Language for the
  50.    Reactive Typewriter.  Comm. ACM 9, 3 (March, 1966)
  51.  
  52. 3. Moors, C. N.; TRAC, A Text Handling Language.  Proc. ACM 20th
  53.    Nat. Conf., Cleveland, August, 1965.
  54.  
  55. 4. Wegner, Peter; Programming Languages, Information Structures,
  56.    and Machine Organization.  McGraw-Hill Book Co., 1968.
  57.  
  58.                                                   ACT version 31
  59.                                 2                     10/17/77
  60.  
  61.  
  62.                 Summary of Actor (ACT) functions
  63.  
  64.  
  65.  
  66. E_x_e_c_u_t_e_ _l_i_n_e_
  67.  
  68.  
  69.          act
  70.          act <file-name>
  71.          act <file-name> <options>
  72.  
  73. If a file name is given, then the ACT macros in the file are read
  74. first; <file-name> has the general form "d:x.y".  The string @in
  75. is initialized to the characters between "act " and the return.
  76.  
  77. As a special case, <options> may be the three characters ^hh,
  78. where ^ is the caret (or up arrow), and hh is a hex page number.
  79. Free storage is allocated from the end of the interpreter up to,
  80. but not including, page hh or FBASE if ^hh is not given.
  81.  
  82.  
  83. N_o_n_-_d_i_s_k_ _I_/_O_ _a_n_d_ _d_e_b_u_g_
  84.  
  85. @{rs|prompt}  "read string"
  86.    Value is a line of input from the console (via CP/M call #10),
  87.    or the next string from the input file.  Line-feed, return,
  88.    and tab characters from the input file are ignored; a string
  89.    is terminated by the meta-character (~) or by the end-of-file.
  90.    Comments on the input file are enclosed within matching left
  91.    quotes (`).  Input files generally do not end with the
  92.    meta-character.
  93.  
  94. @{ps|a|a|...}  "print string"
  95.    Each argument (after the "ps") is printed on a separate line;
  96.    but there is no CR-LF after the last argument.
  97.  
  98. @{so|message}  "send to Octopus"
  99.    The message is sent over the selected Octopus channel.
  100.    Usually the message does not end with an Octopus end-message
  101.    character.  The echo is lost.  (Note:  "Octopus" is the name
  102.    of the LLL time sharing system.  The so and ro functions talk
  103.    to Octopus over a serial interface as an ordinary terminal.
  104.    Separate documentation illustrates how this hardware dependent
  105.    function can be patched for different i/o ports.)
  106.  
  107. @{ro|x|s|f|eom}  "read Octopus"
  108.    If the Octopus time-out is greater than zero, then a message
  109.    terminator is sent.  This terminator either causes a previous
  110.    "so" message to be delivered or a log-out in case there was no
  111.    previous "so" and the terminator is a control-D.  Octopus
  112.    output is then collected in the string @ro until the string x
  113.    is encountered or until the time-out interval passes since the
  114.    last character.  The value is s if x was found, otherwise f.
  115.    If s and f are omitted, the value is null.  (Note this
  116.  
  117.                                                   ACT version 31
  118.                                 3                     10/17/77
  119.  
  120.  
  121.                 Summary of Actor (ACT) functions
  122.  
  123.  
  124.  
  125.    inconsistency with the functions gc and in.)  A null x will
  126.    always fail to match.
  127.  
  128.    A non-null last argument (eom) will change the Octopus message
  129.    terminator.  The argument eom must be the two hex characters
  130.    which correspond to the terminator.  The terminator is
  131.    initially a control-D.
  132.  
  133. @{io|x|x|...}  "input-output parameters"
  134.    Each argument x is a letter (o,t,m) followed by an associated
  135.    parameter:
  136.          oa   selects Octopus channel a. (initial value)
  137.          ob   selects Octopus channel b.
  138.          tn   sets the Octopus time-out to n seconds.  E.g. t120.
  139.          mc   redefines the meta-character to be the character c.
  140.          p    print: terminal output is thru CP/M, "fw" applies.
  141.          d    display: direct output, "fw" does not apply.
  142.               Note: this option is hardware dependent.
  143.  
  144. @{fw|n}  "form width"
  145.    The "print string" function will start a new line after n
  146.    characters.  The initial form width is 80.  However, this does
  147.    not apply if an @{io|p} is in effect.
  148.  
  149. @{tn}  "trace on"
  150.    Turn the trace mode on and save the previous mode.  Note:  An
  151.    @{io|d} is implicitly given so that the output will wrap
  152.    around; see the fw function above.
  153.  
  154. @{tf}  "trace off"
  155.    Restore the previous trace mode, up to eight levels.
  156.  
  157. @{nb}  "number of blocks"
  158.    Value is the number of sixteen word free storage blocks.
  159.  
  160. @{fs|n|m}  "free storage"
  161.    Free storage is augmented by the memory locations n up to but
  162.    not including m; n and m are decimal and must be multiples of
  163.    16.
  164.  
  165. @{vn}  "version number"
  166.    Value is the ACT version number.
  167.  
  168.  
  169.  
  170.  
  171.  
  172.                                                   ACT version 31
  173.                                 4                     10/17/77
  174.  
  175.  
  176.                 Summary of Actor (ACT) functions
  177.  
  178.  
  179.  
  180. D_i_s_k_ _I_/_O_
  181.  
  182. @{of|file-name|n|s|f}  "open file"
  183.    The file name has the general form "d:x.y".  If d is omitted,
  184.    the system drive is selected; lower case characters in the
  185.    name are mapped to upper case.  The number of the next record
  186.    to read or write is set to n.  (Records are numbered
  187.    sequentially starting at zero; each record consists of 128
  188.    characters.)  If the open fails the value is f; otherwise the
  189.    value is s.
  190.  
  191.    Since only one file can be open at a time, the record number
  192.    of the crrrent file may need to be saved by @{rn}.  Also, a
  193.    currently opened output file must be closed before another
  194.    open.
  195.  
  196. @{mf|file-name|s|f}  "make file"
  197.    If the named file can be created, the value is s; otherwise
  198.    the value is f.  The current record number is set to zero.
  199.  
  200. @{cf|s|f}  "close file"
  201.    The currently opened file is closed.  The value is f if there
  202.    is a close error, otherwise s.
  203.  
  204. @{df}  "destroy file"
  205.    The current file is destroyed.
  206.  
  207. @{rn}  "record number"
  208.    The value is the record number of the next record to read or
  209.    write.  This number applies to the currently opened file.
  210.  
  211. @{wf|string-name|x|s|f}  "write file"
  212.    Characters from the named string, starting with the first, are
  213.    written to the currently opened file.  If x is null, then the
  214.    last partial record is not written; instead, the form pointer
  215.    of the named string is left positioned at the remainder.  For
  216.    example, the output for the next write could be constructed by
  217.    @{ns|name|@@{in|name}<more output>}.
  218.  
  219.    If x is non-null, then the first character of x is used to pad
  220.    out the remainder of the record and the record is written.  An
  221.    entire record of pad characters is written if the previous
  222.    output ended on a record boundary.
  223.  
  224.    The value is f if there is a write error, otherwise s.
  225.  
  226. @{rf|string-name|m|s|f}  "read file"
  227.    The next m records are read from the currently opened file and
  228.    appended to the named string.  The value is f if the physical
  229.    end of file is reached, otherwise s.
  230.  
  231.  
  232.                                                   ACT version 31
  233.                                 5                     10/17/77
  234.  
  235.  
  236.                 Summary of Actor (ACT) functions
  237.  
  238.  
  239.  
  240. @{rd}  "read dialect"
  241.    The value is the text from the currently open file.  The file
  242.    is read starting with the record set by the open file.  The
  243.    input is processed in the same manner as described for the rs
  244.    function.  Thus, one program can load another in the same way
  245.    as is done when a file name is put on the execute line after
  246.    "act".  Warning:  No of or mf commands can be executed until
  247.    the file has been read.
  248.  
  249.  
  250.  
  251.  
  252. C_o_n_t_r_o_l_ _a_n_d_ _d_e_l_a_y_
  253.  
  254. @{eq|a|b|s|b|s|...|b|s} or @{eq|a|b|s|b|s|...|f}  "equal"
  255.    The value is the first s for which the preceeding b is equal
  256.    to a, where "equal" means string equality.  If the last
  257.    argument is not one of a "b-s" pair, then it provides an
  258.    "else" value.
  259.  
  260. @{ge|n|m|s|f}  "greater than or equal to"
  261.    The value is s if n is numericallly greater than or equal to
  262.    m, otherwise the value is f.
  263.  
  264. @{nt|name|s|f}  "null test"
  265.    The value is s if the named string is null, otherwise the
  266.    value is f.
  267.  
  268. @{ex|x}   "exit"
  269.    Clear the active and neutral strings; then set the active
  270.    string to x.
  271.  
  272. @{st}  "stop"
  273.    Return to CP/M.
  274.  
  275. @{zz|n}  "sleep"
  276.    Sleep for n/10 seconds.
  277.  
  278.  
  279.  
  280.  
  281. S_t_r_i_n_g_ _o_p_s_ _a_n_d_ _h_e_x_-_t_o_-_c_h_a_r_a_c_t_e_r_s_
  282.  
  283. @{ns|name|value|name|value|...}  "name string"
  284.    Create one or more strings with the given values.
  285.  
  286. @{as|name|x|name|x|...}  "append string"
  287.    Append the string x to the named string.
  288.  
  289.  
  290.                                                   ACT version 31
  291.                                 6                     10/17/77
  292.  
  293.  
  294.                 Summary of Actor (ACT) functions
  295.  
  296.  
  297.  
  298. @{ss|name|arg|arg|...}  "segment string"
  299.    Create arguments in the named string.
  300.  
  301. @{cl|name|arg|arg|...} or @{name|arg|arg|...}  "call"
  302.    Return the named string, starting at the first character, with
  303.    the actual arguments substituted for those corresponding
  304.    substrings which were matched by a previous "segment string".
  305.  
  306. @{gc|name|n|s|f}  "get characters"  (4 or more arguments)
  307.    Move the form pointer over n characters, or to the end of the
  308.    form if there are fewer than n characters remaining.  The
  309.    characters passed over are put into the string "@gc".  Return
  310.    s if there are n characters after the form pointer in the
  311.    named string, otherwise return f.
  312.  
  313. @{gc|name|n}  "get characters"  (3 arguments)
  314.    Like gc with 4 or more arguments except that the value of @gc
  315.    is also the value of this function.
  316.  
  317. @{gc|name}
  318.    Return the total number of characters in the named form.
  319.  
  320. @{in|name|p|s|f}  "initial"  (4 or more arguments)
  321.    Starting at the form pointer, search for the substring p.  The
  322.    characters which are passed over in the search, up to but not
  323.    including p, are put into the string "@in".  If p is found
  324.    return s, otherwise return f.  The form pointer is left
  325.    positioned after s, or at the end of the form.  Null p always
  326.    fails.
  327.  
  328. @{in|name|p}  "initial"  (3 arguments)
  329.    Like in with 4 or more arguments except that the value of @in
  330.    is also the value of this function.
  331.  
  332. @{in|name}  "initial"  (2 arguments)
  333.    Return the characters from the form pointer to the end of the
  334.    form; also set @in to this value.  The form pointer is left
  335.    past the end of the form.
  336.  
  337. @{cr|name}   "call restore"
  338.    Move the form pointer of the named string to the beginning of
  339.    the string.
  340.  
  341. @{dd|name|name|...}   "delete definitions"
  342.    Delete the named strings.
  343.  
  344. @{pk|hex}   "pack"
  345.    Return the characters whose hex values are given.
  346.  
  347.  
  348.                                                   ACT version 31
  349.                                 7                     10/17/77
  350.  
  351.  
  352.                 Summary of Actor (ACT) functions
  353.  
  354.  
  355.  
  356. @{uk|x}  "unpack"
  357.    Return the hex form of the string x.
  358.  
  359.  
  360.  
  361.  
  362. A_r_i_t_h_m_e_t_i_c_
  363.  
  364. @{ad|n|n|...}   "add"
  365.    Return the sum of the arguments.  Numbers are represented by
  366.    signed decimal integers whose magnitude is less than 32768.
  367.  
  368. @{su|n|m}   "subtract"
  369.    Return n-m.
  370.  
  371. @{ml|n|n|...}   "multiply"
  372.    Return the product of the arguments.
  373.  
  374. @{dv|n|m}   "divide"
  375.    Return n/m.
  376.  
  377. @{md|n|m}   "mod"
  378.    Return n mod m.
  379.  
  380.  
  381.  
  382.  
  383. S_p_e_c_i_a_l_ _s_t_r_i_n_g_s_
  384.  
  385. @cb   "console break"
  386.    The value of this string is the last console break character.
  387.  
  388. @im   "idle macro"
  389.    This macro is loaded whenever the active string is empty.  The
  390.    initial value of @im is @{ps|@{rs|.}}, but @im may be changed
  391.    at any time.
  392.  
  393.  
  394.  
  395.  
  396.  
  397.                                                   ACT version 31
  398.                                 8                     10/17/77
  399.  
  400.  
  401.                 Summary of Actor (ACT) functions
  402.  
  403.  
  404.  
  405. C_o_n_s_o_l_e_ _"_b_r_e_a_k_"_
  406.  
  407.    The last character of any console imput, other than
  408.    for the @{rs} function, is saved in the string @cb.
  409.    Moreover, if the input character is an ESC, then you
  410.    will be prompted to type one of the letters t, n, or i
  411.    which will turn the trace on (t), turn the trace off (n),
  412.    or reload the idle macro (i).
  413.  
  414.    Console input will stop output, or cause an immediate
  415.    return from the zz or ro functions.
  416.  
  417.  
  418.  
  419.  
  420. G_e_n_e_r_a_t_i_n_g_ _a_ _C_O_M_ _f_i_l_e_ _w_i_t_h_ _a_ _p_r_e_l_o_a_d_e_d_ _A_C_T_ _p_r_o_g_r_a_m_
  421.  
  422. A COM file containing the ACT interpreter and a preloaded macro
  423. file may be created as follows, assuming a 32K system.
  424.  
  425. 1. Append something like the following to your macro file
  426.  
  427.          @{ns|@im|{
  428.             @{fs|26368|29184}
  429.             @{ns|@im|{@{ps|@{rs|.}}}}
  430.             @{start}
  431.          }}
  432.          @{st}
  433.  
  434.    where "start" is the name of your top level macro.  Note that
  435.    the fs function adds 6700 hex up to 7200 hex to the free
  436.    storage list after the program is started (step 4).  Free
  437.    storage normally extends to FBASE which is 7200 hex in a 32K
  438.    system.
  439.  
  440. 2. Load your program by typing
  441.  
  442.          act macro-file ^67
  443.  
  444.    where "^" is the caret, or up arrow.  Free storage will extend
  445.    up to 6700 hex; if your program needs more space, then you
  446.    need more than 32K to make a COM file.  The st function at the
  447.    end of your file will return control to CP/M.
  448.  
  449. 3. Make a COM file with the SAVE command
  450.  
  451.          save 103 code.com
  452.  
  453. 4. Run the code by typing either of the following
  454.  
  455.          code
  456.  
  457.                                                   ACT version 31
  458.                                 9                     10/17/77
  459.  
  460.  
  461.                 Summary of Actor (ACT) functions
  462.  
  463.  
  464.  
  465.          code options
  466.  
  467.    The options will be in the string @in.
  468.  
  469.  
  470.  
  471.  
  472. E_r_r_o_r_ _m_e_s_s_a_g_e_s_
  473.  
  474. DISK EOF:  The rs function is trying to read beyond the end of
  475.    file.
  476.  
  477. FREE STORAGE IS EMPTY:  The combined storage required for named
  478.    strings, string names, and active and neutral strings has
  479.    exceeded the allocated memory.  At this point, the active and
  480.    neutral strings are cleared and control given to the @im
  481.    macro.  The second time this happens, control returns to CP/M.
  482.  
  483. NS STACK OVERFLOW:  The number of unprocessed arguments exceeds
  484.    250.  The level of nesting or the number of arguments is
  485.    excessive.  For example, the number of arguments for a ns
  486.    should not get much over 200.
  487.