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

Syntax of make-record :pattern



Could somebody give an example of the use of

(make-record :pattern)

In the pre 2.0 times the pattern record was a variant that allowed us to
specify the bytes as in

(make-record :pattern
                 :b0 15  :b1 15  :b2 15  :b3 15
                 :b4 240 :b5 240 :b6 240 :b7 240)

With the 2.0 definition Mcl don'T like that anymore and we have to use
something like

(make-record :pattern :array ....)

but I don't know how to use that.

I saw that make-record actually expands to something like
(LET ((#:G301 (CCL::%REGISTER-TRAP 41246 896 8)))
  (SETF (%GET-UNSIGNED-BYTE #:G301 0) 15)
  (SETF (%GET-UNSIGNED-BYTE #:G301 1) 15)
  (SETF (%GET-UNSIGNED-BYTE #:G301 2) 15)
  (SETF (%GET-UNSIGNED-BYTE #:G301 3) 15)
  (SETF (%GET-UNSIGNED-BYTE #:G301 4) 240)
  (SETF (%GET-UNSIGNED-BYTE #:G301 5) 240)
  (SETF (%GET-UNSIGNED-BYTE #:G301 6) 240)
  (SETF (%GET-UNSIGNED-BYTE #:G301 7) 240)
  #:G301)

, but I do not feel comfortable with that syntax either

Karsten



;;;;Pre 2.0 syntax
(defrecord pattern
  (variant ((w0 integer)
            (w1 integer)
            (w2 integer)
            (w3 integer))
           ((b0 byte)
            (b1 byte)
            (b2 byte)
            (b3 byte)
            (b4 byte)
            (b5 byte)
            (b6 byte)
            (b7 byte))
           ((bytes (array byte 8)))
           ((array (array :unsigned-byte 8)))))


;2.0 syntax
(defrecord (Pattern :handle) (array (array :unsigned-byte 8)))