[cxml-devel] ... and another

Marco Antoniotti marcoxa at cs.nyu.edu
Fri Apr 22 14:04:28 UTC 2011


Thanks...


On Apr 22, 2011, at 05:08 , David Lichteblau wrote:

> Quoting Marco Antoniotti (marcoxa at cs.nyu.edu):
>> 
>> On Apr 21, 2011, at 16:54 , David Lichteblau wrote:
>> 
>>> Quoting Marco Antoniotti (marcoxa at cs.nyu.edu):
>>>> Always on LWM.  I assume this has to do with UNICODE or not support, but the example in the docs is misleading.
>>>> 
>>>> 
>>>> CL-USER 37 > (defparameter *source* (cxml:make-source "<example>text</example>"))
>>> 
>>> That example should work in any implementation with Unicode support.
>>> 
>>> Backtrace?
>>> Value of *features*?
>>> 
>> 
>> 
>> Here they are.  I suspect that LWM does not support UNICODE.
> 
> It supports Unicode, but LispWorks has slighly weird subtypes of
> CHARACTER, and sometimes code insists on one subtype over the other.
> 
> In this case, I'm afraid the argument to MAKE-SOURCE needs to be a
> string made up of LW:SIMPLE-CHAR rather than CHARACTER.
> 
> Things to try:
> 
> ;; returns T on other Lisps, but might go wrong on LispWorks:
> (typep "<example>text</example>" '(vector runes:rune))

NIL



> 
> ;; possible workaroud
> (cxml:make-source (coerce "<example>text</example>"
>                          '(simple-array runes:rune)))

CL-USER 14 > (cxml:make-source (coerce "<example>text</example>"
                                       '(simple-array runes:rune)))

Error: Cannot coerce "<example>text</example>" to type (SIMPLE-ARRAY RUNES:RUNE).
  1 (abort) Return to level 0.
  2 Return to top loop level 0.

Type :b for backtrace or :c <option number> to proceed.
Type :bug-form "<subject>" for a bug report template or :? for other options.

CL-USER 15 : 1 > :b
Call to ERROR
Call to COERCE
Call to EVAL
Call to CAPI::CAPI-TOP-LEVEL-FUNCTION
Call to CAPI::INTERACTIVE-PANE-TOP-LOOP
Call to MP::PROCESS-SG-FUNCTION

CL-USER 16 : 1 > 


> 
> Sorry about that, but I gave up on trying to fix all of these little
> issues related to lw:simple-char a long time ago.  We have to assume
> lw:simple-char at some point (for a presumably good reason which I can't
> recall any more), and then that assumption trickles down.
> 
> So: "the example works in any implementation with Unicode support [IF
> the object behind the printed representation of the string has the right
> shape]".  Not ideal, I admit that.


Ok.

What about adding something along the lines of the following in "closure-common/characters.lisp"?

(eval-when (:load-toplevel :compile-toplevel :execute)
    (unless (eq *default-character-element-type* 'lw:simple-char)
      (cerror "Set the default sting character element type to LW:SIMPLE-CHAR."
              "The current default character element type is ~A." *default-character-element-type*)
      (set-default-character-element-type 'lw:simple-char))))

Going over the LW mailing list archives it appears that the above would work, provided that the set-default-character-element-type call is the only one in the image.

I am also bugging the LW folks on this.  

Cheers
--
Marco



--
Marco Antoniotti


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cxml-devel/attachments/20110422/3839e546/attachment.html>


More information about the cxml-devel mailing list