rif <rif@...> writes:
> Suppose I declare an alien structure (assume (use-package :sb-alien)
> thoroughout):
>
> (define-alien-type a-struct (struct a-struct (foo unsigned-int)))
>
> and an accessor:
>
> (defun get-a-struct-foo (a-struct)
> (declare (type (alien (* (struct a-struct (foo (unsigned 32))))) a-struct))
> (slot a-struct 'foo))
> My question is, is there any better, more concise way to write the
> type declaration? Preferably something that involves just saying I've
"Better late then never."
1. After the DEFINE-ALIEN-TYPE you can just use (ALIEN (* A-STRUCT)).
2. (DEFTYPE *A-STRUCT () `(ALIEN (* A-STRUCT))) allows you to just
(DECLARE (TYPE *A-STRUCT ...)).
Cheers,
-- Nikodemus Schemer: "Buddha is small, clean, and serious."
Lispnik: "Buddha is big, has hairy armpits, and laughs."
|