[cl-pdf-devel] switching to binary format

Dmitriy Ivanov divanov at aha.ru
Fri Mar 18 15:37:32 UTC 2005


Hello Marc,

|> BTW, I have just updated my contribution di-pdf.lisp at lisp.ystok.ru.
| 
| OK from a first look you are still using write-string and format on the
| binary stream. I don't think this will work on other implementations.

No wonder - the code is LispWorks biased. I always
- open files with :element-type '(unsigned-byte 8);
- for non-base characters, invoke
    (write-byte  (ef:char-external-code char *pdf-code-page*)
                      *pdf-stream*));

- for base characters, invoke write-char or write-sequence, which are
accepted by LispWorks bivalent streams.

I suggest following these guidelines in pursuance of compatibility.

1. (deftype octet () '(unsigned-byte 8))

2. In CL-PDF code, use only write byte or write-sequence that is always
given an array of type (vector octet) as an argument.

3. To convert to (vector octet),
- either introduce a kind of write-pdf-string and format-pdf functions
- or use acl-compat.excl:string-to-octets explicitly.
--
Sincerely,
Dmitriy Ivanov
lisp.ystok.ru




More information about the cl-pdf-devel mailing list