Clozure CL bugs



Here are some patches for better Clozure CL support:

1) :toplevel-function in save-application does not work -- use command
line option in the maxima script instead
2) added the missing parts in server.lisp (checked with xmaxima and wxmaxima)
3) set ccl::**invoke-debugger-hook-on-interrupt* so that interrupting works
4) use builtin defsystem instead of lisp-utils/defsystem.lisp

Andrej

Index: Makefile.am
===================================================================
RCS file: /cvsroot/maxima/maxima/src/Makefile.am,v
retrieving revision 1.84
diff -u -r1.84 Makefile.am
--- Makefile.am	18 Feb 2009 17:51:36 -0000	1.84
+++ Makefile.am	30 Mar 2009 20:03:30 -0000
@@ -247,8 +247,8 @@
 openmcl:binary-openmcl/maxima.image

 binary-openmcl/maxima.image:
-	$(EXECUTEOPENMCL) '(progn $(LOADDEFSYSTEM) $(DEFSYSTEMCOMPILE)
(ccl::quit))' && \
-	$(EXECUTEOPENMCL) '(progn $(LOADDEFSYSTEM) $(DEFSYSTEMLOAD)
(ccl:save-application "binary-openmcl/maxima.image" :toplevel-function
(function cl-user::run)) (ccl::quit))'
+	$(EXECUTEOPENMCL) '(progn (require :defsystem)  $(DEFSYSTEMCOMPILE)
(ccl::quit))' && \
+	$(EXECUTEOPENMCL) '(progn (require :defsystem) $(DEFSYSTEMLOAD)
(ccl:save-application "binary-openmcl/maxima.image") (ccl::quit))'

 install-openmcl:
 	$(mkinstalldirs) "$(DESTDIR)$(verpkglibdir)/binary-openmcl"
Index: command-line.lisp
===================================================================
RCS file: /cvsroot/maxima/maxima/src/command-line.lisp,v
retrieving revision 1.10
diff -u -r1.10 command-line.lisp
--- command-line.lisp	29 Aug 2008 13:36:41 -0000	1.10
+++ command-line.lisp	30 Mar 2009 20:03:30 -0000
@@ -134,6 +134,7 @@

   #+lispworks (rest system:*line-arguments-list*)

-  #+openmcl
-  (rest (ccl::command-line-arguments))
+  #+openmcl (let ((result  (rest (ccl::command-line-arguments))))
+	      (do ((removed-arg nil (pop result)))
+		  ((or (equal removed-arg "--") (equal nil result)) result)))
   )
Index: init-cl.lisp
===================================================================
RCS file: /cvsroot/maxima/maxima/src/init-cl.lisp,v
retrieving revision 1.140
diff -u -r1.140 init-cl.lisp
--- init-cl.lisp	1 Mar 2009 17:56:32 -0000	1.140
+++ init-cl.lisp	30 Mar 2009 20:03:30 -0000
@@ -650,6 +650,7 @@
   (in-package :maxima)
   (setf *load-verbose* nil)
   (setf *debugger-hook* #'maxima-lisp-debugger)
+  #+ccl (setf ccl::*invoke-debugger-hook-on-interrupt* t)
   (let ((input-stream *standard-input*)
 	(batch-flag nil))
     #+allegro
Index: maxima.in
===================================================================
RCS file: /cvsroot/maxima/maxima/src/maxima.in,v
retrieving revision 1.28
diff -u -r1.28 maxima.in
--- maxima.in	29 Aug 2008 15:59:56 -0000	1.28
+++ maxima.in	30 Mar 2009 20:03:30 -0000
@@ -136,7 +136,7 @@
 elif [ "$MAXIMA_LISP" = "openmcl" ]; then
 # FIXME: arguments need in a manner consistent with the way they are extracted
 #        in the function get-application-args in command-line.lisp
-    exec "@OPENMCL_NAME@" -I "$maxima_image_base.image" "$arg1"
"$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+    exec "@OPENMCL_NAME@" -I "$maxima_image_base.image" -e
'(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6"
"$arg7" "$arg8" "$arg9"
 elif [ "$MAXIMA_LISP" = "ecl" ]; then
     exec "$maxima_image_base"  -- "$arg1" "$arg2" "$arg3" "$arg4"
"$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
 elif [ "$MAXIMA_LISP" = "sbcl" ]; then
Index: server.lisp
===================================================================
RCS file: /cvsroot/maxima/maxima/src/server.lisp,v
retrieving revision 1.18
diff -u -r1.18 server.lisp
--- server.lisp	18 Jan 2009 20:17:24 -0000	1.18
+++ server.lisp	30 Mar 2009 20:03:30 -0000
@@ -69,7 +69,8 @@
     #+lispworks (comm:open-tcp-stream host port :direction :io :element-type
                                       (if bin 'unsigned-byte 'base-char))
     #+ecl (si::open-client-stream host port)
-    #-(or allegro clisp cmu scl sbcl gcl lispworks ecl)
+    #+ccl (ccl::make-socket :remote-host host :remote-port port)
+    #-(or allegro clisp cmu scl sbcl gcl lispworks ecl ccl)
     (error 'not-implemented :proc (list 'open-socket host port bin))))


@@ -96,7 +97,8 @@
 #+openmcl (ccl::getpid)
 #+lispworks (system::getpid)
 #+ecl (si:getpid)
-#-(or clisp cmu scl sbcl gcl openmcl lispworks ecl) (getpid-from-environment)
+#+ccl (ccl::getpid)
+#-(or clisp cmu scl sbcl gcl openmcl lispworks ecl ccl)
(getpid-from-environment)
 )

 #+(or gcl clisp cmu scl sbcl lispworks ecl)