[zip-devel] Porting to clisp

Surendra Singhi efuzzyone at netscape.net
Sun Jun 5 08:11:54 UTC 2005


Hello,
  I feel that the zip utility should be extended to clisp too.
Below are some patches which will help in that direction. Please comment on
them. 


Index: package.lisp
===================================================================
RCS file: /project/zip/cvsroot/zip/package.lisp,v
retrieving revision 1.2
diff -u -r1.2 package.lisp
--- package.lisp	5 Apr 2005 15:04:33 -0000	1.2
+++ package.lisp	5 Jun 2005 07:39:14 -0000
@@ -26,9 +26,14 @@
   #-allegro
   (:import-from #+sbcl :sb-gray
                 #+lispworks :stream
-                #-(or sbcl lispworks) ...
+		#+clisp :gray
+                #-(or sbcl lispworks clisp) ...
                 #:fundamental-binary-output-stream
-                #:stream-write-sequence
+		#+clisp #:stream-write-byte-sequence
+                #+(or sbcl lispworks) #:stream-write-sequence
                 #:fundamental-binary-input-stream
                 #:stream-read-byte
-                #:stream-read-sequence))
+		#+clisp #:stream-read-byte-sequence
+                #+(or sbcl lispworks) #:stream-read-sequence
+		)
+  )




Index: gray.lisp
===================================================================
RCS file: /project/zip/cvsroot/zip/gray.lisp,v
retrieving revision 1.2
diff -u -r1.2 gray.lisp
--- gray.lisp	5 Apr 2005 15:44:54 -0000	1.2
+++ gray.lisp	5 Jun 2005 08:08:18 -0000
@@ -7,12 +7,20 @@
 (defmethod stream-write-sequence
     #+sbcl ((stream buffer-output-stream) seq &optional (start 0) end)
     #+lispworks ((stream buffer-output-stream) seq start end)
-    #-(or sbcl lispworks) ...
+    #-(or sbcl lispworks clisp) ...
   (replace (buf stream)
 	   :start1 (pos stream)
 	   :start2 start
 	   :end2 end))
 
+#+(clisp)
+(defmethod stream-write-byte-sequence
+    ((stream buffer-output-stream) seq &optional (start 0) end no-hang)
+      (replace (buf stream)
+	   :start1 (pos stream)
+	   :start2 start
+	   :end2 end))
+
 (defun make-buffer-output-stream (outbuf)
   (make-instance 'buffer-output-stream :buf outbuf))
 
@@ -31,7 +39,21 @@
 (defmethod stream-read-sequence
     #+sbcl ((s truncating-stream) seq &optional (start 0) (end (length seq)))
     #+lispworks ((s truncating-stream) seq start end)
-    #-(or sbcl lispworks) ...
+    #-(or sbcl lispworks clisp) ...
+  (let* ((n (- end start))
+	 (max (- (size s) (pos s)))
+	 (result
+	  (read-sequence (input-handle s)
+			 seq
+			 :start start
+			 :end (+ start (min n max)))))
+    (incf (pos s) (- result start))
+    result))
+
+
+#+(clisp)
+(defmethod stream-read-byte-sequence


A new file on the lines of sbcl.lisp, acl.lisp may be needed for clisp, but at
present I don't understand them and cannot modify. Please help in porting this
package to clisp.

Thanks.
-- 
Surendra Singhi
http://www.public.asu.edu/~sksinghi/index.htm

Great wits are sure to madness near allied,
And thin partitions do their bounds divide.

   (John Dryden, Absalom and Achitophel, 1681)




More information about the zip-devel mailing list