home *** CD-ROM | disk | FTP | other *** search
-
-
-
-
-
-
- Version 8.7 of Icon for OS/2
-
- Ralph E. Griswold
- Department of Computer Science, The University of Arizona
-
-
-
- 1.__Introduction
-
- Version 8.7 of Icon runs under OS/2 2.0. It is a 32-bit appli-
- cation. A math co-processors is supported and used if present;
- otherwise software emulation is used.
-
- This implementation of Icon is in the public domain and may be
- copied and used without restriction. The Icon Project makes no
- warranties of any kind as to the correctness of this material or
- its suitability for any application. The responsibility for the
- use of Icon lies entirely with the user.
-
- The basic reference for Version 8 of Icon is the second edi-
- tion of the book The Icon Programming Language [1]. This book is
- available from the Icon Project at The University of Arizona. It
- also can be ordered through any bookstore that handles special
- orders.
-
- The new features of Version 8.7 of Icon are in an accompanying
- technical report [2].
-
-
- 2.__Installing_OS/2_Icon
-
- Two executable binary files are needed to run Icon:
-
- icont.exe translator
- iconx.exe executor
-
- These files should be located at a place on your PATH specifica-
- tion.
-
- The distribution is contained in several files in LHarc (lzh)
- format. A copy of lharc.exe is included for dearchiving. The dis-
- tribution files are:
-
- docs.lzh documents
- icon.lzh executable binary files
- lharc.exe dearchiving utility
- readme installation overview and recent notes
- samples.lzh Icon programs and data
-
-
- To install the .exe files, set your current directory to the
- desired place, place the appropriate distribution diskette in
- drive A, and dearchive the files there using lharc.exe. For
- example, to dearchive the executable binary files, the following
-
-
-
- IPD200 - 1 - July 6, 1992
-
-
-
-
-
-
-
-
- will do:
-
- a:lharc a:icon.lzh
-
- The same technique can be used for extracting the remaining
- files.
-
-
- 3.__Running_OS/2_Icon_-_Basic_Information
-
- Files containing Icon programs must have the extension .icn.
- Such files should be plain text files (without line numbers or
- other extraneous information). The icont translator produces an
- ``icode'' file that can be executed by iconx. For example, an
- Icon program in the file prog.icn is translated by
-
- icont prog.icn
-
- The result is an icode file with the name prog.icx. This file
- can be run by
-
- iconx prog.icx
-
- If your executor is named differently, simply use that name. For
- example, if your executor is named iconxl.exe, use
-
- iconxl prog.icx
-
- Alternatively, icont can be instructed to execute the icode file
- after translation by appending a -x to the command line, as in
-
- icont prog.icn -x
-
- This only works if your executor is named iconx.exe, since the -x
- option looks for this name. In the sections that follow, it is
- assumed that the executor is named iconx.exe.
-
- If icont is run with the -x option, the file prog.icx is left
- and can be run subsequently using an explicitly named executor as
- described above.
-
- The extensions .icn and .icx are optional. For example, it is
- sufficient to use
-
- icont prog
-
- and
-
- iconx prog
-
-
- iconx will find an icode file if it is in the current direc-
- tory or at place given on your PATH specification.
-
-
-
-
- IPD200 - 2 - July 6, 1992
-
-
-
-
-
-
-
-
- 4.__Testing_the_Installation
-
- There are a few programs on the distribution diskette that can
- be used for testing the installation and getting a feel for run-
- ning Icon:
-
- 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 cross -x <cross.dat
-
-
- meander.icn This program prints the ``meandering strings''
- that contain all subsequences of a specified
- length from a given set of characters. Run this
- test as
-
- icont meander -x <meander.dat
-
-
- roman.icn This program converts Arabic numerals to Roman
- numerals. Run this test as
-
- icont roman -x
-
- and provide some Arabic numbers from your con-
- sole.
-
- If these tests work, your installation is probably correct and
- you should have a running version of Icon.
-
-
- 5.__More_on_Running_Icon
-
- For simple applications, the instructions for running Icon
- given in Section 3 may be adequate. The icont translator supports
- a variety of options that may be useful in special situations.
- There also are several aspects of execution that can be con-
- trolled with environment variables. These are listed here. If
- you are new to Icon, you may wish to skip this section on the
- first reading but come back to it if you find the need for more
-
-
-
- IPD200 - 3 - July 6, 1992
-
-
-
-
-
-
-
-
- control over the translation and execution of Icon programs.
-
- 5.1__Arguments
-
- Arguments can be passed to the Icon program by appending them
- to the command line. Such arguments are passed to the main pro-
- cedure as a list of strings. For example,
-
- iconx prog text.dat log.dat
-
- runs the icode file prog.icx, passing its main procedure a list
- of two strings, "text.dat" and "log.dat". The program also can
- be translated and run with these arguments with a single command
- line by putting the arguments after the -x:
-
- icont prog -x text.dat log.dat
-
- These arguments might be the names of files that prog.icn reads
- from and writes to. For example, the main procedure might begin
- as follows:
-
- procedure main(a)
- in := open(a[1]) | stop("cannot open input file")
- out := open(a[2],"w") | stop("cannot open output file")
- .
- .
- .
-
-
- 5.2__The_Translator
-
- The icont translator can accept several Icon source files at
- one time. When several files are given, they are translated and
- combined into a single icode file whose name is derived from the
- name of the first file. For example,
-
- icont prog1 prog2
-
- translates the files prog1.icn and prog2.icn and produces one
- icode file, prog1.icx.
-
- A name other than the default one for the icode file produced
- by Micont can be specified by using the -o option, followed by
- the desired name. For example,
-
- icont -o probe.icx prog
-
- produces the icode file named probe.icx rather than prog.icx.
-
- If the -c option is given to icont, the translator stops
- before producing an icode file and intermediate ``ucode'' files
- with the extensions .u1 and .u2 are left for future use (normally
- they are deleted). For example,
-
-
-
-
- IPD200 - 4 - July 6, 1992
-
-
-
-
-
-
-
-
- icont -c prog1
-
- leaves prog1.u1 and prog1.u2, instead of producing prog1.icx.
- These ucode files can be used in a subsequent icont command by
- using the .u1 name. This saves translation time when the program
- is used again. For example,
-
- icont prog2 prog1.u1
-
- translates prog2.icn and combines the result with the ucode files
- from a previous translation of prog1.icn. Note that only the .u1
- name is given. The extension can be abbreviated to .u, as in
-
- icont prog2 prog1.u
-
- Ucode files also can be added to a program using the link
- declaration.
-
- Icon source programs may be read from standard input. The
- argument - signifies the use of standard input as a source file.
- In this case, the ucode files are named stdin.u1 and stdin.u2 and
- the icode file is named stdin.icx.
-
- The informative messages from the translator can be suppressed
- by using the -s option. Normally, both informative messages and
- error messages are sent to standard error output.
-
- The -t option causes &trace to have an initial value of -1
- when the icode file is executed. Normally, &trace has an initial
- value of 0.
-
- The option -u causes warning messages to be issued for unde-
- clared identifiers in the program.
-
- 5.3__Environment_Variables
-
- When an icode file is executed, several environment variables
- are examined to determine execution parameters. The values
- assigned to these variables should be numbers.
-
- Environment variables are particularly useful in adjusting
- Icon's storage requirements. Particular care should be taken
- when changing default values: unreasonable values may cause Icon
- to malfunction.
-
- The following environment variables can be set to adjust
- Icon's execution parameters. Their default values are listed in
- parentheses after the environment variable name:
-
- TRACE (undefined). This variable initializes the value
- of &trace. If this variable has a value, it overrides the
- translation-time -t option.
-
- NOERRBUF (undefined). If this variable is set, &errout
-
-
-
- IPD200 - 5 - July 6, 1992
-
-
-
-
-
-
-
-
- is not buffered.
-
- STRSIZE (65000). This variable determines the size, in
- bytes, of the initial region in which strings are stored.
- If additional string regions are needed, they may be
- smaller.
-
- BLKSIZE (65000). This variable determines the size, in
- bytes, of the initial region in which Icon allocates lists,
- tables, and other objects. If additional block regions are
- needed, they may be smaller.
-
- COEXPSIZE (2000). This variable determines the size, in
- 32-bit words, of each co-expression block.
-
- MSTKSIZE (10000). This variable determines the size, in
- words, of the main interpreter stack.
-
- QLSIZE (5000). This variable determines the size, in
- bytes, of the region used by the garbage collector for
- pointers to strings.
-
-
- 6.__Features_of_OS/2_Icon
-
- OS/2 Icon supports all the features of Version 8.7 of Icon,
- with the following exceptions and additions:
-
- + For files opened in the translate mode, the position pro-
- duced by seek() may not reflect the actual byte position
- because of the translation of carriage-return/line-feed
- sequences to line-feed characters.
-
- + Path specifications can be entered using either a / or a
- \. Examples are:
-
- A:\ICON\TEST.ICN
- A:/ICON/TEST.ICN
-
-
- + The following OS/2 device names can be used as file
- names:
-
- console CON
- printer PRN LST LPT LPT1
- auxiliary port AUX COM RDR PUN
- null NUL NULL
-
- For example,
-
- prompt := open("CON", "w")
-
- causes strings written to prompt to be displayed on the
- console. Use of a null file name means no file is
-
-
-
- IPD200 - 6 - July 6, 1992
-
-
-
-
-
-
-
-
- created.
-
-
- 7.__Reporting_Problems
-
- Problems with Icon should be noted on a trouble report form
- (included with the distribution) and sent to
-
- Icon Project
- Department of Computer Science
- Gould-Simpson Building
- The University of Arizona
- Tucson, AZ 85721
- U.S.A.
- (602) 621-8448 (voice)
- (602) 621-4246 (fax)
- icon-project@cs.arizona.edu (Internet)
- ... uunet!arizona!icon-project (uucp)
-
-
-
- 8.__Registering_Copies_of_Icon
-
- If you received your copy of Icon directly from the Icon Pro-
- ject, it has been registered in your name and you will automati-
- cally receive the Icon Newsletter. This newsletter contains
- information about new implementations, updates, programming tech-
- niques, and information of general interest about Icon.
-
- If you received your copy of Icon from another source, please
- fill out the registration form that is included in the distribu-
- tion and send it to the Icon Project at the address listed above.
- This will assure that you receive the Icon Newsletter and infor-
- mation about updates.
-
- Acknowledgements
-
- The design and implementation of the Icon programming language
- was supported, in part, by grants from the National Science Foun-
- dation.
-
- Clint Jeffery, Gregg Townsend, and Ken Walker collaborated
- with the author in the development of Version 8.7. The OS/2
- implementation was provided by Darren Merrill with assistance
- from Mark Emmer.
-
- References
-
-
- 1. R. E. Griswold and M. T. Griswold, The Icon Programming
- Language, Prentice-Hall, Inc., Englewood Cliffs, NJ, second
- edition, 1990.
-
-
-
-
-
- IPD200 - 7 - July 6, 1992
-
-
-
-
-
-
-
-
- 2. R. E. Griswold, C. L. Jeffery, G. M. Townsend and K. Walker,
- Version 8.7 of the Icon Programming Language, The Univ. of
- Arizona Icon Project Document IPD188, 1992.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- IPD200 - 8 - July 6, 1992
-
-
-