Skip to content

Commit

Permalink
Major issues fixed!
Browse files Browse the repository at this point in the history
  • Loading branch information
warweasle committed Mar 27, 2017
1 parent 7ec0f1b commit 6a1334e
Show file tree
Hide file tree
Showing 17 changed files with 8,405 additions and 8,363 deletions.
16 changes: 5 additions & 11 deletions autowrap.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,14 @@

(c-include "/usr/local/include/chipmunk/chipmunk.h"
:spec-path '(cl-chipmunk spec)
:definition-package :%chipmunk
:definition-package :%chip
;;:exclude-sources (".*.h")
:include-sources ("chipmunk/cpVect.h"
"chipmunk/cpBB.h"
"chipmunk/cpSpace.h"
"chipmunk/cpSpatialIndex.h"
"chipmunk/cpBody.h"
;; "chipmunk/cpShape.h"
;; "chipmunk/cpPolyShape.h"
;; "chipmunk/cpArbiter.h"
;; "chipmunk/constraints/cpConstraint.h"
)
)
;;:exclude-definitions ("dWorldSetStepThreadingImplementation")
;; :symbol-regex (("cp?[A-Z]\\w*" () (lambda (name matches regex)
;; (declare (ignore matches regex))
;; (subseq name 2)))))
"chipmunk/cpShape.h"
"chipmunk/cpPolyShape.h"
"chipmunk/cpArbiter.h"
"chipmunk/constraints/cpConstraint.h"))
10 changes: 5 additions & 5 deletions cl-chipmunk.asd
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
:author "Pavel Korolev"
:mailto "[email protected]"
:license "MIT"
:depends-on (alexandria cl-autowrap/libffi cl-plus-c )
:depends-on (alexandria cl-autowrap/libffi cl-plus-c rtg-math)
:serial t
:components ((:file "packages")
(:file "libchipmunk")
(:file "autowrap")

;;(:file "ode")
(:module spec
:components ((:static-file "chipmunk.h")))))
(:module spec
:components ((:static-file "chipmunk.h")))
(:file "utils")
(:file "space")))
7 changes: 3 additions & 4 deletions libchipmunk.lisp
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
(cl:in-package :%chipmunk)


(cffi:define-foreign-library libchipmunk
(:darwin (:or "libchipmunk.6.dylib" "libchipmunk.dylib"))
(:unix (:or "libchipmunk.so.0d3.0.0" ; debian/ubuntu convention for 0.14 version
"libchipmunk.so.0d3" "libchipmunk.so.0d3"))
(:darwin (:or "libchipmunk.7.dylib" "libchipmunk.dylib"))
(:unix (:or "libchipmunk.so.7" ; debian/ubuntu convention for 0.14 version
"libchipmunk.so.7.0.1" "libchipmunk.so"))
(:windows "chipmunk.dll")
(t (:default "chipmunk")))

Expand Down
7 changes: 6 additions & 1 deletion packages.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@


(defpackage :%chipmunk
(:nicknames :%chip)
(:use))


(defpackage :cl-chipmunk
(:nicknames :chipmunk :chip)
(:use :cl :alexandria :autowrap :plus-c)
(:export ))
(:export

#:cp-space-init
#:cp-space-new
#:cp-space-get-gravity))
20 changes: 20 additions & 0 deletions space.lisp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
(in-package :cl-chipmunk)


(defun cp-space-new ()
(with-float-traps-masked
(%chip:cp-space-new)))



(defun cp-space-get-gravity (space)
(with-returned-vect (ret)
(%chipmunk:cp-space-get-gravity ret space)))


;; (plus-c:c-with ((ret %chip:cp-vect))
;; (%chipmunk:cp-space-get-gravity g space)
;; (print (plus-c:c-ref g %chipmunk:cp-vect :x)))

;; (plus-c:c-with ((g %chipmunk:cp-vect))

1,470 changes: 735 additions & 735 deletions spec/chipmunk.arm-pc-linux-gnu.spec

Large diffs are not rendered by default.

1,478 changes: 739 additions & 739 deletions spec/chipmunk.i386-unknown-freebsd.spec

Large diffs are not rendered by default.

1,484 changes: 742 additions & 742 deletions spec/chipmunk.i386-unknown-openbsd.spec

Large diffs are not rendered by default.

1,480 changes: 740 additions & 740 deletions spec/chipmunk.i686-apple-darwin9.spec

Large diffs are not rendered by default.

1,464 changes: 732 additions & 732 deletions spec/chipmunk.i686-pc-linux-gnu.spec

Large diffs are not rendered by default.

1,736 changes: 868 additions & 868 deletions spec/chipmunk.i686-pc-windows-msvc.spec

Large diffs are not rendered by default.

1,476 changes: 738 additions & 738 deletions spec/chipmunk.x86_64-apple-darwin9.spec

Large diffs are not rendered by default.

1,438 changes: 719 additions & 719 deletions spec/chipmunk.x86_64-pc-linux-gnu.spec

Large diffs are not rendered by default.

1,708 changes: 854 additions & 854 deletions spec/chipmunk.x86_64-pc-windows-msvc.spec

Large diffs are not rendered by default.

1,476 changes: 738 additions & 738 deletions spec/chipmunk.x86_64-unknown-freebsd.spec

Large diffs are not rendered by default.

1,474 changes: 737 additions & 737 deletions spec/chipmunk.x86_64-unknown-openbsd.spec

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions utils.lisp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
(in-package :cl-chipmunk)


(defmacro with-float-traps-masked (&body body)
(let ((masking #+sbcl '(sb-int:with-float-traps-masked (:overflow
:underflow
:inexact
:invalid
:divide-by-zero))
#-sbcl '(progn)))
`(,@masking
,@body)))


(defmacro cp-vect->lisp (x)
(let ((var (gensym)))
`(let ((,var ,x))
(rtg-math:v! (plus-c:c-ref ,var %chipmunk:cp-vect :x)
(plus-c:c-ref ,var %chipmunk:cp-vect :y)))))

(defmacro with-returned-vect ((name) &body body)
`(plus-c:c-with ((,name %chipmunk:cp-vect))
,@body
(cp-vect->lisp ,name)))

0 comments on commit 6a1334e

Please sign in to comment.