<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Thanks, next time I'll look in the mail archive first.<div><br></div><div>If you're changing the examples, there are other small errors in this load nibfile example. The text leading up to the final version uses the constant "#&NSTopLevelObjects" instead of "#&NSNibTopLevelObjects" (although that is corrected in the final version of the code). And the function load-nibfile as shown in the example and in the example file ".../ccl/examples/cocoa/nib-loading/load-nibfile.lisp" will not work as given. The object/key pairs passed to dictionaryWithObjectsAndKeys: must be null-terminated or you get an objective C runtime exception. I don't know if this is a result of changes made in the objective C methods since this was written or something else, but a version that works for me and is a bit safer is:</div><div><br></div><div><div>(defun load-nibfile (nib-path)</div><div>  (let* ((app (#/sharedApplication ns:ns-application))</div><div>         (app-zone (#/zone app))</div><div>         (nib-name (%make-nsstring (namestring nib-path)))</div><div>         (objects-array (#/arrayWithCapacity: ns:ns-mutable-array 16))</div><div>         (toplevel-objects (list))</div><div>         (dict (#/dictionaryWithObjectsAndKeys: ns:ns-mutable-dictionary</div><div>                app #@"NSNibOwner"</div><div>                objects-array #&NSNibTopLevelObjects</div><div>                (%null-ptr)))</div><div>         (result (#/loadNibFile:externalNameTable:withZone: ns:ns-bundle</div><div>                                                            nib-name</div><div>                                                            dict</div><div>                                                            app-zone)))</div><div>    (when result</div><div>      (dotimes (i (#/count objects-array))</div><div>        (setf toplevel-objects </div><div>              (cons (#/objectAtIndex: objects-array i)</div><div>                    toplevel-objects))))</div><div>    (#/release nib-name)</div><div>    (#/release dict)</div><div>    (#/release objects-array)</div><div>    (values toplevel-objects result)))</div><div><br></div><div><br></div><div><div>On Apr 27, 2009, at 12:22 PM, R. Matthew Emerson wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Instead of (@class ns-mutable-array), you can just write ns:ns-mutable-array, e.g.,<div><br></div><div><div><div><div>(let* ((my-array (#/arrayWithCapacity: ns:ns-mutable-array 10)))</div><div>  (...))</div><div><br></div><div>See also:</div><div><a href="http://clozure.com/pipermail/openmcl-devel/2009-March/009009.html">http://clozure.com/pipermail/openmcl-devel/2009-March/009009.html</a></div><div><br></div><div>This needs to be fixed, obviously, but the @class thing is sort of obsolete usage, so nobody's really taken a look.  I will see about updating the example as soon as I can.</div><div><br></div><div><br></div><div>On Apr 27, 2009, at 12:31 PM, Paul Krueger wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">I recently upgraded to: Clozure Common Lisp Version 1.3-r11966M  (DarwinPPC32).<div><br></div><div>I'm trying to run through the NIB loading examples as described in the file: ".../ccl/examples/cocoa/nib-loading/HOWTO.html". I did NOT try these on any previous release. Part of one of the examples does the following while in the ccl package:</div><div><br></div><div><pre><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px; white-space: normal;">? (setf *my-dict* 
        (#/dictionaryWithObject:forKey: (@class ns-mutable-dictionary) 
        *my-app* #@"NSNibOwner"))</span></font></pre><pre><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px; white-space: normal;">When I do this I get the following:</span></font></pre><pre><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px; white-space: normal;">> Error: Unknown type specifier: (@METACLASS "NSMutableDictionary") </span></font></pre><pre><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px; white-space: normal;">> While executing: %%TYPEP, in process Listener(6).</span></font></pre><pre><span class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; white-space: normal; ">Investigating further I did:</span></pre><pre><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px; white-space: normal;"><pre><pre><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="white-space: normal;">? (macroexpand-1 '(@class ns-mutable-dictionary)) </span></font></pre><pre><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="white-space: normal;">(THE (@METACLASS "NSMutableDictionary") (%OBJC-CLASS-CLASSPTR #S(OBJC-CLASS-DESCRIPTOR :NAME "NSMutableDictionary" :CLASSPTR #<OBJC:OBJC-CLASS NS:NS-MUTABLE-DICTIONARY (#xA015289C)>))) </span></font></pre><pre><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="white-space: normal;">T</span></font></pre><pre><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="white-space: normal;">So clearly the class was found and it's the @METACLASS type assertion that is causing the problem (just as the first error message said). I just bypassed the type declaration and got the example to work just fine.</span></font></pre><pre><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="white-space: normal;">The @class macro seems to be used in several places, so I hunted all over to see if I could discover how (@metaclass  ...) should have been turned into a valid type specifier, but couldn't find it. The closest I came was the function "get-objc-class-from-declaration" which as near as I can tell is only called in one place that didn't seem to be relevant to all the different ways that @class is used, but maybe I missed something there.</span></font></pre><pre><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="white-space: normal;">Can anyone clarify for me whether the example should have worked as written and if so what might be wrong? How does the @class macro defined in objc-runtime.lisp ever work?</span></font></pre><pre><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="white-space: normal;"><br></span></font></pre><pre><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="white-space: normal;">Thanks, Paul</span></font></pre></pre></span></font></pre></div></div>_______________________________________________<br>Openmcl-devel mailing list<br><a href="mailto:Openmcl-devel@clozure.com">Openmcl-devel@clozure.com</a><br><a href="http://clozure.com/mailman/listinfo/openmcl-devel">http://clozure.com/mailman/listinfo/openmcl-devel</a><br></blockquote></div><br></div></div></div></blockquote></div><br></div></body></html>