Allow initialization of wrapped slots in make-instance.
authorVitaly Mayatskikh <v.mayatskih@gmail.com>
Sat, 7 Nov 2009 13:43:52 +0000 (7 14:43 +0100)
committerVitaly Mayatskikh <v.mayatskih@gmail.com>
Sat, 7 Nov 2009 13:43:52 +0000 (7 14:43 +0100)
videodev2.lisp

index 23dd7c1..b43839b 100644 (file)
@@ -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