home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / i / icon88.zip / DOCS.ZIP / IPD210.DOC < prev    next >
Text File  |  1992-12-13  |  13KB  |  595 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.                Version 8.8 of the Icon Programming
  11.                             Language
  12.  
  13.                   Ralph E. Griswold, Clinton L.
  14.                  Jeffery, Gregg M. Townsend, and
  15.                          Kenneth Walker
  16.  
  17.                Department of Computer Science, The
  18.                       University of Arizona
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25. 1.__Introduction
  26.  
  27.    The current version of Icon is Version 8.8.  The second edi-
  28. tion of the Icon book [1] describes Version 8.0.  This report is
  29. a supplement to that book.
  30.  
  31.    Most of the language extensions in Version 8.8 are upward-
  32. compatible with previous versions of Icon and most programs writ-
  33. ten for earlier versions work properly under Version 8.8.  The
  34. language additions to Version 8.8 are:
  35.  
  36.      +  an optional interface to the X Window system (for plat-
  37.         forms that have X)
  38.  
  39.      +  new functions and keywords
  40.  
  41.      +  several minor changes
  42.  
  43.    There also are changes to the implementation in Version 8.8,
  44. including support for multiple storage regions, that provide more
  45. capabilities for some users.  See Section 3.
  46.  
  47.  
  48. 2.__Language_Features
  49.  
  50. X_Graphic_Facilities
  51.  
  52.    Version 8.8 provides support for X Window System facilities
  53. through a combination of high-level support and a repertoire of
  54. functions. The name X-Icon is used to distinguish versions of
  55. Icon that support these X facilities.  Note: There are several
  56. changes to X-Icon in Version 8.8.  Persons who used an earlier
  57. version of X-Icon should consult the curent reference manual [2].
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64. IPD210                        - 1 -             December 13, 1992
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73. New_Functions_and_Keywords
  74.  
  75.    The new functions and keywords are described briefly here.  At
  76. the end of this report there also is a sheet with more complete
  77. descriptions in the style of the second edition of the Icon book.
  78. This sheet can be trimmed and used as an insert to the book.
  79.  
  80.    There are five new functions:
  81.  
  82.      chdir(s)    Changes the current directory to s but fails if
  83.                  there is no such directory or if the change can-
  84.                  not be made.
  85.  
  86.      delay(i)    Delays execution i milliseconds. This function
  87.                  is not supported on all platforms.
  88.  
  89.      flush(f)    Flushes the input/output buffers for file f.
  90.  
  91.      function()  Generates the names of the Icon (built-in) func-
  92.                  tions.
  93.  
  94.      sortf(X,i)  Produces a sorted list of the elements of X. The
  95.                  results are similar to those of sort(X,i),
  96.                  except that among lists and among records,
  97.                  structure values are ordered by comparing their
  98.                  ith fields.
  99.  
  100.    There are five new keywords:
  101.  
  102.      &allocated  Generates the number of bytes allocated since
  103.                  the beginning of program execution. The first
  104.                  result is the total number of bytes in all
  105.                  regions, followed by the number of bytes in the
  106.                  static, string, and block regions.
  107.  
  108.      &e          The base of the natural logarithms, 2.71828 ...
  109.  
  110.      &phi        The golden ratio, 1.61803 ...
  111.  
  112.      &pi         The ratio of the circumference of a circle to
  113.                  its diameter, 3.14159 ...
  114.  
  115.      &progname   The file name of the executing program. &prog-
  116.                  name is a variable and a string value can be
  117.                  assigned to it to replace its initial value.
  118.  
  119. The X interface adds additional new keywords [2].
  120.  
  121.    Some UNIX platforms now support the keyboard functions
  122. getch(), getche(), and kbhit(). Whether or not these functions
  123. are supported can be determined from the values generated by
  124. &features.  Note: On UNIX platforms, ``keyboard'' input comes
  125. from standard input, which may not necessarily be the keyboard.
  126. Warning: The keyboard functions under UNIX may not work reliably
  127.  
  128.  
  129.  
  130. IPD210                        - 2 -             December 13, 1992
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139. in all situations and may leave the console in a strange mode if
  140. interrupted at an unfortunate time. These potential problems
  141. should be kept in mind when using these functions.
  142.  
  143. Other_Enhancements
  144.  
  145.    A record can now be subscripted by the string name of one of
  146. its fields, as in
  147.  
  148.         z["r"]
  149.  
  150. which is equivalent to
  151.  
  152.         z.r
  153.  
  154. If the named field does not exist for the record, the subscript-
  155. ing expression fails.
  156.  
  157.    Multiple subscripts are now allowed in subscripting expres-
  158. sions. For example,
  159.  
  160.         L[i, j, k]
  161.  
  162. is equivalent to
  163.  
  164.         L[i][j][k]
  165.  
  166.  
  167. Minor_Changes
  168.  
  169.      +  The invocable declaration is accepted but ignored by the
  170.         interpreter to provide source-language compatibility with
  171.         the Icon compiler.  See [3] for a description of this
  172.         declaration.
  173.  
  174.      +  Real literals that are less than 1 no longer need a lead-
  175.         ing zero. For example, .5 now is a valid real literal
  176.         instead of being the dereferencing operator applied to
  177.         the integer 5.
  178.  
  179.      +  The identifiers listed by display() are now given in
  180.         sorted order.
  181.  
  182.      +  In sorting structures, records now are first sorted by
  183.         record name and then by age (serial number).
  184.  
  185.      +  The keyword &features now includes either interpreted or
  186.         compiled to indicate whether the program is interpreted
  187.         or compiled.
  188.  
  189.      +  If X-Window facilities are supported, &features also
  190.         includes X Windows.
  191.  
  192.  
  193.  
  194.  
  195.  
  196. IPD210                        - 3 -             December 13, 1992
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.      +  If multiple storage regions are supported, &features also
  206.         includes Multiple Regions.
  207.  
  208.      +  Error message 101 now reads integer expected or out of
  209.         range to reflect the fact that not all operations support
  210.         large integers.
  211.  
  212.      +  Error 120 now reads two csets or two sets expected to
  213.         more accurately reflect the fact that set operations
  214.         require arguments of the same type.
  215.  
  216.      +  Error 125, list or set expected, has been added for
  217.         sortf().
  218.  
  219.      +  Errors 140, window expected, and 141, program terminated
  220.         by window manager, have been added when X-Window facili-
  221.         ties are supported.
  222.  
  223.      +  Errors 316, interpreter stack too large, and 318, co-
  224.         expression stack too large, have been added for 16-bit
  225.         platforms.
  226.  
  227.  
  228. 3.__Implementation_Changes
  229.  
  230.    The implementation of Version 8.8 is different in many
  231. respects from the implementation of Version 8.0.  The most signi-
  232. ficant differences are:
  233.  
  234.      +  Icon now uses fixed-sized storage regions.  Multiple
  235.         regions are allocated if needed.
  236.  
  237.      +  Memory monitoring is no longer supported.
  238.  
  239.      +  Under MS-DOS, iconx now finds icode files at any place on
  240.         the PATH specification as well as in the current direc-
  241.         tory.
  242.  
  243.    In addition, the tables used by icont now expand automati-
  244. cally.  The -S option is no longer needed. As a side effect of
  245. this change, the sizes of procedures are no longer listed during
  246. translation.
  247.  
  248.  
  249. 4.__Limitations,_Bugs,_and_Problems
  250.  
  251.  
  252.      +   Line numbers sometimes are wrong in diagnostic messages
  253.          related to lines with continued quoted literals.
  254.  
  255.      +   Large-integer arithmetic is not supported in i to j and
  256.          seq().  Large integers cannot be assigned to keywords.
  257.  
  258.  
  259.  
  260.  
  261.  
  262. IPD210                        - 4 -             December 13, 1992
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.      +   Large-integer literals are constructed at run-time. Con-
  272.          sequently, they should not be used in loops where they
  273.          would be constructed repeatedly.
  274.  
  275.      +   Conversion of a large integer to a string is quadratic
  276.          in the length of the integer. Conversion of very a large
  277.          integer to a string may take a very long time and give
  278.          the appearance of an endless loop.
  279.  
  280.      +   Right shifting of large negative integers by ishift() is
  281.          inconsistent with the shifting of ordinary integers.
  282.  
  283.      +   Integer overflow on exponentiation may not be detected
  284.          during execution.  Such overflow may occur during type
  285.          conversion.
  286.  
  287.      +   In some cases, trace messages may show the return of
  288.          subscripted values, such as &null[2], that would be
  289.          erroneous if they were dereferenced.
  290.  
  291.      +   If a long file name for an Icon source-language program
  292.          is truncated by the operating system, mysterious diag-
  293.          nostic messages may occur during linking.
  294.  
  295.      +   Stack overflow checking uses a heuristic that is not
  296.          always effective.
  297.  
  298.      +   If an expression such as
  299.  
  300.                  x := create expr
  301.  
  302.          is used in a loop, and x is not a global variable,
  303.          unreferenceable co-expressions are generated by each
  304.          successive create operation.  These co-expressions are
  305.          not garbage collected.  This problem can be circumvented
  306.          by making x a global variable or by assigning a value to
  307.          x before the create operation, as in
  308.  
  309.                  x := &null
  310.                  x := create expr
  311.  
  312.  
  313.      +   Stack overflow in a co-expression may not be detected
  314.          and may cause mysterious program malfunction.
  315.  
  316. Acknowledgements
  317.  
  318.    The design and implementation of Version 8.8 of Icon was sup-
  319. ported, in part, by National Science Foundation Grants CCR-
  320. 8713690 and CCR-8901573.
  321.  
  322.    Sandra Miller and Richard Goerwitz contributed to the imple-
  323. mentation of Version 8.8 of Icon.
  324.  
  325.  
  326.  
  327.  
  328. IPD210                        - 5 -             December 13, 1992
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337. References
  338.  
  339.  
  340. 1.   R. E. Griswold and M. T. Griswold, The Icon Programming
  341.      Language, Prentice-Hall, Inc., Englewood Cliffs, NJ, second
  342.      edition, 1990.
  343.  
  344. 2.   C. L. Jeffery, X-Icon: An Icon Windows Interface, The Univ.
  345.      of Arizona Tech. Rep. 91-1, 1991.
  346.  
  347. 3.   K. Walker and R. E. Griswold, Using Version 8.7 of the Icon
  348.      Compiler, The Univ. of Arizona Icon Project Document IPD191,
  349.      1992.
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394. IPD210                        - 6 -             December 13, 1992
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403. __________________________________________________
  404.  
  405. chdir(s) : n                      change directory
  406.  
  407. chdir(s) changes the directory to s but fails if
  408. there is no such directory or if the change cannot
  409. be made. Whether the change in the directory
  410. persists after program termination depends on the
  411. operating system on which the program runs.
  412.  
  413. Error:  103 s not string
  414.  
  415. __________________________________________________
  416.  
  417. delay(i) : n                       delay execution
  418.  
  419. delay(i) delays execution i milliseconds. This
  420. function presently is supported only on UNIX
  421. platforms.
  422.  
  423. Error:  101 i not integer
  424.  
  425. __________________________________________________
  426.  
  427. flush(f) : n                          flush buffer
  428.  
  429. flush(f) flushes the input/output buffers for f.
  430.  
  431. Error:  105 f not file
  432.  
  433. __________________________________________________
  434.  
  435. function() : s1, s2,...,sn generate function names
  436.  
  437. function() generates the names of the Icon
  438. (built-in) functions.
  439.  
  440. __________________________________________________
  441.  
  442. sortf(X,i) : L           sort list or set by field
  443.  
  444. sortf(X,i) produces a sorted list of the values in
  445. X.  Sorting is primarily by type and in most
  446. respects is the same as with sort(X,i). However,
  447. among lists and among records, two structures are
  448. ordered by comparing their ith fields. i can be
  449. negative but not zero. Two structures having equal
  450. ith fields are ordered as they would be in regular
  451. sorting, but structures lacking an ith field
  452. appear before structures having them.
  453.  
  454. Default:i      1
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.        Errors: 101 i not integer
  473.                115 X not list or set
  474.                205 i =  0
  475.                307 inadequate space in block region
  476.  
  477.  
  478.  
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538.        __________________________________________________
  539.  
  540.        &allocated : i1, i2, i3, i4  cumulative allocation
  541.  
  542.        &allocated generates the total amount of space, in
  543.        bytes, allocated since the beginning of program
  544.        execution.  The first value is the total for all
  545.        regions, followed by the totals for the static,
  546.        string, and block regions, respectively.  The
  547.        space allocated in the static region is always
  548.        given as zero.  Note: &allocated gives the
  549.        cumulative allocation; &storage gives the current
  550.        allocation; that is, the amount that has not been
  551.        freed by garbage collection.
  552.  
  553.        __________________________________________________
  554.  
  555.        &e : r                  base of natural logarithms
  556.  
  557.        The value of &e is the base of the natural
  558.        logarithms, 2.71828 ... .
  559.  
  560.        __________________________________________________
  561.  
  562.        &phi : r                              golden ratio
  563.  
  564.        The value of &phi is the golden ratio, 1.61803 ...
  565.        .
  566.  
  567.        __________________________________________________
  568.  
  569.        &pi : ratio of circumference to diameter of a circle
  570.  
  571.        The value of &pi is the ratio of the circumference
  572.        of a circle to its diameter, 3.14159 ... .
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.