Created
August 15, 2014 01:00
-
-
Save W-Net-AI/54fb86306b132140e900 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; DMATCH | |
(define-foreign-type dmatch () | |
((garbage-collect :reader garbage-collect :initform nil :initarg | |
:garbage-collect)) | |
(:actual-type :pointer) | |
(:simple-parser dmatch)) | |
(defclass cv-dmatch () | |
((c-pointer :reader c-pointer :initarg :c-pointer))) | |
(defmethod translate-to-foreign ((lisp-value cv-dmatch) (c-type dmatch)) | |
(values (c-pointer lisp-value) lisp-value)) | |
(defmethod translate-from-foreign (c-pointer (c-type dmatch)) | |
(let ((dmatch (make-instance 'cv-dmatch :c-pointer c-pointer))) | |
(when (garbage-collect c-type) | |
(tg:finalize dmatch (lambda () (del-dmatch c-pointer)))) | |
dmatch)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment