home *** CD-ROM | disk | FTP | other *** search
/ Really Useful CD 1 / ReallyUsefulCD1.iso / extras / utilities / icon / readmearc < prev    next >
Encoding:
Text File  |  1990-08-07  |  10.5 KB  |  283 lines

  1.                    Icon version 8 for the Archimedes
  2.                    ---------------------------------
  3.  
  4. There is very little here to say regarding this implementation of Icon
  5. for the Archimedes. It conforms fully to the standard Icon version 8
  6. documentation, ie. "The Icon Programming Language (2nd edition)" by R.E.
  7. and M.T. Griswold.
  8.  
  9. This version of Icon supports
  10.  
  11.     * Large Integers
  12.     * Co-expressions
  13.     * Keyboard functions (getch, getche, kbhit)
  14.     * The system() function
  15.  
  16. (which are the most often omitted features). Note that the
  17. implementation of co-expressions is slightly "untidy" at present, in
  18. that whenever a co-expression is created, a stack is allocated (16K).
  19. This stack is NEVER FREED (due to problems interfacing the Icon model
  20. of C stack handling and the Arm procedure call standard). I hope to fix
  21. this, in the long term, but for now be aware that programs using lots
  22. of co-expressions will probably grow short of memory.
  23.  
  24. For the Archimedes, &features includes "Acorn Archimedes".
  25.  
  26.  
  27. Environment variables
  28. ---------------------
  29.  
  30. Icon uses a number of environment variables to set run-time values such
  31. as stack sizes or whether tracing is switched on. These are usually
  32. given names such as
  33.  
  34.     MSTKSIZE        Main stack size
  35.     TRACE            Tracing on?
  36.  
  37. Following the usual Archimedes conventions, these variables have all
  38. been renamed, by prefixing the name with "Icon$". So, the above
  39. variables are called
  40.  
  41.     Icon$MStkSize        Main stack size
  42.     Icon$Trace        Tracing on?
  43.  
  44. and similarly for all "start-up" environment variables.
  45.  
  46.  
  47. File names
  48. ----------
  49.  
  50. As usual, the convention of using file name "extensions" causes
  51. difficulties. Icon uses four file extensions, namely
  52.  
  53.     .icn            Icon source code
  54.     .u1            Intermediate code (procedures)
  55.     .u2            Intermediate code (globals)
  56.     .ux            Linker diagnostics (-L flag)
  57.  
  58. Under RISC OS, the usual transformation is performed, ie. rather than
  59. looking for "file.icn", Icont looks for "Icn.file" - ie, file "file" in
  60. directory "Icn".
  61.  
  62. Similarly to Acorn C, Icont expects the U1 and U2 directories to be set
  63. up in advance (and the Ux directory if -L is used). Also, note that an
  64. "extension" of .icn can be omitted from the file name in Icont, so that
  65. to compile and link "Icn.Hello", all you need is
  66.  
  67.     Icont hello
  68.  
  69. The convention of using an "extension of .u to mean .u1 and .u2 is
  70. retained. So, to link U1.hello, U2.hello, U1.options and U2.options,
  71. giving an output file called HelloW, all that is needed is
  72.  
  73.     Icont -o HelloW U.hello U.options
  74.  
  75. Note that, UNLIKE Acorn C, filenames cannot be written in the
  76. "extension" form, so that
  77.  
  78.     Icont -o HelloW hello.u options.u
  79.  
  80. is WRONG.
  81.  
  82. Also, note that if compiling stdin (via Icont -, or simply Icont with no
  83. parameters) the output files are U1.Stdin, U2.Stdin and Stdin (the
  84. I-code executable).
  85.  
  86.  
  87. Standard search path
  88. --------------------
  89.  
  90. When looking for files named in "link" statements, Icon looks in places
  91. specified in the IPATH environment variable (called Icon$Ipath on the
  92. Archimedes). The default for this variable, when not set, is
  93.  
  94.     "Icon: Lib:Icon."
  95.  
  96. Icon therefore first looks along the RISC OS path specified by the OS
  97. variable Icon$Path, and if the file is not found, it then looks for a
  98. directory "Icon" on Lib$Path.
  99.  
  100. To alter the search path, two methods can be used. First, the value of
  101. Icon$Ipath can be altered. In this case, the Icon form of path,
  102. consisting of a space-separated list of directory prefixes, is used. An
  103. alternative method is to leave the default IPATH, but set up a suitable
  104. Icon$Path variable.
  105.  
  106. The second method is recommended, as it conforms better to the standard
  107. conventions under RISC OS. (A third possibility, to install a directory
  108. Icon somewhere on Lib$Path, is possible. This is a good idea for people
  109. like me, who keep all their language run-time stuff somewhere on
  110. Lib$Path).
  111.  
  112.  
  113. File types
  114. ----------
  115.  
  116. Icont will timestamp the executable I-code file, giving it file type
  117. "Icon" if such a file type exists. Ie, if <File$Type_xxx> is "Icon", for
  118. any xxx, then the I-code file is given file type xxx. This allows users
  119. to set up in their !Boot file
  120.  
  121.     Set File$Type_xxx    Icon
  122.     Set Alias$@RunType_xxx    Iconx %0 %*1
  123.  
  124. to make icon I-code files directly executable. (The %*1 allows for
  125. parameters being passed to the Icon program).
  126.  
  127.  
  128. Pipes
  129. -----
  130.  
  131. Archimedes Icon DOES support the opening of files as pipes (the "p"
  132. mode). This is done using temporary files. The input or output of the
  133. command is stored in a temporary file in one of the following places
  134. (tried in this order)
  135.  
  136.     <Tmp$Dir>    if this OS variable is set, and the directory exists
  137.     &.Tmp        if the directory exists
  138.     @        ie, the current directory
  139.  
  140. The temporary filenames will not clash with existing files (hopefully!),
  141. and the temporary files will be deleted when they are finished with.
  142.  
  143. The IO redirection is done using the C convention ("command <in >out")
  144. for all but built-in commands (there is a hard-coded list of these). The
  145. built-in commands use OS redirection ("command { < in > out }") and the
  146. output file is post-processed to convert line separators "\r\n" into
  147. just "\n", which is what Icon expects.
  148.  
  149. If you want to run a program which is NOT a built-in, but which does not
  150. support the C convention (eg, pascal or fortran programs), simply add a
  151. '%' to the front of the command (ie "%command arg arg..."). OS
  152. redirection will then be used, and the '%' removed. If you want to run a
  153. command starting with a '%', and STILL use C redirection, "*%command"
  154. should work (OS_CLI ignores leading asterisks).
  155.  
  156. Also, if you have the PD program "m4", which preprocesses files (giving
  157. C-like #define and #include facilities, plus much more, but with a
  158. different syntax), then you can use the "-m" flag to Icont, to
  159. preprocess your Icon code using m4.
  160.  
  161.  
  162. System Dependent Functions
  163. --------------------------
  164.  
  165. Archimedes Icon includes a number of low-level RISC OS interface
  166. functions, in a similar manner to MS-DOS ports of Icon. The relevant
  167. functions are
  168.  
  169. 1. Swi(swi,r)
  170.  
  171.    Swi(swi,r) is a general interface to the OS SWI functions. The inputs
  172.    are a SWI number (or name), and a list of registers [r0, ..., r9].
  173.    The "swi" parameter is treated as a SWI number if it is an integer,
  174.    and a SWI name if it is a string. An invalid name results in run-time
  175.    error 205 (value out of range), and any type other than integer or
  176.    string results in run-time error 123 (invalid type).
  177.  
  178.    The register list, r, can contain between 0 and 10 values (an omitted
  179.    parameter is treated as []), each being assigned to a register
  180.    (r0, ..., r9). If a value is an integer, it is assigned direct. If it
  181.    is a string, its address is assigned (strings are null-terminated).
  182.    Any other type gives run-time error 123 (invalid type).
  183.  
  184.    If the SWI call fails (ie, an OS error occurs), Swi(swi,r) fails (in
  185.    the Icon sense). Otherwise, the return value is a 10-element list,
  186.    holding the integer values of r0, ..., r9. To get at strings which
  187.    are returned as pointers, see Peek() below.
  188.  
  189.    Note that Swi() can be a great way of corrupting Icon's internal data
  190.    structures, if used carelessly. In particular, passing the address of
  191.    an Icon string to a SWI which expects to be able to overwrite the
  192.    string can be fatal. For the brave, note that the Icon string can be
  193.    assumed to be as many bytes long as its length (*str). The length on
  194.    return will be unchanged - Icon strings CAN contain nulls, so if the
  195.    OS inserts a null-terminated string into an Icon string, you must
  196.    arrange to extract the appropriate substring manually (eg, using
  197.    tab(upto('\0')), or something similar).
  198.  
  199.    To get a safe buffer, use GetSpace(), below.
  200.  
  201. 2. GetSpace(i)
  202.  
  203.    GetSpace(i) returns an integer, which is the address of a block of
  204.    storage, i bytes long. The storage is claimed using malloc(), and is
  205.    completely outside the control of Icon. The only way to read from or
  206.    write to this area, is using Peek() and Poke(), below.
  207.  
  208.    GetSpace() fails (in the Icon sense) if the memory is unavailable
  209.    (ie, malloc() returns NULL). This also happens if i is 0.
  210.  
  211. 3. FreeSpace(a)
  212.  
  213.    FreeSpace(a) frees the block of storage at address a (which must be
  214.    an integer), using free(). This should be used to free storage
  215.    allocated using GetSpace(). No check is made to make sure that a is
  216.    the address of an area claimed by GetSpace(). If it is not, you will
  217.    almost surely crash Icon.
  218.  
  219. 4. Peek(a,i)
  220.  
  221.    Peek(a,i) returns an Icon string, consisting of the i bytes at
  222.    address a. Peek() does not move any data about. It simply builds an
  223.    Icon string qualifier, pointing to the data. Hence string returned by
  224.    Peek() is not modifiable.
  225.  
  226. 5. Poke(a,s)
  227.  
  228.    Poke(a,s) copies the Icon string s to address a. The string is copied
  229.    directly, byte by byte, with no conversion. No terminating null byte
  230.    is added. This is the only way of assigning data into a block of
  231.    storage allocated using GetSpace().
  232.  
  233. To go with these functions, &features includes "Archimedes extensions".
  234.  
  235.  
  236. Port information
  237. ----------------
  238.  
  239. This port was produced by
  240.  
  241. Paul Moore
  242.  
  243. 10, Mulberry Rise,
  244. Firdale Park,
  245. Northwich,
  246. Cheshire
  247. CW8 4UQ
  248.  
  249. E-Mail: pmoore@cix.UUCP
  250.     pmoore@cix.compulink.co.uk
  251.  
  252. I am interested in hearing about any bugs in the port, or any
  253. suggestions for improvements (although I will not put in any Archimedes
  254. specific alterations to the Icon language itself - I intend to register
  255. this port with the Icon project, so that any upgrades will be
  256. automatically available).
  257.  
  258. This distribution may not include full source (depending upon where you
  259. got it from). If not, I can supply source. Please contact me (including
  260. a couple of FORMATTED disks), and I'll send a copy. Note: the sources
  261. are held as Spark archives, so you'll need to have Spark or the PD
  262. un-archiver SparkPlug to get at them.
  263.  
  264. I also have the rest of the Icon distribution (the Icon program library,
  265. Idol - an object-oriented front end for Icon, and a few other bits).
  266. Again, contact me, including disks, if you want them.
  267.  
  268. IF YOU ARE REQUESTING ANY OF THE ABOVE, please let me know if you have
  269. the latest version of Spark (2.00). I hold my backup copies of all of
  270. these things as Spark archives using the latest compression format
  271. (16-bit compress). This saves me a lot of disk space. However, it does
  272. mean that I have to do a fair bit of work to prepare disks for earlier
  273. versions of Spark (or for SparkPlug, which does not support 16-bit
  274. compress at present). I would recommend people getting the Full version
  275. of Spark anyway - it only costs 5 or 6 pounds, and the disk includes a
  276. number of other PD goodies, as well. Avaliable from David Pilling (see
  277. his ads in Risc User or Archive). End of adverts.
  278.  
  279.  
  280. Have fun with Icon - it's an unusual, but nice, language.
  281.  
  282. Paul Moore
  283.