home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
OSK
/
EFFO
/
pd6.lzh
/
SRC
/
PORTING
< prev
next >
Wrap
Text File
|
1989-12-21
|
5KB
|
197 lines
THREADED INTERPRETIVE LANGUAGE ENVIRONMENT (TILE) PORTING
December 14, 1989
Mikael R.K. Patel
Computer Aided Design Laboratory (CADLAB)
Department of Computer and Information Science
Linkoping University
S-581 83 LINKOPING
SWEDEN
Email: mip@ida.liu.se
1. KERNEL DEFINITIONS
1.1 Vocabulary listing parameters (File: kernel.c)
The column and line width used by "words" may be altered by changing
the lines:
#define COLUMNWIDTH 15
#define LINEWIDTH 75
1.2 Set of search vocabularies (File: kernel.c)
The set of search vocabularies, "context", is realized as a vector.
The maximum number of vocabularies in is defined by:
#define CONTEXTSIZE 32
An error will occur it the set is filled. No checking is currently
performed.
1.3 Lookup cache (File: kernel.c)
The lookup function in the kernel is supported by a simple cache.
A hash function (see below) is used to map a string into the cache
and there, if possible, find the entry. The size of the cache
is given by:
#define CACHESIZE 256
#define hash(s) ((s[0] + (s[1] << 4)) & (CACHESIZE - 1))
The hash function is tailored for the current cache size and thus
special care must be taken when altering these.
1.4 Internal structures (File: kernel.c)
The "pad" and the "tib" may be changed by altering:
#define PADSIZE 84
#define TIBSIZE 256
1.5 Word alignment (File: kernel.h)
Alignment of threaded code and data structures are performed by the
macro:
#define align(p) p = (long *) ((long) ((char *) p + 3) & -4)
This macro currently aligns to word (long) boundaries and is used by
"colon" and "create".
1.6 Function casting (File: kernel.h)
Some compilers might not like the current definition of casting of
a function to a long number in the entry structure. To reduce rewriting
a macro is used:
#define SUBR(x) ((long) (void (*) ()) (x))
This macro is used by the entry generators (see kernel.h). Some
compilers will not allow this and thus will require that the primitive,
i.e. the C-level subroutines, are bound at run-time. This code is
not included.
1.7 Initialization of the kernel (File: kernel.c)
The initialization function for the kernel requires five parameters.
The two first allows the application such as forth.c to extend the
basic forth vocabulary by giving the first and last entry in the
application vocabulary. The three following parameters specify the
size of the foreground task, the forth interpreter. See the file
forth.c for an example.
2. IO MANAGEMENT
2.1 File and path name size (File: io.c)
The maximum length of a file or path name is defined as:
#define FILENAMESIZE 128
#define PATHNAMESIZE 128
These length are not test for currently. An error may occur if
a file or path name is longer than the given sizes.
2.2 File buffer stack (File: io.c)
The io management package implements a stack of input file buffers to
allow loading of files from within other files etc. The maximum depth
of this stack is defined as:
#define FSTACKSIZE 32
The depth should be chosen to the maximum number of open files.
2.3 Set of loaded files (File: io.c)
The file loading mechanism automatically looks if the file already
has been opened. The set of opened files is maintained as a vector.
The maximum number of loaded files is:
#define INFILESSIZE 64
The vector contains the fully expanded names of the loaded files.
An error may occur if this limit is succeeded. It is not checked for
currently.
2.4 Set of paths (File: io.c)
The io packages also maintains an ordered collection of paths which
are used to expand file names with when search for the file. The
maximum size of this collection is defined by:
#define PATHSSIZE 64
This collection is automatically appended by the $TILEPATH environ-
ment variable when the io package is initiated.
2.5 White space (File: io.h)
The definition of "white" space is defined as:
#define ISSPACE(c) ((c) <= ' ')
This eliminates space and any control characters. Some application
might want to redefine this.
2.6 Non-blocking read operation (File: io.c)
To achieve multi-tasking during input wait the input package function
"io_fillbuf" uses a non-blocking read operation. Some environments
do not support this. Thus this may require re-implementation.
To check if the read operation was an success the error number
variable is used ("errno"). Some environments do not include it
in the include file thus the below line is needed:
extern int errno;
This is available in SUN include files.
3. ERROR MANAGEMENT
3.1 Signals (File: error.c)
Error handing is realized using two basic mechanisms; first signals from
the execution environment and second by user defined exceptions in
the kernel (high level code).
The signal message table and the appropriate operations, "error_restart",
or "error_fatal", may have to be changed to give the right performance.
Please see these functions and "error_initiate" where the actual binding
of signals and actions is performed.
4. MEMORY MANAGEMENT
4.1 Memory allocation (File: memory.c)
Currently memory for the dictionary, strings, entries, and task blocks
are allocated using "malloc".
The size of the dictionary is determined when calling the initialization
function in the memory management package, "memory_initiate". The
current size is defined as:
#define DICTIONARYSIZE 128L * 1024L
And may be too large for smaller machines. Please see the file: forth.c.