/[cffi-objects]/struct.lisp
ViewVC logotype

Diff of /struct.lisp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 9 by rklochkov, Fri Aug 24 19:26:53 2012 UTC revision 12 by rklochkov, Sun Oct 7 11:59:54 2012 UTC
# Line 99  or may be cons (class-name . struct-name Line 99  or may be cons (class-name . struct-name
99          (mapc (lambda (slot)          (mapc (lambda (slot)
100                  (let ((val (getf (slot-value object 'value) slot default)))                  (let ((val (getf (slot-value object 'value) slot default)))
101                    (unless (eq val default)                    (unless (eq val default)
102                      (setf (foreign-slot-value res class slot) val))))                      (setf (foreign-slot-value res (list :struct class) slot)
103                              val))))
104                (foreign-slot-names class))                (foreign-slot-names class))
105          res)          res)
106        (pointer object)))        (pointer object)))
# Line 119  Only exception is the presence of OBJECT Line 120  Only exception is the presence of OBJECT
120              (unless (null-pointer-p struct)              (unless (null-pointer-p struct)
121                (dolist (slot (foreign-slot-names class))                (dolist (slot (foreign-slot-names class))
122                  (setf (getf (slot-value %object 'value) slot)                  (setf (getf (slot-value %object 'value) slot)
123                        (foreign-slot-value struct class slot)))))                        (foreign-slot-value struct (list :struct class) slot)))))
124            (setf (pointer %object) struct))            (setf (pointer %object) struct))
125        %object)))        %object)))
126    
# Line 128  Only exception is the presence of OBJECT Line 129  Only exception is the presence of OBJECT
129    (:actual-type :pointer))    (:actual-type :pointer))
130    
131  (defmethod free-sent-ptr ((type cffi-struct) ptr place)  (defmethod free-sent-ptr ((type cffi-struct) ptr place)
132    (when (and (slot-boundp place 'value) (not (null-pointer-p ptr)))    (when (and (not (null-pointer-p ptr)) (slot-boundp place 'value))
133      (free-struct (object-class type) ptr)))      (free-struct (object-class type) ptr)))
134    
135  (defmethod free-returned-ptr ((type cffi-struct) ptr)  (defmethod free-returned-ptr ((type cffi-struct) ptr)

Legend:
Removed from v.9  
changed lines
  Added in v.12

  ViewVC Help
Powered by ViewVC 1.1.5