--- Begin Message ---
- To: submit@bugs.debian.org
- Subject: cl-pdf: More loading problems
- From: "Robert J. Macomber" <robertm@rojoma.com>
- Date: Mon, 3 Mar 2003 08:29:19 -0700
- Message-id: <20030303152919.GA15873@argon.no-ip.com>
Package: cl-pdf
Version: 1.1.1b-1
cl-pdf again fails to load with a "compress" foreign symbol error. In
addition, once that is passed, the chart.x86f load stumbles on a bug
in font.lisp. Included is a patch that fixes both problems. Verified
that it works for the cl-pdf example functions on cmucl-normal, acl,
and sbcl, within the limits of Lisp memory allegro trial edition
allows or cmucl-limits on the MAKE-ALIEN call.
The patch for the compress-loading problem is unfortunately one of the
"it works but I don't know why" sort; cmucl (or perhaps uffi-on-cmucl)
seems extraordinarily picky about how foreign code is loaded.
Random Obligatory Bug Report Stuff:
cl-pdf 1.1.1b-1
cmucl-normal 3.1.7
acl-installer 6.2.18
sbcl 0.7.13-1
cl-uffi 1.2.7-1
libc6 2.3.1-14
zlib1g-dev 1.1.4-10
kernel-image-2.4.20 custom.1.0
---- Begin patch ----
diff -ru cl-pdf.orig/config.lisp cl-pdf/config.lisp
--- cl-pdf.orig/config.lisp 2003-03-03 07:59:40.000000000 -0700
+++ cl-pdf/config.lisp 2003-03-03 08:04:27.000000000 -0700
@@ -18,8 +18,7 @@
(defvar *compress-streams* t
"Enables the internal streams compression by zlib")
-(defvar *zlib-search-paths* '("/usr/local/lib/" "/usr/lib/")
- "The paths where to search the zlib shared library")
+;; Note: *zlib-search-paths* is in zlib.lisp.
(defparameter *afm-files-directories* `(#P"/usr/share/fonts/afms/adobe/" #P"/usr/lib/afm/"
,@(when *load-pathname*
diff -ru cl-pdf.orig/font.lisp cl-pdf/font.lisp
--- cl-pdf.orig/font.lisp 2003-03-03 07:59:40.000000000 -0700
+++ cl-pdf/font.lisp 2003-03-03 08:04:27.000000000 -0700
@@ -18,7 +18,7 @@
(font-metrics :accessor font-metrics)
(widths :accessor widths :initform (make-array 256 :initial-element 0 :element-type '(signed-byte 16)))
(kernings :accessor kernings :initform (make-array 256 :initial-element nil))
- (characters :accessor characters :initform (make-array 256))))
+ (characters :accessor characters :initform (make-array 256 :initial-element nil))))
(defmethod initialize-instance :after ((font font) &rest init-options &key &allow-other-keys)
(let ((font-metrics (gethash (name font) *font-metrics*)))
diff -ru cl-pdf.orig/zlib.lisp cl-pdf/zlib.lisp
--- cl-pdf.orig/zlib.lisp 2003-03-03 07:59:40.000000000 -0700
+++ cl-pdf/zlib.lisp 2003-03-03 08:04:27.000000000 -0700
@@ -6,7 +6,13 @@
;Adapted from an UFFI example
-(eval-when (:load-toplevel)
+(eval-when (:compile-toplevel :load-toplevel :execute)
+
+;; CMUCL desperately wants this *here*, not in config.lisp, or it
+;; won't load the compiled file. Putting it in an eval-when in
+;; config.lisp doesn't work either.
+(defvar *zlib-search-paths* '("/usr/local/lib/" "/usr/lib/")
+ "The paths where to search the zlib shared library")
(defparameter *zlib-path*
#-(or macosx darwin)
@@ -29,18 +35,20 @@
(push :zlib cl:*features*))
(t
(warn "Unable to load zlib. Disabling compression.")
- (setf *compress-streams* nil)))
+ (setf *compress-streams* nil))))
+
+#+zlib (uffi:def-struct dummy ; Why is this necessary???
+ (dummy :int)) ; Without it, CMUCL doesn't load the library..
-(when (find :zlib cl:*features*)
- (uffi:def-function ("compress" c-compress)
- ((dest (* :unsigned-char))
- (destlen (* :long))
- (source :cstring)
- (source-len :long))
- :returning :int
- :module "zlib")
+#+zlib (uffi:def-function ("compress" c-compress)
+ ((dest (* :unsigned-char))
+ (destlen (* :long))
+ (source :cstring)
+ (source-len :long))
+ :returning :int
+ :module "zlib")
- (defun compress-string (source)
+#+zlib (defun compress-string (source)
"Returns two values: array of bytes containing the compressed data
and the numbe of compressed bytes"
(let* ((sourcelen (length source))
@@ -62,7 +70,7 @@
(error "zlib error, code ~D" result))
(progn
(uffi:free-foreign-object destlen)
- (uffi:free-foreign-object dest)))))))))
+ (uffi:free-foreign-object dest)))))))
#|
Unfinished Work!
---- End patch ----
--
Robert Macomber
robertm@rojoma.com
--- End Message ---