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

MCL and Handles/Ptrs



>Date: Tue, 11 Aug 92 14:42:19 -0400
>From: jbk@world.std.com (Jeffrey B Kane)
>To: info-mcl@cambridge.apple.com
>Subject: 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:
>
>(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))))

Try this instead:

(defun test ()
  (with-macptrs ((gdh (#_GetDeviceList)))
    (print gdh)
    (loop
      (when (%null-ptr-p gdh)
        (return))
      (format t "~&~A, ~A" 
              (href gdh gdevice.gdrect.bottom)
              (href gdh gdevice.gdrect.right))
      (%setf-macptr gdh (#_GetNextDevice gdh)))))

? (test)
#<A Mac Handle, Locked, Size 62 #x2124> 
480, 640
534, 1792
NIL