home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / lisp / stk-3.002 / stk-3 / STk-3.1 / Lib / STk.init < prev    next >
Encoding:
Text File  |  1995-12-19  |  7.0 KB  |  236 lines

  1. ;;;; Template for configuration of *features* for STk -*-scheme-*-
  2. ;;; Copyright (C) 1991, 1992, 1993 Aubrey Jaffer.
  3.  
  4. ;; Author Erick Gallesio (eg@unice.fr)
  5.  
  6. (require "unix")
  7.  
  8. ;;; (software-type) should be set to the generic operating system type.
  9. ;;; UNIX, VMS, MACOS, AMIGA and MSDOS are supported.
  10.  
  11. (define (software-type) 'UNIX)
  12.  
  13. ;;; (scheme-implementation-type) should return the name of the scheme
  14. ;;; implementation loading this file.
  15.  
  16. (define (scheme-implementation-type) '|STk|)
  17.  
  18. ;;; (scheme-implementation-version) should return a string describing
  19. ;;; the version the scheme implementation loading this file.
  20.  
  21. (define (scheme-implementation-version) (version))
  22.  
  23. ;;; (implementation-vicinity) should be defined to be the pathname of
  24. ;;; the directory where any auxillary files to your Scheme
  25. ;;; implementation reside.
  26.  
  27. (define (implementation-vicinity) "/usr/local/lib/stk/")
  28.  
  29. ;;; (library-vicinity) should be defined to be the pathname of the
  30. ;;; directory where files of Scheme library functions reside.
  31.  
  32. (define library-vicinity
  33.   (let ((library-path (or (getenv "SCHEME_LIBRARY_PATH") "/usr/local/lib/slib/")))
  34.     (lambda () library-path)))
  35.  
  36. ;;; *FEATURES* should be set to a list of symbols describing features
  37. ;;; of this implementation.  Suggestions for features are:
  38.  
  39. (define *features*
  40.       '(
  41.     source                ;can load scheme source files
  42.                     ;(slib:load-source "filename")
  43.     compiled            ;can load compiled files
  44.                     ;(slib:load-compiled "filename")
  45.     rev4-report            ;conforms to
  46. ;    rev3-report            ;conforms to
  47. ;    ieee-p1178            ;conforms to
  48. ;    sicp                ;runs code from Structure and
  49.                     ;Interpretation of Computer
  50.                     ;Programs by Abelson and Sussman.
  51.     rev4-optional-procedures    ;LIST-TAIL, STRING->LIST,
  52.                     ;LIST->STRING, STRING-COPY,
  53.                     ;STRING-FILL!, LIST->VECTOR,
  54.                     ;VECTOR->LIST, and VECTOR-FILL!
  55. ;    rev3-procedures            ;LAST-PAIR, T, and NIL
  56. ;    rev2-procedures            ;SUBSTRING-MOVE-LEFT!,
  57.                     ;SUBSTRING-MOVE-RIGHT!,
  58.                     ;SUBSTRING-FILL!,
  59.                     ;STRING-NULL?, APPEND!, 1+,
  60.                     ;-1+, <?, <=?, =?, >?, >=?
  61.     multiarg/and-            ;/ and - can take more than 2 args.
  62.     multiarg-apply            ;APPLY can take more than 2 args.
  63. ;    rationalize
  64.     delay                ;has DELAY and FORCE
  65.     with-file            ;has WITH-INPUT-FROM-FILE and
  66.                     ;WITH-OUTPUT-FROM-FILE
  67.     string-port            ;has CALL-WITH-INPUT-STRING and
  68.                     ;CALL-WITH-OUTPUT-STRING
  69. ;    transcript            ;TRANSCRIPT-ON and TRANSCRIPT-OFF
  70. ;    char-ready?
  71. ;    macro                ;has R4RS high level macros
  72. ;    defmacro            ;has Common Lisp DEFMACRO
  73.     eval                ;SLIB:EVAL is single argument eval
  74. ;    record                ;has user defined data structures
  75. ;    values                ;proposed multiple values
  76.     dynamic-wind            ;proposed dynamic-wind
  77.     ieee-floating-point        ;conforms to
  78.     full-continuation        ;can return multiple times
  79. ;    object-hash            ;has OBJECT-HASH
  80.  
  81. ;    sort                ; commented because icomplete
  82. ;    queue                ;queues
  83. ;    pretty-print
  84. ;    object->string
  85. ;    format
  86. ;    compiler            ;has (COMPILER)
  87.     ed                ;(ED) is editor
  88.     system                ;posix (system <string>)
  89.     getenv                ;posix (getenv <string>)
  90. ;    program-arguments        ;returns list of strings (argv)
  91. ;    Xwindows            ;X support
  92. ;    curses                ;screen management package
  93. ;    termcap                ;terminal description package
  94. ;    terminfo            ;sysV terminal description
  95.     ))
  96.  
  97. ;;; (OUTPUT-PORT-WIDTH <port>)
  98. (define (output-port-width . arg) 79)
  99.  
  100. ;;; (OUTPUT-PORT-HEIGHT <port>)
  101. (define (output-port-height . arg) 24)
  102.  
  103. ;;; (TMPNAM) makes a temporary file name.
  104. (define tmpnam (let ((cntr 100))
  105.          (lambda () (set! cntr (+ 1 cntr))
  106.              (string-append "slib_" (number->string cntr)))))
  107.  
  108. ;;; (DELETE-FILE <string>)
  109. (define (delete-file f) (system (format #f "/bin/rm ~A" f)))
  110.  
  111. ;;; FORCE-OUTPUT flushes any pending output on optional arg output port
  112. ;;; use this definition if your system doesn't have such a procedure.
  113. (define (force-output . arg) (apply flush arg))
  114.  
  115. ;;; CHAR-CODE-LIMIT is one greater than the largest integer which can
  116. ;;; be returned by CHAR->INTEGER.
  117. (define char-code-limit 256)
  118.  
  119. ;;; MOST-POSITIVE-FIXNUM is used in modular.scm
  120. (define most-positive-fixnum #x0fffffff)
  121.  
  122. ;;; If your implementation provides eval SLIB:EVAL is single argument
  123. ;;; eval using the top-level (user) environment.
  124. (define slib:eval eval)
  125.  
  126. ;;; If your implementation provides R4RS macros:
  127. ;(define macro:eval slib:eval)
  128. ;(define macro:load load)
  129.  
  130. (define *macros* '())
  131.  
  132. (define-macro (defmacro name args . body)
  133.   `(begin
  134.      (define-macro (,name ,@args) ,@body)
  135.      (set! *macros* (cons ,name *macros*))))
  136.  
  137.  
  138. (define (defmacro? m) (and (memv m *macros*) #t))
  139.  
  140. (define macroexpand-1 MACRO-EXPAND-1)
  141. (define macroexpand   MACRO-EXPAND)
  142.  
  143.  
  144. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  145.  
  146. (define gentemp   GENSYM)
  147. (define base:eval slib:eval)
  148.  
  149. (define (defmacro:eval x) (base:eval (defmacro:expand* x)))
  150. (define (defmacro:expand* x)
  151.   (require 'defmacroexpand) (apply defmacro:expand* x '()))
  152.  
  153. (define (defmacro:load <pathname>)
  154.   (slib:eval-load <pathname> defmacro:eval))
  155.  
  156. (define (slib:eval-load <pathname> evl)
  157.   (if (not (file-exists? <pathname>))
  158.       (set! <pathname> (string-append <pathname> (scheme-file-suffix))))
  159.   (call-with-input-file <pathname>
  160.     (lambda (port)
  161.       (let ((old-load-pathname *load-pathname*))
  162.     (set! *load-pathname* <pathname>)
  163.     (do ((o (read port) (read port)))
  164.         ((eof-object? o))
  165.       (evl o))
  166.     (set! *load-pathname* old-load-pathname)))))
  167.  
  168. ;;; define an error procedure for the library
  169. (define (slib:error . args)
  170.   (error (apply string-append (map (lambda (x) (format #f " ~a" x)) args))))
  171.  
  172.  
  173. ;;; define these as appropriate for your system.
  174. (define slib:tab     (integer->char 9))
  175. (define slib:form-feed  (integer->char 12))
  176.  
  177. ;;; Define these if your implementation's syntax can support it and if
  178. ;;; they are not already defined.
  179. (define -1+ 1-)
  180.  
  181. (define in-vicinity string-append)
  182.  
  183. ;;; Define SLIB:EXIT to be the implementation procedure to exit or
  184. ;;; return if exitting not supported.
  185. (define slib:exit exit)
  186.  
  187. ;;; Here for backward compatability
  188. (define scheme-file-suffix
  189.   (let ((suffix (case (software-type)
  190.           ((NOSVE) "_scm")
  191.           (else ".scm"))))
  192.     (lambda () suffix)))
  193.  
  194. ;;; (SLIB:LOAD-SOURCE "foo") should load "foo.scm" or with whatever
  195. ;;; suffix all the module files in SLIB have.  See feature 'SOURCE.
  196.  
  197. (define slib:load-source LOAD)
  198.  
  199. ;;; (SLIB:LOAD-COMPILED "foo") should load the file that was produced
  200. ;;; by compiling "foo.scm" if this implementation can compile files.
  201. ;;; See feature 'COMPILED.
  202.  
  203. (define slib:load-compiled load)
  204.  
  205. ;;;
  206. ;;; Retain original require/provide before loading "require.scm"
  207. ;;;
  208. (define stk:require require)
  209. (define stk:provide provide)
  210. (define stk:provided? provided?)
  211.  
  212. (define slib:load slib:load-source)
  213. (slib:load (in-vicinity (library-vicinity) "require"))
  214.  
  215.  
  216. ;;;
  217. ;;; Redefine require/provide so that symbols use SLIB one and strings use STk one
  218. ;;;
  219.  
  220. (define require
  221.   (let ((slib:require require))
  222.     (lambda (item)
  223.       ((if (symbol? item) slib:require stk:require) item ))))
  224.  
  225. (define provide
  226.   (let ((slib:provide provide))
  227.     (lambda (item)
  228.       ((if (symbol? item) slib:provide stk:provide) item))))
  229.  
  230. (define provided?
  231.   (let ((slib:provided? provided?))
  232.     (lambda (item)
  233.       ((if (symbol? item) slib:provided? stk:provided?) item))))
  234.  
  235. (define identity (lambda (x) x))
  236.