[Openmcl-devel] Re: Status of Cocoa under Tiger?

Gary Byers gb at clozure.com
Sat May 14 15:39:03 PDT 2005



On Sat, 14 May 2005, Gary Byers wrote:

>
>
> On Sat, 14 May 2005, Tord Kallqvist Romstad wrote:
>> 
>> However, there is a problem when I try to load a NIB file using a
>> subclass of NSWindowController.  It seems that the outlets of my
>> window controller object are not initialized correctly.  When the NIB
>> file is loaded and the window is displayed on the screen, all the
>> outlets contain the value #<A Null Mac Pointer>, even though the
>> outlets are connected to user interface objects in the NIB file.
>> 
>> I added a small example to Bosco's source code in order to illustrate
>> the problem:
>> 
>> http://www.math.uio.no/~romstad/bosco-0.6.1.tar.gz
>
> I probably won't have time to look at this for at least a few days.
>
> If anyone does have time and interest to look into it, the thing that's
> probably most worth looking at is whether the ObjC class created by
> DEFCLASS has it ObjC instance variables in the right place(s) and with
> the right (ObjC) names.
>
> Following that advice: I just looked at the function %MAKE-OBJC-IVARS
> (in "ccl:examples;objc-clos.lisp").   The form:
>
>
> 	  (setq offset
>                (ash (foreign-direct-slot-definition-offset dslotd) 3))
>
> looks like it should be:
>
> 	  (setq offset
>                (ash (foreign-direct-slot-definition-offset dslotd) -3))
>
> (the lisp FOREIGN-DIRECT-SLOT-DEFINITION's OFFSET field contains a bit
> offset; the ObjC ivar's :objc_ivar.ivar_offset wants a byte offset,
> and even though it's about 5:30 AM, I'm pretty sure that you divide by
> 8 (shift right by 3) rather than multiply to convert a bit offset to a
> byte offset.)

With the benefit of several hours' sleep, I can now definitively say
that dividing (right-shifting) would work a lot better than multiplying
(left-shifting) in this case.  If ObjC's notion of the byte offset
of an instance variable is completely wrong, that would certainly
explain why loading a .nib doesn't correctly connect update outlets
and connections (but may update random memory locations a few dozen/
a few hundred bytes away.)

If this change doesn't totally fix the problem, please remind me in
a few days; I obviously want to get this stuff right (and finished),
but I want to change (and possibly break) a lot of other, unrelated
things first.



More information about the Openmcl-devel mailing list