[cl-pdf-devel] cl-pdf and cl-typesetting portability
Marc Battyani
marc.battyani at fractalconcept.com
Fri Sep 10 21:12:13 UTC 2004
"Andras Simon" <andras at renyi.hu> wrote:
>
> cl-pdf works now with abcl.
Great!
> > For instance I've been told that there are again some problems with the
zlib
> > FFI binding for SBCL and maybe CMUCL.
> > (This zlib FFI has proven to be the major annoyance.)
>
> No such problems with abcl, since it doesn't have an FFI at all.
> But it has Java. Sticking the following in at the end of zlib.lisp
>
> #+abcl
> (progn
> (defun compress-string (i-string)
> (let* ((i-string-bytes
> (java:jcall
> (java:jmethod "java.lang.String" "getBytes" "java.lang.String")
i-string "UTF-8"))
> (out-array (java:jnew (java:jconstructor
"java.io.ByteArrayOutputStream")))
> (compresser (java:jnew (java:jconstructor "java.util.zip.Deflater"
"int")
> (java:jfield "java.util.zip.Deflater" "BEST_COMPRESSION")))
> (defl-out-stream
> (java:jnew
> (java:jconstructor
> "java.util.zip.DeflaterOutputStream" "java.io.OutputStream"
"java.util.zip.Deflater")
> out-array compresser)))
> (java:jcall (java:jmethod "java.util.zip.Deflater" "setInput" "[B")
compresser i-string-bytes)
> (java:jcall (java:jmethod "java.util.zip.DeflaterOutputStream"
"close") defl-out-stream)
> (java:jcall (java:jmethod "java.io.ByteArrayOutputStream"
"toString") out-array)))
>
> (setf *compress-streams* t))
>
> provides compression.
Thanks, I will add this to cl-pdf.
Marc
More information about the cl-pdf-devel
mailing list