;;; -*- mode: scheme; scheme48-package: (exec) -*- ;;;;;; SLIME for Scheme48 ;;;;;; Load script ;;; This code is written by Taylor Campbell and placed in the Public ;;; Domain. All warranties are disclaimed. (config '(run (define-structure swank-versions (export swank-version) (open scheme handle i/o filenames) (begin (define (swank-version) the-swank-version) (define the-swank-version (call-with-current-continuation (lambda (exit) (with-handler (lambda (condition propagate) condition propagate ;ignore (exit #f)) (lambda () (call-with-input-file (translate "=slime48/ChangeLog") (lambda (port) (let* ((date-length (string-length "YYYY-MM-DD")) (date (make-string date-length)) (count (read-block date 0 date-length port))) (and (= count date-length) date))))))))))))) (config '(load "=slime48/defrectype.scm" "=slime48/interfaces.scm" "=slime48/packages.scm")) ;;; Get rid of Scheme48's crap of a SRFI 35 implementation. (new-package) (open 'exceptions-internal 'vm-exceptions) (run '(begin (initialize-vm-exceptions! really-signal-condition) #t)) ; Don't print what INITIALIZE-VM-EXCEPTIONS! returns. (user) ;;; Fix BREAKPOINT. (in 'debugging '(run (define (breakpoint . args) (command-loop (cons 'breakpoint args))))) ;;; Load the Swank back end, and create a top-level wrapper in a new ;;; package. (load-package 'swank-rpc) (config '(structure swank-structures (export scheme module-system built-in-structures swank-rpc))) (in 'package-commands-internal '(structure config-package (export config-package))) ;;; Set up the #. reader macro so that presentations can work. This ;;; should be done in a better way, e.g. MIT Scheme's #@n device. It ;;; should also really not affect the reader globally, but Scheme48 ;;; unfortunately has a very primitive reader with no customizable ;;; readtable mechanism or anything. If there were one, or if one be ;;; introduced, this global hack should be replaced by something that ;;; uses it. (new-package) (open 'reading 'swank-structures 'packages) (run '(define-sharp-macro #\. (lambda (char port) (read-char port) (eval (read port) (structure-package swank-rpc))))) (user) (config '(run (define-interface slime48-interface (export make-slime48-world spawn-slime48-session serve-one-slime48-session spawn-slime48-tcp-server )))) (config '(run (define-structure slime48 slime48-interface (open scheme receiving srfi-2 ;and-let* threads threads-internal placeholders (subset i/o (force-output)) (subset i/o-internal (call-with-current-output-port call-with-current-input-port periodically-force-output!)) string-i/o silly ;reverse-list->string restarting handle simple-conditions simple-signals vm-exceptions (subset architecture (enum op exception)) locations templates (subset packages (structure-package package-lookup)) (subset bindings (binding-place)) (subset disclosers (location-name)) swank-structures config-package swank-worlds swank-sessions swank-i/o swank-tcp-servers swank-sldb swank-logging ) (optimize auto-integrate) ;; Not sure whether the =slime48/ is necessary. (files =slime48/top)))) (define (slime48-start single-session? . port-opt) (in 'SLIME48 `(RUN (BEGIN (DEFINE SLIME48-WORLD (MAKE-SLIME48-WORLD ',(user interaction-environment))) ,@(cond (single-session? `((DEFINE SLIME48-SESSION (SPAWN-SLIME48-SESSION SLIME48-WORLD)) (SERVE-ONE-SLIME48-SESSION SLIME48-SESSION ,@port-opt))) (else `((DEFINE CLOSE-SLIME48 (SPAWN-SLIME48-TCP-SERVER SLIME48-WORLD ,@port-opt)))))))))