From: Fredrik Tolf Date: Wed, 10 Mar 2010 04:00:58 +0000 (+0100) Subject: Added a constructor function for codec-character-streams. X-Git-Url: http://git.dolda2000.com/gitweb/?a=commitdiff_plain;ds=sidebyside;h=ebf1ccf75c98bbaf66b39e126d92aa43aaf255f3;p=lisp-utils.git Added a constructor function for codec-character-streams. --- diff --git a/charcode.lisp b/charcode.lisp index 2a051ae..68ef0de 100644 --- a/charcode.lisp +++ b/charcode.lisp @@ -5,6 +5,7 @@ (:use :cl #+sbcl :sb-gray #-sbcl :gray) (:export "MAKE-ENCODER" "MAKE-DECODER" "ENCODE-STRING" "DECODE-STRING" "CODING-ERROR" + "MAKE-CODEC-CHARACTER-STREAM" "LATIN-1" "LATIN1" "UTF-8" "UTF8")) (in-package :charcode) @@ -75,6 +76,10 @@ (read-pos :initform 0) (buffer :initform (make-array '(64) :element-type 'character :adjustable t :fill-pointer 0)))) +(defun make-codec-character-stream (real-stream charset) + (declare (type stream real-stream)) + (make-instance 'codec-character-stream :decoder (make-decoder charset) :encoder (make-encoder charset) :back real-stream)) + (defmethod close ((stream codec-character-stream) &key abort) (with-slots (back) stream (close back :abort abort))