[Openmcl-devel] Cocoa bridge questions

Randall Beer beer at eecs.cwru.edu
Fri Apr 23 08:39:38 PDT 2004


The standard way to make temporary foreign (nonLisp) structures in 
OpenMCL is through RLET:

(rlet ((p :<NSP>oint :x 100.0 :y 200.0))
   ... do something with P ...
   )

The Cocoa bridge also provides a few convenience forms for working with 
foreign Cocoa structures. For example, you could also use SLET:

(ccl::slet ((p (ccl::ns-make-point 100.0 200.0)))
   ... do something with P ...
   )

Also, SEND does an implicit SLET around each of its arguments:

(ccl::send
   (find-class 'ns:ns-bezier-path)
   :stroke-line-from-point (ccl::ns-make-point 100.0 200.0)
   :to-point (ccl::ns-make-point 300.0 400.0))

In the current Bleeding Edge CVS, there is some support for passing a 
Lisp NS-POINT structure into and out of Cocoa messages that deal with 
ObjC NSPoint structures, with automatic conversion between the two as 
part of integrating CLOS methods with ObjC methods. Hopefully, I'll 
actually be able to get back to working on this again someday soon.

Randy


On Apr 23, 2004, at 11:07 AM, Thom Goodsell wrote:

> Hi all,
>
> I'm struggling to get a firm grasp on the OpenMCL Cocoa bridge 
> starting from a moderate knowledge of Lisp and a little knowledge of 
> Cocoa (i.e., I've read a book). My current struggle is to instantiate 
> an NSPoint. The trouble is that NSPoint is a struct, not an Obj-C 
> class. Instances are usually constructed via NSMakePoint, but I can't 
> figure out how to call that, nor how to manually construct an NSPoint 
> (or even refer to one).
>
> I'd be most appreciative of any help. I have many more questions, but 
> I'm hoping to figure most of them out by working through some simple 
> examples.
>
> Thanks,
> Thom Goodsell
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
>




More information about the Openmcl-devel mailing list