[Openmcl-devel] same foreign object?
gz at clozure.com
Sat Jan 30 08:13:27 PST 2010
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 foreign-
> (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 to
> finding that ns-object is based on foreign-standard-object. That raw-
> addr code is entirely adhoc -- based on something I saw in the bridge.
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
More information about the Openmcl-devel