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

Re: QD arcs



At 10:28 AM 10/25/93 +0000, Ranson wrote:
>I think I have found the problem : some of my parameters are floats. Shouldn't
>the trap calling code at least complain about that ?
>     Daniel.

The trap expansion code checks types of 2-byte args to traps only
if the SAFETY optimization quantity is 3. Hence, your code would not
check the types unless you had safety globally PROCLAIMed to be 3:

(defun draw-arc (x y a da r)
  (rlet ((rc :rect))
    (setf (rref rc :rect.top) (- y r)
          (rref rc :rect.left) (- x r)
          (rref rc :rect.bottom) (+ y r)
          (rref rc :rect.right) (+ x r))
      (#_FrameArc rc a da)))

Changing your draw-arc function as follows enables run-time type checking
for the #_FrameArc call and makes your example run:

(defun draw-arc (x y a da r)
  (declare (optimize (safety 3)))
  (rlet ((rc :rect))
    (setf (rref rc :rect.top) (round (- y r))
          (rref rc :rect.left) (round (- x r))
          (rref rc :rect.bottom) (round (+ y r))
          (rref rc :rect.right) (round (+ x r)))
      (#_FrameArc rc (round a) (round da))))