[cl-typesetting-devel] zlib and CMUCL

Klaus Weidner klaus at atsec.com
Tue Apr 20 16:17:13 UTC 2004


On Tue, Apr 20, 2004 at 11:09:06AM +0200, Edi Weitz wrote:
> I'd prefer the UFFI approach (as a matter of policy). In this case
> it's just about load order and I think the version I proposed should
> work. (Maybe it also has to be conditionalized for SBCL.)
> 
> I'm currently quite busy so I don't have the time to test this myself,
> sorry.

Yes, your approach does work, and that's what my original patch did -
all that's needed is moving the def-function to zlib.c. See attached
patch.

That definitely works on CMUCL and SBCL, and if it doesn't break one of
the other supported platforms I'd suggest making this change.

I can't get cl-pdf to load on clisp at all, since that doesn't implement
uffi. Is there some way to conditionalize the .asd file on a feature, or
to recover gracefully from a missing component? 

Or maybe a separate cl-pdf-zlib.asd file, and keep all the zlib stuff out
of the default cl-pdf.asd?

A pure Lisp zlib would really be a good thing...

-Klaus
-------------- next part --------------
diff -urN orig/cl-pdf/init.lisp cl-pdf/init.lisp
--- orig/cl-pdf/init.lisp	Mon Feb  9 14:39:42 2004
+++ cl-pdf/init.lisp	Sat Apr 17 13:33:55 2004
@@ -23,13 +23,6 @@
 	    (uffi:load-foreign-library zlib-path
 				       :module "zlib" 
 				       :supporting-libraries '("c"))
-	    (uffi:def-function ("compress" c-compress)
-		((dest (* :unsigned-char))
-		 (destlen (* :long))
-		 (source :cstring)
-		 (source-len :long))
-	      :returning :int
-	      :module "zlib")
 	    (setf *zlib-loaded* t *compress-streams* t))
 	  (progn
 	    (warn "Unable to load zlib. Disabling compression.")
diff -urN orig/cl-pdf/zlib.lisp cl-pdf/zlib.lisp
--- orig/cl-pdf/zlib.lisp	Fri Jan 30 10:31:48 2004
+++ cl-pdf/zlib.lisp	Sat Apr 17 13:35:01 2004
@@ -6,6 +6,14 @@
 
 ;Adapted from an UFFI example
 
+(uffi:def-function ("compress" c-compress)
+    ((dest (* :unsigned-char))
+     (destlen (* :long))
+     (source :cstring)
+     (source-len :long))
+  :returning :int
+  :module "zlib")
+
 (defun compress-string (source)
   "Returns two values: array of bytes containing the compressed data
  and the numbe of compressed bytes"


More information about the cl-typesetting-devel mailing list