[Openmcl-devel] same foreign object?
bhyde at pobox.com
Sat Jan 30 22:50:12 UTC 2010
Thanks. And since eql works on ccl::foreign-standard-objects as well;
it can be usefule on the cocoa bridge objects.
ccl> (defmacro application-native-menubar () `(slot-value (slot-value
*application* 'ccl::ui-object) 'ns:_main-menu))
ccl> (type-of (application-native-menubar))
ccl> (typep (application-native-menubar) 'foreign-standard-object)
ccl> (eq (application-native-menubar) (application-native-menubar))
ccl> (eql (application-native-menubar) (application-native-menubar))
On Jan 30, 2010, at 11:13 AM, Gail Zacharias wrote:
> EQL compares unboxed macptr's.
> ? (eql (%int-to-ptr 123) (%int-to-ptr 123))
> On Sat, Jan 30, 2010 at 10:19 AM, Ben Hyde <bhyde at pobox.com> wrote:
>> I could use a bit of critique here. No doubt I am confused on many
>> many different levels, but I think I need something like this.
>> (in-package :ccl)
>> (defmethod same-foreign-object ((a foreign-standard-object) (b
>> (flet ((raw-addr (x)
>> (let* ((p (%null-ptr)))
>> (%set-macptr-domain p 1)
>> (%setf-macptr p x)
>> (ccl:%ptr-to-int p))))
>> (eq (raw-addr a) (raw-addr b))))
>> This came up because I wanted to toggle the IDE's menubar back and
>> forth between my App's menubar and the IDE's one. That lead to a
>> desire to squirrel away the current menubar. See that (slot-value
>> (slot-value *application* 'ccl::ui-object) 'ns:_main-menu)) boxes; so
>> eq tests don't work out. Diving into the objective c bridge leads
>> finding that ns-object is based on foreign-standard-object. That
>> addr code is entirely adhoc -- based on something I saw in the
>> Openmcl-devel mailing list
>> Openmcl-devel at clozure.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Openmcl-devel