home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / OE.LZH / DOCS.LZH / IPD188.DOC next >
Text File  |  1992-07-06  |  13KB  |  529 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.                Version 8.7 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.7.  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.7 are upward-
  32. compatible with previous versions of Icon and most programs writ-
  33. ten for earlier versions work properly under Version 8.7.  The
  34. language additions to Version 8.7 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.7,
  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.7 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. IPD188b                       - 1 -                  July 4, 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.    Some UNIX platforms now support the keyboard functions
  113. getch(), getche(), and kbhit(). Whether or not these functions
  114. are supported can be determined from the values generated by
  115. &features.  Note: On UNIX platforms, ``keyboard'' input comes
  116. from standard input, which may not necessarily be the keyboard.
  117. Warning: The keyboard functions under UNIX may not work reliably
  118. in all situations and may leave the console in a strange mode if
  119. interrupted at an unfortunate time. These potential problems
  120. should be kept in mind when using these functions.
  121.  
  122. Minor_Changes
  123.  
  124.      +  The invocable declaration is accepted but ignored by the
  125.         interpreter to provide source-language compatibility with
  126.         the Icon compiler.  See [3] for a description of this
  127.  
  128.  
  129.  
  130. IPD188b                       - 2 -                  July 4, 1992
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.         declaration.
  140.  
  141.      +  Real literals that are less than 1 no longer need a lead-
  142.         ing zero. For example, .5 now is a valid real literal
  143.         instead of being the dereferencing operator applied to
  144.         the integer 5.
  145.  
  146.      +  The identifiers listed by display() are now given in
  147.         sorted order.
  148.  
  149.      +  In sorting structures, records now are first sorted by
  150.         record name and then by age (serial number).
  151.  
  152.      +  The keyword &features now includes either interpreted or
  153.         compiled to indicate whether the program is interpreted
  154.         or compiled.
  155.  
  156.      +  If X-Window facilities are supported, &features also
  157.         includes X Windows.
  158.  
  159.      +  If multiple storage regions are supported, &features also
  160.         includes Multiple Regions.
  161.  
  162.      +  Error message 101 now reads integer expected or out of
  163.         range to reflect the fact that not all operations support
  164.         large integers.
  165.  
  166.      +  Error 120 now reads two csets or two sets expected to
  167.         more accurately reflect the fact that set operations
  168.         require arguments of the same type.
  169.  
  170.      +  Error 125, list or set expected, has been added for
  171.         sortf().
  172.  
  173.      +  Errors 140, window expected, and 141, program terminated
  174.         by window manager, have been added when X-Window facili-
  175.         ties are supported.
  176.  
  177.      +  Errors 316, interpreter stack too large, and 318, co-
  178.         expression stack too large, have been added for 16-bit
  179.         platforms.
  180.  
  181.  
  182. 3.__Implementation_Changes
  183.  
  184.    The implementation of Version 8.7 is different in many
  185. respects from the implementation of Version 8.0 [4]. Most of the
  186. differences are transparent to the user. The following changes
  187. provide additional facilities:
  188.  
  189.      +  On platforms that use fixed-sized storage regions (not-
  190.         ably MS-DOS), Icon now allocates additional regions if
  191.         more space is needed. Consequently, some programs that
  192.         formerly ran out of memory on such platforms no longer do
  193.  
  194.  
  195.  
  196. IPD188b                       - 3 -                  July 4, 1992
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.         so.
  206.  
  207.         Memory monitoring is not designed for multiple regions
  208.         and if an additional region is allocated, memory monitor-
  209.         ing is disabled.
  210.  
  211.      +  Under MS-DOS, iconx now finds icode files at any place on
  212.         the PATH specification as well as in the current direc-
  213.         tory.
  214.  
  215.    In addition, the tables used by icont now expand automati-
  216. cally.  The -S option is no longer needed. As a side effect of
  217. this change, the sizes of procedures are no longer listed during
  218. translation.
  219.  
  220.  
  221. 4.__Limitations,_Bugs,_and_Problems
  222.  
  223.  
  224.      +   Line numbers sometimes are wrong in diagnostic messages
  225.          related to lines with continued quoted literals.
  226.  
  227.      +   Large-integer arithmetic is not supported in i to j and
  228.          seq().  Large integers cannot be assigned to keywords.
  229.  
  230.      +   Large-integer literals are constructed at run-time. Con-
  231.          sequently, they should not be used in loops where they
  232.          would be constructed repeatedly.
  233.  
  234.      +   Conversion of a large integer to a string is quadratic
  235.          in the length of the integer. Conversion of very a large
  236.          integer to a string may take a very long time and give
  237.          the appearance of an endless loop.
  238.  
  239.      +   Right shifting of large negative integers by ishift() is
  240.          inconsistent with the shifting of ordinary integers.
  241.  
  242.      +   Integer overflow on exponentiation may not be detected
  243.          during execution.  Such overflow may occur during type
  244.          conversion.
  245.  
  246.      +   In some cases, trace messages may show the return of
  247.          subscripted values, such as &null[2], that would be
  248.          erroneous if they were dereferenced.
  249.  
  250.      +   If a long file name for an Icon source-language program
  251.          is truncated by the operating system, mysterious diag-
  252.          nostic messages may occur during linking.
  253.  
  254.      +   Stack overflow checking uses a heuristic that is not
  255.          always effective.
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262. IPD188b                       - 4 -                  July 4, 1992
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.      +   If an expression such as
  272.  
  273.                  x := create expr
  274.  
  275.          is used in a loop, and x is not a global variable,
  276.          unreferenceable co-expressions are generated by each
  277.          successive create operation.  These co-expressions are
  278.          not garbage collected.  This problem can be circumvented
  279.          by making x a global variable or by assigning a value to
  280.          x before the create operation, as in
  281.  
  282.                  x := &null
  283.                  x := create expr
  284.  
  285.  
  286.      +   Stack overflow in a co-expression may not be detected
  287.          and may cause mysterious program malfunction.
  288.  
  289. Acknowledgements
  290.  
  291.    The design and implementation of Version 8.7 of Icon was sup-
  292. ported, in part, by National Science Foundation Grants CCR-
  293. 8713690 and CCR-8901573.
  294.  
  295.    Sandra Miller and Richard Goerwitz contributed to the imple-
  296. mentation of Version 8.7 of Icon.
  297.  
  298. References
  299.  
  300.  
  301. 1.   R. E. Griswold and M. T. Griswold, The Icon Programming
  302.      Language, Prentice-Hall, Inc., Englewood Cliffs, NJ, second
  303.      edition, 1990.
  304.  
  305. 2.   C. L. Jeffery, X-Icon: An Icon Windows Interface, The Univ.
  306.      of Arizona Tech. Rep. 91-1, 1992.
  307.  
  308. 3.   K. Walker and R. E. Griswold, Using Version 8.7 of the Icon
  309.      Compiler, The Univ. of Arizona Icon Project Document IPD191,
  310.      1992.
  311.  
  312. 4.   R. E. Griswold, Supplementary Information for the
  313.      Implementation  of Version 8.5 of Icon, The Univ. of Arizona
  314.      Icon Project Document IPD180, 1992.
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328. IPD188b                       - 5 -                  July 4, 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.