[Openmcl-devel] Specifying data types for calls via the Obj-C bridge with a variable number of arguments

Phil pbpublist at comcast.net
Sat Apr 28 06:06:12 UTC 2007


Ah... thanks!  Am I correct in assuming you meant (objc:send  
(objc:@class "NSString") :string-with-format #@"Testing: %@" (:id  
"one two three four")) as an example of using a Lisp string?  (i.e.  
it appears to work but seems a little weird as %@ is used in the  
format string.)

Thanks,
Phil

On Apr 28, 2007, at 1:59 AM, Gary Byers wrote:

>
> (objc:send (objc:@class "NSString") :string-with-format #@"Testing:  
> %@" (:id #@"one two three four"))
>
> (objc:send (objc:@class "NSString") :string-with-format #@"Testing:  
> %@" (:address #@"one two three four"))
>
> With SEND, it's necessary to use parens to delimit the foreign-type- 
> keyword/
> arg pairs for all non-required arguments; otherwise, SEND might  
> interpret
> the foreign type keywords as part of the message name.
>
> Or
>
> (#/stringWithFormat: ns:ns-string #@"Testing: %@" #@"one two three  
> four")
>
> In the latter case. the foreign type is determined by the type of the
> lisp argument (integers are passed as integers, floats as floats,
> pointers as pointers.)
>
>
> On Sat, 28 Apr 2007, Phil wrote:
>
>> I'm not having much luck in specifying the required data types for
>> methods that accept vargs... any pointers on specifying the valid
>> types are appreciated.
>>
>> (objc:send (objc:@class "NSString") "stringWithFormat:" #@"Testing: %
>> d" (:integer 1)) ; Seems simple enough
>>
>> (objc:send (objc:@class "NSString") "stringWithFormat:" #@"Testing: %
>> s" (:string "string")) ; OK, maybe not
>>
>> (objc:send (objc:@class "NSString") "stringWithFormat:" #@"Testing: %
>> @" (??? #@"string")) ; No idea
>>
>> Thanks,
>> Phil
>> _______________________________________________
>> Openmcl-devel mailing list
>> Openmcl-devel at clozure.com
>> http://clozure.com/mailman/listinfo/openmcl-devel
>>
>>




More information about the Openmcl-devel mailing list