home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
s
/
s48.zip
/
VM
/
RESUME.SCM
< prev
next >
Wrap
Text File
|
1992-06-17
|
2KB
|
56 lines
; -*- Mode: Scheme; Syntax: Scheme; Package: Scheme; -*-
; Copyright (c) 1992 by Richard Kelsey and Jonathan Rees. See file COPYING.
; This is file resume.scm.
;;;; Top level entry into Scheme48 system
; RESUME is the main entry point to the entire system, and the only
; routine that calls RUN-MACHINE other than for debugging purposes.
(define (resume filename startup-string)
(let* ((string-space (vm-string-size (string-length startup-string)))
(startup-proc (read-image filename string-space)))
(call-startup-procedure startup-proc startup-string)))
(define (call-startup-procedure startup-proc startup-string)
(clear-registers)
(push (enter-string startup-string)) ; get it in the heap so suspend will
; save it
(push (initial-input-port))
(push (initial-output-port))
(set! *nargs* 3)
(set! *val* startup-proc)
(run-machine (label perform-application)))
; Restartable version that the PreScheme compiler cannot deal with yet.
;(define (call-startup-procedure startup-proc startup-string)
; (clear-registers)
; (push (enter-string startup-string)) ; get it in the heap so suspend will
; ; save it
; (push (initial-input-port))
; (push (initial-output-port))
; (set! *code-pointer* (make-byte-vector 2))
; (byte-vector-set! *code-pointer* 0 op/call)
; (byte-vector-set! *code-pointer* 1 3) ; nargs
; (set! *val* startup-proc)
; (run-machine (label interpret)))
;(define (restart value)
; (set! *val* value)
; (run-machine (label interpret)))
; Used by RUN
(define (start-vm thunk)
(set! *val* thunk)
(set! *nargs* 0)
(set! *pending-interrupts* 0)
(run-machine perform-application)
*val*)
; (define (run x) (start-vm (make-closure (compile-form `(halt ,x) e) 'run)))
; (define write-instruction (access-scheme48 'write-instruction))