home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / icon / dos / bin386 / ipd174.doc < prev    next >
Text File  |  1992-01-31  |  13KB  |  529 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.                Version 8.5 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.5.  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.5 are upward-
  32. compatible with previous versions of Icon and most programs writ-
  33. ten for earlier versions work properly under Version 8.5.  The
  34. language additions to Version 8.5 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.5,
  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-Window_Facilities
  51.  
  52.    Version 8.5 provides support for X Windows through a large
  53. repertoire of functions. These facilities are optional and are
  54. not available on all platforms. See [2] for more information.
  55.  
  56. New_Functions_and_Keywords
  57.  
  58.    The new functions and keywords are described briefly here.  At
  59. the end of this report there also is a sheet with more complete
  60. descriptions in the style of the second edition of the Icon book.
  61.  
  62.  
  63.  
  64. IPD174                        - 1 -              January 31, 1992
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73. This sheet can be trimmed and used as an insert to the book.
  74.  
  75.    There are five new functions:
  76.  
  77.      chdir(s)    Changes the current directory to s but fails if
  78.                  there is no such directory or if the change can-
  79.                  not be made.
  80.  
  81.      delay(i)    Delays execution i milliseconds. This function
  82.                  presently is only supported on UNIX platforms.
  83.  
  84.      flush(f)    Flushes the input/output buffers for file f.
  85.  
  86.      function()  Generates the names of the Icon (built-in) func-
  87.                  tions.
  88.  
  89.      sortf(X,i)  Produces a sorted list of the elements of X. The
  90.                  results are similar to those of sort(X,i),
  91.                  except that among lists and among records,
  92.                  structure values are ordered by comparing their
  93.                  ith fields.
  94.  
  95.    There are four new keywords:
  96.  
  97.      &allocated  Generates the number of bytes allocated since
  98.                  the beginning of program execution. The first
  99.                  result is the total number of bytes in all
  100.                  regions, followed by the number of bytes in the
  101.                  static, string, and block regions.
  102.  
  103.      &e          The base of the natural logarithms, 2.71828 ...
  104.  
  105.      &phi        The golden ratio, 1.61803 ...
  106.  
  107.      &pi         The ratio of the circumference of a circle to
  108.                  its diameter, 3.14159 ...
  109.  
  110. The X interface adds additional new keywords [2].
  111.  
  112. Minor_Changes
  113.  
  114.      +  The invocable declaration is accepted but ignored by the
  115.         interpreter to provide source-language compatibility with
  116.         the Icon compiler.  See [3] for a description of this
  117.         declaration.
  118.  
  119.      +  Real literals that are less than 1 no longer need a lead-
  120.         ing zero. For example, .5 now is a valid real literal
  121.         instead of being the dereferencing operator applied to
  122.         the integer 5.
  123.  
  124.      +  The identifiers listed by display() are now given in
  125.         sorted order.
  126.  
  127.  
  128.  
  129.  
  130. IPD174                        - 2 -              January 31, 1992
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.      +  In sorting structures, records now are first sorted by
  140.         record name and then by age (serial number).
  141.  
  142.      +  The keyword &features now includes either interpreted or
  143.         compiled to indicate whether the program is interpreted
  144.         or compiled.
  145.  
  146.      +  If X-Window facilities are supported, &features also
  147.         includes X Windows.
  148.  
  149.      +  If multiple storage regions are supported, &features also
  150.         includes Multiple Regions.
  151.  
  152.      +  Error message 101 now reads integer expected or out of
  153.         range to reflect the fact that not all operations support
  154.         large integers.
  155.  
  156.      +  Error 120 now reads two csets or two sets expected to
  157.         more accurately reflect the fact that set operations
  158.         require arguments of the same type.
  159.  
  160.      +  Error 125, list or set expected, has been added for
  161.         sortf().
  162.  
  163.      +  Errors 140, window expected, and 141, program terminated
  164.         by window manager, have been added when X-Window facili-
  165.         ties are supported.
  166.  
  167.      +  Errors 316, interpreter stack too large, and 318, co-
  168.         expression stack too large, have been added for 16-bit
  169.         platforms.
  170.  
  171.  
  172. 3.__Implementation_Changes
  173.  
  174.    The implementation of Version 8.5 is different in many
  175. respects from the implementation of Version 8.0 [4]. Most of the
  176. differences are transparent to the user. The following changes
  177. provide additional facilities:
  178.  
  179.      +  On platforms that use fixed-sized storage regions (not-
  180.         ably MS-DOS), Icon now allocates additional regions if
  181.         more space is needed. Consequently, some programs that
  182.         formerly ran out of memory on such platforms no longer do
  183.         so.
  184.  
  185.         Memory monitoring is not designed for multiple regions
  186.         and if an additional region is allocated, memory monitor-
  187.         ing is disabled.
  188.  
  189.      +  Under MS-DOS, iconx now finds icode files at any place on
  190.         the PATH specification as well as in the current direc-
  191.         tory.
  192.  
  193.  
  194.  
  195.  
  196. IPD174                        - 3 -              January 31, 1992
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.      4.__Limitations,_Bugs,_and_Problems
  206.  
  207.  
  208.           +   Line numbers sometimes are wrong in diagnostic mes-
  209.               sages related to lines with continued quoted
  210.               literals.
  211.  
  212.           +   Large-integer arithmetic is not supported in i to j
  213.               and seq().  Large integers cannot be assigned to
  214.               keywords.
  215.  
  216.           +   Large-integer literals are constructed at run-time.
  217.               Consequently, they should not be used in loops
  218.               where they would be constructed repeatedly.
  219.  
  220.           +   Conversion of a large integer to a string is qua-
  221.               dratic in the length of the integer. Conversion of
  222.               very a large integer to a string may take a very
  223.               long time and give the appearance of an endless
  224.               loop.
  225.  
  226.           +   Right shifting of large negative integers by
  227.               ishift() is inconsistent with the shifting of ordi-
  228.               nary integers.
  229.  
  230.           +   Integer overflow on exponentiation may not be
  231.               detected during execution.  Such overflow may occur
  232.               during type conversion.
  233.  
  234.           +   In some cases, trace messages may show the return
  235.               of subscripted values, such as &null[2], that would
  236.               be erroneous if they were dereferenced.
  237.  
  238.           +   If a long file name for an Icon source-language
  239.               program is truncated by the operating system, mys-
  240.               terious diagnostic messages may occur during link-
  241.               ing.
  242.  
  243.           +   Stack overflow checking uses a heuristic that is
  244.               not always effective.
  245.  
  246.           +   If an expression such as
  247.  
  248.                       x := create expr
  249.  
  250.               is used in a loop, and x is not a global variable,
  251.               unreferenceable co-expressions are generated by
  252.               each successive create operation.  These co-
  253.               expressions are not garbage collected.  This prob-
  254.               lem can be circumvented by making x a global vari-
  255.               able or by assigning a value to x before the create
  256.               operation, as in
  257.  
  258.  
  259.  
  260.  
  261.  
  262. IPD174                        - 4 -              January 31, 1992
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.                       x := &null
  272.                       x := create expr
  273.  
  274.  
  275.           +   Stack overflow in a co-expression may not be
  276.               detected and may cause mysterious program malfunc-
  277.               tion.
  278.  
  279.      Acknowledgements
  280.  
  281.         The design and implementation of Version 8.5 of Icon was
  282.      supported, in part, by the National Science Foundation
  283.      Grants CCR-8713690 and CCR-8901573.
  284.  
  285.         Sandra Miller contributed to the implementation of Ver-
  286.      sion 8.5 of Icon.
  287.  
  288.      References
  289.  
  290.  
  291.      1.   R. E. Griswold and M. T. Griswold, The Icon Programming
  292.           Language, Prentice-Hall, Inc., Englewood Cliffs, NJ,
  293.           second edition, 1990.
  294.  
  295.      2.   C. L. Jeffery, X-Icon: An Icon Windows Interface, The
  296.           Univ. of Arizona Tech. Rep. 91-1, 1991.
  297.  
  298.      3.   K. Walker, Using the Icon Compiler, The Univ. of
  299.           Arizona Icon Project Document IPD157, 1991.
  300.  
  301.      4.   R. E. Griswold, Supplementary Information for the
  302.           Implementation  of Version 8.5 of Icon, The Univ. of
  303.           Arizona Icon Project Document IPD180, 1992.
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328. IPD174                        - 5 -              January 31, 1992
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337. __________________________________________________
  338.  
  339. chdir(s) : n                      change directory
  340.  
  341. chdir(s) changes the directory to s but fails if
  342. there is no such directory or if the change cannot
  343. be made. Whether the change in the directory
  344. persists after program termination depends on the
  345. operating system on which the program runs.
  346.  
  347. Error:  103 s not string
  348.  
  349. __________________________________________________
  350.  
  351. delay(i) : n                       delay execution
  352.  
  353. delay(i) delays execution i milliseconds. This
  354. function presently is supported only on UNIX
  355. platforms.
  356.  
  357. Error:  101 i not integer
  358.  
  359. __________________________________________________
  360.  
  361. flush(f) : n                          flush buffer
  362.  
  363. flush(f) flushes the input/output buffers for f.
  364.  
  365. Error:  105 f not file
  366.  
  367. __________________________________________________
  368.  
  369. function() : s1, s2,...,sn generate function names
  370.  
  371. function() generates the names of the Icon
  372. (built-in) functions.
  373.  
  374. __________________________________________________
  375.  
  376. sortf(X,i) : L           sort list or set by field
  377.  
  378. sortf(X,i) produces a sorted list of the values in
  379. X.  Sorting is primarily by type and in most
  380. respects is the same as with sort(X,i). However,
  381. among lists and among records, two structures are
  382. ordered by comparing their ith fields. i can be
  383. negative but not zero. Two structures having equal
  384. ith fields are ordered as they would be in regular
  385. sorting, but structures lacking an ith field
  386. appear before structures having them.
  387.  
  388. Default:i      1
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.        Errors: 101 i not integer
  407.                115 X not list or set
  408.                205 i =  0
  409.                307 inadequate space in block region
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.        __________________________________________________
  473.  
  474.        &allocated : i1, i2, i3, i4  cumulative allocation
  475.  
  476.        &allocated generates the total amount of space, in
  477.        bytes, allocated since the beginning of program
  478.        execution.  The first value is the total for all
  479.        regions, followed by the totals for the static,
  480.        string, and block regions, respectively.  The
  481.        space allocated in the static region is always
  482.        given as zero.  Note: &allocated gives the
  483.        cumulative allocation; &storage gives the current
  484.        allocation; that is, the amount that has not been
  485.        freed by garbage collection.
  486.  
  487.        __________________________________________________
  488.  
  489.        &e : r                  base of natural logarithms
  490.  
  491.        The value of &e is the base of the natural
  492.        logarithms, 2.71828 ... .
  493.  
  494.        __________________________________________________
  495.  
  496.        &phi : r                              golden ratio
  497.  
  498.        The value of &phi is the golden ratio, 1.61803 ...
  499.        .
  500.  
  501.        __________________________________________________
  502.  
  503.        &pi : ratio of circumference to diameter of a circle
  504.  
  505.        The value of &pi is the ratio of the circumference
  506.        of a circle to its diameter, 3.14159 ... .
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.