[cxml-devel] questions - utf8-string-to-rod

Sean Champ gimmal at gmail.com
Wed Aug 16 17:24:52 UTC 2006


Hello,

While building CXML in SBCL 0.9.15, I'm noticing a warning from the
compiler. The warning is occurring about the following form in unparse.lisp

(defun utf8-string-to-rod (str)
  (let* ((bytes (map '(vector (unsigned-byte 8)) #'char-code str))
         (buffer (make-array (length bytes) :element-type '(unsigned-byte 16)))
         (n (decode-sequence :utf-8 bytes 0 (length bytes) buffer 0 0 nil))
         (result (make-array n :element-type 'rune)))
    (map-into result #'code-rune buffer)
    result))

The warnning is presented as so, in the REPL:

; in: DEFUN UTF8-STRING-TO-ROD
;     (MAP-INTO CXML::RESULT #'RUNES:CODE-RUNE CXML::BUFFER)
; --> DO BLOCK LET TAGBODY RETURN-FROM PROGN WHEN COND IF PROGN SETF
; ==>
;   (SB-KERNEL:%SET-FILL-POINTER SB-C::RESULT SB-INT:INDEX)
;
; caught WARNING:
;   Asserted type ARRAY conflicts with derived type
;   (VALUES (SIMPLE-ARRAY CHARACTER (*)) &OPTIONAL).
;   See also:
;     The SBCL Manual, Node "Handling of Types"

I can work around that that warning occurs, certainly -- just telling ASDF to
treat the file as if it was compiled "all oakiedoke".

I can expect that that warning will occur, every time when I will compile
unparse.lisp in SBCL. It would be convenient if that would not be a concern

I had thought i might be able to resolve that that warning is occurring. It
appears that I cannot.

I am stumped about why that warning is occurring. I hope that someone more
familiar with the CXML code might know how that warning may occur.


Now, maybe the issue will be moot.

Upon consideration of the UTF8-STRING-TO-ROD operation -- thinking that I
have understood the operations of the present form of that function, correctly
-- considering it, in the context of an #+SB-UNICODE host : I would like to
inquire, would the IDENTITY function not suffice? I mean, would it not
suffice as the sole executor for the body of UTF8-STRING-TO-ROD -- as when
the  form would be compiled a host in host in which the feature
:RUNE-IS-CHARACTER is defined.

Please correct me, if I have misunderstood: That the function
UTF8-STRING-TO-ROD, when compiled in an SB-UNICODE host, would translate a
string to a string?


With courtesy,

--
Sean Champ



More information about the cxml-devel mailing list