home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / doc / ipd236.txt < prev    next >
Text File  |  1994-07-22  |  29KB  |  1,255 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.                Version 9.0 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.0.  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.0 are upward-
  31. compatible with previous versions of Icon and most programs writ-
  32. ten for earlier versions work properly under Version 9.0.  The
  33. language additions to Version 9.0 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. IPD236a                       - 1 -                 July 16, 1994
  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. IPD236a                       - 2 -                 July 16, 1994
  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. IPD236a                       - 3 -                 July 16, 1994
  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. IPD236a                       - 4 -                 July 16, 1994
  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.0 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.0.  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. IPD236a                       - 5 -                 July 16, 1994
  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 Suns and DEC
  349.                       Alpha systems running UNIX. See [3] for
  350.                       details.
  351.  
  352.      sortf(X, i)      Produces a sorted list of the elements of
  353.                       X. The results are similar to those of
  354.                       sort(X, i), except that among lists and
  355.                       among records, structure values are ordered
  356.                       by comparing their ith fields.
  357.  
  358.    There are six new keywords:
  359.  
  360.      &allocated  Generates the number of bytes allocated since
  361.                  the beginning of program execution. The first
  362.                  result is the total number of bytes in all
  363.                  regions, followed by the number of bytes in the
  364.                  static, string, and block regions.
  365.  
  366.      &dump       If the value of &dump is nonzero at program ter-
  367.                  mination, a dump in the style of display() is
  368.                  provided.
  369.  
  370.      &e          The base of the natural logarithms, 2.71828 ...
  371.  
  372.      &phi        The golden ratio, 1.61803 ...
  373.  
  374.      &pi         The ratio of the circumference of a circle to
  375.                  its diameter, 3.14159 ...
  376.  
  377.      &progname   The file name of the executing program. &prog-
  378.                  name is a variable and a string value can be
  379.                  assigned to it to replace its initial value.
  380.  
  381. The graphics facilities add additional new keywords [2].
  382.  
  383.    Some UNIX platforms now support the keyboard functions
  384. getch(), getche(), and kbhit(). Whether or not these functions
  385. are supported can be determined from the values generated by
  386. &features.  Note: On UNIX platforms, ``keyboard'' input comes
  387. from standard input, which may not necessarily be the keyboard.
  388. Warning: The keyboard functions under UNIX may not work reliably
  389. in all situations and may leave the console in a strange mode if
  390. interrupted at an unfortunate time. These potential problems
  391.  
  392.  
  393.  
  394. IPD236a                       - 6 -                 July 16, 1994
  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. IPD236a                       - 7 -                 July 16, 1994
  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. 2.5__Other_Changes
  490.  
  491.      +  The ability to configure Icon so that Icon procedures can
  492.         be called from a C program has been eliminated.
  493.  
  494.      +  Memory monitoring and the functions associated with it no
  495.         longer are supported.
  496.  
  497.      +  The dynamic declaration, a synonym for local, is no
  498.         longer supported.
  499.  
  500.      +  Real literals that are less than 1 no longer need a lead-
  501.         ing zero. For example, .5 now is a valid real literal
  502.         instead of being the dereferencing operator applied to
  503.         the integer 5.
  504.  
  505.      +  A reference to an unknown record field now produces a
  506.         linker warning message rather than a fatal error. A
  507.         reference to an unknown field at run-time now causes
  508.         error termination.
  509.  
  510.      +  The identifiers listed by display() are now given in
  511.         sorted order.
  512.  
  513.      +  In sorting structures, records now are first sorted by
  514.         record name and then by age (serial number).
  515.  
  516.      +  Some of the values generated by &features have been
  517.         changed, and some former values corresponding the
  518.         features that are present in all implementations of Icon
  519.         have been deleted. See the appendix.
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526. IPD236a                       - 8 -                 July 16, 1994
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.      +  The text of some run-time error messages has been changed
  536.         and a few new error numbers have been added. A complete
  537.         list is available on request.
  538.  
  539.  
  540. 3.__Implementation_Changes
  541.  
  542. Linker_Changes
  543.  
  544.    By default, unreferenced globals (including procedures and
  545. record constructors) are now omitted from the code generated by
  546. icont.  This may substantially reduce the size of icode files,
  547. especially when a package of procedures is linked but not all the
  548. procedures are used.
  549.  
  550.    The invocable declaration and the command-line options -f s
  551. and -v n are now honored by icont as well as iconc [4].  The
  552. invocable declaration can be used to prevent the removal of
  553. specific unreferenced procedures and record constructors that are
  554. invoked by string invocation. The -f s option prevents the remo-
  555. val of all unreferenced declarations and is equivalent to invoca-
  556. ble all.
  557.  
  558.    The command line option -v n to icont controls the verbosity
  559. of its output:
  560.  
  561.      -v 0 is the same as icont -s
  562.      -v 1 is the default
  563.      -v 2 reports the sizes of the icode sections (procedures,
  564.             strings, and so forth)
  565.      -v 3 also lists discarded globals
  566.  
  567.    Note: Programs that use string invocation may malfunction if
  568. the default removal of declarations is used. The safest and easi-
  569. est approach is to add
  570.  
  571.         invocable all
  572.  
  573. to such programs.
  574.  
  575. Other_Changes
  576.  
  577.      +  The tables used by icont now expand automatically.  The
  578.         -S option is no longer needed. As a side effect of this
  579.         change, the sizes of procedures are no longer listed dur-
  580.         ing translation.
  581.  
  582.      +  Most implementations of Icon now use fixed-sized storage
  583.         regions.  Multiple regions are allocated if needed.
  584.  
  585.      +  Under UNIX, shell headers are now produced instead of
  586.         bootstrapping code in icode files. This substantially
  587.         reduces the size of icode files on some platforms.
  588.  
  589.  
  590.  
  591.  
  592. IPD236a                       - 9 -                 July 16, 1994
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.      +  Under MS-DOS, iconx now finds icode files at any place on
  602.         the PATH specification as well as in the current direc-
  603.         tory.  The MS-DOS translator now is also capable of pro-
  604.         ducing .exe files.
  605.  
  606.  
  607. 4.__Limitations,_Bugs,_and_Problems
  608.  
  609.  
  610.      +   Line numbers sometimes are wrong in diagnostic messages
  611.          related to lines with continued quoted literals.
  612.  
  613.      +   Large-integer arithmetic is not supported in i to j and
  614.          seq().  Large integers cannot be assigned to keywords.
  615.  
  616.      +   Large-integer literals are constructed at run-time. Con-
  617.          sequently, they should not be used in loops where they
  618.          would be constructed repeatedly.
  619.  
  620.      +   Conversion of a large integer to a string is quadratic
  621.          in the length of the integer. Conversion of very a large
  622.          integer to a string may take a very long time and give
  623.          the appearance of an endless loop.
  624.  
  625.      +   Right shifting of large negative integers by ishift() is
  626.          inconsistent with the shifting of ordinary integers.
  627.  
  628.      +   Integer overflow on exponentiation may not be detected
  629.          during execution.  Such overflow may occur during type
  630.          conversion.
  631.  
  632.      +   In some cases, trace messages may show the return of
  633.          subscripted values, such as &null[2], that would be
  634.          erroneous if they were dereferenced.
  635.  
  636.      +   If a long file name for an Icon source-language program
  637.          is truncated by the operating system, mysterious diag-
  638.          nostic messages may occur during linking.
  639.  
  640.      +   Stack overflow checking uses a heuristic that is not
  641.          always effective.
  642.  
  643.      +   If an expression such as
  644.  
  645.                  x := create expr
  646.  
  647.          is used in a loop, and x is not a global variable,
  648.          unreferenceable co-expressions are generated by each
  649.          successive create operation.  These co-expressions are
  650.          not garbage collected. This problem can be circumvented
  651.          by making x a global variable or by assigning a value to
  652.          x before the create operation, as in
  653.  
  654.  
  655.  
  656.  
  657.  
  658. IPD236a                      - 10 -                 July 16, 1994
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.                  x := &null
  668.                  x := create expr
  669.  
  670.  
  671.      +   Stack overflow in a co-expression may not be detected
  672.          and may cause mysterious program malfunction.
  673.  
  674. Acknowledgements
  675.  
  676.    The design and implementation of Version 9.0 of Icon was sup-
  677. ported in part by National Science Foundation Grant CCR-8901573.
  678.  
  679. References
  680.  
  681.  
  682. 1.   R. E. Griswold and M. T. Griswold, The Icon Programming
  683.      Language, Prentice-Hall, Inc., Englewood Cliffs, NJ, second
  684.      edition, 1990.
  685.  
  686. 2.   C. L. Jeffery, G. M. Townsend and R. E. Griswold, Graphics
  687.      Facilities for the Icon Programming Language; Version 9.0,
  688.      The Univ. of Arizona Icon Project Document IPD255, 1994.
  689.  
  690. 3.   R. E. Griswold and G. M. Townsend, Calling C Functions from
  691.      Version 9.0 of Icon, The Univ. of Arizona Icon Project
  692.      Document IPD240, 1994.
  693.  
  694. 4.   R. E. Griswold, Version 9.0 of the Icon Compiler, The Univ.
  695.      of Arizona Icon Project Document IPD237, 1994.
  696.  
  697.  
  698.  
  699.  
  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. IPD236a                      - 11 -                 July 16, 1994
  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.              _EXPANDABLE_REGIONS           expandable regions
  759.              _FIXED_REGIONS                fixed regions
  760.  
  761.  
  762.              _CO_EXPRESSIONS               co-expressions
  763.              _DIRECT_EXECUTION             direct execution
  764.              _DYNAMIC_LOADING              dynamic loading
  765.              _EVENT_MONITOR                event monitoring
  766.              _EXECUTABLE_IMAGES            executable images
  767.              _EXTERNAL_FUNCTIONS           external functions
  768.              _GRAPHICS                     graphics
  769.              _KEYBOARD_FUNCTIONS           keyboard functions
  770.              _LARGE_INTEGERS               large integers
  771.              _MEMORY_MONITOR               memory monitoring
  772.              _MULTITASKING                 multiple programs
  773.              _MULTIREGION                  multiple regions
  774.              _PIPES                        pipes
  775.              _RECORD_IO                    record I/O
  776.              _STRING_INVOKE                string invocation
  777.              _SYSTEM_FUNCTION              system function
  778.              _VISUALIZATION                visualization support
  779.  
  780.  
  781.              _ARM_FUNCTIONS                Archimedes extensions
  782.              _DOS_FUNCTIONS                MS-DOS extensions
  783.              _PRESENTATION_MGR             Presentation Manager
  784.              _X_WINDOW_SYSTEM              X Windows
  785.  
  786.  
  787.  
  788.  
  789.  
  790. IPD236a                      - 12 -                 July 16, 1994
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.    In addition, the symbol _V9 is defined in Version 9.0.
  800.  
  801.  
  802.  
  803.  
  804.  
  805.  
  806.  
  807.  
  808.  
  809.  
  810.  
  811.  
  812.  
  813.  
  814.  
  815.  
  816.  
  817.  
  818.  
  819.  
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856. IPD236a                      - 13 -                 July 16, 1994
  857.  
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  
  864.  
  865. __________________________________________________
  866.  
  867. chdir(s) : n                      change directory
  868.  
  869. chdir(s) changes the directory to s but fails if
  870. there is no such directory or if the change cannot
  871. be made. Whether the change in the directory
  872. persists after program termination depends on the
  873. operating system on which the program runs.
  874.  
  875. Error:    103 s not string
  876.  
  877. __________________________________________________
  878.  
  879. delay(i) : n                       delay execution
  880.  
  881. delay(i) delays execution i milliseconds. This
  882. function is not supported on all platforms; if it
  883. is not, there is no delay and delay() fails.
  884.  
  885. Error:    101 i not integer
  886.  
  887. __________________________________________________
  888.  
  889. flush(f) : n                          flush buffer
  890.  
  891. flush(f) flushes the output buffers for f.
  892.  
  893. Error:    105 f not file
  894.  
  895. __________________________________________________
  896.  
  897. function() : s1, s2, ..., sgenerate function names
  898.  
  899. function() generates the names of the Icon
  900. (built-in) functions.
  901.  
  902. __________________________________________________
  903.  
  904. loadfunc(s1, s2) : p        load external function
  905.  
  906. loadfunc(s1, s2) loads the function named s2 from
  907. the library file s1. s2 must be a C or compatible
  908. function that provides a particular interface
  909. expected by loadfunc().  loadfunc() is not
  910. available on all systems.
  911.  
  912. __________________________________________________
  913.  
  914. proc(x, i) : p                convert to procedure
  915.  
  916. proc(x, i) produces a procedure corresponding to
  917. the value of x, but fails if x does not correspond
  918. to a procedure. If x is the string name of an
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931.  
  932.  
  933.  
  934.        operator, i specifies the number of arguments: 1
  935.        for unary (prefix), 2 for binary (infix) and 3 for
  936.        ternary. proc(x, 0) produces the built-in function
  937.        named x even if the global identifier having that
  938.        name has been assigned another value.  proc(x, 0)
  939.        fails if x is not the name of a function.
  940.  
  941.        Default:  i      1
  942.  
  943.        Errors:   101 i not integer
  944.                  205 i not 0, 1, 2, or 3
  945.  
  946.        __________________________________________________
  947.  
  948.        push(L, x1, x2, ..., xn) : L        push onto list
  949.  
  950.        push(L, x1, x2, ..., xn) pushes x1, x2, ..., onto
  951.        the left end of L. Values are pushed in order from
  952.        left to right, so xn becomes the first (leftmost)
  953.        value on L. push(L) with no second argument pushes
  954.        a null value onto L.
  955.  
  956.        Errors:   108 L not list
  957.                  307 inadequate space in block region
  958.  
  959.        See also: get(), pop(), pull(), and put()
  960.  
  961.        __________________________________________________
  962.  
  963.        put(L, x1, x2, ..., xn) : L          put onto list
  964.  
  965.        put(L, x1, x2, ..., xn) puts x1, x2, ..., onto the
  966.        right end of L. Values are pushed in order from
  967.        left to right, so xn becomes the last (rightmost)
  968.        value on L. put(L) with no second argument puts a
  969.        null value onto L.
  970.  
  971.        Errors:   108 L not list
  972.                  307 inadequate space in block region
  973.  
  974.        See also: get(), pop(), pull(), and push()
  975.  
  976.        __________________________________________________
  977.  
  978.        sort(X, i) : L                      sort structure
  979.  
  980.        sort(X, i) produces a list containing values from
  981.        x. If X is a list, record, or set, sort(X, i)
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.  
  995.  
  996.  
  997.  
  998.  
  999.  
  1000.        produces the values of X in sorted order. If X is
  1001.        a table, sort(X, i) produces a list obtained by
  1002.        sorting the elements of X, depending on the value
  1003.        of i.  For i = 1 or 2, the list elements are two-
  1004.        element lists of key/value pairs. For i = 3 or 4,
  1005.        the list elements are alternative keys and values.
  1006.        Sorting is by keys for i odd, by value for i even.
  1007.  
  1008.        Default:  i      1
  1009.  
  1010.        Errors:   101 i not integer
  1011.                  115 X not structure
  1012.                  205 i not 1, 2, 3, or 4
  1013.                  307 inadequate space in block storage region
  1014.  
  1015.        See also: sortf()
  1016.  
  1017.  
  1018.  
  1019.  
  1020.  
  1021.  
  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.        sortf(X, i) : L            sort structure by field
  1069.  
  1070.        sortf(X, i) produces a sorted list of the values
  1071.        in X.  Sorting is primarily by type and in most
  1072.        respects is the same as with sort(X, i). However,
  1073.        among lists and among records, two structures are
  1074.        ordered by comparing their ith fields. i can be
  1075.        negative but not zero. Two structures having equal
  1076.        ith fields are ordered as they would be in regular
  1077.        sorting, but structures lacking an ith field
  1078.        appear before structures having them.
  1079.  
  1080.        Default:  i      1
  1081.  
  1082.        Errors:   101 i not integer
  1083.                  126 X not list, record, or set
  1084.                  205 i =  0
  1085.                  307 inadequate space in block region
  1086.  
  1087.        See also: sort()
  1088.  
  1089.  
  1090.  
  1091.  
  1092.  
  1093.  
  1094.  
  1095.  
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.  
  1127.  
  1128.  
  1129.  
  1130.  
  1131.  
  1132.        __________________________________________________
  1133.  
  1134.        &allocated : i1, i2, i3, i4  cumulative allocation
  1135.  
  1136.        &allocated generates the total amount of space, in
  1137.        bytes, allocated since the beginning of program
  1138.        execution.  The first value is the total for all
  1139.        regions, followed by the totals for the static,
  1140.        string, and block regions, respectively.  The
  1141.        space allocated in the static region is always
  1142.        given as zero.  Note: &allocated gives the
  1143.        cumulative allocation; &storage gives the current
  1144.        allocation; that is, the amount that has not been
  1145.        freed by garbage collection.
  1146.  
  1147.        __________________________________________________
  1148.  
  1149.        &dump : i                         termination dump
  1150.  
  1151.        If the value of &dump is nonzero when program
  1152.        execution terminates, a dump in the style of
  1153.        display() is provided.
  1154.  
  1155.        __________________________________________________
  1156.  
  1157.        &e : r                  base of natural logarithms
  1158.  
  1159.        The value of &e is the base of the natural
  1160.        logarithms, 2.71828 ... .
  1161.  
  1162.        __________________________________________________
  1163.  
  1164.        &phi : r                              golden ratio
  1165.  
  1166.        The value of &phi is the golden ratio, 1.61803 ...
  1167.        .
  1168.  
  1169.        __________________________________________________
  1170.  
  1171.        &pi : ratio of circumference to diameter of a circle
  1172.  
  1173.        The value of &pi is the ratio of the circumference
  1174.        of a circle to its diameter, 3.14159 ... .
  1175.  
  1176.        __________________________________________________
  1177.  
  1178.        &progname : s                         program name
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.        The value of &progname is the file name of the
  1199.        executing program.  A string value can be assigned
  1200.        to &progname to replace its initial value.
  1201.  
  1202.  
  1203.  
  1204.  
  1205.  
  1206.  
  1207.  
  1208.  
  1209.  
  1210.  
  1211.  
  1212.  
  1213.  
  1214.  
  1215.  
  1216.  
  1217.  
  1218.  
  1219.  
  1220.  
  1221.  
  1222.  
  1223.  
  1224.  
  1225.  
  1226.  
  1227.  
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.