home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / languages / icon_1 / DOCS / IPD267_DOC < prev   
Text File  |  1995-12-01  |  30KB  |  1,189 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.                Version 9.1 of the Icon Programming
  11.                             Language
  12.  
  13.                   Ralph E. Griswold, Clinton L.
  14.                  Jeffery, and Gregg M. Townsend
  15.  
  16.                Department of Computer Science, The
  17.                       University of Arizona
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24. 1.__Introduction
  25.  
  26.    The current version of Icon is Version 9.1.  The second edi-
  27. tion of the Icon book [1] describes Version 8.0.  This descrip-
  28. tion is a supplement to that book.
  29.  
  30.    Most of the language extensions in Version 9.1 are upward-
  31. compatible with previous versions of Icon and most programs writ-
  32. ten for earlier versions work properly under Version 9.1.  The
  33. language additions to Version 9.1 are:
  34.  
  35.      +  a preprocessor
  36.  
  37.      +  an optional interface to graphic facilities (for plat-
  38.         forms that support them)
  39.  
  40.      +  new functions and keywords
  41.  
  42.      +  several other changes and enhancements
  43.  
  44.    There also are several improvements to the implementation. See
  45. Section 3.
  46.  
  47.  
  48. 2.__Language_Features
  49.  
  50. 2.1__Preprocessing
  51.  
  52.    All Icon source code passes through a preprocessor before
  53. translation.  The effects of preprocessing can be seen by running
  54. icont or iconc with the -E flag.
  55.  
  56.    Preprocessor directives control the actions of the preproces-
  57. sor and are not passed to the Icon translator or compiler. If no
  58. preprocessor directives are present, the source code passes
  59. through the preprocessor unaltered.
  60.  
  61.  
  62.  
  63.  
  64. IPD267                        - 1 -              November 1, 1995
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.    A source line is a preprocessor directive if its first non-
  74. whitespace character is a $ and if that $ is not followed by
  75. another punctuation character. The general form of a preprocessor
  76. directive is
  77.  
  78.         $ directive arguments # comment
  79.  
  80. Whitespace separates tokens when needed, and case is significant,
  81. as in Icon proper. The entire preprocessor directive must appear
  82. on a single line which cannot be continued. The comment portion
  83. is optional. An invalid preprocessor directive produces an error
  84. except when skipped by conditional compilation.
  85.  
  86.    Preprocessor directives can appear anywhere in an Icon source
  87. file without regard to procedure, declaration, or expression
  88. boundaries.
  89.  
  90. Include_Directives
  91.  
  92.    An include directive has the form
  93.  
  94.         $include filename
  95.  
  96.  
  97.    An include directive causes the contents of another file to be
  98. interpolated in the source file. The file name must be quoted if
  99. it is not in the form of an Icon identifier. #line comments are
  100. inserted before and after the included file to allow proper iden-
  101. tification of errors.
  102.  
  103.    Included files may be nested to arbitrary depth, but a file
  104. may not include itself either directly or indirectly. File names
  105. are looked for first in the current directory and then in the
  106. directories listed in the environment variable LPATH.  Relative
  107. paths are interpreted in the preprocessor's context and not in
  108. relation to the including file's location.
  109.  
  110. Line_Directives
  111.  
  112.    A line directive has the form
  113.  
  114.         $line n [filename]
  115.  
  116. The line containing the preprocessing directive is considered to
  117. be line n of the given file (or the current file, if unspecified)
  118. for diagnostic and other purposes. The line number is a simple
  119. unsigned integer. The file name must be quoted if it is not in
  120. the form of an Icon identifier.
  121.  
  122.    Note that the interpretation of n differs from that of the C
  123. preprocessor, which interprets it as the number of the next line.
  124.  
  125.    $line is an alternative form of the older, special comment
  126. form #line. The preprocessor recognizes both forms and produces
  127.  
  128.  
  129.  
  130. IPD267                        - 2 -              November 1, 1995
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139. the fully specified older form for the lexical analyzer.
  140.  
  141. Define_Directives
  142.  
  143.    A define directive has the form
  144.  
  145.         $define name text
  146.  
  147. The define directive defines the text to be substituted for later
  148. occurrences of the identifier name in the source code.  text is
  149. any sequence of characters except that any string or cset
  150. literals must be properly terminated within the definition. Lead-
  151. ing and trailing whitespace are not part of the definition.  The
  152. text can be empty.
  153.  
  154.    Redefinition of a name is allowed only if the new text is
  155. exactly the same as the old text. For example, 3.0 is not the
  156. same as 3.000.
  157.  
  158.    Redefinition of Icon's reserved words and keywords is allowed
  159. but not advised.
  160.  
  161.    Definitions remain in effect through the end of the current
  162. original source file, crossing include boundaries, but they do
  163. not persist from file to file when names are given on the command
  164. line.
  165.  
  166.    If the text of a definition is an expression, it is wise to
  167. parenthesize it so that precedence causes no problems when it is
  168. substituted.  If the text begins with a left parenthesis, it must
  169. be separated from the name by at least one space.  Note that the
  170. Icon preprocessor, unlike the C preprocessor, does not provide
  171. parameterized definitions.
  172.  
  173. Undefine_Directives
  174.  
  175.    An undefine directive has the form
  176.  
  177.         $undef name
  178.  
  179. The current definition of name is removed, allowing its redefini-
  180. tion if desired. It is not an error to undefine a non-existent
  181. name.
  182.  
  183. Predefined_Symbols
  184.  
  185.    At the start of each source file, several symbols are automat-
  186. ically defined to indicate the Icon system configuration. Each
  187. potential predefined symbol corresponds to one of the values pro-
  188. duced by the keyword &features. If a feature is present, the sym-
  189. bol is defined with a value of 1. If a feature is absent, the
  190. symbol is not defined.  See the appendix for a list of predefined
  191. symbols.
  192.  
  193.  
  194.  
  195.  
  196. IPD267                        - 3 -              November 1, 1995
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.    Predefined symbols have no special status: like other symbols,
  206. they can be undefined and redefined.
  207.  
  208. Substitution
  209.  
  210.    As input is read, each identifier is checked to see if it
  211. matches a previous definition. If it does, the value replaces the
  212. identifier in the input stream.
  213.  
  214.    No whitespace is added or deleted when a definition is
  215. inserted. The replacement text is scanned for defined identif-
  216. iers, possibly causing further substitution, but recognition of
  217. the original identifier name is disabled to prevent infinite
  218. recursion.
  219.  
  220.    Occurrences of defined names within comments, literals, or
  221. preprocessor directives are not altered.
  222.  
  223.    The preprocessor is ignorant of multi-line literals and can
  224. potentially be fooled this way into making a substitution inside
  225. a string constant.
  226.  
  227.    The preprocessor works hard to get line numbers right, but
  228. column numbers are likely to be rendered incorrect by substitu-
  229. tions.
  230.  
  231.    Substitution cannot produce a preprocessor directive. By then
  232. it is too late.
  233.  
  234. Conditional_Compilation
  235.  
  236.    Conditional compilation directives have the form
  237.  
  238.         $ifdef name
  239.  
  240. and
  241.  
  242.         $ifndef name
  243.  
  244. $ifdef or $ifndef cause subsequent code to be accepted or skipped
  245. depending on whether name has been previously defined.  $ifdef
  246. succeeds if a definition exists; $ifndef succeeds if a definition
  247. does not exist. The value of the definition does not matter.
  248.  
  249.    A conditional block has this general form:
  250.  
  251.         $ifdef name   or   $ifndef name
  252.            ... code to use if test succeeds ...
  253.         $else
  254.            ... code to use if test fails ...
  255.         $endif
  256.  
  257. The $else section is optional. Conditional blocks can be nested
  258. provided that all of the $if/$else/$endif directives for a
  259.  
  260.  
  261.  
  262. IPD267                        - 4 -              November 1, 1995
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271. particular block are in the same source file. This does not
  272. prevent the conditional inclusion of other files via $include as
  273. long as any included conditional blocks are similarly self-
  274. contained.
  275.  
  276. Error_Directives
  277.  
  278.    An error directive has the form
  279.  
  280.         $error text
  281.  
  282. An $error directive forces a fatal compilation error displaying
  283. the given text. This is typically used with conditional compila-
  284. tion to indicate an improper set of definitions.
  285.  
  286. Subtle_Points
  287.  
  288.    Because substitution occurs on replacement text but not on
  289. preprocessor directives, either of the following sequences is
  290. valid:
  291.  
  292.         $define x 1    $define y x
  293.         $define y x    $define x 1
  294.         write(y)       write(y)
  295.  
  296. It is possible to construct pathological examples of definitions
  297. that combine with the input text to form a single Icon token, as
  298. in
  299.  
  300.         $define X e3   $define Y 456e
  301.         write(123X)    write(Y+3)
  302.  
  303.  
  304. 2.2__Graphics_Facilities
  305.  
  306.    Version 9.1 provides support for graphics facilities through a
  307. combination of high-level support and a repertoire of functions.
  308. Not all platforms support graphics.  Note: There are numerous
  309. changes to the graphics facilities in Version 9.1.  Persons who
  310. used an earlier version of Icon should consult the current refer-
  311. ence manual [2].
  312.  
  313. 2.3__New_Functions_and_Keywords
  314.  
  315.    The new functions and keywords are described briefly here.  At
  316. the end of this report there also is a sheet with more complete
  317. descriptions in the style of the second edition of the Icon book.
  318. This sheet can be trimmed and used as an insert to the book.
  319.  
  320.    There are six new functions:
  321.  
  322.      chdir(s)         Changes the current directory to s but
  323.                       fails if there is no such directory or if
  324.                       the change cannot be made.
  325.  
  326.  
  327.  
  328. IPD267                        - 5 -              November 1, 1995
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.      delay(i)         Delays execution i milliseconds. Delaying
  338.                       execution is not supported on all plat-
  339.                       forms; if it is not, there is no delay and
  340.                       delay() fails.
  341.  
  342.      flush(f)         Flushes the output buffers for file f.
  343.  
  344.      function()       Generates the names of the Icon (built-in)
  345.                       functions.
  346.  
  347.      loadfunc(s1, s2) Dynamically loads a C function. This func-
  348.                       tion presently is supported on a few UNIX
  349.                       systems. See [3] for details.
  350.  
  351.      sortf(X, i)      Produces a sorted list of the elements of
  352.                       X. The results are similar to those of
  353.                       sort(X, i), except that among lists and
  354.                       among records, structure values are ordered
  355.                       by comparing their ith fields.
  356.  
  357.    There are six new keywords:
  358.  
  359.      &allocated  Generates the number of bytes allocated since
  360.                  the beginning of program execution. The first
  361.                  result is the total number of bytes in all
  362.                  regions, followed by the number of bytes in the
  363.                  static, string, and block regions.
  364.  
  365.      &dump       If the value of &dump is nonzero at program ter-
  366.                  mination, a dump in the style of display() is
  367.                  provided.
  368.  
  369.      &e          The base of the natural logarithms, 2.71828 ...
  370.  
  371.      &phi        The golden ratio, 1.61803 ...
  372.  
  373.      &pi         The ratio of the circumference of a circle to
  374.                  its diameter, 3.14159 ...
  375.  
  376.      &progname   The file name of the executing program. &prog-
  377.                  name is a variable and a string value can be
  378.                  assigned to it to replace its initial value.
  379.  
  380. The graphics facilities add additional new keywords [2].
  381.  
  382.    Some UNIX platforms now support the keyboard functions
  383. getch(), getche(), and kbhit(). Whether or not these functions
  384. are supported can be determined from the values generated by
  385. &features.  Note: On UNIX platforms, ``keyboard'' input comes
  386. from standard input, which may not necessarily be the keyboard.
  387. Warning: The keyboard functions under UNIX may not work reliably
  388. in all situations and may leave the console in a strange mode if
  389. interrupted at an unfortunate time. These potential problems
  390.  
  391.  
  392.  
  393.  
  394. IPD267                        - 6 -              November 1, 1995
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403. should be kept in mind when using these functions.
  404.  
  405. 2.4__Other_Language_Enhancements
  406.  
  407. Lists
  408.  
  409.    The functions push() and put() now can be called with multiple
  410. arguments to add several values to a list at one time. For exam-
  411. ple,
  412.  
  413.         put(L, x1, x2, x3)
  414.  
  415. appends the values of x1, x2, and x3 to L. In the case of push(),
  416. values are prepended in order that they appear from left to
  417. right. Consequently, as a result of
  418.  
  419.         push(L, x1, x2, x3)
  420.  
  421. the first (leftmost) item on L is the value of x3.
  422.  
  423. Records
  424.  
  425.    Records can now be sorted by sort() and sortf() to produce
  426. sorted lists of the record fields.
  427.  
  428.    A record can now be subscripted by the string name of one of
  429. its fields, as in
  430.  
  431.         z["r"]
  432.  
  433. which is equivalent to
  434.  
  435.         z.r
  436.  
  437. If the named field does not exist for the record, the subscript-
  438. ing expression fails.
  439.  
  440.    Records can now be used to supply arguments in procedure invo-
  441. cation, as in
  442.  
  443.         p ! R
  444.  
  445. which invokes p with arguments from the fields of R.
  446.  
  447. Multiple_Subscripts
  448.  
  449.    Multiple subscripts are now allowed in subscripting expres-
  450. sions. For example,
  451.  
  452.         X[i, j, k]
  453.  
  454. is equivalent to
  455.  
  456.  
  457.  
  458.  
  459.  
  460. IPD267                        - 7 -              November 1, 1995
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.         X[i][j][k]
  470.  
  471. X can be a string, list, table, or record.
  472.  
  473. Integers
  474.  
  475.    The sign of an integer is now preserved when it is shifted
  476. right with ishift().
  477.  
  478.    The form of approximation for large integers that appear in
  479. diagnostic messages now indicates a power of ten, as in 10^57.
  480. The approximation is now accurate to the nearest power of 10.
  481.  
  482. Named_Functions
  483.  
  484.    The function proc(x, i) has been extended so that proc(x, 0)
  485. produces the built-in function named x even if the global iden-
  486. tifier having that name has been assigned another value. proc(x,
  487. 0) fails if x is not the name of a function.
  488.  
  489. String_Invocation
  490.  
  491.    String invocation can now be used for assignment operations,
  492. as in
  493.  
  494.         ":="(x, 3)
  495.  
  496. which assigns 3 to x.
  497.  
  498. 2.5__Other_Changes
  499.  
  500.      +  The ability to configure Icon so that Icon procedures can
  501.         be called from a C program has been eliminated.
  502.  
  503.      +  Memory monitoring and the functions associated with it no
  504.         longer are supported.
  505.  
  506.      +  The dynamic declaration, a synonym for local, is no
  507.         longer supported.
  508.  
  509.      +  Real literals that are less than 1 no longer need a lead-
  510.         ing zero. For example, .5 now is a valid real literal
  511.         instead of being the dereferencing operator applied to
  512.         the integer 5.
  513.  
  514.      +  A reference to an unknown record field now produces a
  515.         linker warning message rather than a fatal error. A
  516.         reference to an unknown field at run-time now causes
  517.         error termination.
  518.  
  519.      +  The identifiers listed by display() are now given in
  520.         sorted order.
  521.  
  522.  
  523.  
  524.  
  525.  
  526. IPD267                        - 8 -              November 1, 1995
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.      +  In sorting structures, records now are first sorted by
  536.         record name and then by age (serial number).
  537.  
  538.      +  Some of the values generated by &features have been
  539.         changed, and some former values corresponding the
  540.         features that are present in all implementations of Icon
  541.         have been deleted. The corresponding pre-defined con-
  542.         stants have been deleted. See the appendix.
  543.  
  544.      +  The text of some run-time error messages has been changed
  545.         and a few new error numbers have been added. A complete
  546.         list is available on request.
  547.  
  548.  
  549. 3.__Implementation_Changes
  550.  
  551. Linker_Changes
  552.  
  553.    By default, unreferenced globals (including procedures and
  554. record constructors) are now omitted from the code generated by
  555. icont.  This may substantially reduce the size of icode files,
  556. especially when a package of procedures is linked but not all the
  557. procedures are used.
  558.  
  559.    The invocable declaration and the command-line options -f s
  560. and -v n are now honored by icont as well as iconc [4].  The
  561. invocable declaration can be used to prevent the removal of
  562. specific unreferenced procedures and record constructors that are
  563. invoked by string invocation. The -f s option prevents the remo-
  564. val of all unreferenced declarations and is equivalent to invoca-
  565. ble all.
  566.  
  567.    The command line option -v n to icont controls the verbosity
  568. of its output:
  569.  
  570.      -v 0 is the same as icont -s
  571.      -v 1 is the default
  572.      -v 2 reports the sizes of the icode sections (procedures,
  573.             strings, and so forth)
  574.      -v 3 also lists discarded globals
  575.  
  576.    Note: Programs that use string invocation may malfunction if
  577. the default removal of declarations is used. The safest and easi-
  578. est approach is to add
  579.  
  580.         invocable all
  581.  
  582. to such programs.
  583.  
  584. Other_Changes
  585.  
  586.      +  The tables used by icont now expand automatically.  The
  587.         -S option is no longer needed. As a side effect of this
  588.         change, the sizes of procedures are no longer listed
  589.  
  590.  
  591.  
  592. IPD267                        - 9 -              November 1, 1995
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.         during translation.
  602.  
  603.      +  All implementations of Icon now use fixed-sized storage
  604.         regions.  Multiple regions are allocated if needed.
  605.  
  606.      +  Under UNIX, shell headers are now produced instead of
  607.         bootstrapping code in icode files. This substantially
  608.         reduces the size of icode files on some platforms.
  609.  
  610.      +  Under MS-DOS, iconx now finds icode files at any place on
  611.         the PATH specification as well as in the current direc-
  612.         tory.  The MS-DOS translator now is also capable of pro-
  613.         ducing .exe files.
  614.  
  615.  
  616. 4.__Limitations,_Bugs,_and_Problems
  617.  
  618.  
  619.      +   Line numbers sometimes are wrong in diagnostic messages
  620.          related to lines with continued quoted literals.
  621.  
  622.      +   Large-integer arithmetic is not supported in i to j and
  623.          seq().  Large integers cannot be assigned to keywords.
  624.  
  625.      +   Large-integer literals are constructed at run-time. Con-
  626.          sequently, they should not be used in loops where they
  627.          would be constructed repeatedly.
  628.  
  629.      +   Conversion of a large integer to a string is quadratic
  630.          in the length of the integer. Conversion of a very large
  631.          integer to a string may take a very long time and give
  632.          the appearance of an endless loop.
  633.  
  634.      +   Integer overflow on exponentiation may not be detected
  635.          during execution.  Such overflow may occur during type
  636.          conversion.
  637.  
  638.      +   In some cases, trace messages may show the return of
  639.          subscripted values, such as &null[2], that would be
  640.          erroneous if they were dereferenced.
  641.  
  642.      +   If a long file name for an Icon source-language program
  643.          is truncated by the operating system, mysterious diag-
  644.          nostic messages may occur during linking.
  645.  
  646.      +   Stack overflow checking uses a heuristic that is not
  647.          always effective.
  648.  
  649.      +   If an expression such as
  650.  
  651.                  x := create expr
  652.  
  653.          is used in a loop, and x is not a global variable,
  654.          unreferenceable co-expressions are generated by each
  655.  
  656.  
  657.  
  658. IPD267                       - 10 -              November 1, 1995
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.          successive create operation.  These co-expressions are
  668.          not garbage collected. This problem can be circumvented
  669.          by making x a global variable or by assigning a value to
  670.          x before the create operation, as in
  671.  
  672.                  x := &null
  673.                  x := create expr
  674.  
  675.  
  676.      +   Stack overflow in a co-expression may not be detected
  677.          and may cause mysterious program malfunction.
  678.  
  679. Acknowledgements
  680.  
  681.    Frank Lhota contributed to Version 9.1 of Icon.
  682.  
  683. References
  684.  
  685.  
  686. 1. R. E. Griswold and M. T. Griswold, The Icon Programming
  687.    Language, Prentice-Hall, Inc., Englewood Cliffs, NJ, second
  688.    edition, 1990.
  689.  
  690. 2. G. M. Townsend, R. E. Griswold and C. L. Jeffery, Graphics
  691.    Facilities for the Icon Programming Language; Version 9.1, The
  692.    Univ. of Arizona Icon Project Document IPD268, 1995.
  693.  
  694. 3. R. E. Griswold and G. M. Townsend, Calling C Functions from
  695.    Version 9 of Icon, The Univ. of Arizona Icon Project Document
  696.    IPD240, 1995.
  697.  
  698. 4. R. E. Griswold, Version 9 of the Icon Compiler, The Univ. of
  699.    Arizona Icon Project Document IPD237, 1995.
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724. IPD267                       - 11 -              November 1, 1995
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733.                    Appendix - Predefined Symbols
  734.  
  735.  
  736.  
  737.            predefined symbol             &features value
  738.            _AMIGA                        Amiga
  739.            _ACORN                        Acorn Archimedes
  740.            _ATARI                        Atari ST
  741.            _CMS                          CMS
  742.            _MACINTOSH                    Macintosh
  743.            _MSDOS_386                    MS-DOS/386
  744.            _MSDOS                        MS-DOS
  745.            _MVS                          MVS
  746.            _OS2                          OS/2
  747.            _PORT                         PORT
  748.            _UNIX                         UNIX
  749.            _VMS                          VMS
  750.  
  751.  
  752.            _COMPILED                     compiled
  753.            _INTERPRETED                  interpreted
  754.            _ASCII                        ASCII
  755.            _EBCDIC                       EBCDIC
  756.  
  757.  
  758.            _CO_EXPRESSIONS               co-expressions
  759.            _DIRECT_EXECUTION             direct execution
  760.            _DYNAMIC_LOADING              dynamic loading
  761.            _EVENT_MONITOR                event monitoring
  762.            _EXTERNAL_FUNCTIONS           external functions
  763.            _GRAPHICS                     graphics
  764.            _KEYBOARD_FUNCTIONS           keyboard functions
  765.            _LARGE_INTEGERS               large integers
  766.            _MULTITASKING                 multiple programs
  767.            _PIPES                        pipes
  768.            _RECORD_IO                    record I/O
  769.            _STRING_INVOKE                string invocation
  770.            _SYSTEM_FUNCTION              system function
  771.            _VISUALIZATION                visualization support
  772.  
  773.  
  774.            _ARM_FUNCTIONS                Archimedes extensions
  775.            _DOS_FUNCTIONS                MS-DOS extensions
  776.            _PRESENTATION_MGR             Presentation Manager
  777.            _X_WINDOW_SYSTEM              X Windows
  778.  
  779.  
  780.    In addition, the symbol _V9 is defined in Version 9.
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790. IPD267                       - 12 -              November 1, 1995
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799. __________________________________________________
  800.  
  801. chdir(s) : n                      change directory
  802.  
  803. chdir(s) changes the directory to s but fails if
  804. there is no such directory or if the change cannot
  805. be made. Whether the change in the directory
  806. persists after program termination depends on the
  807. operating system on which the program runs.
  808.  
  809. Error:    103 s not string
  810.  
  811. __________________________________________________
  812.  
  813. delay(i) : n                       delay execution
  814.  
  815. delay(i) delays execution i milliseconds. This
  816. function is not supported on all platforms; if it
  817. is not, there is no delay and delay() fails.
  818.  
  819. Error:    101 i not integer
  820.  
  821. __________________________________________________
  822.  
  823. flush(f) : n                          flush buffer
  824.  
  825. flush(f) flushes the output buffers for f.
  826.  
  827. Error:    105 f not file
  828.  
  829. __________________________________________________
  830.  
  831. function() : s1, s2, ..., sgenerate function names
  832.  
  833. function() generates the names of the Icon
  834. (built-in) functions.
  835.  
  836. __________________________________________________
  837.  
  838. loadfunc(s1, s2) : p        load external function
  839.  
  840. loadfunc(s1, s2) loads the function named s2 from
  841. the library file s1. s2 must be a C or compatible
  842. function that provides a particular interface
  843. expected by loadfunc().  loadfunc() is not
  844. available on all systems.
  845.  
  846. __________________________________________________
  847.  
  848. proc(x, i) : p                convert to procedure
  849.  
  850. proc(x, i) produces a procedure corresponding to
  851. the value of x, but fails if x does not correspond
  852. to a procedure. If x is the string name of an
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  
  864.  
  865.  
  866.  
  867.  
  868.        operator, i specifies the number of arguments: 1
  869.        for unary (prefix), 2 for binary (infix) and 3 for
  870.        ternary. proc(x, 0) produces the built-in function
  871.        named x even if the global identifier having that
  872.        name has been assigned another value.  proc(x, 0)
  873.        fails if x is not the name of a function.
  874.  
  875.        Default:  i      1
  876.  
  877.        Errors:   101 i not integer
  878.                  205 i not 0, 1, 2, or 3
  879.  
  880.        __________________________________________________
  881.  
  882.        push(L, x1, x2, ..., xn) : L        push onto list
  883.  
  884.        push(L, x1, x2, ..., xn) pushes x1, x2, ..., onto
  885.        the left end of L. Values are pushed in order from
  886.        left to right, so xn becomes the first (leftmost)
  887.        value on L. push(L) with no second argument pushes
  888.        a null value onto L.
  889.  
  890.        Errors:   108 L not list
  891.                  307 inadequate space in block region
  892.  
  893.        See also: get(), pop(), pull(), and put()
  894.  
  895.        __________________________________________________
  896.  
  897.        put(L, x1, x2, ..., xn) : L          put onto list
  898.  
  899.        put(L, x1, x2, ..., xn) puts x1, x2, ..., onto the
  900.        right end of L. Values are pushed in order from
  901.        left to right, so xn becomes the last (rightmost)
  902.        value on L. put(L) with no second argument puts a
  903.        null value onto L.
  904.  
  905.        Errors:   108 L not list
  906.                  307 inadequate space in block region
  907.  
  908.        See also: get(), pop(), pull(), and push()
  909.  
  910.        __________________________________________________
  911.  
  912.        sort(X, i) : L                      sort structure
  913.  
  914.        sort(X, i) produces a list containing values from
  915.        x. If X is a list, record, or set, sort(X, i)
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931.  
  932.  
  933.  
  934.        produces the values of X in sorted order. If X is
  935.        a table, sort(X, i) produces a list obtained by
  936.        sorting the elements of X, depending on the value
  937.        of i.  For i = 1 or 2, the list elements are two-
  938.        element lists of key/value pairs. For i = 3 or 4,
  939.        the list elements are alternative keys and values.
  940.        Sorting is by keys for i odd, by value for i even.
  941.  
  942.        Default:  i      1
  943.  
  944.        Errors:   101 i not integer
  945.                  115 X not structure
  946.                  205 i not 1, 2, 3, or 4
  947.                  307 inadequate space in block storage region
  948.  
  949.        See also: sortf()
  950.  
  951.  
  952.  
  953.  
  954.  
  955.  
  956.  
  957.  
  958.  
  959.  
  960.  
  961.  
  962.  
  963.  
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.  
  995.  
  996.  
  997.  
  998.  
  999.  
  1000.        __________________________________________________
  1001.  
  1002.        sortf(X, i) : L            sort structure by field
  1003.  
  1004.        sortf(X, i) produces a sorted list of the values
  1005.        in X.  Sorting is primarily by type and in most
  1006.        respects is the same as with sort(X, i). However,
  1007.        among lists and among records, two structures are
  1008.        ordered by comparing their ith fields. i can be
  1009.        negative but not zero. Two structures having equal
  1010.        ith fields are ordered as they would be in regular
  1011.        sorting, but structures lacking an ith field
  1012.        appear before structures having them.
  1013.  
  1014.        Default:  i      1
  1015.  
  1016.        Errors:   101 i not integer
  1017.                  126 X not list, record, or set
  1018.                  205 i =  0
  1019.                  307 inadequate space in block region
  1020.  
  1021.        See also: sort()
  1022.  
  1023.  
  1024.  
  1025.  
  1026.  
  1027.  
  1028.  
  1029.  
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063.  
  1064.  
  1065.  
  1066.        __________________________________________________
  1067.  
  1068.        &allocated : i1, i2, i3, i4  cumulative allocation
  1069.  
  1070.        &allocated generates the total amount of space, in
  1071.        bytes, allocated since the beginning of program
  1072.        execution.  The first value is the total for all
  1073.        regions, followed by the totals for the static,
  1074.        string, and block regions, respectively.  The
  1075.        space allocated in the static region is always
  1076.        given as zero.  Note: &allocated gives the
  1077.        cumulative allocation; &storage gives the current
  1078.        allocation; that is, the amount that has not been
  1079.        freed by garbage collection.
  1080.  
  1081.        __________________________________________________
  1082.  
  1083.        &dump : i                         termination dump
  1084.  
  1085.        If the value of &dump is nonzero when program
  1086.        execution terminates, a dump in the style of
  1087.        display() is provided.
  1088.  
  1089.        __________________________________________________
  1090.  
  1091.        &e : r                  base of natural logarithms
  1092.  
  1093.        The value of &e is the base of the natural
  1094.        logarithms, 2.71828 ... .
  1095.  
  1096.        __________________________________________________
  1097.  
  1098.        &phi : r                              golden ratio
  1099.  
  1100.        The value of &phi is the golden ratio, 1.61803 ...
  1101.        .
  1102.  
  1103.        __________________________________________________
  1104.  
  1105.        &pi : ratio of circumference to diameter of a circle
  1106.  
  1107.        The value of &pi is the ratio of the circumference
  1108.        of a circle to its diameter, 3.14159 ... .
  1109.  
  1110.        __________________________________________________
  1111.  
  1112.        &progname : s                         program name
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.  
  1127.  
  1128.  
  1129.  
  1130.  
  1131.  
  1132.        The value of &progname is the file name of the
  1133.        executing program.  A string value can be assigned
  1134.        to &progname to replace its initial value.
  1135.  
  1136.  
  1137.  
  1138.  
  1139.  
  1140.  
  1141.  
  1142.  
  1143.  
  1144.  
  1145.  
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155.  
  1156.  
  1157.  
  1158.  
  1159.  
  1160.  
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.