[cl-pdf-devel] Writing binary data fails with SBCL
Wim Oudshoorn
woudshoo+cl-typesetting at xs4all.nl
Thu May 31 15:49:53 UTC 2007
For me every example in cl-typesetting failed with SBCL 1.0.2 because
SBCL does by default not open streams in such a way that binary data can
be written.
The relevant section in the SBCL documentation is:
9.1 Bivalent Streams
A bivalent stream can be used to read and write both character and
(unsigned-byte 8) values. A bivalent stream is created by calling open
with the argument :element-type :default. On such a stream, both binary
and character data can be read and written with the usual input and output
functions.
I fixed it by the following patch, although, keep in mind that I just
started to play
with common lisp so I hesitate to suggest it to do it this way.
*** cl-pdf/pdf.lisp Tue Jan 3 17:01:21 2006
--- ../asdf-source/cl-pdf/pdf.lisp Thu May 31 16:56:44 2007
***************
*** 528,535 ****
(format s "~%>>~%startxref~%~d~%%%EOF~%" startxref))))
(defmethod write-document ((filename pathname) &optional (document
*document*))
! (with-open-file (s filename :direction :output :if-exists :supersede
! :external-format +external-format+)
(write-document s document)))
(defmethod write-document ((filename string) &optional (document
*document*))
--- 528,536 ----
(format s "~%>>~%startxref~%~d~%%%EOF~%" startxref))))
(defmethod write-document ((filename pathname) &optional (document
*document*))
! (with-open-file (s filename :direction :output :if-exists :supersede
! #+sbcl :element-type #+sbcl :default
! :external-format +external-format+)
(write-document s document)))
(defmethod write-document ((filename string) &optional (document
*document*))
More information about the cl-pdf-devel
mailing list