cl-rw

Layered streams for Common Lisp
git clone https://logand.com/git/cl-rw.git/
Log | Files | Refs

commit 05b035aca3bd5a96b9e42a415e39e955d7388d43
parent e4f4f7c05a099c380cdf558eab956a590e0f5a57
Author: Tomas Hlavaty <tom@logand.com>
Date:   Sun, 21 Sep 2014 12:26:36 +0200

ecl portability

Diffstat:
Mder.lisp | 16++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/der.lisp b/der.lisp @@ -41,16 +41,28 @@ ;; http://serverfault.com/questions/9708/what-is-a-pem-file-and-how-does-it-differ-from-other-openssl-generated-key-file (defun octets-to-utf8-string (x) - #-(or ccl sbcl) + #-(or ecl ccl sbcl) (error "TODO port RW.DER::OCTETS-TO-UTF8-STRING") + #+ecl + (let ((s (ext:make-sequence-input-stream x :external-format :utf-8))) + (coerce (rw:till (rw:peek-reader (rw:char-reader s)) nil nil nil) 'string)) #+ccl (ccl:decode-string-from-octets x :external-format :utf-8) #+sbcl (sb-ext:octets-to-string x :external-format :utf-8)) (defun utf8-string-to-octets (x) - #-(or ccl sbcl) + #-(or ecl ccl sbcl) (error "TODO port RW.DER::UTF8-STRING-TO-OCTETS") + #+ecl + (let ((z (make-array 42 + :adjustable t + :fill-pointer 0 + :element-type '(unsigned-byte 8) + :initial-element 0))) + (write-string x + (ext:make-sequence-output-stream z :external-format :utf-8)) + z) #+ccl (ccl:encode-string-to-octets x :external-format :utf-8) #+sbcl