<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:10pt"><div style="" class=""><br style="" class="">I have this conditional from a cond statement I need to satisfy<br style="" class=""><br style="" class=""><br style="" class=""> ((listp (first args))<br style="" class=""> (c-arr-to-vector-point (first args)))<br style="" class=""><br style="" class=""><br style="" class="">The (first args) will be this but it should be able to have an infinite number <br style="" class="">of (point i j) in it.<br style="" class=""><br style="" class="">(foreign-alloc :pointer :initial-contents (LIST (POINT 1 2) (POINT 3 4)))<br style="" class=""><br style="" class=""><br style="" class="">The thing is that the output of (point i j) is a metaobject e.g. #<CV-POINT {10038888E3}> . That is how I have my
return for point defined. When I need to use foreign-alloc to define an array of point I have to do it like this...<br style="" class=""><br style="" class=""><br style="" class="">(foreign-alloc :pointer :initial-contents (LIST (c-pointer (POINT 1 2)) (c-pointer (POINT 3 4))))<br style="" class=""><br style="" class="">...because my defclass is this:<br style="" class=""><br style="" class="">(defclass std-vector-point ()<br style="" class=""> ((c-pointer :reader c-pointer :initarg :c-pointer)))<br style="" class=""><br style="" class="">Here is my function I need to change so a when it is run I can just enter (LIST (POINT 1 2) (POINT 3 4)) for the (first args) in the above mentioned conditional block and have the %c-arr-to-vector-point function be satisfied, because it accepts a list of pointers as its input. But I need help because I don't want the user to see the c-pointer at all let alone have to wrap each (point i j) like
this (c-pointer (point i j)) that is too much typing. How would I do this without it making my function any slower.<br style="" class=""><br style="" class="">(defun vector-point (&rest args)<br style="" class=""> (cond<br style="" class=""> ((fourth args)<br style="" class=""> (error "odd number of args to VECTOR-POINT"))<br style="" class=""> ((null (first args))<br style="" class=""> (%vector-point))<br style="" class=""> ((listp (first args))<br style="" class=""> (%c-arr-to-vector-point (foreign-alloc :pointer :initial-contents (first args))))<br style="" class=""> ((eq :size (second args))<br style="" class=""> (%vector-point-size (first args)))<br style="" class=""> ((and (eq (type-of (first args)) 'std-vector-point) (second args) (not (third
args))) <br style="" class=""> (mem-aref (c-pointer <br style="" class=""> (%vector-point-to-c-array (first args))) :pointer (second args)))<br style="" class=""> ((and (eq (type-of (first args)) 'std-vector-point) (second args) (third args)) <br style="" class=""> (mem-aref (c-pointer <br style="" class=""> (mem-aref (c-pointer <br style="" class=""> (%vector-point-to-c-array (first args))) :pointer (second args))) <br style="" class=""> :int (third args)))<br style="" class=""> ((not (eq (type-of (first args)) 'std-vector-point))<br style="" class=""> (error "The value ~a is not of type (STD-VECTOR-POINT)." (first args)))))<br style="" class=""><br
style="" class=""><br style="" class=""></div><div style="" class=""><br style="" class=""></div></div></body></html>