Lisp Knowledgebase

Title: CLOCC fixes for LispWorks

ID: 17059


Product: LispWorks
Version: 5.1
OS: All

Description: The following changes make CLOCC [http://clocc.sourceforge.net/ snapshot (02/05/2007) or CVS (20/08/2008 )] compile in LispWorks 5.1.

1. A function relies on recursive reading by #. which LispWorks does
not support. Apply this change.

Index: src/cllib/fileio.lisp
===================================================================
RCS file: /cvsroot/clocc/clocc/src/cllib/fileio.lisp,v
retrieving revision 1.48
diff -u -r1.48 fileio.lisp
--- src/cllib/fileio.lisp 16 Jun 2008 16:02:32 -0000 1.48
+++ src/cllib/fileio.lisp 27 Aug 2008 12:32:53 -0000
@@ -67,7 +67,7 @@
                (read-sequence buf in)))
         (beg (+ (or (search #1="-*-" buf :end2 len)
                     #2=(return-from file-header-alist nil))
-                 #.(length #1#))))
+                 (length #1#))))
    (mapcar (lambda (pair-string)
              (let ((pos (or (position #\: pair-string)
                             (error "~S: invalid header ~S"




2. Similar to 1. Apply this change.

Index: src/cllib/url.lisp
===================================================================
RCS file: /cvsroot/clocc/clocc/src/cllib/url.lisp,v
retrieving revision 2.60
diff -u -r2.60 url.lisp
--- src/cllib/url.lisp 24 Aug 2006 02:29:16 -0000 2.60
+++ src/cllib/url.lisp 27 Aug 2008 12:13:07 -0000
@@ -118,7 +118,7 @@
    (check-type proxy-string string)
    (let* ((start (if (string-equal #1="http://" proxy-string
                                    :end2 (min (length proxy-string)
-                                               #2=#.(length #1#)))
+                                               #2=(length #1#)))
                      #2# 0))
           (at (position #\@ proxy-string :start start))
           (colon (position #\: proxy-string :start (or at start))))




3. mp:claim-lock and mp:release-lock were superseded by
mp:process-lock and mp:process-unlock in LispWorks 5.1. Apply this
change.

Index: src/port/proc.lisp
===================================================================
RCS file: /cvsroot/clocc/clocc/src/port/proc.lisp,v
retrieving revision 1.17
diff -u -r1.17 proc.lisp
--- src/port/proc.lisp 23 May 2005 15:18:15 -0000 1.17
+++ src/port/proc.lisp 27 Aug 2008 12:13:44 -0000
@@ -442,7 +442,7 @@
  #+CMU        (mp::lock-wait lock (mp:process-whostate mp:*current-process*))
  #+CormanLisp FIXME
  #+Genera     FIXME
-  #+LispWorks  (mp:claim-lock lock)
+  #+LispWorks  (mp:process-lock lock)
  #+Lucid      (lcl:process-lock lock)
  #+(and MCL (not OpenMCL))        (ccl:process-enqueue lock)
  #+OpenMCL    (ccl:grab-lock lock)
@@ -455,7 +455,7 @@
  #+CMU        (setf (mp::lock-process lock) nil)
  #+CormanLisp FIXME
  #+Genera     FIXME
-  #+LispWorks  (mp:release-lock lock)
+  #+LispWorks  (mp:process-unlock lock)
  #+Lucid      (lcl:process-unlock lock)
  #+(and MCL (not OpenMCL))        (ccl:process-dequeue lock)
  #+OpenMCL    (ccl:release-lock lock)




4. A bug in LispWorks 5.1 prevents compiling an access to a structure
slot type that is not defined. This bug will be fixed in LispWorks
6.0, but the code can be made to work in earlier versions simply by defining
the TABLE structure earlier.

Incidentally, the slot type specifier (or nil table) is incorrect,
should be (or null table). Not sure if actually causes a problem.

Apply this change to fix both these issues.

Index: src/cllib/data.lisp
===================================================================
RCS file: /cvsroot/clocc/clocc/src/cllib/data.lisp,v
retrieving revision 1.48
diff -u -r1.48 data.lisp
--- src/cllib/data.lisp 21 Jun 2007 14:01:19 -0000 1.48
+++ src/cllib/data.lisp 27 Aug 2008 12:13:07 -0000
@@ -143,9 +143,15 @@
                  drop-count len (/ (* 1d2 drop-count) len))))
      (values lines (- len drop-count)))))

+(defstruct table
+  (path "" :type (or string pathname)) ; file containing the table
+  (lines () :type (or list integer)) ; lines or line count
+  (stats () :type list)              ; of stat-column
+  (names #() :type vector))          ; of column names
+
;; TABLE is defined later; this should not be a problem in ANSI CL
(defstruct (stat-column (:conc-name sc-))
-  (table nil :type (or nil table))
+  (table nil :type (or null table))
  (pos 0 :type index-t)
  (name "" :type string)
  (mdl +bad-mdl+ :type mdl)
@@ -206,11 +212,6 @@
                    *levels*))
      (format out " ~F~:{ [~F:~A]~}" (sc-median sc) (sc-levels sc)))))


-(defstruct table
-  (path "" :type (or string pathname)) ; file containing the table
-  (lines () :type (or list integer)) ; lines or line count
-  (stats () :type list)              ; of stat-column
-  (names #() :type vector))          ; of column names
(defun table-lines$ (table)
  "Return the number of lines in the TABLE."
  (let ((lines (table-lines table)))




5. Lastly, all modern versions of LispWorks have HCL:GET-WORKING-DIRECTORY so its worth
applying this change.

Index: src/defsystem-3.x/defsystem.lisp
===================================================================
RCS file: /cvsroot/clocc/clocc/src/defsystem-3.x/defsystem.lisp,v
retrieving revision 1.105
diff -u -r1.105 defsystem.lisp
--- src/defsystem-3.x/defsystem.lisp 1 Jul 2007 21:51:02 -0000 1.105
+++ src/defsystem-3.x/defsystem.lisp 27 Aug 2008 12:13:10 -0000
@@ -1281,23 +1281,7 @@
    ;; Somehow it is better to qualify default-directory in CMU with
    ;; the appropriate package (i.e. "EXTENSIONS".)
    ;; Same for Allegro.
-    #+(and :lispworks (not :lispworks4) (not :lispworks5))
-    ,(multiple-value-bind (major minor)
-  #-:lispworks-personal-edition
-  (system::lispworks-version)
-  #+:lispworks-personal-edition
-  (values system::*major-version-number*
-  system::*minor-version-number*)
-       (if (or (> major 3)
-       (and (= major 3) (> minor 2))
-       (and (= major 3) (= minor 2)
-    (equal (lisp-implementation-version) "3.2.1")))
-   `(make-pathname :directory
-   ,(find-symbol "*CURRENT-WORKING-DIRECTORY*"

- (find-package "SYSTEM")))
-           (find-symbol "*CURRENT-WORKING-DIRECTORY*"
-                        (find-package "LW"))))
-    #+(or :lispworks4 :lispworks5)
+    #+:lispworks
    (hcl:get-working-directory)
    ;; Home directory
    #-sbcl

See Also:
Workaround:
Patch:

Hardware:N/A
Summary:
Bug#:
Patch Enhancement#:
Reported:

Company     Contact     Privacy Policy     Terms of Use