<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Mar 1, 2013, at 2:33 AM, mikel evins <<a href="mailto:mevins@me.com">mevins@me.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">I think it's worth mentioning a couple of things that are made possible by the CCL FFI, and that Gambit users might want to consider. <br><br>With CCL's FFI you can make Lisp classes whose superclasses are Objective-C classes. You can write Lisp methods for Objective-C functions (or, rather, "messages"). You can create instances of Objective-C classes some of whose instance variables are Lisp values, and vice-versa: instances of Lisp classes, some of whose slots are Objective-C values. As shown in the example, you can call Objective-C methods directly, and you can refer to Objective-C variables and constants directly.<br><br>Again, almost all of the infrastructure is generated automatically, using ffigen together with parsers written in Lisp.</blockquote><br></div><div>I thought I'd just see how hard it was to use the current version of ffigen to generate Cocoa headers, as I haven't done it in a while. It was pretty easy; it took less than 15 minutes from start to finish. The longest phase was downloading the large piece of ffigen.</div><div><br></div><div>I've done it before several times, though.</div><div><br></div><div>Actually generating ffi interfaces to Cocoa took three quarters of a second.</div><div><br></div><div>Here are a few randomly-chosen samples of the output of ffigen, for illustration:</div><div><br></div><div><div><font face="Monaco">(function ("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/objc/message.h" 223)</font></div><div><font face="Monaco"> "objc_msgSendv_stret"</font></div><div><font face="Monaco"> (function</font></div><div><font face="Monaco">  ((pointer (void ())) (typedef "id") (typedef "SEL") (typedef "size_t") (typedef "marg_list") )</font></div><div><font face="Monaco">  (void ())) (extern))</font></div><div><font face="Monaco"><br></font></div><div><font face="Monaco">(macro ("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/objc/runtime.h" 364) "_C_ID" "'@'")</font></div><div><font face="Monaco"><br></font></div><div><font face="Monaco"><div>(enum-ident ("" 0)</div><div> "OBJC_ASSOCIATION_ASSIGN" 0)</div><div>(enum-ident ("" 0)</div><div> "OBJC_ASSOCIATION_RETAIN_NONATOMIC" 1)</div><div>(enum-ident ("" 0)</div><div> "OBJC_ASSOCIATION_COPY_NONATOMIC" 3)</div><div>(enum-ident ("" 0)</div><div> "OBJC_ASSOCIATION_RETAIN" 769)</div><div>(enum-ident ("" 0)</div><div> "OBJC_ASSOCIATION_COPY" 771)</div><div><div><br></div><div>(struct ("" 0)</div><div> "Protocol"</div><div> (("isa" (field (typedef "Class") 0 8))))</div></div><div><br></div><div><div>(objc-instance-method ("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h" 158)</div><div> "NSObject"</div><div> ("NSDiscardableContentProxy")</div><div> "autoContentAccessingProxy"</div><div> ()</div><div> (typedef "id"))</div><div><br></div><div><div>(var ("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/objc/runtime.h" 593)</div><div> "_zoneAlloc"</div><div> (pointer (function</div><div>  ((typedef "Class") (typedef "size_t") (pointer (void ())) )</div><div>  (typedef "id"))) (extern))</div><div><br></div><div><br></div><div><br></div></div></div></font></div></div><div><font face="Monaco"><br></font></div><div><br></div><div><br></div><br></body></html>