On Sat, 27 Aug 2011 17:32:26 +0200
Juan Jose Garcia-Ripoll <juanjose.garciarip...@googlemail.com> wrote:

>  - Implemented SEQUENCE-STREAMs, which are input/output streams defined on
> some
>    specialized array type. The functions to create them are
>      (ext:make-sequence-input-stream vector &key :start :end
> :external-format)
>      (ext:make-sequence-output-stream vector &key :external-format)

Awesome!

However when trying it I ran into a problem here, I'm not sure if I'm
missing something or if it's a bug:


(setf *bytes*
      (make-array 16
                  :element-type '(unsigned-byte 8)
                  :fill-pointer 0))
;;; -> #()

(with-open-stream
    (s (ext:make-sequence-output-stream *bytes*
                                        :external-format :utf-8))
  (write-string "Héhéhéhé~%" s)
  *bytes*)
;;; -> #(72 195 169 104 195 169 104 195 169 104 195 169 126 37) as expected

(with-open-stream
    (s (ext:make-sequence-input-stream *bytes*
                                       :external-format :utf-8))
  (read-line s))
;;; -> "HHHHHHHHHHHHHH" T       I would have expected   "Héhéhéhé
                                                        "


I then tried the inverse to convert the bytes back:


(setf *string*
               (make-array 16
                           :element-type 'character
                           :fill-pointer 0))
;;; -> ""

(with-open-stream
    (s (ext:make-sequence-output-stream *string*))
  (loop
     for b across *bytes*
     do
       (write-byte b s))
  *string*)

;;; -> Crashes SLIME (ECL remains running, but *STRING* contains illegal chars,
;;;    and (schar *string* <n>) can yield segmentation fault signals.
;;;     I also try with various settings of :external-format


Thanks,
-- 
Matt

------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management 
Up to 160% more powerful than alternatives and 25% more efficient. 
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________
Ecls-list mailing list
Ecls-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ecls-list

Reply via email to