[cl-pdf-devel] patch for contrib/zlib-clisp.lisp

Yaroslav Kavenchuk kavenchuk at jenty.by
Thu Nov 17 11:52:06 UTC 2005


at clisp there is module "zlib"

zlib-clisp.diff
=======================================
--- zlib-clisp.lisp.orig	Mon Oct 10 11:36:10 2005
+++ zlib-clisp.lisp	Thu Nov 17 11:22:30 2005
@@ -35,6 +35,7 @@

 #-CLISP (error "This code should be loaded in CLISP.")

+#-:zlib
 (use-package "FFI")

 #|
@@ -49,6 +50,7 @@
   (:return-type ffi:int))
 |#

+#-:zlib
 (defvar *zlib-path*
   (or #+WIN32 "zlib.dll"
       ;; TODO how to deal with cygwin (#+UNIX on MS-Windows)? -- it
wants zlib.dll
@@ -58,7 +60,9 @@
   "Set this variable to point to the location of the zlib library
 (libz.so or zlib.dll) on your system.")

+#-:zlib
 (defvar *zlib*)
+#-:zlib
 (unless (and (boundp '*zlib*)
              (ffi:validp *zlib*))
   (setq *zlib* (user::foreign-library *zlib-path*)))
@@ -73,6 +77,7 @@
 ;; ffi:c-string (or ffi:c-array-ptr character), since it receives the
 ;; buffer length as an extra argument.

+#-:zlib
 (ffi:def-lib-call-out zlib-compress-string *zlib*
   (:name "compress")
   (:arguments (dest ffi:c-pointer :in)
@@ -82,6 +87,7 @@
   (:return-type ffi:int)
   (:language :stdc))

+#-:zlib
 (defun compress-string (source)
   "Compress the string SOURCE. Returns an array of bytes
 representing the compressed data."
@@ -97,6 +103,8 @@
             (ffi:offset dest 0 `(c-array uint8 ,actual))
           (error "zlib error, code ~d" status))))))

+#+:zlib
+(setf (symbol-function 'compress-string) #'zlib:compress)

 (defmethod write-object ((obj pdf-stream) &optional root-level &aux
compressed)
   #+(or Lispworks allegro CMU CLISP)
===========================================

Thanks!

-- 
WBR, Yaroslav Kavenchuk.



More information about the cl-pdf-devel mailing list