From leigh at leighsmith.com Sun Feb 15 13:10:17 2009 From: leigh at leighsmith.com (Leigh Smith) Date: Sun, 15 Feb 2009 14:10:17 +0100 Subject: [cl-objc-devel] cl-objc-leopard patch and NSString bug? Message-ID: I notice cl-objc devel has been very quiet recently, I assume the project hasn't been superseded by another bridge? Looking back through the archives, I note that the protocol bug on 10.5 has been fixed and checked into cl-objc-leopard. That's great, except most developers wanting to access the code for the most recent version of MacOS X need to look in a different repository (cl-objc- leopard). Can I suggest we reverse the order so that the primary repository is for Leopard and the branch is for Tiger? Perhaps a new version should be released? There's a very small typo in cffi, that I've attached the patch for, below. Also, there seems to be a problem handling NSStrings, executing the following, crashes sbcl 1.0.24-i86: (in-package :cl-objc) (setf pool (invoke 'ns-autorelease-pool alloc)) (invoke pool init) (import-framework "Foundation") (setf my-string (invoke 'ns-string alloc)) (invoke my-string :init-with-utf8-string "blah blah") (invoke my-string utf8-string) ; This produces the following error message: * 2009-02-15 00:24:04.234 sbcl[1000:613] Did you forget to nest alloc and init? 2009-02-15 00:24:04.235 sbcl[1000:613] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -length only defined for abstract class. Define -[NSPlaceholderString length]!' 2009-02-15 00:24:04.236 sbcl[1000:613] Stack: ( (segfaults sbcl) To begin tracking this down, can I verify if someone else has the same error? It seems the NSPlaceholderString has no real NSString to refer to? darcs Patch below: Sun Feb 15 13:35:15 CET 2009 leigh at leighsmith.com * cffi corrected typo of format parameter. New patches: [cffi corrected typo of format parameter. leigh at leighsmith.com**20090215123515] hunk ./src/cffi.lisp 650 -Included Protocols: ~{~s~ ~} +Included Protocols: ~{~s ~} Context: [Fix to Support Leopard matley at muppetslab.org**20080520155547] [Documentation update matley at muppetslab.org**20071030000342] [TAG 1.0 matley at muppetslab.org**20071017011832] Patch bundle hash: 46559c82f5f87d3ab3a2440e44bd64abf4c4f850 Leigh -- Leigh M. Smith mailto:leigh at leighsmith.com http://www.leighsmith.com skype:aussieleighsmith From leigh at leighsmith.com Fri Feb 20 09:22:45 2009 From: leigh at leighsmith.com (Leigh Smith) Date: Fri, 20 Feb 2009 10:22:45 +0100 Subject: [cl-objc-devel] cl-objc-leopard patch and NSString bug? In-Reply-To: References: Message-ID: <50F4A2F8-20B5-45AB-8876-3F8C29BA4E85@leighsmith.com> Ok, I'm answering my own question because it was rather silly in the first place and because of the incredible amount of response I got :-) The code below crashes: (in-package :cl-objc) (setf pool (invoke 'ns-autorelease-pool alloc)) (invoke pool init) (setf my-string (invoke 'ns-string alloc)) (invoke my-string :init-with-utf8-string "blah blah") (invoke my-string utf8-string) Because, subtly, my-string assigned by alloc is different to what init- with-utf8-string returns. So I should have done: (setf my-string (invoke (invoke 'ns-string alloc) :init-with-utf8- string "blah blah")) (invoke my-string utf8-string) So using the result returned by :init-with-utf8-string then works fine, and I'm happy. Hope this helps someone. P.S. You will still need the patch I enclosed in the previous post to be able to build cl-objc, however. Leigh -- Leigh M. Smith mailto:leigh at leighsmith.com http://www.leighsmith.com skype:aussieleighsmith