[Openmcl-devel] Trying to use AddressBook

Ralph Richard Cook ralphc at bellsouth.net
Fri Nov 4 21:41:32 PST 2005


The cfstring- calls got it. I'm now doing everything I wanted to do.
Thanks for the help.


On Nov 4, 2005, at 1:31 AM, Gary Byers wrote:

>
>
> On Fri, 4 Nov 2005, Ralph Richard Cook wrote:
>
>
>> Getting there. I'm now able to get to the ABAddressBook class and  
>> send messages to it, etc.
>> The AddressBook framework uses pointers to constant NSStrings for  
>> some properties, such as this, defined in ABGlobals.h
>>
>> extern NSString * const kABFirstNameProperty;             // First  
>> name - kABStringProperty
>>
>
> That declaration means that kABFirstNameProperty is a variable with
> the "const" attribute.  That's somewhat different from someting  
> defined
> with #define or enum.
>
> You should be able to access the value of this variable with the
> #& reader macro, as in:
>
> #&kABFirstNameProperty
>
> That'll probably print as an anonymous MACPTR.  To get the type system
> to recognize it, we have to do still more work (after loading a new
> ObjC library) to identify the address ranges associated with object
> file sections that might contain static instances.
>
>   [... elided code for loading a framework or library ...]
>   (ccl::reset-cfstring-sections)
>   (ccl::find-cfstring-sections)
>   (ccl::reset-objc-class-count)
>   (ccl::map-objc-classes)
>   (whatever-else-im-forgetting)
>
>
>
>>
>> The #$ reader macro doesn't work on these, as it does with numeric  
>> properties, for example #$kABMultiDateProperty, and I don't think  
>> I can get to the string directly so I could copy it with a #@""  
>> reader macro.
>>
>>
>
> It's also worth noting that there's a difference between
>
> ? #@"FOO"
> #<NS-CONSTANT-STRING "FOO" (#x107080)>
> ? (ccl::%make-nsstring "FOO")
> #<NS-MUTABLE-STRING "FOO" (#x1E42D0)>
>
> (The latter's likely to actually be an instance of the ObjC NSCFString
> class.  Even though that ObjC class is docmented and somewhat public,
> it's not actually declared in the Cocoa header files, and the type
> system recognizes it as an instance of a declared superclass of  
> NSCFString.)
>




More information about the Openmcl-devel mailing list