[Openmcl-devel] NSStrings
Paul D. Lathrop
plathrop at nmu.edu
Wed Mar 3 05:57:30 PST 2004
I am doing some work with the cocoa/objc bridge (for the Clotho
project) and I've come across some confusion involving passing a string
from the lisp to the objc runtime. What I am working on currently is
implementing a function that will swap the case of the current
selection. I am able to get the selection and change it's case. I am
then allocating an nsstring using the following form:
(ccl::%make-nsstring new-string)
new-string is the lispy form of the string I'm trying to send. The
problem is, when the string reaches the cocoa component I'm sending it
to, it has one character's worth of garbage appended to it. The lisp
doesn't see this garbage at all - it registers the nsstring as:
#<NS-CONSTANT-STRING "FOObarBAz" (#x155190)>
whereas, Cocoa gives me:
"FOObarBAz¨"
(note the extra char on the end). Am I missing a "proper" way of
accomplishing this? If not, what am I missing? The only clue I have
left is that the string I get *from* the objc runtime is:
#<NS-CF-STRING "fooBARbaZ" (#x160B50)>
Which is not what I am sending back. Could this be a problem? If it is,
how do I allocate the appropriate type of string? If I'm missing
something obvious, feel free to RTFM me.
Thanks,
Paul Lathrop
More information about the Openmcl-devel
mailing list