<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:10pt"><div>I'm trying to write an all purpose dereferencing macro...ive done pretty good so far I have</div><div><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br></div>(defmacro -> (var1 var2 var3 &optional var4 var5)<br><br>         ;; if var4 and var5 arent supplied give value of struct member<br>         (if (not (and var4 var5)) `(cffi:with-foreign-slots ((,var3)<br>                                  ,var2 (:struct ,var1)) (list
 ,var3))<br><br>         ;; if var4 and var5 are supplied give value of nested struct member<br>         (if (and var4 var5)<br><br>             `(cffi:with-foreign-slots ((,var3)<br>                        ,var2 (:struct ,var1))<br>            <br>            (cffi:with-foreign-slots ((,var5)<br>                          ,var3 (:struct ,var4)) ,var5) ))))<br><br><br><br><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">the roi
 struct member of ipl-image is defined as this</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">    (roi (:pointer (:struct ipl-roi)))</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px;
 font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br>;this gets the roi  slot value  of ipl-image correctly<br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">CL-OPENCV> (-> ipl-image a roi )<br>(#.(SB-SYS:INT-SAP #X7FFFDC000E80))</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family:
 HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">;this gets the nested struct member "width" of ipl-roi which is just a an :int correctly<br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">CL-OPENCV> (-> ipl-image a roi ipl-roi width)<br>100<br><br>both work correctly but i could use help getting rid of some of the typing to access
 these members</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">in this (-> ipl-image a roi ipl-roi width)  i have to type "ipl-image"(the name of the struct) "a"( the name of  the variable i'm dereferencing)  "roi" (the name of the ipl-image struct member) "ipl-roi" (the foreign-type of roi) and "width" (the ipl-roi struct member) . if there was a way i can get the foreign type  of the roi struct member like i can call foreign-slot-names to get all the slot names of a struct i could not have to use the ipl-roi here (-> ipl-image a roi ipl-roi width) but i looked in the manual and
 nothing....I couldnt think of any other way to shorten this (-> ipl-image a roi ipl-roi width) and make it a little closer to c so if someone could give me advice, or better yet their awesome dereferencing macro=), i named this post so everyone....including me=) would have access to this great information<br></div></div></body></html>