home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ICONV8.ZIP / DOCS.ZIP / TR90-1.DOC < prev    next >
Text File  |  1990-03-29  |  49KB  |  1,849 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.                        Version 8 of Icon*
  15.  
  16.  
  17.                         Ralph E. Griswold
  18.  
  19.  
  20.  
  21.  
  22.  
  23.                             TR 90-1c
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.            January 1, 1990; last revised March 8, 1990
  50.  
  51.  
  52.                  Department of Computer Science
  53.  
  54.                     The University of Arizona
  55.  
  56.                       Tucson, Arizona 85721
  57.  
  58.  
  59.  
  60.  
  61. *This work was supported by the National Science Foundation under
  62. Grant CCR-8713690.
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.                         Version 8 of Icon
  77.  
  78.  
  79.  
  80.  
  81. 1.__Introduction
  82.  
  83.    The current version of Icon is Version 8.  Version 8, which
  84. replaces Version 7.5, contains a number of features not present
  85. in earlier versions.  The first edition of the Icon book [1]
  86. describes Version 5.  The second edition of this book, which is
  87. in press, describes Version 8.  This report serves as a temporary
  88. supplement to the first edition until the second edition is pub-
  89. lished.  The descriptions here are brief and in some cases incom-
  90. plete. Complete descriptions are contained in the second edition
  91. of the book.
  92.  
  93.    Most of the language extensions in Version 8 are upward-
  94. compatible with previous versions of Icon and most programs writ-
  95. ten for earlier versions work properly under Version 8.  However,
  96. some of the more implementation-dependent aspects described in
  97. the Version 5 book are now obsolete.
  98.  
  99.    The major differences between Versions 5 and 8 are listed
  100. below.  Features that are new since Version 7.5 are identified by
  101. squares ([]):
  102.  
  103.         A set data type.
  104.  
  105.      [] Serial numbers for structures.
  106.  
  107.         Functions for interfacing the operating system.
  108.  
  109.         Functions for manipulating bits.
  110.  
  111.      [] Functions for performing mathematical computations.
  112.  
  113.      [] Keyboard functions.
  114.  
  115.      [] Functions for getting variables from their names and vice
  116.         versa.
  117.  
  118.         Additional keywords related to co-expressions, csets,
  119.         program location, storage management information, and
  120.         language features.
  121.  
  122.      [] Support for arithmetic on integers of arbitrarily large
  123.         magnitude.
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.                              - 1 -
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.         Declaration of procedures with a variable number of argu-
  140.         ments.
  141.  
  142.         The invocation of functions, procedures, and operators by
  143.         their string names.
  144.  
  145.      [] The invocation of functions and procedures with arguments
  146.         from a list.
  147.  
  148.         Syntactic support for the use of co-expressions in
  149.         programmer-defined control operations.
  150.  
  151.         Optional conversion of potential run-time errors to
  152.         expression failure.
  153.  
  154.         Additional options for sorting tables.
  155.  
  156.         Co-expression tracing.
  157.  
  158.      [] Interfaces for calling C functions from Icon and calling
  159.         an Icon program from C.
  160.  
  161.         Error trace back, which provides detailed information
  162.         about the source of run-time errors.
  163.  
  164.         Correction of the handling of scanning environments.
  165.  
  166.         Correction of the handling of co-expression return points
  167.  
  168.      [] Instrumentation of storage management.
  169.  
  170.         A declaration to allow the inclusion of separately
  171.         translated Icon programs.
  172.  
  173.  
  174. 2.__New_Language_Features
  175.  
  176. 2.1__Structures
  177.  
  178. Sets
  179.  
  180.    Sets are unordered collections of values and have many of the
  181. properties normally associated with sets in the mathematical
  182. sense.  The function
  183.  
  184.         set(L)
  185.  
  186. creates a set that contains the distinct elements of the list L.
  187. For example,
  188.  
  189.         set(["abc",3])
  190.  
  191. creates a set with two members, "abc" and 3.
  192.  
  193.  
  194.  
  195.  
  196.                              - 2 -
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.    The default value for an omitted argument to set() is an empty
  206. list.  Consequently, set() creates an empty set.
  207.  
  208.    Sets, like other data aggregates in Icon, need not be homo-
  209. geneous - a set may contain members of different types.  Sets can
  210. be members of sets, as in:
  211.  
  212.         S1 := set([1,2,3])
  213.         S2 := set([S1,[]])
  214.  
  215. in which S2 contains two members, one of which is a set of three
  216. members and the other of which is an empty list.
  217.  
  218.    Any specific value can occur only once in a set. For example,
  219.  
  220.         set([1,2,3,3,1])
  221.  
  222. creates a set with the three members 1, 2, and 3.  Set membership
  223. is determined the same way the equivalence of values is deter-
  224. mined in the operation
  225.  
  226.         x === y
  227.  
  228. For example,
  229.  
  230.         set([[],[]])
  231.  
  232. creates a set that contains two distinct empty lists.
  233.  
  234.    Several set operations are provided. The function member(S,x)
  235. succeeds and produces the value of x if x is a member of S, but
  236. fails otherwise. Note that
  237.  
  238.         member(S1,member(S2,x))
  239.  
  240. succeeds if x is a member of both S1 and S2.
  241.  
  242.    The function insert(S,x) inserts x into the set S and produces
  243. the value of S.  Note that insert(S,x) is similar to put(L,x) in
  244. form.  A set may contain (a pointer to) itself: insert(S,S) adds
  245. S as an member of itself.  The function delete(S,x) deletes the
  246. member x from the set S and produces S.
  247.  
  248.    The functions insert(S,x) and delete(S,x) always succeed,
  249. whether or not x is in S. This allows their use in loops in which
  250. failure may occur for other reasons. For example,
  251.  
  252.         S := set()
  253.         while insert(S,read())
  254.  
  255. builds a set that consists of the (distinct) lines from the stan-
  256. dard input file.
  257.  
  258.    The operations
  259.  
  260.  
  261.  
  262.                              - 3 -
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.         S1 ++ S2
  272.         S1 ** S2
  273.         S1 -- S2
  274.  
  275. create the union, intersection, and difference of S1 and S2,
  276. respectively. In each case, the result is a new set.
  277.  
  278.    The use of these operations on csets is unchanged. There is no
  279. automatic type conversion between csets and sets; the result of
  280. the operation depends on the types of the arguments. For example,
  281.  
  282.         'aeiou' ++ 'abcde'
  283.  
  284. produces the cset 'abcdeiou', while
  285.  
  286.         set([1,2,3]) ++ set([2,3,4])
  287.  
  288. produces a set that contains 1, 2, 3, and 4. On the other hand,
  289.  
  290.         set([1,2,3]) ++ 4
  291.  
  292. and
  293.  
  294.         set(['a','b','c']) ++ 'd'
  295.  
  296. are erroneous.
  297.  
  298.    The functions and operations of Icon that apply to other data
  299. aggregates apply to sets as well. For example, if S is a set, *S
  300. is the size of S (the number of members in it). Similarly,
  301. type(S) produces the string set.
  302.  
  303.    The operation !S generates the members of S, but in no
  304. predictable order. Similarly, ?S produces a randomly selected
  305. member of S.  These operations produce values, not variables - it
  306. is not possible to assign a value to !S or ?S.
  307.  
  308.    The function copy(S) produces a new set, distinct from S, but
  309. which contains the same members as S. The copy is made in the
  310. same fashion as the copy of a list - the members themselves are
  311. not copied.  The function sort(S) produces a list containing the
  312. members of S in sorted order.  Sets occur after tables but before
  313. records in sorting.
  314.  
  315. Tables
  316.  
  317.    The functions member(), insert(), and delete() apply to tables
  318. as well as sets.
  319.  
  320.    The function member(T,x) succeeds if x is an entry value (key)
  321. in the table T, but fails otherwise.
  322.  
  323.    The function insert(T,x,y) inserts the entry value x into
  324. table T with the assigned value y. If there already was an entry
  325.  
  326.  
  327.  
  328.                              - 4 -
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337. value x in T, its assigned value is changed.  Note that insert
  338. has three arguments when used with tables, as compared to two
  339. when used with sets. An omitted third argument defaults to the
  340. null value.
  341.  
  342.    The function delete(T,x) removes the entry value x and its
  343. corresponding assigned value from T. If x is not an entry value
  344. in T, no operation is performed; delete() succeeds in either
  345. case.
  346.  
  347.    [] The function key(T) generates the keys in table T.
  348.  
  349. Sorting_Order_for_Elements_of_Lists_and_Tables
  350.  
  351.    A complete ordering is now defined for structures (lists,
  352. sets, tables, and records) and csets that appear in a larger
  353. structure to be sorted.  Different types are still kept separate,
  354. but within each structure type, elements are now sorted chrono-
  355. logically (in the order they were created). All of the different
  356. record types are sorted together.  Csets are sorted lexically, in
  357. the same fashion as strings.
  358.  
  359. Sorting_Options_for_Tables
  360.  
  361.    Two new options are available for sorting tables. These
  362. options are specified by the values 3 and 4 as the second argu-
  363. ment of sort(T,i).  Both of these options produce a single list
  364. in which the entry values and assigned values of table elements
  365. alternate. A value of 3 for i produces a list in which the entry
  366. values are in sorted order, and a value of 4 produces a list in
  367. which the assigned values are in sorted order.
  368.  
  369.    The main advantage of the new sorting options is that they
  370. only produce a single list, rather than a list of lists as pro-
  371. duced by the options 1 and 2. The amount of space needed for the
  372. single list is proportionally much less than for the list of
  373. lists.
  374.  
  375. [] Serialization_of_Structures
  376.  
  377.    Structures are now serialized, starting at 1 with the first
  378. structure of each type. Serial numbers are shown in the string
  379. images of structures. For example, the value of image(set())
  380. might be "set_5(0)".
  381.  
  382. 2.2__Functions
  383.  
  384.    Most of the new functions are described in this section. See
  385. other sections for functions related to specific features.  Note:
  386. Some implementations have additional functions. These are
  387. described in user manuals.
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.                              - 5 -
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403. System-Interface_Functions
  404.  
  405. getenv(s)
  406.  
  407.    getenv(s) produces the value of the environment variable s. It
  408. fails if the environment variable is not set. It also fails on
  409. systems that do not support environment variables.
  410.  
  411. remove(s)
  412.  
  413.    remove(s) removes the file named s. Subsequent attempts to
  414. open the file fail, unless it is created anew. If the file is
  415. open, the behavior of remove(s) is system dependent. remove(s)
  416. fails if it is unsuccessful.
  417.  
  418. rename(s1,s2)
  419.  
  420.    rename(s1,s2) causes the file named s1 to be henceforth known
  421. by the name s2.  The file named s1 is effectively removed. If a
  422. file named s2 exists prior to the renaming, the behavior is sys-
  423. tem dependent.  rename(s1,s2) fails if unsuccessful, in which
  424. case if the file existed previously it is still known by its ori-
  425. ginal name. Among the other possible causes of failure would be a
  426. file currently open, or a necessity to copy the file's contents
  427. to rename it.
  428.  
  429. seek(f,i)
  430.  
  431.    seek(f,i) seeks to position i in file f.  As with other posi-
  432. tions in Icon, a nonpositive value of i can be used to reference
  433. a position relative to the end of f.  i defaults to 1.  seek(f,i)
  434. produces f but fails if an error occurs.
  435.  
  436. where(f)
  437.  
  438.    where(f) produces the current byte position in the file f.
  439.  
  440. Characters_and_Ordinals
  441.  
  442. char(i)
  443.  
  444.    char(i) produces a string containing the character whose
  445. internal representation, or ordinal, is the integer i. i must be
  446. between 0 and 255 inclusive.  If i is out of range, or not con-
  447. vertible to integer, a run-time error occurs.
  448.  
  449. ord(s)
  450.  
  451.    ord(s) produces an integer between 0 and 255 representing the
  452. ordinal, or internal representation, of a character. If s is not
  453. convertible to string, or if the string's length is not 1, a
  454. run-time error occurs.
  455.  
  456.  
  457.  
  458.  
  459.  
  460.                              - 6 -
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469. Tab_Expansion_and_Insertion
  470.  
  471. detab(s,i1,i2,...,in)
  472.  
  473.    detab(s,i1,i2,...,in) replaces each tab character in s by one
  474. or more space characters, using tab stops at i1,i2...,in, and
  475. then additional tab stops created by repeating the last interval
  476. as necessary. The default is detab(s,9).
  477.  
  478.    Tab stops must be positive and strictly increasing. There is
  479. an implicit tab stop at position 1 to establish the first inter-
  480. val. Examples are:
  481.  
  482. detab(s)             tab stops at 9, 17, 25, 33, ...
  483. detab(s,5)           tab stops at 5, 9, 13, 17, ...
  484. detab(s,8,12)        tab stops at 8, 12, 16, 20, ...
  485. detab(s,11,18,30,36) tab stops at 11, 18, 30, 36, 42, 48, ...
  486.  
  487. For purposes of tab processing, "\b" has a width of -1, and "\r"
  488. and "\n" restart the counting of positions. Other nonprinting
  489. characters have zero width, and printing characters have a width
  490. of 1.
  491.  
  492. entab(s,i1,i2,...,in)
  493.  
  494.    entab(s,i1,i2,...,in) replaces runs of consecutive spaces with
  495. tab characters.  Tab stops are specified in the same manner as
  496. for the detab function. Any existing tab characters in s are
  497. preserved, and other nonprinting characters are treated identi-
  498. cally with the detab function.  The default is entab(s,9).
  499.  
  500.    A lone space is never replaced by a tab character;  however, a
  501. tab character may replace a single space character that is part
  502. of a longer run.
  503.  
  504. Bit-Wise_Functions
  505.  
  506.    The following functions operate on the individual bits compos-
  507. ing one or two integers. All produce an integer result.
  508.  
  509. iand(i,j)   bit-wise and of i and j
  510. ior(i,j)    bit-wise inclusive or of i and j
  511. ixor(i,j)   bit-wise exclusive or of i and j
  512. icom(i)     bit-wise complement (one's complement) of i
  513. ishift(i,j) If j is positive, i shifted left by j bit positions.
  514.             If j is negative, i shifted right by -j bit positions.
  515.             In all cases, vacated bit positions are filled with zeroes.
  516.  
  517.  
  518. [] Math_Functions
  519.  
  520.    The following functions are provided for performing mathemati-
  521. cal computations:
  522.  
  523.  
  524.  
  525.  
  526.                              - 7 -
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535. sin(r)      sine of r
  536. cos(r)      cosine of r
  537. tan(r)      tangent of r
  538. asin(r)     arc sine of r
  539. acos(r)     arc cosine of r
  540. atan(r1,r2) arc tangent of r1 / r2
  541. dtor(r)     radian equivalent of r given in degrees
  542. rtod(r)     degree equivalent of r given in radians
  543. sqrt(r)     square root of r
  544. exp(r)      e raised to the power r
  545. log(r1,r2)  logarithm of r1 to the base r2
  546.  
  547.  
  548. [] Keyboard_Functions
  549.  
  550.    The following functions for keyboard input and output are
  551. available on systems that support such capabilities:
  552.  
  553. getch()
  554.  
  555.    getch() waits until a character has been entered from the key-
  556. board and then produces the corresponding one-character string.
  557. The character is not displayed.
  558.  
  559. getche()
  560.  
  561.    getche() waits until a character has been entered from the
  562. keyboard and then produces the corresponding one-character
  563. string. The character is displayed.
  564.  
  565. kbhit()
  566.  
  567.    kbhit() succeeds if a character is available for getch() or
  568. getche() but fails otherwise.
  569.  
  570. [] Variables_and_Names
  571.  
  572. name(v)
  573.  
  574.    name(v) produces the string name of the variable v. The string
  575. name of an identifier or keyword is just as it appears in the
  576. program. The string name of a subscripted string-valued variable
  577. consists of the variable and the subscript, as in "line[2+:3]".
  578. The string name of a list or table reference consists of the data
  579. type and the subscripting expression, as in "list[3]".  The
  580. string name of a record field reference consists of the record
  581. type and field name with a separating period, as in "complex.r".
  582.  
  583. variable(s)
  584.  
  585.    variable(s) produces the variable for the identifier or key-
  586. word with the name s.
  587.  
  588.  
  589.  
  590.  
  591.  
  592.                              - 8 -
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601. Executable_Images
  602.  
  603. save(s)
  604.  
  605.    The function save(s) saves an executable image of an executing
  606. Icon program in the file named s. This function presently is
  607. implemented only on BSD UNIX systems. See Section 2.10 for a
  608. method of determining if this feature is implemented.
  609.  
  610.    save() can be called from any point in a program. It accepts a
  611. single argument that names the file that is to receive the
  612. resulting executable.  The named file is created if it does not
  613. exist. Any output problems on the file cause save() to fail. For
  614. lack of anything better, save() produces the number of bytes in
  615. the data region.
  616.  
  617.    When the new executable is run, execution of the Icon program
  618. begins in the main procedure. Global and static variables have
  619. the value they had when save() was called, but all dynamic local
  620. variables have the null value. Any initial clauses that have been
  621. executed are not re-executed.  As usual, arguments present on the
  622. command line are passed to the main procedure as a list.  Command
  623. line input and output redirections are processed normally, but
  624. any files that were open are no longer open and attempts to read
  625. or write them will fail.
  626.  
  627.    When the Icon interpreter starts up, it examines a number of
  628. environment variables to determine various operational parame-
  629. ters. When a saved executable starts up, the environment vari-
  630. ables are not examined; the parameter values recorded in the exe-
  631. cutable are used instead.  Note that many of the parameter values
  632. are dynamic and may have changed considerably from values sup-
  633. plied initially.
  634.  
  635.    Consider an example:
  636.  
  637.         global hello
  638.         procedure main()
  639.            initial {
  640.               hello := "Hello World!"
  641.               save("hello") | stop("Error saving to 'hello'")
  642.               exit()
  643.               }
  644.            write(hello)
  645.         end
  646.  
  647.  
  648.    The global variable hello is assigned "Hello World!" and then
  649. the interpreter is saved to the file hello. The program then
  650. exits.  When hello is run, main's initial clause is skipped since
  651. it has already been executed. The variable hello has retained its
  652. value and the call to write produces the expected greeting.
  653.  
  654.    It is possible to call save() any number of times during the
  655.  
  656.  
  657.  
  658.                              - 9 -
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667. course of execution. Saving to the same file each time is rather
  668. uninteresting, but imagine a complex data structure that passes
  669. through levels of refinement and then saving out a series of exe-
  670. cutables that capture the state of the structure at given times.
  671.  
  672.    Saved executables contain the entire data space present at the
  673. time of the save and thus can be quite large. Saved executables
  674. on a VAX are typically around 250k bytes.
  675.  
  676. [] Large_Integers
  677.  
  678.    Integers now are not limited in magnitude by machine architec-
  679. ture. This feature is not supported on all implementations of
  680. Icon because it increases the size of the Icon system by a signi-
  681. ficant amount. See Section 2.10 for a method of determining if
  682. this feature is implemented.
  683.  
  684.    Negative large integers become positive if shifted right by
  685. ishift().
  686.  
  687.    The string image of a large integer whose decimal representa-
  688. tion would have more than about 25 digits has the form
  689. integer(~n), where n is the approximate number of decimal digits.
  690.  
  691. Integer_Sequences
  692.  
  693.    seq(i,j) generates an infinite sequence of integers starting
  694. at i with increments of j. An omitted or null-valued argument
  695. defaults to 1. For example, seq() generates 1, 2, 3, ... .
  696.  
  697. 2.3__Procedures_and_Functions
  698.  
  699. Procedures_with_a_Variable_Number_of_Arguments
  700.  
  701.    A procedure can be made to accept a variable number of argu-
  702. ments by appending [] to the last (or only) parameter in the
  703. parameter list.  An example is:
  704.  
  705.         procedure p(a,b,c[])
  706.           suspend a + b + !c
  707.         end
  708.  
  709.  
  710. If called as p(1,2,3,4,5), the parameters have the following
  711. values:
  712.  
  713.         a    1
  714.         b    2
  715.         c    [3,4,5]
  716.  
  717.  
  718.    The last parameter always contains a list. This list consists
  719. of the arguments not used by the previous parameters. If the pre-
  720. vious parameters use up all the arguments, the list is empty. If
  721.  
  722.  
  723.  
  724.                              - 10 -
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733. there are not enough arguments to satisfy the previous parame-
  734. ters, the null value will be used for the remaining ones, but the
  735. last parameter will still contain the empty list.
  736.  
  737. [] Invocation_with_a_List_of_Values
  738.  
  739.  
  740.    The operation p!L invokes p with the arguments in the list L.
  741. For example,
  742.  
  743.         write![1,2,3]
  744.  
  745. is equivalent to
  746.  
  747.         write(1,2,3)
  748.  
  749. Note that this feature allows functions and procedures to be
  750. invoked with a number of arguments that need not be known when
  751. the program is written.
  752.  
  753. Invocation_by_String_Name
  754.  
  755.    A string-valued expression that corresponds to the name of a
  756. procedure or operation can be used in place of the procedure or
  757. operation in an invocation expression. For example,
  758.  
  759.         "image"(x)
  760.  
  761. produces the same call as
  762.  
  763.         image(x)
  764.  
  765. and
  766.  
  767.         "-"(i,j)
  768.  
  769. is equivalent to
  770.  
  771.         i - j
  772.  
  773.  
  774.    In the case of operator symbols with unary and binary forms,
  775. the number of arguments determines the operation. Thus
  776.  
  777.         "-"(i)
  778.  
  779. is equivalent to
  780.  
  781.         -i
  782.  
  783. Since to-by is an operation, despite its reserved-word syntax, it
  784. is included in this facility with the string name "..." .  Thus
  785.  
  786.  
  787.  
  788.  
  789.  
  790.                              - 11 -
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.         "..."(1,10,2)
  800.  
  801. is equivalent to
  802.  
  803.         1 to 10 by 2
  804.  
  805. [] Similarly, range specifications are represented by "[:]", so
  806. that
  807.  
  808.         "[:]"(s,i,j)
  809.  
  810. is equivalent to
  811.  
  812.         s[i:j]
  813.  
  814. The subscripting operation is available with the string name
  815. "[]". Thus
  816.  
  817.         "[]"(&lcase,3)
  818.  
  819. produces c.
  820.  
  821.    Defaults are not provided for omitted or null-valued arguments
  822. in this facility. Consequently,
  823.  
  824.         "..."(1,10)
  825.  
  826. results in a run-time error when it is evaluated.
  827.  
  828.    Arguments to operators invoked by string names are derefer-
  829. enced. Consequently, string invocation for assignment operations
  830. is ineffective and results in error termination.
  831.  
  832.    String names are available for the operations in Icon, but not
  833. for control structures. Thus
  834.  
  835.         "|"(expr1,expr2)
  836.  
  837. is erroneous.  Note that string scanning is a control structure.
  838.  
  839.    Field references, of the form
  840.  
  841.         expr . fieldname
  842.  
  843. are not operations in the ordinary sense and are not available
  844. via string invocation.  In addition, conjunction is not available
  845. via string invocation, since no operation is actually performed.
  846.  
  847.    String names for procedures are available through global iden-
  848. tifiers.  Note that the names of functions, such as image, are
  849. global identifiers. Similarly, any procedure-valued global iden-
  850. tifier may be used as the string name of a procedure. Thus, in
  851.  
  852.  
  853.  
  854.  
  855.  
  856.                              - 12 -
  857.  
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  
  864.  
  865.         global q
  866.  
  867.         procedure main()
  868.            q := p
  869.            "q"("hi")
  870.         end
  871.  
  872.         procedure p(s)
  873.            write(s)
  874.         end
  875.  
  876. the procedure p is invoked via the global identifier q.
  877.  
  878.    The function proc(x,i) converts x to a procedure, if possible.
  879. If x is procedure-valued, its value is returned unchanged. If the
  880. value of x is a string that corresponds to the name of a pro-
  881. cedure as described previously, the corresponding procedure value
  882. is returned.  The value of i is used to distinguish between unary
  883. and binary operators.  For example, proc("*",2) produces the mul-
  884. tiplication operator, while proc("*",1) produces the size opera-
  885. tor.  The default value for i is 1.  If x cannot be converted to
  886. a procedure, proc(x,i) fails.
  887.  
  888. 2.4__String_Scanning
  889.  
  890.    Scanning environments (&subject and &pos) are now maintained
  891. correctly.  In particular, they are are now restored when a scan-
  892. ning expression is exited via break, next, return, fail, and
  893. suspend. This really is a correction of a bug, although the
  894. former handling of scanning environments is described as a
  895. ``feature'' in the first edition of the Icon book. Note also that
  896. this change could affect the behavior of existing Icon programs.
  897.  
  898. 2.5__Co-Expressions
  899.  
  900.    Co-expression return points are now handled properly, so that
  901. co-expressions can be used as coroutines.
  902.  
  903.    The image of a co-expression now includes a serial number.
  904. Numbers start with 1 for &main and increase as new co-expressions
  905. are created.
  906.  
  907.    Co-expression activation and return are now traced along with
  908. procedure calls and returns if &trace is nonzero. Co-expression
  909. tracing shows the identifying numbers.
  910.  
  911.    The value of ¤t is the current co-expression.
  912.  
  913.    The initial size of &main is now 1, instead of 0, to reflect
  914. its activation to start program execution.
  915.  
  916.    An attempt to refresh &main results in a run-time error.
  917. (Formerly, it caused a memory violation.)
  918.  
  919.  
  920.  
  921.  
  922.                              - 13 -
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931. 2.6__Programmer-Defined_Control_Operations
  932.  
  933.    Co-expressions can be used to provide programmer-defined con-
  934. trol operations. This facility uses an alternative syntax for
  935. procedure invocation in which the arguments are passed in a list
  936. of co-expressions. This syntax uses braces in place of
  937. parentheses:
  938.  
  939.         p{expr1, expr2, ..., exprn}
  940.  
  941. is equivalent to
  942.  
  943.         p([create expr1, create expr2, ..., create exprn])
  944.  
  945. Note that
  946.  
  947.         p{}
  948.  
  949. is equivalent to
  950.  
  951.         p([])
  952.  
  953.  
  954. 2.7__Input_and_Output
  955.  
  956.    There no longer are any length limitations on the string pro-
  957. duced by read() or reads(), nor on the length of the argument to
  958. system() or the first argument of open().
  959.  
  960.    Formerly the value returned by write(x1,x2,...,xn) and
  961. writes(x1,x2,...,xn) was the last written argument converted to a
  962. string. The conversion is no longer performed. For example, the
  963. value returned by write(1) is the integer 1.
  964.  
  965.    Errors during writing (such as inadequate space on the output
  966. device) now cause error termination.
  967.  
  968.    The function read(f) reads the last line of the file f, even
  969. if that line does not end with a newline (Version 5 discarded
  970. such a line).
  971.  
  972.    If the file f is open as a pipe, close(f) produces the system
  973. code resulting from closing f instead of f.
  974.  
  975.    Icon no longer performs its own I/O buffering; instead, this
  976. function is left to the operating system on which Icon runs. The
  977. environment variable NBUFS is no longer supported.
  978.  
  979. 2.8__Errors
  980.  
  981. Error_Trace_Back
  982.  
  983.    A run-time error now shows a trace back, giving the sequence
  984. of procedure calls to the site of the error, followed by a
  985.  
  986.  
  987.  
  988.                              - 14 -
  989.  
  990.  
  991.  
  992.  
  993.  
  994.  
  995.  
  996.  
  997. symbolic rendering of the offending expression.  For example,
  998. suppose the following program is contained in the file max.icn:
  999.  
  1000.         procedure main()
  1001.            i := max("a",1)
  1002.         end
  1003.  
  1004.  
  1005.         procedure max(i,j)
  1006.            if i > j then i else j
  1007.         end
  1008.  
  1009. Its execution in Version 8 produces the following output:
  1010.  
  1011.         Run-time error 102
  1012.         File max.icn; Line 6
  1013.         numeric expected
  1014.         offending value: "a"
  1015.         Trace back:
  1016.            main()
  1017.            max("a",1) from line 2 in max.icn
  1018.            {"a" > 1} from line 6 in max.icn
  1019.  
  1020.  
  1021. Error_Conversion
  1022.  
  1023.    The keyword &error controls the conversion of potential run-
  1024. time errors into expression failure. It behaves like &trace: if
  1025. it is zero, the default value, errors are handled as usual. If it
  1026. is non-zero, errors are treated as failure and &error is decre-
  1027. mented.
  1028.  
  1029.    There are a few errors that cannot be converted to failure:
  1030. arithmetic overflow and underflow, stack overflow, and errors
  1031. during program initialization.
  1032.  
  1033.    When an error is converted to failure in this way, three key-
  1034. words are set:
  1035.  
  1036.       &errornumber is the number of the error (e.g., 101).
  1037.       Reference to &errornumber fails if there has not been an
  1038.       error.
  1039.  
  1040.       &errortext is the error message (e.g., integer expected).
  1041.  
  1042.       &errorvalue is the offending value. Reference to &error-
  1043.       value fails if there is no specific offending value.
  1044.  
  1045. The function errorclear() removes the indication of the last
  1046. error. Subsequent references to &errornumber fail until another
  1047. error occurs.
  1048.  
  1049.    The function runerr(i,x) causes program execution to terminate
  1050. with error number i as if a corresponding run-time error had
  1051.  
  1052.  
  1053.  
  1054.                              - 15 -
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063. occurred. If i is the number of a standard run-time error, the
  1064. corresponding error text is printed; otherwise no error text is
  1065. printed. The value of x is given as the offending value. If x is
  1066. omitted, no offending value is printed.
  1067.  
  1068.    This function is provided so that library procedures can be
  1069. written to terminate in the same fashion as built-in operations.
  1070. It is advisable to use error numbers for programmer-defined
  1071. errors that are well outside the range of numbers used by Icon
  1072. itself. See Appendix B. Error number 500 has the predefined text
  1073. "program malfunction" for use with runerr().  This number is not
  1074. used by Icon itself.
  1075.  
  1076.    A call of runerr() is subject to conversion to failure like
  1077. any other run-time error.
  1078.  
  1079. 2.9__[] Icon-C_Interfaces
  1080.  
  1081.    C functions now can be called from Icon programs [2]. The
  1082. function callout(x,x1,x2,...,xn) calls the C function designated
  1083. by x and passes it the arguments x1, x2, ..., xn. The method of
  1084. designating C functions and passing arguments is system-
  1085. dependent.
  1086.  
  1087.    An Icon program also can be called from C. The method of doing
  1088. this is described in [2].
  1089.  
  1090. 2.10__Implementation_Features
  1091.  
  1092.    The &features generates the features of the implementation on
  1093. which the current program is running. For example, on a BSD UNIX
  1094. implementation,
  1095.  
  1096.         every write(&features)
  1097.  
  1098. produces
  1099.  
  1100.         UNIX
  1101.         ASCII
  1102.         calling to Icon
  1103.         co-expressions
  1104.         direct execution
  1105.         environment variables
  1106.         error trace back
  1107.         executable images
  1108.         expandable regions
  1109.         external functions
  1110.         large integers
  1111.         math functions
  1112.         memory monitoring
  1113.         pipes
  1114.         string invocation
  1115.         system function
  1116.  
  1117.  
  1118.  
  1119.  
  1120.                              - 16 -
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.  
  1127.  
  1128.  
  1129.    Similarly, a program that uses co-expressions can check for
  1130. the presence of this feature:
  1131.  
  1132.         if not(&features == "co-expressions") then runerr(401)
  1133.  
  1134.  
  1135. 2.11__Storage_Management
  1136.  
  1137.    Storage is allocated automatically during the execution of an
  1138. Icon program, and garbage collections are performed automatically
  1139. to reclaim storage for subsequent reallocation.  There are three
  1140. storage regions: static, string, and block.  Only implementations
  1141. in which regions can be expanded support a static region.  See
  1142. [3] for more information.
  1143.  
  1144.    An Icon programmer normally need not worry about storage
  1145. management.  However, in applications that require a large amount
  1146. of storage or that must operate in a limited amount of memory,
  1147. some knowledge of the storage management process may be useful.
  1148.  
  1149.    The keyword &collections generates four values associated with
  1150. garbage collection: the total number since program initiation,
  1151. the number triggered by static allocation, the number triggered
  1152. by string allocation, and the number triggered by block alloca-
  1153. tion.  The keyword ®ions generates the current sizes of the
  1154. static, string, and block regions.  The keyword &storage gen-
  1155. erates the current amount of space used in the static, string,
  1156. and block regions. The value given for the static region
  1157. presently is not meaningful.
  1158.  
  1159.    Garbage collection is forced by the function collect(i,j).
  1160. The value of i specifies the region and the value of j specifies
  1161. the amount of space that must be free following the collection.
  1162. The regions are designated as follows:
  1163.  
  1164.         i    region
  1165.         1    static
  1166.         2    string
  1167.         3    block
  1168.  
  1169. The region specified is reflected in the values generated by
  1170. &collections.  A value of 0 for i causes a garbage collection
  1171. without a specific region. In this case, the value of j is
  1172. irrelevant.  The default values for i and j are 0.
  1173.  
  1174. 2.12__[] Memory_Monitoring
  1175.  
  1176.    Storage allocation and garbage collection now are instrumented
  1177. [4].  Normally, this instrumentation is disabled. It is enabled
  1178. by setting the environment variable MEMMON to the name of an
  1179. allocation history file to receive memory-monitoring data.
  1180.  
  1181.    There are several tools for processing memory-monitoring data,
  1182. including ones for producing interactive visualizations of
  1183.  
  1184.  
  1185.  
  1186.                              - 17 -
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195. storage management. See [4] for more information.
  1196.  
  1197.    The function mmpause(s) causes a pause in interactive visuali-
  1198. zations, displaying the identification s. The default for s is
  1199. "programmed pause".
  1200.  
  1201.    The function mmshow(x,s) redraws the object x in a color
  1202. specified by s. The color specifications are:
  1203.  
  1204.         "b"  black
  1205.         "g"  gray
  1206.         "w"  white
  1207.         "h"  highlight: blinking black and white
  1208.         "r"  redraw in normal color
  1209.  
  1210. The default is "r".
  1211.  
  1212.    The function mmout(s) writes s (without interpretation) as a
  1213. separate line to the allocation history file.
  1214.  
  1215. 2.13__Odds_and_Ends
  1216.  
  1217. Other_Keywords
  1218.  
  1219.    In addition to the new keywords mentioned above, there are
  1220. four others:
  1221.  
  1222.         &digits, whose value is '0123456789'.
  1223.  
  1224.      [] &letters, whose value is a cset containing the 52 upper-
  1225.         and lowercase letters.
  1226.  
  1227.         &line, the current source-code line number.
  1228.  
  1229.         &file, the current source-code file name.
  1230.  
  1231. Addition_to_suspend
  1232.  
  1233.    The suspend control structure now has an optional do clause,
  1234. analogous to every-do. If a do clause is present in a suspend
  1235. control structure, its argument is evaluated after the suspend is
  1236. resumed and before possible suspension with another result.
  1237.  
  1238.    For example, the following expression might be used to count
  1239. the number of suspensions:
  1240.  
  1241.         suspend expr do count +:= 1
  1242.  
  1243.  
  1244. String_and_Cset_Images
  1245.  
  1246.    ``Unprintable'' characters in strings and csets now are imaged
  1247. with hexadecimal escape sequences rather than with octal ones.
  1248.  
  1249.  
  1250.  
  1251.  
  1252.                              - 18 -
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261. Display_Output
  1262.  
  1263.    The function display(f,i) now prints the image of the current
  1264. co-expression before listing the values of variables.
  1265.  
  1266. Tracing
  1267.  
  1268.    If the value of &trace is negative, it is decremented every
  1269. time a trace message is written. Previously it was left
  1270. unchanged. This change does not affect tracing itself, but it
  1271. does allow the number of trace messages that have been written to
  1272. be determined by a running program.
  1273.  
  1274. [] Reserved_Words
  1275.  
  1276.    The reserve word dynamic has been deleted.
  1277.  
  1278. [] Character_Equivalents
  1279.  
  1280.    The character pairs $(, $), $<, and $> are equivalent to [, ],
  1281. {, and }, respectively.  These equivalents are provided for use
  1282. on EBCDIC systems that cannot input and output braces and brack-
  1283. ets, but the equivalents also can be used on ASCII systems.
  1284.  
  1285. [] Numeric_Conversion
  1286.  
  1287.    If large integers are not supported, an attempt to convert a
  1288. string of digits whose numeric value would be too large for an
  1289. Icon integer now fails instead of producing a real number.
  1290.  
  1291.  
  1292. 3.__Running_Icon
  1293.  
  1294. 3.1__Command-Line_Options
  1295.  
  1296.    Options to icont must precede file names on the command line.
  1297. For example,
  1298.  
  1299.         icont -o manager proto.icn
  1300.  
  1301. not
  1302.  
  1303.         icont proto.icn -o manager
  1304.  
  1305. The position of options has always been documented this way, but
  1306. it was not enforced previously. Consequently, options in the
  1307. incorrect position that worked before will not work now. This
  1308. problem is most likely to occur in scripts that were composed
  1309. under earlier versions of Icon.
  1310.  
  1311.    Note that the -x option is an exception; it must occur after
  1312. all file names for icont, since any command-line arguments after
  1313. -x apply to execution (iconx).
  1314.  
  1315.  
  1316.  
  1317.  
  1318.                              - 19 -
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327. 3.2__The_Link_Declaration
  1328.  
  1329.    The link declaration simplifies the inclusion of separately
  1330. translated libraries of Icon procedures. If icont [5] is run with
  1331. the -c option, source files are translated into intermediate
  1332. ucode files (with names ending in .u1 and .u2).  For example,
  1333.  
  1334.         icont -c libe.icn
  1335.  
  1336. produces the ucode files libe.u1 and libe.u2. The ucode files can
  1337. be incorporated in another program with the new link declaration,
  1338. which has the form
  1339.  
  1340.         link libe
  1341.  
  1342. The argument of link is, in general, a list of identifiers or
  1343. string literals that specify the names of files to be linked
  1344. (without the .u1 or .u2). Thus, when running under UNIX,
  1345.  
  1346.         link libe, "/usr/icon/ilib/collate"
  1347.  
  1348. specifies the linking of libe in the current directory and col-
  1349. late in /usr/icon/ilib.  The syntax for paths may be different
  1350. for other operating systems.
  1351.  
  1352.    The environment variable IPATH controls the location of files
  1353. specified in link declarations. The value of IPATH should be a
  1354. blank-separated string of the form p1 p2  ... pn where each pi
  1355. names a directory.  Each directory is searched in turn to locate
  1356. files named in link declarations. The default value of IPATH is
  1357. the current directory. The current directory is always searched
  1358. first, regardless of the value of IPATH.
  1359.  
  1360. Linker_Options
  1361.  
  1362.    The option to generate diagnostic (.ux) files during linking
  1363. has been changed from -D to -L.
  1364.  
  1365.    The amount of space needed to associate source-program line
  1366. numbers with executable code can be set by -Snn. The default
  1367. value of n is 1000.  Similarly, the amount of space needed to
  1368. associate file names with executable code can be set by -SFn. The
  1369. default is 10.
  1370.  
  1371. [] Path_to_iconx
  1372.  
  1373.    For implementations that support direct execution of icode
  1374. files, the hardwired path to iconx is overridden by the value of
  1375. the environment variable ICONX, if it is set.  If ICONX is not
  1376. set and iconx is not found on the hardwired path, PATH is
  1377. searched for it.
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.                              - 20 -
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.  
  1391.  
  1392.  
  1393. Block_Region_Size
  1394.  
  1395.    The environment variables BLOCKSIZE and BLKSIZE now are
  1396. synonyms for HEAPSIZE.
  1397.  
  1398. File_Names
  1399.  
  1400.    During translation and linking, the suffix .u is interpreted
  1401. as .u1, and no suffix is interpreted as .icn.
  1402.  
  1403.    On some systems, the icode file produced by the linker has the
  1404. extension icx.  For example, on MS-DOS,
  1405.  
  1406.         icont prog.icn
  1407.  
  1408. produces an icode file named prog.icx. The extension need not be
  1409. given when using iconx, as in:
  1410.  
  1411.         iconx prog
  1412.  
  1413.  
  1414. Redirection_of_Error_Output
  1415.  
  1416.    The option -e now allows standard error output to be
  1417. redirected to a file. For example,
  1418.  
  1419.         iconx -e prog.err prog
  1420.  
  1421. executes prog and sends any error output to the file prog.err.
  1422. If - is given in place of a file name, error output is redirected
  1423. to standard output. On systems on which standard output can be
  1424. redirected to a file, -e - causes both error output and standard
  1425. output go to that file. For example,
  1426.  
  1427.         iconx -e - prog >prog.out
  1428.  
  1429. redirects both error output and standard output to prog.out.
  1430.  
  1431. Version_Checking
  1432.  
  1433.    The Icon translator converts a source-language program to an
  1434. intermediate form, called ucode. The Icon linker converts one or
  1435. more ucode files to a binary form called icode. The format of
  1436. Version 8 ucode and icode files is different from that of earlier
  1437. versions.  To avoid the possibility of malfunction due to incom-
  1438. patible ucode and icode formats, Version 8 checks both ucode and
  1439. icode files and terminates processing with an error message if
  1440. the versions are not correct.
  1441.  
  1442. [] Program_Location_Information
  1443.  
  1444.    A comment that begins at the beginning of a line and has the
  1445. form
  1446.  
  1447.  
  1448.  
  1449.  
  1450.                              - 21 -
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.  
  1457.  
  1458.  
  1459.         #line n "f"
  1460.  
  1461. changes the current source-program line number and file name used
  1462. by the Icon translator to n and f, respectively.
  1463.  
  1464. [] Warning_Messages
  1465.  
  1466.    The Icon translator now issues a warning message if the dere-
  1467. ferencing operator is applied to a numeric literal, as in .25.
  1468.  
  1469. Miscellaneous
  1470.  
  1471.    Some run-time environment variables have changed; see Appendix
  1472. A.  Several error messages have been changed.  Appendix B con-
  1473. tains a list of run-time error messages for Version 8.
  1474.  
  1475.  
  1476. 4.__Effects_of_Implementation_Changes
  1477.  
  1478.    There are many differences between the implementation of Ver-
  1479. sion 8 of Icon and earlier versions.  Most of these changes only
  1480. affect performance and are otherwise invisible to users.
  1481.  
  1482.    Changes in the techniques used for hashing, however, change
  1483. the order in which elements are generated from sets and tables
  1484. and the random selection of elements of sets and tables.
  1485.  
  1486.    In addition, the order of generation and random selection from
  1487. sets and tables may vary between implementations.
  1488.  
  1489.  
  1490. 5.__Obsolete_and_Changed_Features
  1491.  
  1492.    The original implementation of Version 5 supported both a com-
  1493. piler (iconc) and an interpreter (icont).  Version 8 supports
  1494. only an interpreter.  It is not possible to load C functions with
  1495. the interpreter as it was with the compiler.  A system for per-
  1496. sonalized interpreters [6] is included with Version 8 for UNIX
  1497. systems to make it comparatively easy to add new functions and
  1498. otherwise modify the Icon run-time system.
  1499.  
  1500.    The reserved word dynamic is no longer available; local is
  1501. equivalent.
  1502.  
  1503.  
  1504. 6.__Bugs_and_Problems
  1505.  
  1506.  
  1507.      +   Line numbers sometimes are wrong in diagnostic messages
  1508.          related to lines with continued quoted literals.
  1509.  
  1510.      +   Large-integer arithmetic is not supported in i to j and
  1511.          seq().  Large integers cannot be assigned to keywords.
  1512.  
  1513.  
  1514.  
  1515.  
  1516.                              - 22 -
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.  
  1523.  
  1524.  
  1525.      +   Large-integer literals are constructed at run-time. Con-
  1526.          sequently, they should not be used in loops where they
  1527.          would be constructed repeatedly.
  1528.  
  1529.      +   Conversion of a large integer to a string is quadratic
  1530.          in the length of the integer. Conversion of very a large
  1531.          integer to a string may take a very long time and give
  1532.          the appearance of an endless loop.
  1533.  
  1534.      +   Integer overflow on exponentiation may not be detected
  1535.          during execution.  Such overflow may occur during type
  1536.          conversion.
  1537.  
  1538.      +   In some cases, trace messages may show the return of
  1539.          subscripted values, such as &null[2], that would be
  1540.          erroneous if they were dereferenced.
  1541.  
  1542.      +   If a long file name for an Icon source-language program
  1543.          is truncated by the operating system, mysterious diag-
  1544.          nostic messages may occur during linking.
  1545.  
  1546.      +   Stack overflow is checked using a heuristic that may not
  1547.          always be effective.
  1548.  
  1549.      +   If an expression such as
  1550.  
  1551.                  x := create expr
  1552.  
  1553.          is used in a loop, and x is not a global variable,
  1554.          unreferenceable co-expressions are generated by each
  1555.          successive create operation.  These co-expressions are
  1556.          not garbage collected.  This problem can be circumvented
  1557.          by making x a global variable or by assigning a value to
  1558.          x before the create operation, as in
  1559.  
  1560.                  x := &null
  1561.                  x := create expr
  1562.  
  1563.  
  1564.      +   Stack overflow in a co-expression may not be detected
  1565.          and may cause mysterious program malfunction.
  1566.  
  1567.  
  1568. 7.__Possible_Differences_Among_Version_8_Implementations
  1569.  
  1570.    A few aspects of the implementation of Version 8 are specific
  1571. to different computer architectures and operating systems. Co-
  1572. expressions require a context switch that is implemented in
  1573. assembly language.  If this context switch is not implemented, an
  1574. attempt to activate a co-expression results in error termination.
  1575.  
  1576.    Some features of Icon, such as opening a pipe for I/O and the
  1577. system() function, are not supported on all operating systems.
  1578. See specific user manuals for details.
  1579.  
  1580.  
  1581.  
  1582.                              - 23 -
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.  
  1589.  
  1590.  
  1591. Acknowledgements
  1592.  
  1593.    Mark Emmer, Clint Jeffery, Sandra Miller, Chris Smith, Gregg
  1594. Townsend, and Ken Walker contributed to Version 8 of Icon.
  1595.  
  1596. References
  1597.  
  1598.  
  1599. 1.   R. E. Griswold and M. T. Griswold, The Icon Programming
  1600.      Language, Prentice-Hall, Inc., Englewood Cliffs, NJ, 1983.
  1601.  
  1602. 2.   R. E. Griswold, Icon-C Calling Interfaces, The Univ. of
  1603.      Arizona Tech. Rep. 90-8, 1990.
  1604.  
  1605. 3.   R. E. Griswold and M. T. Griswold, The Implementation of the
  1606.      Icon Programming Language, Princeton University Press, 1986.
  1607.  
  1608. 4.   G. M. Townsend, The Icon Memory Monitoring System, The Univ.
  1609.      of Arizona Icon Project Document IPD113, 1990.
  1610.  
  1611. 5.   R. E. Griswold, ICONT(1), manual page for UNIX Programmer's
  1612.      Manual, The Univ. of Arizona Icon Project Document IPD109,
  1613.      1990.
  1614.  
  1615. 6.   R. E. Griswold, Personalized Interpreters for Version 8 of
  1616.      Icon, The Univ. of Arizona Tech. Rep. 90-3, 1990.
  1617.  
  1618.  
  1619.  
  1620.  
  1621.  
  1622.  
  1623.  
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632.  
  1633.  
  1634.  
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.                              - 24 -
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.                   Appendix A - Environment Variables
  1658.  
  1659.  
  1660.  
  1661.  
  1662.    There are a number of environment variables that can be set to
  1663. override the default values for sizes of Icon's storage regions
  1664. and other run-time parameters.  Except for ICONX, NOERRBUF, and
  1665. ICONCORE, the values assigned to these environment variables must
  1666. be numbers.  Default values for regions vary from system to
  1667. system and are given in user manuals.  Some implementations also
  1668. have other environment variables.
  1669.  
  1670.    The environment variables are:
  1671.  
  1672.      ICONX     If set, this environment variable specifies the
  1673.                location of iconx used to execute an icode file.
  1674.  
  1675.      TRACE     Specifies the initial value of &trace. The default
  1676.                value is zero.
  1677.  
  1678.      NOERRBUF  If set, standard error output is not buffered.
  1679.  
  1680.      ICONCORE  If set, a core dump is produced in the case of
  1681.                error termination.
  1682.  
  1683.      MSTKSIZE  Specifies the size in words of the main
  1684.                interpreter stack.
  1685.  
  1686.      STRSIZE   Specifies the initial size in bytes of the
  1687.                allocated string region.
  1688.  
  1689.      BLOCKSIZE Specifies the initial size in bytes of the
  1690.                allocated block region.  HEAPSIZE and BLKSIZE are
  1691.                synonyms for BLOCKSIZE.
  1692.  
  1693.      STATSIZE  Specifies the initial size in bytes of the static
  1694.                region in which co-expressions are allocated.
  1695.  
  1696.      STATINCR  Specifies the increment for expanding the static
  1697.                region. The default increment is one-fourth the
  1698.                initial size of the static region.
  1699.  
  1700.      COEXPSIZE Specifies the size in words of co-expression
  1701.                blocks.
  1702.  
  1703.      QLSIZE    Specifies the amount of space used for pointers to
  1704.                strings during garbage collection. Used only on
  1705.                implementations with fixed memory regions.
  1706.  
  1707.      MEMMON    Name of the file for memory-monitoring data.
  1708.  
  1709.    An inappropriate setting of an environment variable prevents
  1710. the program from running.
  1711.  
  1712.  
  1713.  
  1714.                              - 25 -
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.  
  1721.  
  1722.  
  1723.               Appendix B - Run-Time Error Messages
  1724.  
  1725.  
  1726.  
  1727.  
  1728.  
  1729.    A list of run-time error numbers and corresponding messages
  1730. follows.  Some implementations have additional run-time errors.
  1731.  
  1732.         101     integer expected
  1733.         102     numeric expected
  1734.         103     string expected
  1735.         104     cset expected
  1736.         105     file expected
  1737.         106     procedure or integer expected
  1738.         107     record expected
  1739.         108     list expected
  1740.         109     string or file expected
  1741.         110     string or list expected
  1742.         111     variable expected
  1743.         112     invalid type to size operation
  1744.         113     invalid type to random operation
  1745.         114     invalid type to subscript operation
  1746.         115     list, set, or table expected
  1747.         116     invalid type to element generator
  1748.         117     missing main procedure
  1749.         118     co-expression expected
  1750.         119     set expected
  1751.         120     cset or set expected
  1752.         121     function not supported
  1753.         122     set or table expected
  1754.         123     invalid type
  1755.         124     table expected
  1756.  
  1757.         201     division by zero
  1758.         202     remaindering by zero
  1759.         203     integer overflow
  1760.         204     real overflow, underflow, or division by zero
  1761.         205     value out of range
  1762.         206     negative first operand to real exponentiation
  1763.         207     invalid field name
  1764.         208     second and third arguments to map of unequal length
  1765.         209     invalid second argument to open
  1766.         210     non-ascending arguments to detab/entab
  1767.         211     by value equal to zero
  1768.         212     attempt to read file not open for reading
  1769.         213     attempt to write file not open for writing
  1770.         214     input/output error
  1771.         215     attempt to refresh &main
  1772.         216     external function not found
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779.  
  1780.                              - 26 -
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.  
  1787.  
  1788.  
  1789.         301     evaluation stack overflow
  1790.         302     system stack overflow
  1791.         303     inadequate space for evaluation stack
  1792.         304     inadequate space in qualifier list
  1793.         305     inadequate space for static allocation
  1794.         306     inadequate space in string region
  1795.         307     inadequate space in block region
  1796.         308     system stack overflow in co-expression
  1797.  
  1798.         401     co-expressions not implemented
  1799.  
  1800.         500     program malfunction
  1801.  
  1802.  
  1803.  
  1804.  
  1805.  
  1806.  
  1807.  
  1808.  
  1809.  
  1810.  
  1811.  
  1812.  
  1813.  
  1814.  
  1815.  
  1816.  
  1817.  
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845.  
  1846.                              - 27 -
  1847.  
  1848.  
  1849.