Version 7.5 of Icon for the Amiga Clinton Jeffery June 2, 1989 1. Introduction This is an implementation of Version 7.5 of the Icon program- ming language for Amiga computers. This implementation is in the public domain and may be copied and used without restriction. Icon is distributed free of charge by the University of Arizona, except for the costs of media, documentation, handling and shipping. No warranties of any kind as to the correctness of this material or its suitability for any application are made or implied. The responsibility for the use of Icon rests entirely with the user. 2. Documentation The basic reference for the Icon programming language is the book The Icon Programming Language by Ralph E. Griswold and Madge T. Griswold, Prentice-Hall, Inc., Englewood Cliffs, New Jersey, 1983. 313 pages, ISBN 0-13-449777-5. $29.95. This book is available in many college bookstores or can be ordered through any bookstore that handles special orders or by telephone directly from Prentice-Hall: (201) 767-9520. It also is available from the Icon Project at the Department of Computer Science at the University of Arizona. A brief overview of Icon is contained in technical report TR 83-3 [1] (overview.doc on the distribution diskette). Features that have been added to Icon since the book was written are described in TR 88-41 [2] (version7.doc on the distribution diskette). These technical reports, together with this document (guide.doc on the distribution diskette), provide enough informa- tion to write simple Icon programs, but if you are going to use Icon seriously, you will need the book. You may also find it useful to examine the sample programs located on the distribution diskette. 3. Hardware and Software Requirements This version was designed to run under V1.3 of the Amiga operating system software, and the rest of this document assumes you are using it. Amiga Icon version 7.5 has not been tested at all under V1.1 or V1.2. There is no fundamental reason it cannot be used with the older versions; if you want to run Icon with an IPD56 - 1 - June 2, 1989 older version of the operating system you may have problems if Icon can't find a path to its executables or if you need to use environment variables. This version of Icon is command-line based. It does not run under the workbench and does not have any support for Workbench icons or any of the special Amiga features at this time. You should be able to use your choice of: the CLI (for older versions of AmigaDOS), the new AmigaShell, or some third party shell such as Matt Dillon's shell. This version does not run comfortably in 512K. It does run comfortably if you have 1 megabyte or more main memory. A hard disk is also essential for any serious programming work. If you have expansion RAM, the preferred method of using Icon is to copy the Icon binary files into the RAM: area and run icont and iconx from there. If you do not have sufficient expansion memory for this, you will have to run from disk. If you have only 512k of memory you might be able to run Icon by making size assignments to the appropriate environment variables as described below, but this has not been verified. 4. Location of icont and iconx The Icon system naturally follows the standard AmigaDOS search path to find executable files. That is, it looks first in the current directory, then in the C: directory, and finally in any other directories that you have added to the search path by means of the PATH command. This means that you probably will want to place your icont and iconx commands in your C: directory if you have room there, or you can add the directory where the Icon binaries are located to your search path if you are running from the ICON: diskette. 5. Running Icon To translate and link an Icon source program file named myfile.icn first you must add Icon7.5:c to your path (or copy the executables to some directory where AmigaDOS can find them), and then type icont myfile which translates and links myfile.icn and produces the file named myfile. You can then execute this by typing iconx myfile This can be done all in one step as IPD56 - 2 - June 2, 1989 icont myfile -x The usual standard input and standard output redirection is supported by the CLI, but note that the AmigaDOS standard is for the redirection to be given before the other arguments, thus: iconx outfile myprogram myarg1 myarg2 ... If the redirection arguments are not given immediately following the iconx, they do not work. It is not possible to redirect the standard error output in this version but it is possible to combine the standard error output with the standard output by using the command line switch -e - as follows: iconx >outfile -e - myprogram args args ... All the output from the program including error messages is sent to outfile. Note that it is necessary to type the dash (-) fol- lowing the switch. Just typing -e has no effect; you must type -e -. This switch is only allowed on the iconx command. It does work on the icont command. 6. Testing the Installation There are a few programs on the distribution diskette that may be used for testing the installation and getting a feel for run- ning Icon. The programs and appropriate data files are located in the samples directory. Note that files containing Icon pro- grams must have the extension .icn. Such files should be plain text files (without line numbers or other extraneous informa- tion). The command processor icont produces an icode file that can be executed by iconx. For example, an Icon program in the file prog.icn is translated and linked by icont prog The result is an icode file (binary) with the name prog (with the extension removed). This file can be run by iconx prog Alternatively, icont can be instructed to execute the program after translating and linking by appending a -x to the command line, as in icont prog -x In this case the file prog also is left and can be run subse- quently using iconx. IPD56 - 3 - June 2, 1989 Note that the icont and iconx programs are executable binary files and, as such their locations can be discovered by the nor- mal AmigaDOS executable file path search mechanism. But the icode file produced by icont from the Icon source file is not a directly executable file. It essentially is a data file that is read by the Icon interpreter iconx. Therefore, the location of the icode file is not known to AmigaDOS. There is no path search for data files. So your icode file (prog in the above examples) must either be in the current directory, or you must specify its location by giving the drive or directory path as part of the filename. For example, if your current directory is RAM:, and you wish to run the Icon program prog.icn, which might be located in the directory df1:src, and you have placed icont in a location where AmigaDOS can find it, you would type icont df1:src/prog -x In this case, the icode file prog would be left behind in ram:, which was your current directory, after it has been run. You would then be able to run prog again by simply typing iconx prog The sample programs are: hello.icn This program prints the Icon version number, time, and date. Run this test as icont hello iconx hello Note that this can be done in one step with icont hello -x cross.icn This program prints all the ways that two words intersect in a common character. The file cross.dat contains typical data. Run this test as icont