-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmass.lisp
35 lines (24 loc) · 1.1 KB
/
mass.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
(in-package #:cl-ode)
;; (define-foreign-type mass-type () ()
;; (:actual-type :pointer)
;; (:simple-parser dMass))
;; (defclass mass ()
;; ((pointer :initform (foreign-alloc '(:struct dMass-struct))
;; :initarg :pointer)))
;; (defmethod initialize-instance ((this mass) &key)
;; (setf (slot-value this 'pointer) (foreign-alloc '(:struct dmass-struct))))
;; (defmethod translate-to-foreign ((this mass) (type mass-type))
;; (slot-value this 'pointer))
;; (defmethod translate-from-foreign (pointer (type mass-type))
;; (unless (null-pointer-p pointer)
;; (make-instance 'mass :pointer pointer)))
;; ;; (defmethod free-translated-object (pointer (type mass-type) param)
;; ;; (declare (ignore param))
;; ;; (when (delete? this) (foreign-free pointer)))
;; (defmacro struct-slot (name type slot)
;; `(defmacro ,name (this)
;; `(foreign-slot-value (slot-value ,this 'pointer)
;; ',,type ',,slot)))
;; (struct-slot mass (:struct dmass-struct) 'mass)
;; (struct-slot center (:struct dmass-struct) 'center)
;; (struct-slot inertia (:struct dmass-struct) 'inertia)