home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 5
/
DATAFILE_PDCD5.iso
/
utilities
/
i
/
icon
/
DOCS
/
IPD238_DOC
< prev
next >
Wrap
Text File
|
1995-12-01
|
47KB
|
1,717 lines
Configuring the Source Code for
Version 9 of Icon
Gregg M. Townsend, Ralph E. Griswold,
and Clinton L. Jeffery
Department of Computer Science, The
University of Arizona
1.__Background
The implementation of the Icon programming language is large
and sophisticated [1-3]. The implementation is, however, written
almost entirely in C and RTL [4], a superset of C, for which a
translator to C is provided. A small amount of assembly-language
code is needed for the context switch used by co-expressions.
See Appendix B. This code is optional and only affects co-
expressions.
There presently are implementations of Icon for the Acorn
Archimedes, the Amiga, the Atari ST, the Macintosh, MS-DOS, MVS,
OS/2, UNIX, VM/CMS, and VMS.
All implementations of Icon are obtained from the same source
code, using conditional compilation and defined constants to
select and configure platform-dependent code. Consequently,
installing Icon on a new platform is largely a matter of select-
ing appropriate values for configuration parameters, deciding
among alternative definitions, and possibly adding some code that
is dependent on the specific computer, operating system, and C
compiler used.
This document describes the process of configuring Version 9
of the Icon source code for a platform on which it has not previ-
ously been installed.
Since there are several existing configurations for UNIX and
MS-DOS, configuring a new platform for one of these operating
systems is easier than for other platforms. See Sections 5, 6,
and 7 for specific information concerning UNIX and MS-DOS plat-
forms.
Building Icon with a new C compiler on an operating system for
which Icon has previously been installed usually is a fairly sim-
ple task and normally can be done by adjusting a few configura-
tion parameters.
IPD238b - 1 - November 1, 1995
Installing Icon on a new operating system is more complex;
read this report carefully, especially Section 8, before under-
taking such a project.
2.__Requirements
C_Data_Sizes
Icon places the following requirements on C data sizes:
+ chars must be 8 bits.
+ ints must be 16, 32, or 64 bits.
+ longs and pointers must be 32 or 64 bits.
+ All pointers must be the same length.
+ longs and pointers must be the same length.
If your C data sizes do not meet these requirements, do not
attempt to configure Icon.
The_C_Compiler
The main requirement for implementing Icon is a production-
quality C compiler that supports at least the ``K&R'' standard
[5]. An ANSI C compiler is preferable. The term ``production
quality'' implies robustness, correctness, the ability to address
large amounts of memory, the ability to handle large files and
complicated expressions, and a comprehensive run-time library.
The C preprocessor should conform either to the ANSI C stan-
dard [6] or to the K&R standard for UNIX C preprocessors. In
particular, Icon uses the C preprocessor to concatenate strings
and substitute arguments within quotation marks. For the ANSI
preprocessor standard, the following definitions are used:
#define Cat(x, y) x##y
#define Lit(x) #x
For the UNIX K&R standard, the following definitions are used:
#define Ident(x) x
#define Cat(x, y) Ident(x)y
#define Lit(x) "x"
The following program can be used to test these preprocessor
facilities:
IPD238b - 2 - November 1, 1995
Cat(ma, in)()
{
printf(Lit(Hello world\n));
}
If this program does not compile and print Hello world using one
of the sets of definitions above, there is no point in proceed-
ing. Contact the Icon Project for alternative approaches.
Memory
The Icon programming language requires a substantial amount of
memory to run. The practical minimum depends somewhat on the
platform; 640KB is typical.
File_Space
The source code for Icon is large - about 3.5MB. Test pro-
grams and other auxiliary files take additional room, as does
compilation and testing. While the implementation can be divided
into components that can be built separately, this approach may
be painful.
3.__File_Structure
The files for Icon are organized in a hierarchy. The top
level, assuming the hierarchy is rooted in icon is:
|-bin------ executable binaries and support files
|-config--- configurations
|-icon----|-src------ source code
|-tests---- tests
There are several subdirectories in config for different operat-
ing systems:
|-acorn----
|-amiga----
|-atari_st-
|-ibm370---
--config--|-macintosh
|-msdos----
|-os2------
|-unix-----
|-vms------
Not all of these subdirectories are included in all distributions
of Icon. Some configuration directories contain subdirectories
for different platforms. These subdirectories contain various
files, depending on the platform.
IPD238b - 3 - November 1, 1995
The directory src contains the source code for various com-
ponents of Icon.
|-common---- common source
|-h--------- header files
|-iconc----- Icon compiler source
-src------|-icont----- Icon translator source
|-preproc--- C preprocessor source
|-rtt------- run-time translator source
|-vtran----- variant translator support
|-wincap---- BMP image-file format support
|-xpm------- XPM image-file format support
The directory tests contains the test material for various
components of Icon.
|-bench----- benchmarks
|-calling--- calling C functions from Icon
|-general--- general tests
|-graphics-- tests for graphics
-tests----|-ipl------- tests for the Icon program library
|-preproc--- C preprocessor tests
|-samples--- short sample programs
|-special--- tests of special features
|-vtran----- tests variant translators
Some distributions contain other, optional components of Icon.
The Icon compiler is not included in all distributions of Icon.
4.__Parameters_and_Definitions
There are many defined constants and macros in the source code
for Icon that vary from platform to platform. Over the range of
possible platforms, there are many possibilities. A complete list
is given in Appendix A. Do not be intimidated by the large
number of options listed there; most are provided only for
unusual situations and only a few are needed for any one plat-
form.
The defined constants and macros needed for a specific plat-
form are placed in src/h/define.h. There are many existing
define.h files that can be used as guides. One for a ``vanilla''
32-bit platform is:
#define HostStr "new host"
#define NoCoexpr
#define PORT 1
HostStr provides the value used in the Icon keyword &host and
should be changed as appropriate. NoCoexpr causes Icon to be
IPD238b - 4 - November 1, 1995
configured without co-expressions. This definition can be
removed when co-expressions are implemented. See Appendix B.
PORT indicates an implementation for an unspecified operating
system. It should be changed to a name for the operating system
for the new platform (see Section 8). Other definitions probably
need to be added, of course.
5.__Configuring_Icon_for_a_UNIX_Platform
Since Icon has been imple