Code: Select all
(defmacro -> (var1 var2 var3 &optional var4 var5)
;; if var4 and var5 arent supplied give value of struct member
(if (not (and var4 var5)) `(cffi:with-foreign-slots ((,var3)
,var2 (:struct ,var1)) (list ,var3))
;; if var4 and var5 are supplied give value of nested struct member
(if (and var4 var5)
`(cffi:with-foreign-slots ((,var3)
,var2 (:struct ,var1))
(cffi:with-foreign-slots ((,var5)
,var3 (:struct ,var4)) ,var5) ))))
the roi struct member of ipl-image is defined as this
Code: Select all
(roi (:pointer (:struct ipl-roi)))
;this gets the roi slot value of ipl-image correctly
Code: Select all
CL-OPENCV> (-> ipl-image a roi )
(#.(SB-SYS:INT-SAP #X7FFFDC000E80))
Code: Select all
CL-OPENCV> (-> ipl-image a roi ipl-roi width)
100
in this
Code: Select all
(-> ipl-image a roi ipl-roi width)
Code: Select all
(-> ipl-image a roi ipl-roi width)
Code: Select all
(-> ipl-image a roi ipl-roi width)