summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbuild-clisp-haskell.bash12
-rw-r--r--com/clisp/savesys.lisp40
2 files changed, 52 insertions, 0 deletions
diff --git a/build-clisp-haskell.bash b/build-clisp-haskell.bash
new file mode 100755
index 0000000..d6fc502
--- /dev/null
+++ b/build-clisp-haskell.bash
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+dirs="ast backend cfn cl-support com command-interface csys depend derived flic import-export parser prec
+ printers progs/prelude runtime support tdecl top type util"
+
+for dir in ${dirs}; do
+ mkdir -p $dir/clisp
+done
+
+export Y2=$PWD
+
+clisp com/clisp/savesys.lisp
diff --git a/com/clisp/savesys.lisp b/com/clisp/savesys.lisp
new file mode 100644
index 0000000..7010b03
--- /dev/null
+++ b/com/clisp/savesys.lisp
@@ -0,0 +1,40 @@
+(make-package "MUMBLE-IMPLEMENTATION")
+(load "cl-support/cl-init")
+
+;;; Set various internal switches to appropriate values for running
+;;; Haskell code.
+(proclaim '(optimize (speed 3) (safety 0) (compilation-speed 0)))
+(setf *compile-verbose* nil)
+(setf *load-verbose* nil)
+(in-package :mumble-user)
+(setf *printers* '(compiling loading))
+(setf *optimizers* '())
+(setf *compile-interface* '#f)
+
+;;; Load the prelude.
+(compile/load *prelude-unit-filename*)
+
+;;; Set up the saved system.
+(define *saved-readtable* (lisp:copy-readtable lisp:*readtable*))
+
+(define (haskell-toplevel)
+ ;; Saved system always starts up in USER package.
+ (setf lisp:*package* (lisp:find-package :mumble-user))
+ ;; Saved system seems to forget about our readtable hacks.
+ (setf lisp:*readtable* *saved-readtable*)
+ ;; Set printer variables w/implementation-defined initial values
+ ;; to known values
+ (setf *print-pretty* '#f)
+ (load-init-files)
+ (do () ('#f)
+ (cl:with-simple-restart (restart-haskell "Restart Haskell.")
+ (heval))))
+
+(define (restart-haskell)
+ (cl:invoke-restart 'restart-haskell))
+
+(ext:saveinitmem "bin/clisp-haskell"
+ :executable t
+ :quiet t
+ :init-function 'haskell-toplevel)
+(ext:exit)