[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Fwd: Custom patterns
- To: "Mark A. Tapia" <email@example.com>, firstname.lastname@example.org
- Subject: Re: Fwd: Custom patterns
- From: email@example.com (Bill St. Clair)
- Date: Wed, 5 Jan 1994 19:24:27 -0600
- Cc: firstname.lastname@example.org
At 9:32 AM 1/4/94 -0500, Mark A. Tapia wrote:
>On Mon Jan 3 13:24:47 1994, Andrew Newell Mickish writes
>in response to Karsten Poecks suggestion of 19 DEC to use
>the variant record for pattern:
>>> (defparameter *my-pattern*
>>> (make-record :pattern
>>> :b0 238
>>> :b7 119))
>> I tried this, but I got the error
>> > Error: :B0 is not a field of record :PATTERN
>> > Valid fields are: (:ARRAY)
>> Is the technique above supposed to work?
>The short answer is it is not the MPW standard!
>> It seems reasonable to want to supply the values of the fields when
>> the record is created, rather than calling %put-byte afterwards.
>> Does the documentation for the pattern record
>> on p. 715 imply that this is possible?
>It is if you only use the old record definition (included below).
It is possible to supply the field values in MAKE-RECORD even
for the "new" pattern record definition. Note that this is
really just a notational convenience as the MAKE-RECORD macro
expands into a #_NewPtr (or #_NewHandle) call follwed by a bunch
Note also that you usually want a pattern to be a pointer, not
the default handle. I suggest that you never rely on default
record types, but instead always specify the :storage option
to MAKE-RECORD and use PREF or HREF instead of RREF to access
record slots. Note also that the DEFPARAMETER above will not
work correctly in a saved application. macptrs need to be
reinitialized every time you start up the application. That's
what DEF-LOAD-POINTERS is for.
(def-load-pointers initialize-*my-pattern* ()
(make-record (:pattern :storage :pointer)
(array 0) 1
(array 1) 2
(array 2) 4
(array 3) 8
(array 4) 16
(array 5) 32
(array 6) 64
(array 7) 128)))