From: Vitaly Mayatskikh Date: Sat, 7 Nov 2009 13:43:52 +0000 (+0100) Subject: Allow initialization of wrapped slots in make-instance. X-Git-Url: https://repo.or.cz/w/cl-v4l2.git/commitdiff_plain/df6abcbf3a76ca6a9fd42216514b98e6754696a8 Allow initialization of wrapped slots in make-instance. --- diff --git a/videodev2.lisp b/videodev2.lisp index 23dd7c1..b43839b 100644 --- a/videodev2.lisp +++ b/videodev2.lisp @@ -36,7 +36,7 @@ `(progn (defclass ,class-name ,supers (,@(loop for slot in slots collect - `(,slot)) + `(,slot :initarg ,(intern (string-upcase slot) "KEYWORD"))) (raw :accessor ,raw-accessor)) (:metaclass v4l2)) @@ -64,7 +64,7 @@ `(setf (gethash (cons ',class-name ',slot) *v4l2-slot-writers*) (fdefinition '(setf ,slot-name)))) - (defmethod initialize-instance :after ((inst ,class-name) &key pointer) + (defmethod initialize-instance :before ((inst ,class-name) &key pointer) (let ((obj (or pointer (foreign-alloc ',class-name)))) (setf (,raw-accessor inst) obj) (unless pointer