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>"))
Error: In = of (#< 254) arguments should be of type NUMBER. 1 (continue) Return a value to use. 2 Supply a new first argument. 3 (abort) Return to level 0. 4 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.
Cheers
-- Marco Antoniotti
Quoting Marco Antoniotti (marcoxa@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*?
d.
On Apr 21, 2011, at 16:54 , David Lichteblau wrote:
Quoting Marco Antoniotti (marcoxa@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.
CL-USER 2 > (defparameter *source* (cxml:make-source "<example>text</example>"))
Error: In = of (#< 254) arguments should be of type NUMBER. 1 (continue) Return a value to use. 2 Supply a new first argument. 3 (abort) Return to level 0. 4 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 3 : 1 > :b Call to ERROR Call to (METHOD RUNES::FIGURE-ENCODING (STREAM)) Call to RUNES:MAKE-XSTREAM Call to CXML:MAKE-SOURCE Call to LET Call to LET 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 4 : 1 > (pprint *features*)
(BABEL::UCS-2-CHARS :RUNE-IS-CHARACTER :RUNE-IS-UTF-16 :ASDF2 :ASDF :MK-DEFSYSTEM :COMMON-LISPWORKS :LW-EDITOR :CAPI-COCOA-LIB :CAPI-TOOLKIT :CAPI :DBCS-ENV :COCOA :UNIX-WITHOUT-MOTIF :COMMON-FFI :NEW-PATCH-SYSTEM :BYTE-INSTRUCTIONS :COMPILER :SHALLOW-BINDING :ANSI-CL :COMMON-LISP :IEEE-FLOATING-POINT :LISPWORKS :CLASS-SHAKE-USING-GATES :COMMON-DEFSYSTEM :CLOS :DBCS :UNICODE :NATIVE-THREADS :UNIX :HARLEQUIN-COMMON-LISP :LISPWORKS-32BIT :LATIN-1 :LISPWORKS6 :LISPWORKS6.0 :PTHREADS :DARWIN :MAC :MACOSX :APPLE ...)
CL-USER 5 : 1 >
Any idea about how to fix this?
-- Marco Antoniotti
Quoting Marco Antoniotti (marcoxa@cs.nyu.edu):
On Apr 21, 2011, at 16:54 , David Lichteblau wrote:
Quoting Marco Antoniotti (marcoxa@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))
;; possible workaroud (cxml:make-source (coerce "<example>text</example>" '(simple-array runes:rune)))
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.
d.
Thanks...
On Apr 22, 2011, at 05:08 , David Lichteblau wrote:
Quoting Marco Antoniotti (marcoxa@cs.nyu.edu):
On Apr 21, 2011, at 16:54 , David Lichteblau wrote:
Quoting Marco Antoniotti (marcoxa@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
On Apr 21, 2011, at 16:54 , David Lichteblau wrote:
Quoting Marco Antoniotti (marcoxa@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.
CL-USER 2 > (defparameter *source* (cxml:make-source "<example>text</example>"))
Error: In = of (#< 254) arguments should be of type NUMBER. 1 (continue) Return a value to use. 2 Supply a new first argument. 3 (abort) Return to level 0. 4 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 3 : 1 > :b Call to ERROR Call to (METHOD RUNES::FIGURE-ENCODING (STREAM)) Call to RUNES:MAKE-XSTREAM Call to CXML:MAKE-SOURCE Call to LET Call to LET 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 4 : 1 > (pprint *features*)
(BABEL::UCS-2-CHARS :RUNE-IS-CHARACTER :RUNE-IS-UTF-16 :ASDF2 :ASDF :MK-DEFSYSTEM :COMMON-LISPWORKS :LW-EDITOR :CAPI-COCOA-LIB :CAPI-TOOLKIT :CAPI :DBCS-ENV :COCOA :UNIX-WITHOUT-MOTIF :COMMON-FFI :NEW-PATCH-SYSTEM :BYTE-INSTRUCTIONS :COMPILER :SHALLOW-BINDING :ANSI-CL :COMMON-LISP :IEEE-FLOATING-POINT :LISPWORKS :CLASS-SHAKE-USING-GATES :COMMON-DEFSYSTEM :CLOS :DBCS :UNICODE :NATIVE-THREADS :UNIX :HARLEQUIN-COMMON-LISP :LISPWORKS-32BIT :LATIN-1 :LISPWORKS6 :LISPWORKS6.0 :PTHREADS :DARWIN :MAC :MACOSX :APPLE ...)
CL-USER 5 : 1 >
Any idea about how to fix this?
-- Marco Antoniotti