home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / online / source / c / compilers / C_Interp.sit.hqx / C_Interp / Parser.docs < prev    next >
Text File  |  1992-04-21  |  26KB  |  692 lines

  1. THE SCRIPT LANGUAGE
  2.  
  3.  
  4. The script language interpreted by "Terminal" is a subset of C with many
  5. specialized intrinsic (built-in) functions. Please read a C reference book
  6. to learn the C syntax, or see the enclosed script examples to get a feeling
  7. of the language. I will not write a book about programming in C here, only
  8. tell you the essentials.
  9.  
  10.  
  11. PROGRAM
  12.  
  13. A program is recognized as a script if it is in a TEXT file, and if the
  14. file name ends in ".s". Spaces, tabs and carriage return characters are
  15. considered to be white space. No identifier and no keyword can be separated
  16. by white space. A program consists of: comments, global variable
  17. definitions and function definitions. Everything included between "/*" and
  18. "*/" is considered a comment and will not be interpreted. Comments cannot
  19. be nested. The "/*" and "*/" are not recognized as comment delimiters
  20. inside string or character constants. Global variables are those variables
  21. that are known to all functions, unless their names are reused as local
  22. variables. Global variables can be initialized using any expression that
  23. involves either constants or other globals that are already defined at that
  24. point. Function definitions can appear in any order and their must be at
  25. least one function called "main" with no parameters. It is this function
  26. that is called when the script is started. Every function is supposed to
  27. return an integer value as result. If there is no return statement in a
  28. function, 0 will be returned. Functions can be called recursively. There
  29. are many built-in functions that are already defined when the script is
  30. started.
  31.  
  32. The value the "main" function returns is used as follows:
  33.       0 : Don't restore saved settings, continue application
  34.       1 : Restore saved settings, continue application
  35.     256 : Don't restore saved settings, quit application
  36.     257 : Restore saved settings, quit application
  37. Restore saved settings means that all changes the script made to settings
  38. are forgotten as soon as the script finishes. Quit application means, that
  39. as soon as the script has finished, "Terminal" quits. Usually this means
  40. returning to the Finder. But if "Terminal" was launched from HyperCard it
  41. will return to HyperCard.
  42.  
  43. This is an example of a simple script that displays the message "The number
  44. is 123" in the terminal window:
  45.  
  46.     int Number = 123;   /* This is a global variable */
  47.  
  48.     main ()     /* Every script must have a main() function */
  49.     {
  50.         /* display() is a built-in function */
  51.         display("The number is %i\r", Number);
  52.     }
  53.  
  54.  
  55. IDENTIFIERS
  56.  
  57. An identifier is a sequence of letters and digits; the first character must
  58. be a letter. The underscore "_" counts as a letter. An identifier can be of
  59. any length up to 255 characters. All characters are significant and are
  60. case sensitive. There are three types of identifiers: keywords, function
  61. names, variable names. The keywords are: "break", "char", "else", "for",
  62. "if", "int", "return", "while".
  63.  
  64.  
  65. CONSTANTS
  66.  
  67. An integer constant is a sequence of decimal digits, or 0x followed by up
  68. to 8 hexadecimal digits. An integer value is represented internally by 4
  69. bytes (32 bits). A minus sign before a constant is considered as an unary
  70. operator, not a part of the constant itself. A character constant is a
  71. sequence of 1 to 4 characters enclosed in single quotes. Character
  72. constants are converted to integer values, the byte values corresponding to
  73. the ASCII codes of the characters. A string constant is a sequence of
  74. characters enclosed in double quotes. String constants are automatically
  75. terminated by a NULL character. The value of a string constant is the
  76. address of the first character. Some examples of valid constants:
  77.  
  78.     1234567
  79.     0xABCD1234
  80.     'a'
  81.     'TEXT'
  82.     "An apple a day keeps troubles away"
  83.  
  84. In character and string constants the backslash "\" is used as an escape
  85. sequence according to the following table:
  86.  
  87.     LF      0x0A    \n
  88.     TAB     0x09    \t
  89.     FF      0x0C    \f
  90.     BELL    0x07    \a
  91.     BS      0x08    \b
  92.     CR      0x0D    \r
  93.     VT      0x0B    \v
  94.     NULL    0x00    \0
  95.     any     0x..    \x..    (2 hex digits)
  96.  
  97. If the character following a backslash is not one of those specified the
  98. backslash is ignored. This can be used to represent the backslash itself,
  99. to put a single quote into a character constant or to put a double quote
  100. into a string constant. Some examples;
  101.  
  102.     "Going to the next line...\r"
  103.     '\0'
  104.     "This is a single backslash: \\"
  105.     "\"Hello world!\""
  106.     '\''
  107.     '\x03'  /* That's a control-C */
  108.  
  109.  
  110. VARIABLES
  111.  
  112. There are four types of variables: characters, integers, pointers and
  113. arrays. Integers represent 32 bit signed values and characters 8 bit signed
  114. values. Pointers hold the 32 bit address of integers, characters or other
  115. pointers. Arrays are more or less equivalent to pointers. The following
  116. examples show how variables are defined:
  117.  
  118.     char c;     /* "c" is a character variable */
  119.     int n;      /* "n" is an integer variable */
  120.     char *ptr;  /* "ptr" is a pointer to characters */
  121.     char **hdl; /* "hdl" is a pointer to character pointers */
  122.     int *p;     /* "p" is a pointer to integers */
  123.     int **q;    /* "q" is a pointer to integer pointers */
  124.     char a[80]; /* "a" points to an array of 80 characters (80 bytes) */
  125.     int b[10];  /* "b" points to an array of 10 integers (40 bytes) */
  126.     char *c[5]; /* "c" points to an array of 5 character pointers (20 b) */
  127.     int *d[5];  /* "d" points to an array of 5 integer pointers (20 b) */
  128.  
  129. Variable declarations can be grouped together like this:
  130.  
  131.     char c, *ptr, **hdl, a[80], *c[5];
  132.     int n, *p, **q, b[10], *d[5];
  133.  
  134. Variables can be initialized using any legal expression, not only
  135. constants. Arrays can only be initialized at the global level, i.e. outside
  136. of function definitions. Initialized arrays must not include their size
  137. between the square brackets, the size is calculated based on the
  138. initializing values.
  139.  
  140.     char c = 'x';
  141.     int n = -123;
  142.     int m = n * 10;     /* "m" is set to -1230 */
  143.     char message[] = "This is a character string";
  144.     char *messages[] =  /* Array of strings */
  145.         { "This is string #1", "Another string", "and so on..." };
  146.     int a[] = { 1, 2, 3, 4, 5 };    /* Array of 5 integers */
  147.  
  148. The are no logical variables. Everything that is not zero is considered to
  149. be true.
  150.  
  151.  
  152. EXPRESSIONS
  153.  
  154. The following is a list of the supported operators that build up an
  155. expression. The list is by increasing precedence. Normally operators group
  156. left to right unless otherwise noted below. Note that the assignment is an
  157. operator, that an expression may contain several assignments, and that an
  158. assignment returns a value. Logical and numerical operators can be freely
  159. mixed, everything not zero is considered to be true. The precedence level
  160. can be changed by using parentheses. The boolean operators will return 1 as
  161. true.
  162.  
  163.     Assignment                      =                       (right to left)
  164.  
  165.     Logical or                      ||
  166.  
  167.     Logical and                     &&
  168.  
  169.     Equal, not equal                ==  !=
  170.  
  171.     Relational operators            <   <=  >   >=
  172.  
  173.     Add, subtract                   +   -
  174.  
  175.     Multiply, divide, modulo        *   /   %
  176.  
  177.     Logical not, increment,
  178.     decrement, unary minus,
  179.     indirection, address of         !   ++  --  -   *   &   (right to left)
  180.  
  181.     Function call, array element    ()  []
  182.  
  183. The increment or decrement operators can be used before or after a
  184. variable. If the operator comes before the variable (preincrement,
  185. predecrement) the variable is incremented, or decremented, and then the
  186. variable's value is used in the expression evaluation. If the operator
  187. comes after the variable (postincrement, postdecrement) the current value
  188. of the variable is used in the expression evaluation, and then the variable
  189. is incremented, or decremented.
  190.  
  191. Array subscripts start with 0. There is no runtime check of array
  192. boundaries. An array subscript can be any valid expression. Some examples:
  193.  
  194.     char a[80];
  195.     c = a[0];                       /* The first element */
  196.     c = a[79];                      /* The last element */
  197.     c = a[i = (79 - Func(x)*3)];    /* Expression as subscript */
  198.  
  199. For pointer arithmetic the following rules apply: if an integer value is
  200. added or subtracted from a pointer (a pointer is an address) then the
  201. integer value is first scaled depending on what the pointer is pointing to:
  202. 1 for characters, 4 for integers, 4 for pointers. If two pointers are
  203. subtracted the result is scaled in the same way and yields an integer value
  204. representing the number of objects separated by the two pointers. The two
  205. pointers must point to the same type of objects.
  206.  
  207. A function identifier without a parameter list in an expression results in
  208. the address of the function being used. If there is a parameter list, the
  209. function is called and the integer value returned by the function is used.
  210. Functions can also be called indirectly, using any expression that yields a
  211. valid function address followed by a parameter list. Some examples:
  212.  
  213.     int pf;         /* "int" can be used as function pointer */
  214.     int i;
  215.     pf = Func;      /* "pf" will contain address of function "Func" */
  216.     i = Func();     /* "i" gets function result */
  217.     i = (pf)();     /* "i" gets function result */
  218.  
  219.  
  220. FUNCTIONS
  221.  
  222. A function definition can only occur in the outer, global level. A function
  223. cannot be defined inside another function. All functions are supposed to
  224. return integers. A function definition consists of the function name,
  225. followed by a parameter definition list enclosed in parentheses, followed
  226. by a compound statement. The parameter definition list describes the
  227. function parameters. These parameters are considered as local variables
  228. inside the function. Example:
  229.  
  230.     /* The following function takes 3 parameters: a character, an integer
  231.     and a character pointer. It always returns the value 123. */
  232.  
  233.     Function (char c, int i, char *p)
  234.     {
  235.         /* ... */
  236.         return 123;
  237.     }
  238.  
  239. A function call consists of the function name followed by a parameter list.
  240. The parameter list is a comma separated list enclosed in parentheses of
  241. expressions. All parameters are passed by value. There is no verification
  242. if the number of parameters is correct or if the values passed to a
  243. function correspond to the types of the declared parameters. Example:
  244.  
  245.     i = Function ('x', 4567 + x, "Hello");
  246.  
  247.  
  248. STATEMENTS
  249.  
  250. A compound statement starts with an open brace "{" and terminates with a
  251. closing brace "}". There is an optional variable definition part followed
  252. by a list of statements. Variables defined inside a compound statement are
  253. local to that compound statement (block).
  254.  
  255. A statement can be:
  256.     compound statement
  257.     expression ;
  258.     if ( expression ) statement
  259.     if ( expression ) statement else statement
  260.     while ( expression ) statement
  261.     for ( opt expr1 ; opt expr2 ; opt expr3 ) statement
  262.     break ;
  263.     return ;
  264.     return expression ;
  265.     ;
  266.  
  267. The two forms of the conditional statement are:
  268.     if ( expression ) statement
  269.     if ( expression ) statement else statement
  270. In both cases the expression is evaluated and if it is nonzero, the first
  271. substatement is executed. In the second case the second substatement is
  272. executed if the expression is 0. The "else" ambiguity is resolved by
  273. connected an "else" with the last encountered "else"-less "if".
  274.  
  275. The "while" statement has the form:
  276.     while ( expression ) statement
  277. The substatement is executed repeatedly so long as the value of the
  278. expression remains nonzero. The test takes place before each execution of
  279. the statement.
  280.  
  281. The "for" statement has the form:
  282.     for ( opt expr1 ; opt expr2 ; opt expr3 ) statement
  283. This statement is equivalent to:
  284.     expression1 ;
  285.     while ( expression2 ) {
  286.         statement
  287.         expression3;
  288.     }
  289. Thus the first expression specifies initialization for the loop, the second
  290. specifies a test, made before each iteration, such that the loop is exited
  291. when the expression becomes 0; the third expression often specifies an
  292. incrementation which is performed after each iteration. Any or all of the
  293. expressions may be dropped. A missing expression2 makes the implied "while"
  294. clause equivalent to while(1); other missing expressions are simply dropped
  295. from the expansion above.
  296.  
  297. The statement
  298.     break ;
  299. causes termination of the smallest enclosing "while" or "for" statement;
  300. control passes to the statement following the terminating statement.
  301.  
  302. A function returns to its caller by means of the "return" statement, which
  303. has one of the forms:
  304.     return ;
  305.     return expression ;
  306. In the first case the returned value is undefined. In the second case the
  307. value of the expression is returned to the caller of the function. If
  308. required, the expression is converted to an integer. Flowing off the end of
  309. a function is equivalent to a return with no return value.
  310.  
  311. The null statement has the form
  312.     ;
  313. A null statement is useful to supply a null body to a looping statement
  314. such as "while".
  315.  
  316. Note: Unlike real C, logical expressions are completely evaluated, even if
  317. their TRUEthness (different from 0) ore FALSEness (equal to 0) can be
  318. determined before the whole expression is evaluated. In real C that's
  319. called short circuit boolean evaluation. For example in the statement
  320.     if (dothis() && dothat())
  321.         ;
  322. the functions dothis() and dothat() are always called in script C. In real
  323. C the function dothat() is only called if dothis() returns a non-zero
  324. result.
  325.  
  326.  
  327. ___________________________________________________________________________
  328. INTRINSIC FUNCTIONS
  329.  
  330.  
  331. Intrinsic functions are built-in and need not to be defined in the script.
  332. They can be called by any script.
  333.  
  334. All file access functions operate on the file transfer up- and download
  335. folder, which is the folder that can be set with the "Binary file transfer
  336. options..." menu item. File names can be up to 31 characters long and
  337. cannot contain the character ':'.
  338.  
  339. All formatting functions ("display", "format", "type") use a template
  340. string to specify the formatting to be done on the following parameters.
  341. Format specifiers begin with the character % and include zero or more of
  342. the following conversion specification elements (optional fields are in
  343. brackets):
  344.  
  345.     % [option flags] [field size] conversion
  346.  
  347. Some of these elements are optional, but if present, they must be specified
  348. in the order in which they are described below.
  349. Option flags (optional):
  350.     -   Left adjust output in field, pad on right (default is to right
  351.         justify).
  352.     0   Use zero (0) rather than space for the pad character
  353. Field size specification (optional):
  354.     The minimum field width, expressed as a decimal integer. The
  355.     corresponding parameter will be printed in a field at least this wide.
  356. Conversion characters (required)
  357.     c   Parameter is a character
  358.     i   Parameter is an integer
  359.     s   Parameter is a null terminated string
  360.     %   Print a %, no parameter used
  361. The format specification elements must correspond to the following
  362. parameters. Some examples:
  363.     char k, m[80];
  364.     int n;
  365.     type("Unrecognized character %c on line %i of file %s\r", k, n, m);
  366.  
  367. The following list describes all the existing intrinsic functions. They are
  368. described in the so-called prototype format, i.e. the format you would have
  369. to use to define them. E.g.
  370.     xxxx (char *s, int i)
  371. means that "xxxx" is a function taking 2 arguments, the first is a pointer
  372. to a character and the second is an integer. Note that all functions return
  373. integers, but the value returned is not necessarily meaningful for very
  374. function.
  375.  
  376.  
  377. autolf      Set the auto linefeed flag on or off
  378.  
  379.             autolf (int flg)
  380.     flg:    0 means off, 1 means on
  381.  
  382.  
  383. beep        Macintosh system beep
  384.  
  385.             beep ()
  386.  
  387.  
  388. capture     Start/stop capture to text file
  389.  
  390.             capture (int opt, char *name)
  391.     result: Macintosh file system error, 0 if no error
  392.     opt:    0 = Close capture file
  393.             1 = Capture on, new file
  394.             2 = Capture on, append to existing file
  395.     name:   Pointer to character string of at least 32 characters. This
  396.             is the file name.
  397.  
  398.  
  399. catalog     Return file info
  400.  
  401.             catalog (int i, char *name, int *type, int *dsize, int *rsize,
  402.                 int *cdate, int *mdate)
  403.     result: Macintosh file system error, 0 if no error
  404.     i:      If 0, then name must be specified and information about the
  405.             file with that name is returned, if it exists.
  406.             If non-zero information (including file name) about the i-th
  407.             file in the folder is returned.
  408.     name:   Pointer to character string of at least 32 characters. This
  409.             is the file name (specified or returned depending on the value
  410.             of i).
  411.     type:   Integer (4 bytes). File type.
  412.     dsize:  Data fork size in bytes.
  413.     rsize:  Resource fork size in bytes.
  414.     cdate:  Creation date in seconds.
  415.     mdate:  Modification date in seconds.
  416.  
  417.  
  418. date        Convert seconds from Macintosh clock to date and time
  419.  
  420.             date (int sec, int *yr, int *mo, int *da, int *ho, int *mi,
  421.                 int *se, int *dw)
  422.     sec:    Seconds
  423.     yr:     Year (1904..20xx)
  424.     mo:     Month (1..12)
  425.     da:     Day (1..31)
  426.     ho:     Hour (0..23)
  427.     mi:     Minutes (0..59)
  428.     se:     Seconds (0..59)
  429.     dw:     Day of week (1..7, Sunday is 1)
  430.  
  431.  
  432. display     Display in the terminal window
  433.  
  434.             display (char *templ, ...)
  435.     templ:  Template string
  436.     ...:    Variable number of arguments (maximum 9)
  437.  
  438.  
  439. download    Download (receive) a binary file using X/Y/Z-Modem protocol
  440.  
  441.             download (char *name, int bin, int zmodem)
  442.     result: Error code. 0 if Ok. 1 if timeout. 2 if cancel. 3 if abort (5
  443.             consecutive control-X characters received). All other values
  444.             are Macintosh file system errors.
  445.     name:   File name for new file (not used for Y-Modem batch or Z-Modem)
  446.     bin:    1 to recognize and use MacBinary format
  447.     zmodem: 0 use X/Y-Modem, 1 use Z-Modem
  448.  
  449.  
  450. format      Formatted conversion of values into a string
  451.  
  452.             format (char *str, char *templ, ...)
  453.     str:    String for result
  454.     templ:  Template string
  455.     ...:    Variable number of arguments (maximum 8)
  456.  
  457.  
  458. free        Dispose of the memory allocated by the new() function
  459.  
  460.             free (char *p)
  461.     p:      Pointer returned by previous call to new() function
  462.  
  463.  
  464. getcts      Get current state of CTS input line
  465.  
  466.             getcts ()
  467.     result: 0 if negated, 1 if asserted
  468.  
  469.  
  470. getdcd      Get current state of DCD input line
  471.  
  472.             getdcd ()
  473.     result: 0 if negated, 1 if asserted
  474.  
  475.  
  476. lecho       Set the local echo flag on or off
  477.  
  478.             lecho (int flg)
  479.     flg:    0 means off, 1 means on
  480.  
  481.  
  482. macrol      Load new macros file
  483.  
  484.             macrol (char *name)
  485.     result: Error code, 0 means no error
  486.     name:   File name of TEXT file with macros (folder will be the same as
  487.             the "Terminal folder")
  488.  
  489.  
  490. macrox      Execute macro
  491.  
  492.             macrox (int i, int op, char *name)
  493.     result: Error code, 0 ok, 2 cancel, 3 abort (2 consecutive control-X
  494.             characters received)
  495.     i:      Macro number (0 to 9)
  496.     op:     0 send macro text (using send TEXT file parameters), 1 display
  497.             macro text, 2 return macro name
  498.     name:   Only used if op is 2, should point to a string where macro
  499.             name will be returned (at least 30 characters long)
  500.  
  501.  
  502. move        Move bytes from source to destination
  503.  
  504.             move (char *src, char *dest, int cnt)
  505.     src:    Source pointer
  506.     dest:   destination pointer
  507.     cnt:    number of bytes to move
  508.  
  509.  
  510. new         Allocate memory
  511.  
  512.             new (int size)
  513.     result: Pointer to memory, or 0 if not enough memory available
  514.     size:   Number of bytes to allocate
  515.  
  516.  
  517. nextbuff    Wait for some characters
  518.  
  519.             nextbuff (char *buff, int count, int t)
  520.     result: count characters received, 1 timeout, 2 cancel, 3 abort
  521.             (5 consecutive control-X characters received)
  522.     count:  Number of characters to wait for
  523.     buff:   Character buffer to hold received characters. Must be at least
  524.             count characters long
  525.     t:      Timeout value in ticks (1/60th of second)
  526.  
  527.  
  528. nextline    Wait for the next line received over the serial input port
  529.  
  530.             nextline (char *line, int t)
  531.     result: 0 line received, 1 timeout, 2 cancel, 3 abort (5 consecutive
  532.             control-X characters received)
  533.     line:   String to hold line, this will be a '\0' terminated string
  534.             without the final carriage return
  535.     t:      Timeout value in ticks (1/60th of second)
  536.  
  537.  
  538. pause       Pause for specified amount of time
  539.  
  540.             pause (int t)
  541.     result: 1 timeout, 2 cancel.
  542.     t:      Timeout value in ticks (1/60th of second)
  543.  
  544.  
  545. prompt      Wait for a prompt string to come over the serial input port
  546.  
  547.             prompt (char *str, int t)
  548.     err:    0 string received, 1 timeout, 2 cancel, 3 abort (5 consecutive
  549.             control-X characters received).
  550.     str:    String to wait for (case sensitive)
  551.     t:      Timeout value in ticks (1/60th of second)
  552.  
  553.  
  554. protocol    Set binary file transfer options
  555.  
  556.             protocol (bin, qb, zmodem, autorx)
  557.     bin:    0 no MacBinary, 1 use MacBinary, -1 no change
  558.     qb:     0 no QuickB, 1 use QuickB, -1 no change
  559.     zmodem: 0 Z/Y-Modem, 1 Z-Modem, -1 no change
  560.     autorx: 0 no auto-receive, 1 Z-Modem auto-receive, -1 no change
  561.  
  562.  
  563. recho       Set the remote echo flag on or off
  564.  
  565.             recho (int flg)
  566.     flg:    0 means off, 1 means on
  567.  
  568.  
  569. save        Set the save & display flag on or off
  570.  
  571.             save (int flg)
  572.     flg:    0 means off, 1 means on
  573.  
  574.  
  575. send        Send a text file over the serial output port
  576.  
  577.             send (char *name)
  578.     result: error code. 0 if Ok. 2 if cancel. 3 abort (5 consecutive
  579.             control-X characters received). All other values are Macintosh
  580.             file system errors.
  581.     name:   File name
  582.  
  583.  
  584. setdtr      Set DTR output line
  585.  
  586.             setdtr (int onoff)
  587.     onoff:  0 to negate, 1 to assert
  588.  
  589.  
  590. setup       Serial communications port setup
  591.  
  592.             setup (int baud, int data, int parity, int stop, char *port,
  593.                 int dtr, int hs)
  594.     result: 0 if no error
  595.     baud:   0=300, 1=600, 2=1200, 3=2400, 4=4800, 5=9600, 6=19200, 7=38400,
  596.             8=57600 baud (or -1 for no change)
  597.     data:   0=7, 1=8 data bits (or -1 for no change)
  598.     parity: 0=no, 1=even, 2=odd parity (or -1 for no change)
  599.     stop:   0=1, 1=2 stop bit (or -1 for no change)
  600.     port:   port's name, e.g. "Modem Port" or "Printer Port"
  601.             (or -1 for no change)
  602.     dtr:    1=don't drop DTR when quitting (or -1 for no change)
  603.     hs:     Handshake 0=none, 1=XON/XOFF, 2=CTS, 3=DTR, 4=CTS/DTR
  604.  
  605.  
  606. stack       Return free memory available for script heap and stack
  607.  
  608.             stack ()
  609.     result: Combined free heap and stack space (bytes)
  610.  
  611.  
  612. strcmp      Compare two strings (not case sensitive)
  613.  
  614.             strcmp (char *str1, char *str2)
  615.     result: 0 if strings are equal, positive if str1 > str2, negative if
  616.             str1 < str2
  617.     str1:   First string
  618.     str2:   Second string
  619.  
  620.  
  621. terminal    Set terminal parameters
  622.  
  623.             terminal (int lecho, int recho, int autolf, int save)
  624.     lecho:  Local echo flag (or -1 if no modification)
  625.     recho:  Remote echo flag (or -1 if no modification)
  626.     autolf: Auto line feed flag (or -1 if no modification)
  627.     save:   Save & capture flag (or -1 if no modification)
  628.  
  629.  
  630. text        Set text file send parameters
  631.  
  632.             text (char *prompt, int lined, int chard)
  633.     prompt: Prompt text
  634.     lined:  Ticks to wait after each line
  635.     chard:  Ticks to wait after each character
  636.  
  637.  
  638. time        Return seconds from Macintosh clock
  639.  
  640.             time ()
  641.     result: Seconds
  642.  
  643.  
  644. type        Send a string over the serial output port
  645.  
  646.             type (char *templ, ...)
  647.     templ:  Template string
  648.     ...:    Variable number of arguments (maximum 9)
  649.  
  650.  
  651. upload      Upload (transmit) a binary file using X/Y/Z-Modem protocol
  652.  
  653.             upload (char *name, int bin, int zmodem)
  654.     result: error code. 0 if Ok. 1 if timeout. 2 if cancel. 3 abort (5
  655.             consecutive control-X characters received). All other values
  656.             are Macintosh file system errors.
  657.     name:   File name
  658.     bin:    1 to recognize and use MacBinary format
  659.     zmodem: 0 use X/Y-Modem, 1 use Z-Modem
  660.  
  661.  
  662. val         Convert string to number
  663.  
  664.             val (char *str)
  665.     result: Converted integer value
  666.     str:    Character string (0 terminated)
  667.  
  668.  
  669. xyparms     Set binary file transfer options for X/Y-Modem
  670.  
  671.             xyparms (crc, k, batch, t)
  672.     crc:    0 use checksum, 1 use CRC, -1 no change
  673.     k:      0 use 128 Byte blocks, 1 use 1 KByte blocks "C",
  674.             2 use 1 KByte blocks "CK", -1 no change
  675.     batch:  0 no batch (X-Modem), 1 batch official (Y-Modem),
  676.             2 batch RR (Y Modem), -1 no change
  677.     t:      timeout to use in ticks, -1 no change
  678.  
  679.  
  680. zparms      Set binary file transfer options for Z-Modem
  681.  
  682.             zparms (ctl, t, retr, buf, pack, wind, crcq)
  683.     ctl:    0 don't escape control characters, 1 escape control characters,
  684.             -1 no change
  685.     t:      timeout to use in ticks, -1 no change
  686.     retr:   maximal retry count, -1 no change
  687.     buf:    receive buffer size in bytes, -1 no change
  688.     pack:   transmit sub-packet length in bytes, -1 no change
  689.     wind:   transmit window size in bytes, -1 no change
  690.     crcq:   transmit ZCRCQ spacing in bytes, -1 no change
  691.  
  692.