[mcclim-devel] support for clisp (1)

Bruno Haible bruno at clisp.org
Sat Dec 18 14:16:24 UTC 2004


Hi,

Appended you find patches for supporting clisp.

Part 1 of the patches are the obvious portability things. It should be
uncontroversial and adds two files INSTALL.CLISP and Lisp-Dep/fix-clisp.lisp.


diff -r -c3 mcclim.orig/Apps/Listener/dev-commands.lisp mcclim/Apps/Listener/dev-commands.lisp
*** mcclim.orig/Apps/Listener/dev-commands.lisp	2004-10-18 08:30:37.000000000 +0200
--- mcclim/Apps/Listener/dev-commands.lisp	2004-12-18 02:47:15.000000000 +0100
***************
*** 617,625 ****
  (defun x-specializer-direct-generic-functions (specializer)  ;; FIXME - move to CLIM-MOP
    #+PCL (pcl::specializer-direct-generic-functions specializer)
    #+SBCL (sb-pcl::specializer-direct-generic-functions specializer)
    #+openmcl-partial-mop
    (openmcl-mop:specializer-direct-generic-functions specializer)
!   #-(or PCL SBCL openmcl-partial-mop)
    (error "Sorry, not supported in your CL implementation. See the function X-SPECIALIZER-DIRECT-GENERIC-FUNCTION if you are interested in fixing this."))
  
  (defun class-funcs (class)
--- 617,626 ----
  (defun x-specializer-direct-generic-functions (specializer)  ;; FIXME - move to CLIM-MOP
    #+PCL (pcl::specializer-direct-generic-functions specializer)
    #+SBCL (sb-pcl::specializer-direct-generic-functions specializer)
+   #+clisp (clos:specializer-direct-generic-functions specializer)
    #+openmcl-partial-mop
    (openmcl-mop:specializer-direct-generic-functions specializer)
!   #-(or PCL SBCL clisp openmcl-partial-mop)
    (error "Sorry, not supported in your CL implementation. See the function X-SPECIALIZER-DIRECT-GENERIC-FUNCTION if you are interested in fixing this."))
  
  (defun class-funcs (class)
***************
*** 890,896 ****
    ;; hash table capacity
    #+cmu  (values (lisp::internal-symbol-count package))
    #+sbcl (values (sb-int:package-internal-symbol-count package))
!   #-(or cmu sbcl) (portable-internal-symbol-count package))
  
  (defun portable-external-symbol-count (package)
    (let ((n 0))
--- 891,898 ----
    ;; hash table capacity
    #+cmu  (values (lisp::internal-symbol-count package))
    #+sbcl (values (sb-int:package-internal-symbol-count package))
!   #+clisp (svref (sys::%record-ref *package* 1) 2)
!   #-(or cmu sbcl clisp) (portable-internal-symbol-count package))
  
  (defun portable-external-symbol-count (package)
    (let ((n 0))
***************
*** 903,909 ****
    "Return the number of external symbols in PACKAGE."
    #+cmu  (values (lisp::external-symbol-count package))
    #+sbcl (values (sb-int:package-external-symbol-count package))
!   #-(or cmu sbcl) (portable-external-symbol-count package))
  
  (defun package-grapher (stream package inferior-fun)
    "Draw package hierarchy graphs for `Show Package Users' and `Show Used Packages'."
--- 905,912 ----
    "Return the number of external symbols in PACKAGE."
    #+cmu  (values (lisp::external-symbol-count package))
    #+sbcl (values (sb-int:package-external-symbol-count package))
!   #+clisp (svref (sys::%record-ref *package* 0) 2)
!   #-(or cmu sbcl clisp) (portable-external-symbol-count package))
  
  (defun package-grapher (stream package inferior-fun)
    "Draw package hierarchy graphs for `Show Package Users' and `Show Used Packages'."
diff -r -c3 mcclim.orig/Apps/Listener/listener.lisp mcclim/Apps/Listener/listener.lisp
*** mcclim.orig/Apps/Listener/listener.lisp	2004-11-15 08:07:26.000000000 +0100
--- mcclim/Apps/Listener/listener.lisp	2004-12-18 02:48:55.000000000 +0100
***************
*** 64,70 ****
                     #+sbcl  (sb-kernel:dynamic-usage)
                     #+lispworks (getf (system:room-values) :total-allocated)
  		   #+openmcl (+ (ccl::%usedbytes) (ccl::%freebytes))
!                    #-(or cmu sbcl lispworks openmcl) 0))
      (with-text-family (T :serif)
        (formatting-table (T :x-spacing '(3 :character))
          (formatting-row (T)                        
--- 64,71 ----
                     #+sbcl  (sb-kernel:dynamic-usage)
                     #+lispworks (getf (system:room-values) :total-allocated)
  		   #+openmcl (+ (ccl::%usedbytes) (ccl::%freebytes))
!                    #+clisp (values (sys::%room))
!                    #-(or cmu sbcl lispworks openmcl clisp) 0))
      (with-text-family (T :serif)
        (formatting-table (T :x-spacing '(3 :character))
          (formatting-row (T)                        
diff -r -c3 mcclim.orig/Apps/Listener/util.lisp mcclim/Apps/Listener/util.lisp
*** mcclim.orig/Apps/Listener/util.lisp	2004-07-23 14:36:45.000000000 +0200
--- mcclim/Apps/Listener/util.lisp	2004-12-18 02:54:51.000000000 +0100
***************
*** 64,75 ****
--- 64,77 ----
     #+sbcl (sb-ext:posix-getenv var)
     #+lispworks (lw:environment-variable var)
     #+openmcl (ccl::getenv var)
+    #+clisp (ext:getenv var)
     nil))
  
  ;; Need to strip filename/type/version from directory?.. FIXME?
  (defun change-directory (pathname)
    "Ensure that the current directory seen by RUN-PROGRAM has changed, and update *default-pathname-defaults*"
    #+CMU (unix:unix-chdir (namestring pathname))
+   #+clisp (ext:cd pathname)
    ; SBCL FIXME?
   (setf *default-pathname-defaults* pathname))
  
***************
*** 154,161 ****
                 :shell-type "/bin/sh"
                 :output-stream output
                 :wait wait)
  
!   #-(or CMU SBCL lispworks)
    (format T "~&Sorry, don't know how to run programs in your CL.~%"))
  
  ;;;; CLIM/UI utilities
--- 156,164 ----
                 :shell-type "/bin/sh"
                 :output-stream output
                 :wait wait)
+   #+clisp (ext:run-program program :arguments args :wait wait)
  
!   #-(or CMU SBCL lispworks clisp)
    (format T "~&Sorry, don't know how to run programs in your CL.~%"))
  
  ;;;; CLIM/UI utilities
diff -r -c3 mcclim.orig/README mcclim/README
*** mcclim.orig/README	2003-11-12 00:45:15.000000000 +0100
--- mcclim/README	2004-12-18 01:19:07.000000000 +0100
***************
*** 2,9 ****
  
  This is McCLIM, an implementation of the "Common Lisp Interface
  Manager CLIM II Specification." It currently works on X Windows using
! CLX. It works with CMUCL, SBCL, OpenMCL, Allegro CL and LispWorks. The
! INSTALL files in this directory give instructions for each Lisp
  implementation. Release notes for each release of McCLIM are in the
  ReleaseNotes directory.
  
--- 2,9 ----
  
  This is McCLIM, an implementation of the "Common Lisp Interface
  Manager CLIM II Specification." It currently works on X Windows using
! CLX. It works with CMUCL, SBCL, CLISP, OpenMCL, Allegro CL and LispWorks.
! The INSTALL files in this directory give instructions for each Lisp
  implementation. Release notes for each release of McCLIM are in the
  ReleaseNotes directory.
  
diff -r -c3 mcclim.orig/describe.lisp mcclim/describe.lisp
*** mcclim.orig/describe.lisp	2004-11-15 05:47:41.000000000 +0100
--- mcclim/describe.lisp	2004-12-18 01:22:07.000000000 +0100
***************
*** 70,76 ****
      (let ((arglist #+excl (excl:arglist (symbol-function thing))
                     #+cmu (kernel:%function-arglist (symbol-function thing))
                     #+sbcl (sb-kernel:%simple-fun-arglist (symbol-function thing))
!                    #-(or excl cmu sbcl) "( ??? )"))
        (when arglist
          (clim:present arglist
                        (clim:presentation-type-of arglist)
--- 70,77 ----
      (let ((arglist #+excl (excl:arglist (symbol-function thing))
                     #+cmu (kernel:%function-arglist (symbol-function thing))
                     #+sbcl (sb-kernel:%simple-fun-arglist (symbol-function thing))
!                    #+clisp (ext:arglist (symbol-function thing))
!                    #-(or excl cmu sbcl clisp) "( ??? )"))
        (when arglist
          (clim:present arglist
                        (clim:presentation-type-of arglist)
diff -r -c3 mcclim.orig/package.lisp mcclim/package.lisp
*** mcclim.orig/package.lisp	2004-12-07 05:49:51.000000000 +0100
--- mcclim/package.lisp	2004-12-18 01:40:42.000000000 +0100
***************
*** 185,193 ****
             #:with-standard-io-syntax #:write #:write-byte #:write-char #:write-line #:write-sequence
             #:write-string #:write-to-string #:y-or-n-p #:yes-or-no-p #:zerop))
          (packages
-          #+clisp  '(:common-lisp :clos)
           #+gcl    '(:lisp :pcl)
!          #-(or clisp gcl) '(:common-lisp))
          (gray-symbols
           '(#:fundamental-stream
             #:fundamental-input-stream
--- 185,192 ----
             #:with-standard-io-syntax #:write #:write-byte #:write-char #:write-line #:write-sequence
             #:write-string #:write-to-string #:y-or-n-p #:yes-or-no-p #:zerop))
          (packages
           #+gcl    '(:lisp :pcl)
!          #-(or gcl) '(:common-lisp))
          (gray-symbols
           '(#:fundamental-stream
             #:fundamental-input-stream
***************
*** 218,224 ****
             #:stream-read-byte
             #:stream-write-byte ))
          (gray-packages
!          `(#+clisp                 ,@'(:lisp)
             #+cmu                   ,@'(:ext)
  	   #+mcl                   ,@'(:ccl)
             #+allegro               ,@'(:common-lisp :excl :stream)
--- 217,223 ----
             #:stream-read-byte
             #:stream-write-byte ))
          (gray-packages
!          `(#+clisp                 ,@'(:gray)
             #+cmu                   ,@'(:ext)
  	   #+mcl                   ,@'(:ccl)
             #+allegro               ,@'(:common-lisp :excl :stream)
diff -r -c3 mcclim.orig/system.lisp mcclim/system.lisp
*** mcclim.orig/system.lisp	2004-12-07 05:49:51.000000000 +0100
--- mcclim/system.lisp	2004-12-18 01:36:56.000000000 +0100
***************
*** 81,86 ****
--- 81,87 ----
    #+sbcl      "Lisp-Dep/fix-sbcl"
    #+openmcl   "Lisp-Dep/fix-openmcl"
    #+lispworks "Lisp-Dep/fix-lispworks"
+   #+clisp     "Lisp-Dep/fix-clisp"
    "package")
  
  (clim-defsystem (:clim-core :depends-on (:clim-lisp))
diff -r -c3 mcclim.orig/utils.lisp mcclim/utils.lisp
*** mcclim.orig/utils.lisp	2004-10-06 14:03:56.000000000 +0200
--- mcclim/utils.lisp	2004-12-18 01:46:28.000000000 +0100
***************
*** 22,28 ****
  (defun get-environment-variable (string)
    #+excl (sys:getenv string)
    #+cmu (cdr (assoc string ext:*environment-list* :test #'string=))
!   #+clisp (sys::getenv (string string))
    #+sbcl (sb-ext::posix-getenv string)
    #+openmcl (ccl::getenv string)
    #+lispworks (lw:environment-variable string)
--- 22,28 ----
  (defun get-environment-variable (string)
    #+excl (sys:getenv string)
    #+cmu (cdr (assoc string ext:*environment-list* :test #'string=))
!   #+clisp (ext:getenv (string string))
    #+sbcl (sb-ext::posix-getenv string)
    #+openmcl (ccl::getenv string)
    #+lispworks (lw:environment-variable string)
*** /dev/null	2003-09-23 19:59:22.000000000 +0200
--- mcclim/INSTALL.CLISP	2004-12-18 11:37:30.000000000 +0100
***************
*** 0 ****
--- 1,54 ----
+ Install instructions for GNU CLISP
+ ----------------------------------
+ 
+ 1. Get clisp-20041218 or newer. Build it with option --with-module=clx/mit-clx.
+ 
+ 2. Get a copy of the ASDF package. Compile it:
+      $ clisp -c $ASDF/asdf.lisp
+ 
+ 3. Start
+      $ clisp -K full -i $ASDF/asdf.fas -i system.lisp
+ 
+ 4. Load the system (which will also compile it):
+ 
+    > (asdf:operate 'asdf:load-op :clim)          ;; Build CLIM
+    > (asdf:operate 'asdf:load-op :clim-clx)      ;; Build a backend
+    > (asdf:operate 'asdf:load-op :clim-examples)
+ 
+    The first two steps can be done in one step with the :clim-clx-user target:
+      (asdf:operate 'asdf:load-op :clim-clx-user)
+ 
+ 5. At a later date, after everything is compiled, load the compiled system:
+ 
+    > (asdf:operate 'asdf:load-op :clim)          ;; Load CLIM
+    > (asdf:operate 'asdf:load-op :clim-clx)      ;; Load backend
+ 
+ 
+ Running the demos
+ -----------------
+ 
+ 1. Run the calculator demo
+ 
+    (clim-demo::calculator)
+ 
+    This demo is self-explanatory.
+ 
+    When you get tired of it, hit Ctrl-C in the Lisp listener.
+ 
+ 2. Run the menu demo
+ 
+    (menutest::menutest)
+ 
+    This demo is self-explanatory.
+ 
+    When you get tired of it, hit Ctrl-C in the Lisp listener.
+ 
+ 3. Run the slider demo
+ 
+    (clim-demo::colorslider)
+ 
+    You should see three sliders on the left and a color area on the right. 
+    Use the three sliders to adjust RGB values to obtain a color.
+ 
+    When you get tired of it - you know...
+ 
*** /dev/null	2003-09-23 19:59:22.000000000 +0200
--- mcclim/Lisp-Dep/fix-clisp.lisp	2004-12-18 02:04:36.000000000 +0100
***************
*** 0 ****
--- 1,20 ----
+ (defpackage #:clim-mop
+   (:use #:clos))
+ 
+ (eval-when (:compile-toplevel :load-toplevel :execute)
+   (loop for sym being the symbols of :clim-mop
+      do (export sym :clim-mop)))
+ 
+ ;; CLIM expects INPUT-STREAM-P to be a generic function.
+ (unless (typep #'input-stream-p 'generic-function)
+   (setf (fdefinition 'gray::original-input-stream-p) #'input-stream-p)
+   (fmakunbound 'input-stream-p)
+   (defgeneric input-stream-p (stream)
+     (:method ((stream stream)) (gray::original-input-stream-p stream))))
+ 
+ ;; CLIM expects OUTPUT-STREAM-P to be a generic function.
+ (unless (typep #'output-stream-p 'generic-function)
+   (setf (fdefinition 'gray::original-output-stream-p) #'output-stream-p)
+   (fmakunbound 'output-stream-p)
+   (defgeneric output-stream-p (stream)
+     (:method ((stream stream)) (gray::original-output-stream-p stream))))




More information about the mcclim-devel mailing list