home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / s / s48.zip / FILES.SCM < prev    next >
Text File  |  1992-07-06  |  9KB  |  344 lines

  1. ; Copyright (c) 1992 by Richard Kelsey and Jonathan Rees.  See file COPYING.
  2.  
  3. ; Files comprising the system.
  4. ; Load this file into the Scheme48 user environment.
  5. ;
  6. ; With minor modifications, it can be loaded into Pseudoscheme or T;
  7. ; simply change the file prefix "s48-" to "p-" or "t-" in the definitions
  8. ; of prescheme-files and features-files.
  9.  
  10. ; Load a linker by saying
  11. ;   (load-linker)    ; in Scheme
  12. ; After the linker is loaded, link a system by saying
  13. ;   (link-system)
  14.  
  15.  
  16. ; If the current directory isn't the scheme48 root directory, you
  17. ; should set *scheme48-file-prefix* to that directory, e.g.
  18. ;   (set! *scheme48-file-prefix* "~/s48/").
  19.  
  20. (define *scheme48-file-prefix* "")
  21.  
  22. ; For T, set *default-default-file-type* to the object file type for your
  23. ; particular operating system (e.g. 'so for SPARC object file), or to
  24. ; #f to let T do the defaulting.  (T may not be capable of defaulting
  25. ; properly, depending on which bugs your implementation has, and whether
  26. ; it gets passed "namelists" or strings.)
  27.  
  28. (define *default-default-file-type* 'scm)
  29.  
  30. ; You might choose to redefine the procedures load-file and/or no-value
  31. ; for Pseudoscheme or T as well.
  32.  
  33. (define (load-file namelist)
  34.   (load (namestring namelist)))
  35.  
  36. (define (no-value)
  37.   (if '#f '#f))
  38.  
  39. (define features-files
  40.   '((boot s48-record)     ;or p-record, t-record, record
  41.     (boot s48-features)   ;or p-features, t-features
  42.     (boot util)
  43.     (rts table)
  44.     ))
  45.  
  46.  
  47. ; Runtime system files
  48.  
  49. ; Base-files as a whole has the following properties:
  50. ;   - it supports all of R^4 Report Scheme other than LOAD and non-fixnum
  51. ;     arithmetic
  52. ;   - it has no free variables
  53. ;   - it has a minimal error system
  54.  
  55. (define arch-files
  56.   '((rts defenum scm)
  57.     (rts arch)
  58.     (rts rtsistruct) ; ?
  59.     ))
  60.  
  61. (define base-files
  62.   '((rts base)
  63.     (rts util)
  64.     (rts generic)
  65.     (rts number)     ; needs generic
  66.     (rts dynamic)
  67.     (rts port)       ; needs dynamic(make-fluid)
  68.     (rts record)     ; needs generic
  69.     (rts table)         ; needs record
  70.     (rts wind)         ; Dynamic-wind (optional)
  71.     (rts condition)  ; needs write, generic, arch
  72.     (rts xprim)         ;For n-ary primitives.  Optional.
  73.     ))
  74.  
  75. (define rts-files-1  ;The base/rts-1 split is an artifact of the mobot system
  76.   '((rts write)         ;Needs port, generic(disclose), number(number->string)
  77.     (rts read)
  78.     (rts lize)       ;The rationalize procedure (optional, but if unsupplied,
  79.              ; change reflect.scm to not export it).
  80.     ))
  81.  
  82. (define compiler-files-1
  83.   '((rts enum)
  84.     (rts package)
  85.     (rts cenv)
  86.     (rts segment)
  87.     (rts comp)
  88.     (rts cprim)
  89.     (rts derive)
  90.     (rts syntax-rules)
  91.     (rts ctop)
  92.     ))
  93.  
  94. (define rts-files-2
  95.   '((rts shadow)     ;Exception handler to support package system
  96.     (rts reflect)    ;Create the Scheme package and define LOAD
  97.     (rts bare)       ;Bare-bones startup loop
  98.     ))
  99.  
  100. (define rts-files
  101.   (append arch-files
  102.       base-files
  103.       rts-files-1
  104.       compiler-files-1
  105.       rts-files-2))
  106.  
  107. (define system-image-file
  108.   '(boot system image))
  109.  
  110. ; Linker files
  111.  
  112. (define build-files
  113.   '((boot build)
  114.     (misc debuginfo)))
  115.  
  116. (define boot-files
  117.   '((boot data)
  118.     (boot transport)
  119.     (boot write-image)
  120.    ))
  121.  
  122. (define compiler-files
  123.   (append features-files
  124.       arch-files
  125.       compiler-files-1))
  126.  
  127. (define linker-files
  128.   (append boot-files
  129.       ;; Can replace boot-files by '((boot s48-write-image))
  130.       ;; when the image level doesn't change
  131.       build-files))
  132.  
  133. (define quickly-files
  134.   (append '((boot import-comp)        ; replaces compiler-files
  135.             (boot s48-write-image))   ; replaces boot-files
  136.       build-files))
  137.  
  138. ; VM files
  139.  
  140. (define vm-files
  141.   '(
  142.     (rts defenum)
  143.     (vm s48-prescheme)
  144.     (vm util)
  145.     (vm macros)
  146.     
  147.     (vm memory)
  148.     (vm data)
  149.     (vm struct)
  150.     (vm vmio)
  151.     (vm init)
  152.     (vm gc)
  153.  
  154.     (vm arch)
  155.     (vm istruct)
  156.     (vm stack)
  157.     (vm interp)
  158.     (vm prim)
  159.  
  160.     (vm resume)
  161.     ))
  162.  
  163. (define vm-debug-files
  164.   '(
  165.     (vm s48-debug)
  166.     (vm transport)
  167.     (vm debug)
  168.     ))
  169.  
  170. ; The extra-files define optional features that are loaded after
  171. ; startup.  The system is pretty useless without the first 5 of these
  172. ; (command through debuginfo).
  173.  
  174. (define extra-files
  175.   '((misc command)      ;Command processor
  176.  
  177.     (rts defenum)       ; (arch.scm needs)
  178.     (rts arch)        ; (disclosers.scm needs)
  179.     (misc disclosers)   ;Make error messages be more informative
  180.     (misc debuginfo)    ;Defines read-debug-info
  181.  
  182.     (misc debug)        ;Debugging commands: trace, preview, etc.
  183.     (misc inspect)      ;Data structure inspector
  184.     (misc disasm)       ;Disassembler 
  185.     (misc pack)        ;Package system support
  186.  
  187.     (rts xnum)          ;Support for extended numbers
  188.     (rts bignum)        ;Bignum arithmetic - slow but faithful
  189.     (rts ratnum)        ;Rationals
  190.     (rts recnum)        ;Complex numbers (such as they are)
  191.     ))
  192.  
  193. (define thread-files 
  194.   '((misc queue)    ;FIFO queues
  195.     (misc compose-cont) ;Subprimitive used by threads implementation
  196.     (misc thread)    ;Multitasking
  197.     (misc sleep)    ;Multitasking
  198.     ))
  199.  
  200. (define misc-files
  201.   '(
  202.     (boot p-features)   ;Can replace s48-features.scm
  203.     (boot t-features)   ;Can replace s48-features.scm
  204.     (boot p-record)     ;Can replace s48-record.scm
  205.     (boot t-record)     ;Can replace s48-record.scm
  206.     (boot record)    ;Can replace s48-record.scm
  207.     (boot testsys)    ;For making a tiny image that says hello
  208.     (boot little)    ;For making a tiny read-eval-print loop
  209.     (boot package-defs) ;Package setup for for-debugging.scm
  210.     (boot for-debugging) ;For debugging new runtime systems
  211.  
  212.     (misc package-defs) ;Package setup for things in misc directory
  213.     (misc assem)        ;An assembler
  214.     (misc sort)         ;Online merge sort, thanks to Bob Nix and T project
  215.     (misc random)       ;Random number generator, thanks to T project
  216.     (misc pp)           ;Pretty-printer (internally ugly)
  217.     (misc sicp)        ;Structure & Interpretation compatibility
  218.     (misc tokenize)     ;Read tables (used by pratt.scm)
  219.     (misc pratt)    ;Pratt parser (infix), thanks to Paradigm
  220.     (misc sgol)        ;Sample use of Pratt parser
  221.     (misc sgol-runtime) ;Goes with sgol
  222.     (misc icon)        ;backtracking example
  223.  
  224.     (misc wind-test)    ;Just a test for dynamic-wind
  225.     (misc traverse)    ;Storage leak debugger
  226.  
  227.     ;; Richard's stuff
  228.     (boot byte-code-test)
  229.     (misc bigbit)       ;Bignum bitwise operators
  230.     (misc defrecord)
  231.     (misc xport)        ;Extended port framework
  232.     (misc new-ports)
  233.     (misc format)
  234.     (misc values)       ;Multiple values
  235.  
  236.     (vm load)
  237.     (vm debug-util)
  238.     (vm heap-stack)
  239.     ))
  240.  
  241.  
  242. ; Script: load the Scheme48 linker.
  243.  
  244. (define (load-linker)
  245.   (load-compiler)
  246.   (for-each load-file linker-files)
  247.   (no-value))
  248.  
  249. (define (load-compiler)  ;load compiler only
  250.   (for-each load-file compiler-files)
  251.   (no-value))
  252.  
  253. ; Script: link a Scheme48 system image.
  254.  
  255. (define (link-system)
  256.   (set! *the-system* #f)  ;free up space for GC
  257.   (set! *the-system*
  258.     (make-system (map (lambda (n) (namestring n 'scm))
  259.               rts-files)
  260.              '(usual-resumer bare)
  261.              '#t))
  262.   (write-system *the-system* (namestring system-image-file))
  263.   (write-debug-info (namestring '(boot system debug)))
  264.   (no-value))
  265. (define *the-system* #f)
  266.  
  267. (define (link-little)
  268.   (set! *the-system*
  269.     (make-system (map (lambda (n) (namestring n 'scm))
  270.               (append arch-files
  271.                   base-files
  272.                   rts-files-1
  273.                   '((boot little))))
  274.              '(usual-resumer little)
  275.              '#t))
  276.   (write-system *the-system* (namestring '(boot little image))))
  277.  
  278.  
  279.  
  280. ; Convert a namelist '(foo bar) into a string "foo/bar.scm"
  281.  
  282. ; This is Unix-specific, unfortunately.  I guess that's unavoidable.
  283.  
  284. (define (namestring namelist . maybe-default-type)
  285.   (let* ((default-type (if (null? maybe-default-type)
  286.                *default-default-file-type*
  287.                (car maybe-default-type)))
  288.      (type (if (null? (cddr namelist))
  289.            default-type
  290.            (caddr namelist))))
  291.     (string-append *scheme48-file-prefix*
  292.            (namestring-component (car namelist))
  293.            "/"
  294.            (namestring-component (cadr namelist))
  295.            (if type
  296.                (string-append "."
  297.                       (namestring-component type))
  298.                ""))))
  299.  
  300. (define (namestring-component x)
  301.   (cond ((string? x) x)
  302.     ((symbol? x)
  303.      (list->string (map char-downcase
  304.                 (string->list (symbol->string x)))))
  305.     (else (error "bogus namelist component" x))))
  306.  
  307. ; (write-makefile "~/s48/Makefile.filenames")
  308. ;  or  % make Makefile.filenames
  309.  
  310. (define (write-makefile target)
  311.   (set! *scheme48-file-prefix* "")      ;?
  312.   (call-with-output-file target
  313.     (lambda (port)
  314.       (display "#### Do not edit this file.  Edit files.scm instead. ####"
  315.            port)
  316.       (newline port)
  317.       (newline port)
  318.       (let* ((all-files '())
  319.          (foo (lambda (var files)
  320.            (display var port)
  321.            (display " = " port)
  322.            (for-each (lambda (file)
  323.                    (if (not (member file all-files))
  324.                    (set! all-files (cons file all-files)))
  325.                    (display (namestring file 'scm) port)
  326.                    (display " " port))
  327.                  files)
  328.            (newline port))))
  329.     (foo "SYSTEM_IMAGE" (list system-image-file))
  330.     ;; The following is a kludge to prevent boot/system.image from going
  331.     ;; into the distribution.
  332.     (set! all-files '())
  333.     (foo "RTSFILES" rts-files)
  334.     (foo "COMPILERFILES" compiler-files)
  335.     (foo "LINKERFILES" linker-files)
  336.     (foo "QUICKLYFILES" quickly-files)
  337.     (foo "EXTRAFILES" extra-files)
  338.     (foo "OTHERFILES" (append vm-files
  339.                   vm-debug-files
  340.                   thread-files
  341.                   misc-files))
  342.     (foo "ALLFILES" (reverse all-files))))))
  343.