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 >
Text File  |  1989-12-21  |  5KB  |  197 lines

  1. THREADED INTERPRETIVE LANGUAGE ENVIRONMENT (TILE) PORTING
  2.  
  3. December 14, 1989
  4.  
  5. Mikael R.K. Patel
  6. Computer Aided Design Laboratory (CADLAB)
  7. Department of Computer and Information Science
  8. Linkoping University
  9. S-581 83 LINKOPING
  10. SWEDEN
  11. Email: mip@ida.liu.se
  12.  
  13.  
  14.  
  15. 1. KERNEL DEFINITIONS
  16.  
  17. 1.1    Vocabulary listing parameters (File: kernel.c)
  18.  
  19. The column and line width used by "words" may be altered by changing
  20. the lines:
  21.  
  22. #define COLUMNWIDTH 15
  23. #define LINEWIDTH 75
  24.  
  25.  
  26. 1.2    Set of search vocabularies (File: kernel.c)
  27.  
  28. The set of search vocabularies, "context", is realized as a vector.
  29. The maximum number of vocabularies in is defined by:
  30.  
  31. #define CONTEXTSIZE 32
  32.  
  33. An error will occur it the set is filled. No checking is currently 
  34. performed.
  35.  
  36.  
  37. 1.3    Lookup cache (File: kernel.c)
  38.  
  39. The lookup function in the kernel is supported by a simple cache.
  40. A hash function (see below) is used to map a string into the cache
  41. and there, if possible, find the entry. The size of the cache
  42. is given by:
  43.  
  44. #define CACHESIZE 256
  45. #define hash(s) ((s[0] + (s[1] << 4)) & (CACHESIZE - 1))
  46.  
  47. The hash function is tailored for the current cache size and thus
  48. special care must be taken when altering these.
  49.  
  50.  
  51. 1.4    Internal structures (File: kernel.c)
  52.  
  53. The "pad" and the "tib" may be changed by altering:
  54.  
  55. #define PADSIZE 84
  56. #define TIBSIZE 256
  57.  
  58.  
  59. 1.5    Word alignment (File: kernel.h)
  60.  
  61. Alignment of threaded code and data structures are performed by the
  62. macro:
  63.  
  64. #define align(p) p = (long *) ((long) ((char *) p + 3) & -4)
  65.  
  66. This macro currently aligns to word (long) boundaries and is used by
  67. "colon" and "create".
  68.  
  69.  
  70. 1.6    Function casting (File: kernel.h)
  71.  
  72. Some compilers might not like the current definition of casting of
  73. a function to a long number in the entry structure. To reduce rewriting
  74. a macro is used:
  75.  
  76. #define SUBR(x) ((long) (void (*) ()) (x))
  77.  
  78. This macro is used by the entry generators (see kernel.h). Some
  79. compilers will not allow this and thus will require that the primitive,
  80. i.e. the C-level subroutines, are bound at run-time. This code is
  81. not included.
  82.  
  83.  
  84. 1.7    Initialization of the kernel (File: kernel.c)
  85.  
  86. The initialization function for the kernel requires five parameters.
  87. The two first allows the application such as forth.c to extend the
  88. basic forth vocabulary by giving the first and last entry in the 
  89. application vocabulary. The three following parameters specify the
  90. size of the foreground task, the forth interpreter. See the file
  91. forth.c for an example.
  92.  
  93.  
  94. 2.     IO MANAGEMENT
  95.  
  96. 2.1    File and path name size (File: io.c)
  97.  
  98. The maximum length of a file or path name is defined as:
  99.  
  100. #define FILENAMESIZE 128
  101. #define PATHNAMESIZE 128
  102.  
  103. These length are not test for currently. An error may occur if
  104. a file or path name is longer than the given sizes.
  105.  
  106.  
  107. 2.2    File buffer stack (File: io.c)
  108.  
  109. The io management package implements a stack of input file buffers to
  110. allow loading of files from within other files etc. The maximum depth
  111. of this stack is defined as:
  112.  
  113. #define FSTACKSIZE 32
  114.  
  115. The depth should be chosen to the maximum number of open files.
  116.  
  117.  
  118. 2.3    Set of loaded files (File: io.c)
  119.  
  120. The file loading mechanism automatically looks if the file already
  121. has been opened. The set of opened files is maintained as a vector.
  122. The maximum number of loaded files is:
  123.  
  124. #define INFILESSIZE 64
  125.  
  126. The vector contains the fully expanded names of the loaded files.
  127. An error may occur if this limit is succeeded. It is not checked for
  128. currently.
  129.  
  130.  
  131. 2.4    Set of paths (File: io.c)
  132.  
  133. The io packages also maintains an ordered collection of paths which
  134. are used to expand file names with when search for the file. The
  135. maximum size of this collection is defined by:
  136.  
  137. #define PATHSSIZE 64
  138.  
  139. This collection is automatically appended by the $TILEPATH environ-
  140. ment variable when the io package is initiated.
  141.  
  142.  
  143. 2.5    White space (File: io.h)
  144.  
  145. The definition of "white" space is defined as:
  146.  
  147. #define ISSPACE(c) ((c) <= ' ')
  148.  
  149. This eliminates space and any control characters. Some application
  150. might want to redefine this.
  151.  
  152.  
  153. 2.6    Non-blocking read operation (File: io.c)
  154.  
  155. To achieve multi-tasking during input wait the input package function
  156. "io_fillbuf" uses a non-blocking read operation. Some environments
  157. do not support this. Thus this may require re-implementation.
  158.  
  159. To check if the read operation was an success the error number 
  160. variable is used ("errno"). Some environments do not include it
  161. in the include file thus the below line is needed:
  162.  
  163. extern int errno;
  164.  
  165. This is available in SUN include files.
  166.  
  167.  
  168. 3.     ERROR MANAGEMENT
  169.  
  170. 3.1    Signals (File: error.c)
  171.  
  172. Error handing is realized using two basic mechanisms; first signals from
  173. the execution environment and second by user defined exceptions in
  174. the kernel (high level code).
  175.  
  176. The signal message table and the appropriate operations, "error_restart",
  177. or "error_fatal", may have to be changed to give the right performance.
  178.  
  179. Please see these functions and "error_initiate" where the actual binding
  180. of signals and actions is performed.
  181.  
  182.  
  183. 4.     MEMORY MANAGEMENT
  184.  
  185. 4.1    Memory allocation (File: memory.c)
  186.  
  187. Currently memory for the dictionary, strings, entries, and task blocks
  188. are allocated using "malloc".
  189.  
  190. The size of the dictionary is determined when calling the initialization
  191. function in the memory management package, "memory_initiate". The
  192. current size is defined as:
  193.  
  194. #define DICTIONARYSIZE 128L * 1024L
  195.  
  196. And may be too large for smaller machines. Please see the file: forth.c.
  197.