[Openmcl-devel] same foreign object?

Ben Hyde bhyde at pobox.com
Sat Jan 30 07:19:53 PST 2010


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- 
standard-object))
   (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.

Thoughts?



More information about the Openmcl-devel mailing list