[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

MCL and Handles/Ptrs



I've been through the MCL documentation, but it is a little less than clear
when it comes to interfacing with the Mac toolbox directly.  Here is my
problem,
best illustrated by a concrete example:

I want to walk through a list of handles (in this case the GDevice List).  It
each
case I want to check if the handle is nil (i.e. I've reached the end of my
list).
I am using the "rlet" macro to create a temporary gdHandle as follows

(rlet ((gdh :gdHandle %null-ptr))
   (setf gdh (#_GetDeviceList))
   (print gdh)
   (loop
       (when (eql gdh %null-ptr)
           (return))
       (format t "~&~A, ~A" (href gdh gdevice.gdrect.bottom)
                            (href gdh gdevice.gdrect.right))
       (setf gdh (#_GetNextDevice gdh))))
       
The listener really doesn't like it when I use setf to set the handle
directly, but
using rset also seems to cause lots of nasty problems (since I want to set the
handle
directly, and not one of it's dereferenced fields).  I get error messages such
as:

;   Shouldn't assign to variable GDH (2 references), in an anonymous lambda fo

The above bit of code crashes MCL.  How can I manipulate pointers and handles 
directly without resorting to C, Pascal, or Asm code?

How can I get around this?
    Jeffrey