[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: strange record behavior in MCL2.0B1P2 (system 7) (again)
- To: firstname.lastname@example.org (Guillaume Cartier)
- Subject: Re: strange record behavior in MCL2.0B1P2 (system 7) (again)
- From: Bill St. Clair <bill>
- Date: Wed, 12 Jun 91 17:27:53 -0400
- Cc: email@example.com (Macintosh Allegro Common Lisp)
- In-reply-to: Your message of Wed, 12 Jun 91 14:54:00 -0400. <9106121854.AA28509@mipsmath>
Date: Wed, 12 Jun 91 14:54:00 -0400
To: firstname.lastname@example.org (Macintosh Allegro Common Lisp)
From: email@example.com (Guillaume Cartier)
Subject: strange record behavior in MCL2.0B1P2 (system 7) (again)
> You cannot simply pretend that something is a pointer and not a handle.
> You have to actually make it a pointer. You get a pointer from a handle
> by dereferencing it.
> If a bitmap is a handle, then you cannot say:
> (rref b :bitmap.bounds :storage :pointer)
> You must say
> (with-dereferenced-handles ((b-pointer b))
> (rref b :bitmap.bounds :storage :pointer))
> Of course, if you do this and the handle is then relocated, you will
But (make-bitmap 0 0 10 10) returns a pointer!!!
? (setq b (make-bitmap 0 0 10 10))
#<A Mac Zone Pointer Size 34 #x18D240>
The real problem is in the fact the RREF defaults the :STORAGE option.
In 1.3.2 where all the record definitions were typed in by hand by a
human, they were all well-known and made sense. In 2.0, where the
record definitions were spit out by some Lisp code that converted
Pascal into Lisp, the default :STORAGE is :HANDLE if there is a
defined type which is a handle to the record. The default :STORAGE
for the :BITMAP record type as defined in "interfaces;quickdraw.lisp"
is :HANDLE. We are planning to make RREF require its :STORAGE
parameter, and add macros HREF & PREF (Handle REF & Pointer REF).
MAKE-BITMAP crashes your machine sometimes, because it contains RREF's
to the :BITMAP record which compile as handles. The following version
(defun make-bitmap (left &optional top right bottom &aux rowbytes bm)
(with-rectangle-arg (r left top right bottom)
(+ 2 (ash (- (rref r rect.right) (rref r rect.left) 1) -3))))
(+ 14 (* rowbytes (- (rref r rect.bottom) (rref r rect.top))))))
(rset bm bitmap.bounds r :storage :pointer)
(rset bm bitmap.rowbytes rowbytes :storage :pointer)
(rset bm bitmap.baseaddr (%inc-ptr bm 14) :storage :pointer))