Skip to content

Instantly share code, notes, and snippets.

Point2f* Point2f_mul_Assign(Point2f* self, Point2f* other) {
*self *= *other;
return self;
}
Point2f* Point2f_mul_Assign(Point2f* self, Point2f* other) {
return &(*self *= *other);
}
(defun @1 (ptr &optional arg1 arg2 arg3)
(if (symbolp arg1)
(case arg1
(:char (mem-aref (resolve-pointer ptr) :char 0))
(:uchar (mem-aref (resolve-pointer ptr) :uchar arg2))
(:unsigned-char (mem-aref (resolve-pointer ptr) :unsigned-char arg2))
(:short (mem-aref (resolve-pointer ptr) :short arg2))
(:ushort (mem-aref (resolve-pointer ptr) :ushort arg2))
(:unsigned-short (mem-aref (resolve-pointer ptr) :unsigned-short arg2))
(:int (mem-aref (resolve-pointer ptr) :int arg2))
typedef vector<Mat> vector_Mat;
void cv_drawContours(Mat* image, vector_Mat* contours, int contourIdx, Scalar* color, int thickness, int lineType,
Mat* hierarchy, int maxLevel, Point* offset) {
cout << *contours[0] << endl;
cv::drawContours(*image, *contours, contourIdx, *color, thickness, lineType, *hierarchy, maxLevel, *offset);
}
I have a setf version of the @@@ method in this macro. How would I go about calling it inside the macro.
The way I call it is (setf (@@@ object index) val).
(defmacro @ (object &optional i j)
"CFFI:MEM-AREF macro with C-POINTER reader."
(if (keywordp i)
`(mem-aref (resolve-pointer ,object) ,i (or ,j 0))
`(@@@ ,object ,i ,j)))
;; DMATCH
(define-foreign-type dmatch ()
((garbage-collect :reader garbage-collect :initform nil :initarg
:garbage-collect))
(:actual-type :pointer)
(:simple-parser dmatch))
(defun set-br (self val)
(let ((a (cons self nil))
(rect-x (@ self :int))
(rect-y (@ self :int 1))
(rect-width (@ self :int 2))
(rect-height (@ self :int 3))
(point-x (@ val :int))
(point-y (@ val :int 1))
(new-x)
Point* cv_Rect_set_tl(Rect* self, Point* val) {
&self = new Rect(val->x, val->y, self->width, self->height);
return val;
}
(defun set-br (self val)
(let ((rect-x (@ self :int))
(rect-y (@ self :int 1))
(rect-width (@ self :int 2))
(rect-height (@ self :int 3))
(point-x (@ val :int))
(point-y (@ val :int 1))
(new-x)
(new-y))
(defun j (self point)
(defun h (x) (funcall x '= point))
(h (lambda (op &optional val)
(if (eq '= op)
(setf self val)
self)))
(assert (= self point)) (princ self))
(defparameter *b* 0)
(defun s (self val)
(funcall (lambda (a) (setf self a)) val))