chipmunk 5.3.4.0-x86-mingw32 → 5.3.4.2-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +33 -13
 - data/Rakefile +20 -7
 - data/ext/chipmunk/extconf.rb +55 -12
 - data/ext/chipmunk/rb_chipmunk.c +92 -98
 - data/ext/chipmunk/rb_chipmunk.h +44 -34
 - data/ext/chipmunk/rb_cpArbiter.c +135 -98
 - data/ext/chipmunk/rb_cpBB.c +84 -101
 - data/ext/chipmunk/rb_cpBody.c +219 -241
 - data/ext/chipmunk/rb_cpConstraint.c +173 -185
 - data/ext/chipmunk/rb_cpShape.c +347 -251
 - data/ext/chipmunk/rb_cpSpace.c +376 -408
 - data/ext/chipmunk/rb_cpVect.c +132 -170
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/chipmunk.h +163 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/chipmunk_ffi.h +59 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/chipmunk_private.h +49 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/chipmunk_types.h +151 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/chipmunk_unsafe.h +54 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/constraints/cpConstraint.h +105 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/constraints/cpDampedRotarySpring.h +46 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/constraints/cpDampedSpring.h +53 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/constraints/cpGearJoint.h +41 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/constraints/cpGrooveJoint.h +48 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/constraints/cpPinJoint.h +43 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/constraints/cpPivotJoint.h +42 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/constraints/cpRatchetJoint.h +40 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/constraints/cpRotaryLimitJoint.h +39 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/constraints/cpSimpleMotor.h +37 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/constraints/cpSlideJoint.h +44 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/constraints/util.h +134 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/cpArbiter.h +188 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/cpArray.h +49 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/cpBB.h +74 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/cpBody.h +219 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/cpCollision.h +28 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/cpHashSet.h +82 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/cpPolyShape.h +103 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/cpShape.h +177 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/cpSpace.h +206 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/cpSpaceHash.h +110 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/cpVect.h +207 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/src/chipmunk.c +151 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/src/constraints/cpConstraint.c +54 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/src/constraints/cpDampedRotarySpring.c +105 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/src/constraints/cpDampedSpring.c +115 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/src/constraints/cpGearJoint.c +113 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/src/constraints/cpGrooveJoint.c +161 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/src/constraints/cpPinJoint.c +116 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/src/constraints/cpPivotJoint.c +114 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/src/constraints/cpRatchetJoint.c +126 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/src/constraints/cpRotaryLimitJoint.c +120 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/src/constraints/cpSimpleMotor.c +97 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/src/constraints/cpSlideJoint.c +129 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpArbiter.c +280 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpArray.c +143 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpBB.c +47 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpBody.c +192 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpCollision.c +411 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpHashSet.c +253 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpPolyShape.c +240 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpShape.c +405 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpSpace.c +499 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpSpaceComponent.c +279 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpSpaceHash.c +534 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpSpaceQuery.c +246 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpSpaceStep.c +398 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpVect.c +71 -0
 - data/ext/chipmunk/vendor/chipmunk-5.3.4/src/prime.h +68 -0
 - data/lib/1.9/chipmunk.so +0 -0
 - data/lib/chipmunk.rb +19 -8
 - metadata +84 -42
 - data/lib/1.8/chipmunk.so +0 -0
 
    
        data/ext/chipmunk/rb_cpSpace.c
    CHANGED
    
    | 
         @@ -1,15 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            /* Copyright (c) 2007 Scott Lembcke
         
     | 
| 
       2 
     | 
    
         
            -
             * 
     | 
| 
      
 2 
     | 
    
         
            +
             *
         
     | 
| 
       3 
3 
     | 
    
         
             
             * Permission is hereby granted, free of charge, to any person obtaining a copy
         
     | 
| 
       4 
4 
     | 
    
         
             
             * of this software and associated documentation files (the "Software"), to deal
         
     | 
| 
       5 
5 
     | 
    
         
             
             * in the Software without restriction, including without limitation the rights
         
     | 
| 
       6 
6 
     | 
    
         
             
             * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         
     | 
| 
       7 
7 
     | 
    
         
             
             * copies of the Software, and to permit persons to whom the Software is
         
     | 
| 
       8 
8 
     | 
    
         
             
             * furnished to do so, subject to the following conditions:
         
     | 
| 
       9 
     | 
    
         
            -
             * 
     | 
| 
      
 9 
     | 
    
         
            +
             *
         
     | 
| 
       10 
10 
     | 
    
         
             
             * The above copyright notice and this permission notice shall be included in
         
     | 
| 
       11 
11 
     | 
    
         
             
             * all copies or substantial portions of the Software.
         
     | 
| 
       12 
     | 
    
         
            -
             * 
     | 
| 
      
 12 
     | 
    
         
            +
             *
         
     | 
| 
       13 
13 
     | 
    
         
             
             * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         
     | 
| 
       14 
14 
     | 
    
         
             
             * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         
     | 
| 
       15 
15 
     | 
    
         
             
             * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         
     | 
| 
         @@ -18,7 +18,7 @@ 
     | 
|
| 
       18 
18 
     | 
    
         
             
             * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         
     | 
| 
       19 
19 
     | 
    
         
             
             * SOFTWARE.
         
     | 
| 
       20 
20 
     | 
    
         
             
             */
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
       22 
22 
     | 
    
         
             
            #include <stdlib.h>
         
     | 
| 
       23 
23 
     | 
    
         
             
            #include "chipmunk.h"
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
         @@ -36,29 +36,27 @@ VALUE c_cpSpace; 
     | 
|
| 
       36 
36 
     | 
    
         | 
| 
       37 
37 
     | 
    
         | 
| 
       38 
38 
     | 
    
         
             
            static VALUE
         
     | 
| 
       39 
     | 
    
         
            -
            rb_cpSpaceAlloc(VALUE klass)
         
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
            	return Data_Wrap_Struct(klass, NULL, cpSpaceFree, space);
         
     | 
| 
      
 39 
     | 
    
         
            +
            rb_cpSpaceAlloc(VALUE klass) {
         
     | 
| 
      
 40 
     | 
    
         
            +
              cpSpace *space = cpSpaceAlloc();
         
     | 
| 
      
 41 
     | 
    
         
            +
              return Data_Wrap_Struct(klass, NULL, cpSpaceFree, space);
         
     | 
| 
       43 
42 
     | 
    
         
             
            }
         
     | 
| 
       44 
43 
     | 
    
         | 
| 
       45 
44 
     | 
    
         
             
            static VALUE
         
     | 
| 
       46 
     | 
    
         
            -
            rb_cpSpaceInitialize(VALUE self)
         
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
            	rb_iv_set(self, "blocks", rb_hash_new());
         
     | 
| 
      
 45 
     | 
    
         
            +
            rb_cpSpaceInitialize(VALUE self) {
         
     | 
| 
      
 46 
     | 
    
         
            +
              cpSpace *space = SPACE(self);
         
     | 
| 
      
 47 
     | 
    
         
            +
              cpSpaceInit(space);
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
              // These might as well be in one shared hash.
         
     | 
| 
      
 50 
     | 
    
         
            +
              rb_iv_set(self, "static_shapes", rb_ary_new());
         
     | 
| 
      
 51 
     | 
    
         
            +
              rb_iv_set(self, "active_shapes", rb_ary_new());
         
     | 
| 
      
 52 
     | 
    
         
            +
              rb_iv_set(self, "bodies", rb_ary_new());
         
     | 
| 
      
 53 
     | 
    
         
            +
              rb_iv_set(self, "constraints", rb_ary_new());
         
     | 
| 
      
 54 
     | 
    
         
            +
              rb_iv_set(self, "blocks", rb_hash_new());
         
     | 
| 
       57 
55 
     | 
    
         | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
      
 56 
     | 
    
         
            +
              return self;
         
     | 
| 
       59 
57 
     | 
    
         
             
            }
         
     | 
| 
       60 
58 
     | 
    
         | 
| 
       61 
     | 
    
         
            -
            static VALUE 
     | 
| 
      
 59 
     | 
    
         
            +
            static VALUE
         
     | 
| 
       62 
60 
     | 
    
         
             
            SPACEWRAP(cpSpace * space) {
         
     | 
| 
       63 
61 
     | 
    
         
             
              return Data_Wrap_Struct(c_cpSpace, NULL, cpSpaceFree, space);
         
     | 
| 
       64 
62 
     | 
    
         
             
            }
         
     | 
| 
         @@ -88,64 +86,58 @@ rb_cpSpaceSetIdleSpeedThreshold(VALUE self, VALUE val) { 
     | 
|
| 
       88 
86 
     | 
    
         | 
| 
       89 
87 
     | 
    
         | 
| 
       90 
88 
     | 
    
         
             
            static VALUE
         
     | 
| 
       91 
     | 
    
         
            -
            rb_cpSpaceGetIterations(VALUE self)
         
     | 
| 
       92 
     | 
    
         
            -
             
     | 
| 
       93 
     | 
    
         
            -
            	return INT2NUM(SPACE(self)->iterations);
         
     | 
| 
      
 89 
     | 
    
         
            +
            rb_cpSpaceGetIterations(VALUE self) {
         
     | 
| 
      
 90 
     | 
    
         
            +
              return INT2NUM(SPACE(self)->iterations);
         
     | 
| 
       94 
91 
     | 
    
         
             
            }
         
     | 
| 
       95 
92 
     | 
    
         | 
| 
       96 
93 
     | 
    
         
             
            static VALUE
         
     | 
| 
       97 
     | 
    
         
            -
            rb_cpSpaceSetIterations(VALUE self, VALUE val)
         
     | 
| 
       98 
     | 
    
         
            -
             
     | 
| 
       99 
     | 
    
         
            -
             
     | 
| 
       100 
     | 
    
         
            -
            	return val;
         
     | 
| 
      
 94 
     | 
    
         
            +
            rb_cpSpaceSetIterations(VALUE self, VALUE val) {
         
     | 
| 
      
 95 
     | 
    
         
            +
              SPACE(self)->iterations = NUM2INT(val);
         
     | 
| 
      
 96 
     | 
    
         
            +
              return val;
         
     | 
| 
       101 
97 
     | 
    
         
             
            }
         
     | 
| 
       102 
98 
     | 
    
         | 
| 
       103 
99 
     | 
    
         
             
            static VALUE
         
     | 
| 
       104 
     | 
    
         
            -
            rb_cpSpaceGetElasticIterations(VALUE self)
         
     | 
| 
       105 
     | 
    
         
            -
             
     | 
| 
       106 
     | 
    
         
            -
            	return INT2NUM(SPACE(self)->elasticIterations);
         
     | 
| 
      
 100 
     | 
    
         
            +
            rb_cpSpaceGetElasticIterations(VALUE self) {
         
     | 
| 
      
 101 
     | 
    
         
            +
              return INT2NUM(SPACE(self)->elasticIterations);
         
     | 
| 
       107 
102 
     | 
    
         
             
            }
         
     | 
| 
       108 
103 
     | 
    
         | 
| 
       109 
104 
     | 
    
         
             
            static VALUE
         
     | 
| 
       110 
     | 
    
         
            -
            rb_cpSpaceSetElasticIterations(VALUE self, VALUE val)
         
     | 
| 
       111 
     | 
    
         
            -
             
     | 
| 
       112 
     | 
    
         
            -
             
     | 
| 
       113 
     | 
    
         
            -
            	return val;
         
     | 
| 
      
 105 
     | 
    
         
            +
            rb_cpSpaceSetElasticIterations(VALUE self, VALUE val) {
         
     | 
| 
      
 106 
     | 
    
         
            +
              SPACE(self)->elasticIterations = NUM2INT(val);
         
     | 
| 
      
 107 
     | 
    
         
            +
              return val;
         
     | 
| 
       114 
108 
     | 
    
         
             
            }
         
     | 
| 
       115 
109 
     | 
    
         | 
| 
       116 
110 
     | 
    
         
             
            static VALUE
         
     | 
| 
       117 
     | 
    
         
            -
            rb_cpSpaceGetDamping(VALUE self)
         
     | 
| 
       118 
     | 
    
         
            -
             
     | 
| 
       119 
     | 
    
         
            -
            	return rb_float_new(SPACE(self)->damping);
         
     | 
| 
      
 111 
     | 
    
         
            +
            rb_cpSpaceGetDamping(VALUE self) {
         
     | 
| 
      
 112 
     | 
    
         
            +
              return rb_float_new(SPACE(self)->damping);
         
     | 
| 
       120 
113 
     | 
    
         
             
            }
         
     | 
| 
       121 
114 
     | 
    
         | 
| 
       122 
115 
     | 
    
         
             
            static VALUE
         
     | 
| 
       123 
     | 
    
         
            -
            rb_cpSpaceSetDamping(VALUE self, VALUE val)
         
     | 
| 
       124 
     | 
    
         
            -
             
     | 
| 
       125 
     | 
    
         
            -
             
     | 
| 
       126 
     | 
    
         
            -
            	return val;
         
     | 
| 
      
 116 
     | 
    
         
            +
            rb_cpSpaceSetDamping(VALUE self, VALUE val) {
         
     | 
| 
      
 117 
     | 
    
         
            +
              SPACE(self)->damping = NUM2DBL(val);
         
     | 
| 
      
 118 
     | 
    
         
            +
              return val;
         
     | 
| 
       127 
119 
     | 
    
         
             
            }
         
     | 
| 
       128 
120 
     | 
    
         | 
| 
       129 
121 
     | 
    
         
             
            static VALUE
         
     | 
| 
       130 
     | 
    
         
            -
            rb_cpSpaceGetGravity(VALUE self)
         
     | 
| 
       131 
     | 
    
         
            -
             
     | 
| 
       132 
     | 
    
         
            -
            	return VWRAP(self, &SPACE(self)->gravity);
         
     | 
| 
      
 122 
     | 
    
         
            +
            rb_cpSpaceGetGravity(VALUE self) {
         
     | 
| 
      
 123 
     | 
    
         
            +
              return VWRAP(self, &SPACE(self)->gravity);
         
     | 
| 
       133 
124 
     | 
    
         
             
            }
         
     | 
| 
       134 
125 
     | 
    
         | 
| 
       135 
126 
     | 
    
         
             
            static VALUE
         
     | 
| 
       136 
127 
     | 
    
         
             
            rb_cpSpaceSetGravity(VALUE self, VALUE val) {
         
     | 
| 
       137 
     | 
    
         
            -
             
     | 
| 
       138 
     | 
    
         
            -
             
     | 
| 
      
 128 
     | 
    
         
            +
              SPACE(self)->gravity = *VGET(val);
         
     | 
| 
      
 129 
     | 
    
         
            +
              return val;
         
     | 
| 
       139 
130 
     | 
    
         
             
            }
         
     | 
| 
       140 
131 
     | 
    
         | 
| 
       141 
132 
     | 
    
         
             
            static int
         
     | 
| 
       142 
133 
     | 
    
         
             
            doNothingCallback(cpArbiter *arb, cpSpace *space, void *data) {
         
     | 
| 
       143 
     | 
    
         
            -
             
     | 
| 
      
 134 
     | 
    
         
            +
              return 0;
         
     | 
| 
       144 
135 
     | 
    
         
             
            }
         
     | 
| 
       145 
136 
     | 
    
         | 
| 
       146 
137 
     | 
    
         
             
            // We need this as rb_obj_method_arity is not in 1.8.7
         
     | 
| 
       147 
     | 
    
         
            -
            static int 
     | 
| 
       148 
     | 
    
         
            -
             
     | 
| 
      
 138 
     | 
    
         
            +
            static int
         
     | 
| 
      
 139 
     | 
    
         
            +
            cp_rb_obj_method_arity(VALUE self, ID id) {
         
     | 
| 
      
 140 
     | 
    
         
            +
              VALUE metho = rb_funcall(self, rb_intern("method"), 1, ID2SYM(id));
         
     | 
| 
       149 
141 
     | 
    
         
             
              VALUE arity = rb_funcall(metho, rb_intern("arity"), 0, 0);
         
     | 
| 
       150 
142 
     | 
    
         
             
              return NUM2INT(arity);
         
     | 
| 
       151 
143 
     | 
    
         
             
            }
         
     | 
| 
         @@ -153,32 +145,33 @@ static int cp_rb_obj_method_arity(VALUE self, ID id) { 
     | 
|
| 
       153 
145 
     | 
    
         | 
| 
       154 
146 
     | 
    
         | 
| 
       155 
147 
     | 
    
         
             
            // This callback function centralizes all collision callbacks.
         
     | 
| 
       156 
     | 
    
         
            -
            // it also adds flexibility by changing theway the callback is called on the 
     | 
| 
      
 148 
     | 
    
         
            +
            // it also adds flexibility by changing theway the callback is called on the
         
     | 
| 
       157 
149 
     | 
    
         
             
            // arity of the callback block or method. With arity0, no args are pased,
         
     | 
| 
       158 
     | 
    
         
            -
            // with arity 1, the arbiter, 
     | 
| 
      
 150 
     | 
    
         
            +
            // with arity 1, the arbiter,
         
     | 
| 
       159 
151 
     | 
    
         
             
            // with arity 2, body_a and body_b,
         
     | 
| 
       160 
     | 
    
         
            -
            // with arity 3 or more -> body_a, body_b, arbiter 
     | 
| 
       161 
     | 
    
         
            -
            static int 
     | 
| 
       162 
     | 
    
         
            -
             
     | 
| 
      
 152 
     | 
    
         
            +
            // with arity 3 or more -> body_a, body_b, arbiter
         
     | 
| 
      
 153 
     | 
    
         
            +
            static int
         
     | 
| 
      
 154 
     | 
    
         
            +
            do_callback(void * data, ID method, cpArbiter *arb) {
         
     | 
| 
      
 155 
     | 
    
         
            +
              int res      = 0;
         
     | 
| 
       163 
156 
     | 
    
         
             
              CP_ARBITER_GET_SHAPES(arb, a, b);
         
     | 
| 
       164 
     | 
    
         
            -
              VALUE object = (VALUE) data; 
     | 
| 
      
 157 
     | 
    
         
            +
              VALUE object = (VALUE) data;
         
     | 
| 
       165 
158 
     | 
    
         
             
              VALUE va     = (VALUE)a->data;
         
     | 
| 
       166 
159 
     | 
    
         
             
              VALUE vb     = (VALUE)b->data;
         
     | 
| 
       167 
160 
     | 
    
         
             
              VALUE varb   = ARBWRAP(arb);
         
     | 
| 
       168 
161 
     | 
    
         
             
              int arity    = cp_rb_obj_method_arity(object, method);
         
     | 
| 
       169 
162 
     | 
    
         
             
              switch(arity) {
         
     | 
| 
       170 
     | 
    
         
            -
             
     | 
| 
       171 
     | 
    
         
            -
             
     | 
| 
       172 
     | 
    
         
            -
             
     | 
| 
       173 
     | 
    
         
            -
             
     | 
| 
       174 
     | 
    
         
            -
             
     | 
| 
       175 
     | 
    
         
            -
             
     | 
| 
       176 
     | 
    
         
            -
             
     | 
| 
       177 
     | 
    
         
            -
             
     | 
| 
       178 
     | 
    
         
            -
             
     | 
| 
       179 
     | 
    
         
            -
              } 
     | 
| 
      
 163 
     | 
    
         
            +
              case 0:
         
     | 
| 
      
 164 
     | 
    
         
            +
                return CP_BOOL_INT(rb_funcall(object, method, 0));
         
     | 
| 
      
 165 
     | 
    
         
            +
              case 1:
         
     | 
| 
      
 166 
     | 
    
         
            +
                return CP_BOOL_INT(rb_funcall(object, method, 1, varb));
         
     | 
| 
      
 167 
     | 
    
         
            +
              case 2:
         
     | 
| 
      
 168 
     | 
    
         
            +
                return CP_BOOL_INT(rb_funcall(object, method, 2, va, vb));
         
     | 
| 
      
 169 
     | 
    
         
            +
              case 3:
         
     | 
| 
      
 170 
     | 
    
         
            +
              default:
         
     | 
| 
      
 171 
     | 
    
         
            +
                return CP_BOOL_INT(rb_funcall(object, method, 3, va, vb, varb));
         
     | 
| 
      
 172 
     | 
    
         
            +
              }
         
     | 
| 
       180 
173 
     | 
    
         
             
              // we never get here
         
     | 
| 
       181 
     | 
    
         
            -
            } 
     | 
| 
      
 174 
     | 
    
         
            +
            }
         
     | 
| 
       182 
175 
     | 
    
         | 
| 
       183 
176 
     | 
    
         | 
| 
       184 
177 
     | 
    
         
             
            static int
         
     | 
| 
         @@ -198,7 +191,7 @@ preSolveCallback(cpArbiter *arb, cpSpace *space, void *data) { 
     | 
|
| 
       198 
191 
     | 
    
         | 
| 
       199 
192 
     | 
    
         
             
            static void
         
     | 
| 
       200 
193 
     | 
    
         
             
            postSolveCallback(cpArbiter *arb, cpSpace *space, void *data) {
         
     | 
| 
       201 
     | 
    
         
            -
             
     | 
| 
      
 194 
     | 
    
         
            +
              do_callback(data, id_post_solve, arb);
         
     | 
| 
       202 
195 
     | 
    
         
             
            }
         
     | 
| 
       203 
196 
     | 
    
         | 
| 
       204 
197 
     | 
    
         
             
            static void
         
     | 
| 
         @@ -209,110 +202,107 @@ separateCallback(cpArbiter *arb, cpSpace *space, void *data) { 
     | 
|
| 
       209 
202 
     | 
    
         | 
| 
       210 
203 
     | 
    
         
             
            static int
         
     | 
| 
       211 
204 
     | 
    
         
             
            respondsTo(VALUE obj, ID method) {
         
     | 
| 
       212 
     | 
    
         
            -
             
     | 
| 
       213 
     | 
    
         
            -
             
     | 
| 
      
 205 
     | 
    
         
            +
              VALUE value = rb_funcall(obj, rb_intern("respond_to?"), 1, ID2SYM(method));
         
     | 
| 
      
 206 
     | 
    
         
            +
              return RTEST(value);
         
     | 
| 
       214 
207 
     | 
    
         
             
            }
         
     | 
| 
       215 
208 
     | 
    
         | 
| 
       216 
209 
     | 
    
         
             
            static int
         
     | 
| 
       217 
210 
     | 
    
         
             
            isBlock(VALUE obj) {
         
     | 
| 
       218 
     | 
    
         
            -
             
     | 
| 
       219 
     | 
    
         
            -
            }
         
     | 
| 
       220 
     | 
    
         
            -
             
     | 
| 
       221 
     | 
    
         
            -
            static VALUE
         
     | 
| 
       222 
     | 
    
         
            -
            rb_cpSpaceAddCollisionHandler(int argc, VALUE *argv, VALUE self)
         
     | 
| 
       223 
     | 
    
         
            -
             
     | 
| 
       224 
     | 
    
         
            -
             
     | 
| 
       225 
     | 
    
         
            -
             
     | 
| 
       226 
     | 
    
         
            -
             
     | 
| 
       227 
     | 
    
         
            -
             
     | 
| 
       228 
     | 
    
         
            -
             
     | 
| 
       229 
     | 
    
         
            -
             
     | 
| 
       230 
     | 
    
         
            -
             
     | 
| 
       231 
     | 
    
         
            -
             
     | 
| 
       232 
     | 
    
         
            -
             
     | 
| 
       233 
     | 
    
         
            -
             
     | 
| 
       234 
     | 
    
         
            -
             
     | 
| 
       235 
     | 
    
         
            -
             
     | 
| 
       236 
     | 
    
         
            -
             
     | 
| 
       237 
     | 
    
         
            -
             
     | 
| 
       238 
     | 
    
         
            -
             
     | 
| 
       239 
     | 
    
         
            -
             
     | 
| 
       240 
     | 
    
         
            -
             
     | 
| 
       241 
     | 
    
         
            -
             
     | 
| 
       242 
     | 
    
         
            -
             
     | 
| 
       243 
     | 
    
         
            -
             
     | 
| 
       244 
     | 
    
         
            -
             
     | 
| 
       245 
     | 
    
         
            -
             
     | 
| 
       246 
     | 
    
         
            -
             
     | 
| 
       247 
     | 
    
         
            -
             
     | 
| 
       248 
     | 
    
         
            -
             
     | 
| 
       249 
     | 
    
         
            -
             
     | 
| 
       250 
     | 
    
         
            -
             
     | 
| 
       251 
     | 
    
         
            -
             
     | 
| 
       252 
     | 
    
         
            -
             
     | 
| 
       253 
     | 
    
         
            -
             
     | 
| 
       254 
     | 
    
         
            -
             
     | 
| 
       255 
     | 
    
         
            -
             
     | 
| 
       256 
     | 
    
         
            -
             
     | 
| 
       257 
     | 
    
         
            -
             
     | 
| 
       258 
     | 
    
         
            -
             
     | 
| 
       259 
     | 
    
         
            -
             
     | 
| 
       260 
     | 
    
         
            -
             
     | 
| 
       261 
     | 
    
         
            -
             
     | 
| 
       262 
     | 
    
         
            -
             
     | 
| 
       263 
     | 
    
         
            -
             
     | 
| 
       264 
     | 
    
         
            -
             
     | 
| 
       265 
     | 
    
         
            -
             
     | 
| 
       266 
     | 
    
         
            -
             
     | 
| 
       267 
     | 
    
         
            -
             
     | 
| 
       268 
     | 
    
         
            -
             
     | 
| 
       269 
     | 
    
         
            -
             
     | 
| 
       270 
     | 
    
         
            -
             
     | 
| 
       271 
     | 
    
         
            -
             
     | 
| 
       272 
     | 
    
         
            -
             
     | 
| 
       273 
     | 
    
         
            -
             
     | 
| 
       274 
     | 
    
         
            -
             
     | 
| 
       275 
     | 
    
         
            -
             
     | 
| 
       276 
     | 
    
         
            -
             
     | 
| 
       277 
     | 
    
         
            -
             
     | 
| 
       278 
     | 
    
         
            -
             
     | 
| 
       279 
     | 
    
         
            -
             
     | 
| 
       280 
     | 
    
         
            -
             
     | 
| 
       281 
     | 
    
         
            -
             
     | 
| 
       282 
     | 
    
         
            -
             
     | 
| 
       283 
     | 
    
         
            -
             
     | 
| 
       284 
     | 
    
         
            -
             
     | 
| 
       285 
     | 
    
         
            -
             
     | 
| 
       286 
     | 
    
         
            -
             
     | 
| 
       287 
     | 
    
         
            -
             
     | 
| 
       288 
     | 
    
         
            -
             
     | 
| 
       289 
     | 
    
         
            -
             
     | 
| 
       290 
     | 
    
         
            -
             
     | 
| 
       291 
     | 
    
         
            -
             
     | 
| 
       292 
     | 
    
         
            -
             
     | 
| 
       293 
     | 
    
         
            -
             
     | 
| 
       294 
     | 
    
         
            -
             
     | 
| 
       295 
     | 
    
         
            -
             
     | 
| 
       296 
     | 
    
         
            -
             
     | 
| 
       297 
     | 
    
         
            -
             
     | 
| 
       298 
     | 
    
         
            -
             
     | 
| 
       299 
     | 
    
         
            -
             
     | 
| 
       300 
     | 
    
         
            -
             
     | 
| 
       301 
     | 
    
         
            -
             
     | 
| 
       302 
     | 
    
         
            -
             
     | 
| 
       303 
     | 
    
         
            -
             
     | 
| 
       304 
     | 
    
         
            -
             
     | 
| 
       305 
     | 
    
         
            -
             
     | 
| 
       306 
     | 
    
         
            -
             
     | 
| 
       307 
     | 
    
         
            -
             
     | 
| 
       308 
     | 
    
         
            -
             
     | 
| 
       309 
     | 
    
         
            -
             
     | 
| 
       310 
     | 
    
         
            -
             
     | 
| 
       311 
     | 
    
         
            -
             
     | 
| 
       312 
     | 
    
         
            -
             
     | 
| 
       313 
     | 
    
         
            -
            	}
         
     | 
| 
       314 
     | 
    
         
            -
            	
         
     | 
| 
       315 
     | 
    
         
            -
            	return Qnil;
         
     | 
| 
      
 211 
     | 
    
         
            +
              return respondsTo(obj, id_call);
         
     | 
| 
      
 212 
     | 
    
         
            +
            }
         
     | 
| 
      
 213 
     | 
    
         
            +
             
     | 
| 
      
 214 
     | 
    
         
            +
            static VALUE
         
     | 
| 
      
 215 
     | 
    
         
            +
            rb_cpSpaceAddCollisionHandler(int argc, VALUE *argv, VALUE self) {
         
     | 
| 
      
 216 
     | 
    
         
            +
              VALUE a, b, obj, block;
         
     | 
| 
      
 217 
     | 
    
         
            +
              obj = 0;
         
     | 
| 
      
 218 
     | 
    
         
            +
              rb_scan_args(argc, argv, "21&", &a, &b, &obj, &block);
         
     | 
| 
      
 219 
     | 
    
         
            +
             
     | 
| 
      
 220 
     | 
    
         
            +
              VALUE id_a   = rb_obj_id(a);
         
     | 
| 
      
 221 
     | 
    
         
            +
              VALUE id_b   = rb_obj_id(b);
         
     | 
| 
      
 222 
     | 
    
         
            +
              VALUE blocks = rb_iv_get(self, "blocks");
         
     | 
| 
      
 223 
     | 
    
         
            +
             
     | 
| 
      
 224 
     | 
    
         
            +
              if(RTEST(obj) && RTEST(block)) {
         
     | 
| 
      
 225 
     | 
    
         
            +
                rb_raise(rb_eArgError, "Cannot specify both a handler object and a block.");
         
     | 
| 
      
 226 
     | 
    
         
            +
              } else if(RTEST(block)) {
         
     | 
| 
      
 227 
     | 
    
         
            +
                cpSpaceAddCollisionHandler(
         
     | 
| 
      
 228 
     | 
    
         
            +
                  SPACE(self), NUM2UINT(id_a), NUM2UINT(id_b),
         
     | 
| 
      
 229 
     | 
    
         
            +
                  NULL,
         
     | 
| 
      
 230 
     | 
    
         
            +
                  compatibilityCallback,
         
     | 
| 
      
 231 
     | 
    
         
            +
                  NULL,
         
     | 
| 
      
 232 
     | 
    
         
            +
                  NULL,
         
     | 
| 
      
 233 
     | 
    
         
            +
                  (void *)block
         
     | 
| 
      
 234 
     | 
    
         
            +
                  );
         
     | 
| 
      
 235 
     | 
    
         
            +
             
     | 
| 
      
 236 
     | 
    
         
            +
                rb_hash_aset(blocks, rb_ary_new3(2, id_a, id_b), block);
         
     | 
| 
      
 237 
     | 
    
         
            +
              } else if(RTEST(obj)) {
         
     | 
| 
      
 238 
     | 
    
         
            +
                cpSpaceAddCollisionHandler(
         
     | 
| 
      
 239 
     | 
    
         
            +
                  SPACE(self), NUM2UINT(id_a), NUM2UINT(id_b),
         
     | 
| 
      
 240 
     | 
    
         
            +
                  (respondsTo(obj, id_begin)      ? beginCallback     : NULL),
         
     | 
| 
      
 241 
     | 
    
         
            +
                  (respondsTo(obj, id_pre_solve)  ? preSolveCallback  : NULL),
         
     | 
| 
      
 242 
     | 
    
         
            +
                  (respondsTo(obj, id_post_solve) ? postSolveCallback : NULL),
         
     | 
| 
      
 243 
     | 
    
         
            +
                  (respondsTo(obj, id_separate)   ? separateCallback  : NULL),
         
     | 
| 
      
 244 
     | 
    
         
            +
                  (void *)obj
         
     | 
| 
      
 245 
     | 
    
         
            +
                  );
         
     | 
| 
      
 246 
     | 
    
         
            +
             
     | 
| 
      
 247 
     | 
    
         
            +
                rb_hash_aset(blocks, rb_ary_new3(2, id_a, id_b), obj);
         
     | 
| 
      
 248 
     | 
    
         
            +
              } else {
         
     | 
| 
      
 249 
     | 
    
         
            +
                cpSpaceAddCollisionHandler(
         
     | 
| 
      
 250 
     | 
    
         
            +
                  SPACE(self), NUM2UINT(id_a), NUM2UINT(id_b),
         
     | 
| 
      
 251 
     | 
    
         
            +
                  NULL, doNothingCallback, NULL, NULL, NULL
         
     | 
| 
      
 252 
     | 
    
         
            +
                  );
         
     | 
| 
      
 253 
     | 
    
         
            +
              }
         
     | 
| 
      
 254 
     | 
    
         
            +
             
     | 
| 
      
 255 
     | 
    
         
            +
              return Qnil;
         
     | 
| 
      
 256 
     | 
    
         
            +
            }
         
     | 
| 
      
 257 
     | 
    
         
            +
             
     | 
| 
      
 258 
     | 
    
         
            +
            static VALUE
         
     | 
| 
      
 259 
     | 
    
         
            +
            rb_cpSpaceRemoveCollisionHandler(VALUE self, VALUE a, VALUE b) {
         
     | 
| 
      
 260 
     | 
    
         
            +
              VALUE id_a   = rb_obj_id(a);
         
     | 
| 
      
 261 
     | 
    
         
            +
              VALUE id_b   = rb_obj_id(b);
         
     | 
| 
      
 262 
     | 
    
         
            +
              cpSpaceRemoveCollisionHandler(SPACE(self), NUM2UINT(id_a), NUM2UINT(id_b));
         
     | 
| 
      
 263 
     | 
    
         
            +
             
     | 
| 
      
 264 
     | 
    
         
            +
              VALUE blocks = rb_iv_get(self, "blocks");
         
     | 
| 
      
 265 
     | 
    
         
            +
              rb_hash_delete(blocks, rb_ary_new3(2, id_a, id_b));
         
     | 
| 
      
 266 
     | 
    
         
            +
             
     | 
| 
      
 267 
     | 
    
         
            +
              return Qnil;
         
     | 
| 
      
 268 
     | 
    
         
            +
            }
         
     | 
| 
      
 269 
     | 
    
         
            +
             
     | 
| 
      
 270 
     | 
    
         
            +
            static VALUE
         
     | 
| 
      
 271 
     | 
    
         
            +
            rb_cpSpaceSetDefaultCollisionHandler(int argc, VALUE *argv, VALUE self) {
         
     | 
| 
      
 272 
     | 
    
         
            +
              VALUE obj, block;
         
     | 
| 
      
 273 
     | 
    
         
            +
              rb_scan_args(argc, argv, "01&", &obj, &block);
         
     | 
| 
      
 274 
     | 
    
         
            +
             
     | 
| 
      
 275 
     | 
    
         
            +
              if(RTEST(obj) && RTEST(block)) {
         
     | 
| 
      
 276 
     | 
    
         
            +
                rb_raise(rb_eArgError, "Cannot specify both a handler object and a block.");
         
     | 
| 
      
 277 
     | 
    
         
            +
              } else if(RTEST(block)) {
         
     | 
| 
      
 278 
     | 
    
         
            +
                cpSpaceSetDefaultCollisionHandler(
         
     | 
| 
      
 279 
     | 
    
         
            +
                  SPACE(self),
         
     | 
| 
      
 280 
     | 
    
         
            +
                  NULL,
         
     | 
| 
      
 281 
     | 
    
         
            +
                  compatibilityCallback,
         
     | 
| 
      
 282 
     | 
    
         
            +
                  NULL,
         
     | 
| 
      
 283 
     | 
    
         
            +
                  NULL,
         
     | 
| 
      
 284 
     | 
    
         
            +
                  (void *)block
         
     | 
| 
      
 285 
     | 
    
         
            +
                  );
         
     | 
| 
      
 286 
     | 
    
         
            +
             
     | 
| 
      
 287 
     | 
    
         
            +
                rb_hash_aset(rb_iv_get(self, "blocks"), ID2SYM(rb_intern("default")), block);
         
     | 
| 
      
 288 
     | 
    
         
            +
              } else if(RTEST(obj)) {
         
     | 
| 
      
 289 
     | 
    
         
            +
                cpSpaceSetDefaultCollisionHandler(
         
     | 
| 
      
 290 
     | 
    
         
            +
                  SPACE(self),
         
     | 
| 
      
 291 
     | 
    
         
            +
                  (respondsTo(obj, id_begin)      ? beginCallback     : NULL),
         
     | 
| 
      
 292 
     | 
    
         
            +
                  (respondsTo(obj, id_pre_solve)  ? preSolveCallback  : NULL),
         
     | 
| 
      
 293 
     | 
    
         
            +
                  (respondsTo(obj, id_post_solve) ? postSolveCallback : NULL),
         
     | 
| 
      
 294 
     | 
    
         
            +
                  (respondsTo(obj, id_separate)   ? separateCallback  : NULL),
         
     | 
| 
      
 295 
     | 
    
         
            +
                  (void *)obj
         
     | 
| 
      
 296 
     | 
    
         
            +
                  );
         
     | 
| 
      
 297 
     | 
    
         
            +
             
     | 
| 
      
 298 
     | 
    
         
            +
                rb_hash_aset(rb_iv_get(self, "blocks"), ID2SYM(rb_intern("default")), obj);
         
     | 
| 
      
 299 
     | 
    
         
            +
              } else {
         
     | 
| 
      
 300 
     | 
    
         
            +
                cpSpaceSetDefaultCollisionHandler(
         
     | 
| 
      
 301 
     | 
    
         
            +
                  SPACE(self), NULL, doNothingCallback, NULL, NULL, NULL
         
     | 
| 
      
 302 
     | 
    
         
            +
                  );
         
     | 
| 
      
 303 
     | 
    
         
            +
              }
         
     | 
| 
      
 304 
     | 
    
         
            +
             
     | 
| 
      
 305 
     | 
    
         
            +
              return Qnil;
         
     | 
| 
       316 
306 
     | 
    
         
             
            }
         
     | 
| 
       317 
307 
     | 
    
         | 
| 
       318 
308 
     | 
    
         
             
            static void
         
     | 
| 
         @@ -326,239 +316,219 @@ rb_cpSpaceAddPostStepCallback(int argc, VALUE *argv, VALUE self) { 
     | 
|
| 
       326 
316 
     | 
    
         
             
              VALUE obj, block;
         
     | 
| 
       327 
317 
     | 
    
         
             
              rb_scan_args(argc, argv, "10&", &obj, &block);
         
     | 
| 
       328 
318 
     | 
    
         
             
              cpSpaceAddPostStepCallback(SPACE(self),
         
     | 
| 
       329 
     | 
    
         
            -
             
     | 
| 
       330 
     | 
    
         
            -
              return self; 
     | 
| 
      
 319 
     | 
    
         
            +
                                         poststepCallback, (void *) obj, (void *) block);
         
     | 
| 
      
 320 
     | 
    
         
            +
              return self;
         
     | 
| 
       331 
321 
     | 
    
         
             
            }
         
     | 
| 
       332 
322 
     | 
    
         | 
| 
       333 
323 
     | 
    
         
             
            static VALUE
         
     | 
| 
       334 
     | 
    
         
            -
            rb_cpSpaceAddShape(VALUE self, VALUE shape)
         
     | 
| 
       335 
     | 
    
         
            -
             
     | 
| 
       336 
     | 
    
         
            -
             
     | 
| 
       337 
     | 
    
         
            -
             
     | 
| 
       338 
     | 
    
         
            -
            	return shape;
         
     | 
| 
      
 324 
     | 
    
         
            +
            rb_cpSpaceAddShape(VALUE self, VALUE shape) {
         
     | 
| 
      
 325 
     | 
    
         
            +
              cpSpaceAddShape(SPACE(self), SHAPE(shape));
         
     | 
| 
      
 326 
     | 
    
         
            +
              rb_ary_push(rb_iv_get(self, "active_shapes"), shape);
         
     | 
| 
      
 327 
     | 
    
         
            +
              return shape;
         
     | 
| 
       339 
328 
     | 
    
         
             
            }
         
     | 
| 
       340 
329 
     | 
    
         | 
| 
       341 
330 
     | 
    
         
             
            static VALUE
         
     | 
| 
       342 
     | 
    
         
            -
            rb_cpSpaceAddStaticShape(VALUE self, VALUE shape)
         
     | 
| 
       343 
     | 
    
         
            -
             
     | 
| 
       344 
     | 
    
         
            -
             
     | 
| 
       345 
     | 
    
         
            -
             
     | 
| 
       346 
     | 
    
         
            -
            	return shape;
         
     | 
| 
      
 331 
     | 
    
         
            +
            rb_cpSpaceAddStaticShape(VALUE self, VALUE shape) {
         
     | 
| 
      
 332 
     | 
    
         
            +
              cpSpaceAddStaticShape(SPACE(self), SHAPE(shape));
         
     | 
| 
      
 333 
     | 
    
         
            +
              rb_ary_push(rb_iv_get(self, "static_shapes"), shape);
         
     | 
| 
      
 334 
     | 
    
         
            +
              return shape;
         
     | 
| 
       347 
335 
     | 
    
         
             
            }
         
     | 
| 
       348 
336 
     | 
    
         | 
| 
       349 
337 
     | 
    
         
             
            static VALUE
         
     | 
| 
       350 
     | 
    
         
            -
            rb_cpSpaceAddBody(VALUE self, VALUE body)
         
     | 
| 
       351 
     | 
    
         
            -
             
     | 
| 
       352 
     | 
    
         
            -
             
     | 
| 
       353 
     | 
    
         
            -
             
     | 
| 
       354 
     | 
    
         
            -
            	return body;
         
     | 
| 
      
 338 
     | 
    
         
            +
            rb_cpSpaceAddBody(VALUE self, VALUE body) {
         
     | 
| 
      
 339 
     | 
    
         
            +
              cpSpaceAddBody(SPACE(self), BODY(body));
         
     | 
| 
      
 340 
     | 
    
         
            +
              rb_ary_push(rb_iv_get(self, "bodies"), body);
         
     | 
| 
      
 341 
     | 
    
         
            +
              return body;
         
     | 
| 
       355 
342 
     | 
    
         
             
            }
         
     | 
| 
       356 
343 
     | 
    
         | 
| 
       357 
344 
     | 
    
         
             
            static VALUE
         
     | 
| 
       358 
     | 
    
         
            -
            rb_cpSpaceAddConstraint(VALUE self, VALUE constraint)
         
     | 
| 
       359 
     | 
    
         
            -
             
     | 
| 
       360 
     | 
    
         
            -
             
     | 
| 
       361 
     | 
    
         
            -
             
     | 
| 
       362 
     | 
    
         
            -
            	return constraint;
         
     | 
| 
      
 345 
     | 
    
         
            +
            rb_cpSpaceAddConstraint(VALUE self, VALUE constraint) {
         
     | 
| 
      
 346 
     | 
    
         
            +
              cpSpaceAddConstraint(SPACE(self), CONSTRAINT(constraint));
         
     | 
| 
      
 347 
     | 
    
         
            +
              rb_ary_push(rb_iv_get(self, "constraints"), constraint);
         
     | 
| 
      
 348 
     | 
    
         
            +
              return constraint;
         
     | 
| 
       363 
349 
     | 
    
         
             
            }
         
     | 
| 
       364 
350 
     | 
    
         | 
| 
       365 
351 
     | 
    
         
             
            static VALUE
         
     | 
| 
       366 
     | 
    
         
            -
            rb_cpSpaceRemoveShape(VALUE self, VALUE shape)
         
     | 
| 
       367 
     | 
    
         
            -
             
     | 
| 
       368 
     | 
    
         
            -
             
     | 
| 
       369 
     | 
    
         
            -
             
     | 
| 
      
 352 
     | 
    
         
            +
            rb_cpSpaceRemoveShape(VALUE self, VALUE shape) {
         
     | 
| 
      
 353 
     | 
    
         
            +
              VALUE ok = rb_ary_delete(rb_iv_get(self, "active_shapes"), shape);
         
     | 
| 
      
 354 
     | 
    
         
            +
              if(!(NIL_P(ok))) cpSpaceRemoveShape(SPACE(self), SHAPE(shape));
         
     | 
| 
      
 355 
     | 
    
         
            +
              return ok;
         
     | 
| 
       370 
356 
     | 
    
         
             
            }
         
     | 
| 
       371 
357 
     | 
    
         | 
| 
       372 
358 
     | 
    
         
             
            static VALUE
         
     | 
| 
       373 
     | 
    
         
            -
            rb_cpSpaceRemoveStaticShape(VALUE self, VALUE shape)
         
     | 
| 
       374 
     | 
    
         
            -
             
     | 
| 
       375 
     | 
    
         
            -
             
     | 
| 
       376 
     | 
    
         
            -
             
     | 
| 
      
 359 
     | 
    
         
            +
            rb_cpSpaceRemoveStaticShape(VALUE self, VALUE shape) {
         
     | 
| 
      
 360 
     | 
    
         
            +
              VALUE ok = rb_ary_delete(rb_iv_get(self, "static_shapes"), shape);
         
     | 
| 
      
 361 
     | 
    
         
            +
              if(!(NIL_P(ok))) cpSpaceRemoveStaticShape(SPACE(self), SHAPE(shape));
         
     | 
| 
      
 362 
     | 
    
         
            +
              return ok;
         
     | 
| 
       377 
363 
     | 
    
         
             
            }
         
     | 
| 
       378 
364 
     | 
    
         | 
| 
       379 
365 
     | 
    
         
             
            static VALUE
         
     | 
| 
       380 
     | 
    
         
            -
            rb_cpSpaceRemoveBody(VALUE self, VALUE body)
         
     | 
| 
       381 
     | 
    
         
            -
             
     | 
| 
       382 
     | 
    
         
            -
             
     | 
| 
       383 
     | 
    
         
            -
             
     | 
| 
      
 366 
     | 
    
         
            +
            rb_cpSpaceRemoveBody(VALUE self, VALUE body) {
         
     | 
| 
      
 367 
     | 
    
         
            +
              VALUE ok = rb_ary_delete(rb_iv_get(self, "bodies"), body);
         
     | 
| 
      
 368 
     | 
    
         
            +
              if(!(NIL_P(ok))) cpSpaceRemoveBody(SPACE(self), BODY(body));
         
     | 
| 
      
 369 
     | 
    
         
            +
              return ok;
         
     | 
| 
       384 
370 
     | 
    
         
             
            }
         
     | 
| 
       385 
371 
     | 
    
         | 
| 
       386 
372 
     | 
    
         
             
            static VALUE
         
     | 
| 
       387 
     | 
    
         
            -
            rb_cpSpaceRemoveConstraint(VALUE self, VALUE constraint)
         
     | 
| 
       388 
     | 
    
         
            -
             
     | 
| 
       389 
     | 
    
         
            -
             
     | 
| 
       390 
     | 
    
         
            -
             
     | 
| 
      
 373 
     | 
    
         
            +
            rb_cpSpaceRemoveConstraint(VALUE self, VALUE constraint) {
         
     | 
| 
      
 374 
     | 
    
         
            +
              VALUE ok = rb_ary_delete(rb_iv_get(self, "constraints"), constraint);
         
     | 
| 
      
 375 
     | 
    
         
            +
              if(!(NIL_P(ok))) cpSpaceRemoveConstraint(SPACE(self), CONSTRAINT(constraint));
         
     | 
| 
      
 376 
     | 
    
         
            +
              return ok;
         
     | 
| 
       391 
377 
     | 
    
         
             
            }
         
     | 
| 
       392 
378 
     | 
    
         | 
| 
       393 
379 
     | 
    
         
             
            static VALUE
         
     | 
| 
       394 
     | 
    
         
            -
            rb_cpSpaceResizeStaticHash(VALUE self, VALUE dim, VALUE count)
         
     | 
| 
       395 
     | 
    
         
            -
             
     | 
| 
       396 
     | 
    
         
            -
             
     | 
| 
       397 
     | 
    
         
            -
            	return Qnil;
         
     | 
| 
      
 380 
     | 
    
         
            +
            rb_cpSpaceResizeStaticHash(VALUE self, VALUE dim, VALUE count) {
         
     | 
| 
      
 381 
     | 
    
         
            +
              cpSpaceResizeStaticHash(SPACE(self), NUM2DBL(dim), NUM2INT(count));
         
     | 
| 
      
 382 
     | 
    
         
            +
              return Qnil;
         
     | 
| 
       398 
383 
     | 
    
         
             
            }
         
     | 
| 
       399 
384 
     | 
    
         | 
| 
       400 
385 
     | 
    
         
             
            static VALUE
         
     | 
| 
       401 
     | 
    
         
            -
            rb_cpSpaceResizeActiveHash(VALUE self, VALUE dim, VALUE count)
         
     | 
| 
       402 
     | 
    
         
            -
             
     | 
| 
       403 
     | 
    
         
            -
             
     | 
| 
       404 
     | 
    
         
            -
            	return Qnil;
         
     | 
| 
      
 386 
     | 
    
         
            +
            rb_cpSpaceResizeActiveHash(VALUE self, VALUE dim, VALUE count) {
         
     | 
| 
      
 387 
     | 
    
         
            +
              cpSpaceResizeActiveHash(SPACE(self), NUM2DBL(dim), NUM2INT(count));
         
     | 
| 
      
 388 
     | 
    
         
            +
              return Qnil;
         
     | 
| 
       405 
389 
     | 
    
         
             
            }
         
     | 
| 
       406 
390 
     | 
    
         | 
| 
       407 
391 
     | 
    
         
             
            static VALUE
         
     | 
| 
       408 
     | 
    
         
            -
            rb_cpSpaceRehashStatic(VALUE self)
         
     | 
| 
       409 
     | 
    
         
            -
             
     | 
| 
       410 
     | 
    
         
            -
             
     | 
| 
       411 
     | 
    
         
            -
            	return Qnil;
         
     | 
| 
      
 392 
     | 
    
         
            +
            rb_cpSpaceRehashStatic(VALUE self) {
         
     | 
| 
      
 393 
     | 
    
         
            +
              cpSpaceRehashStatic(SPACE(self));
         
     | 
| 
      
 394 
     | 
    
         
            +
              return Qnil;
         
     | 
| 
       412 
395 
     | 
    
         
             
            }
         
     | 
| 
       413 
396 
     | 
    
         | 
| 
       414 
397 
     | 
    
         
             
            static VALUE
         
     | 
| 
       415 
     | 
    
         
            -
            rb_cpSpaceRehashShape(VALUE self, VALUE shape)
         
     | 
| 
       416 
     | 
    
         
            -
            {
         
     | 
| 
      
 398 
     | 
    
         
            +
            rb_cpSpaceRehashShape(VALUE self, VALUE shape) {
         
     | 
| 
       417 
399 
     | 
    
         
             
              cpSpaceRehashShape(SPACE(self), SHAPE(shape));
         
     | 
| 
       418 
400 
     | 
    
         
             
              return Qnil;
         
     | 
| 
       419 
401 
     | 
    
         
             
            }
         
     | 
| 
       420 
402 
     | 
    
         | 
| 
       421 
403 
     | 
    
         | 
| 
       422 
     | 
    
         
            -
            static unsigned int 
     | 
| 
      
 404 
     | 
    
         
            +
            static unsigned int
         
     | 
| 
      
 405 
     | 
    
         
            +
            get_layers(VALUE layers) {
         
     | 
| 
       423 
406 
     | 
    
         
             
              if (NIL_P(layers)) return ~0;
         
     | 
| 
       424 
407 
     | 
    
         
             
              return NUM2UINT(layers);
         
     | 
| 
       425 
     | 
    
         
            -
            } 
     | 
| 
      
 408 
     | 
    
         
            +
            }
         
     | 
| 
       426 
409 
     | 
    
         | 
| 
       427 
     | 
    
         
            -
            static unsigned int 
     | 
| 
      
 410 
     | 
    
         
            +
            static unsigned int
         
     | 
| 
      
 411 
     | 
    
         
            +
            get_group(VALUE group) {
         
     | 
| 
       428 
412 
     | 
    
         
             
              if (NIL_P(group)) return 0;
         
     | 
| 
       429 
413 
     | 
    
         
             
              return NUM2UINT(group);
         
     | 
| 
       430 
     | 
    
         
            -
            } 
     | 
| 
      
 414 
     | 
    
         
            +
            }
         
     | 
| 
       431 
415 
     | 
    
         | 
| 
       432 
416 
     | 
    
         
             
            static void
         
     | 
| 
       433 
     | 
    
         
            -
            pointQueryCallback(cpShape *shape, VALUE block)
         
     | 
| 
       434 
     | 
    
         
            -
             
     | 
| 
       435 
     | 
    
         
            -
            	rb_funcall(block, id_call, 1, (VALUE)shape->data);
         
     | 
| 
      
 417 
     | 
    
         
            +
            pointQueryCallback(cpShape *shape, VALUE block) {
         
     | 
| 
      
 418 
     | 
    
         
            +
              rb_funcall(block, id_call, 1, (VALUE)shape->data);
         
     | 
| 
       436 
419 
     | 
    
         
             
            }
         
     | 
| 
       437 
420 
     | 
    
         | 
| 
       438 
421 
     | 
    
         
             
            static VALUE
         
     | 
| 
       439 
     | 
    
         
            -
            rb_cpSpacePointQuery(int argc, VALUE *argv, VALUE self)
         
     | 
| 
       440 
     | 
    
         
            -
             
     | 
| 
       441 
     | 
    
         
            -
             
     | 
| 
       442 
     | 
    
         
            -
             
     | 
| 
       443 
     | 
    
         
            -
             
     | 
| 
       444 
     | 
    
         
            -
             
     | 
| 
       445 
     | 
    
         
            -
             
     | 
| 
       446 
     | 
    
         
            -
             
     | 
| 
       447 
     | 
    
         
            -
             
     | 
| 
       448 
     | 
    
         
            -
             
     | 
| 
       449 
     | 
    
         
            -
            	return Qnil;
         
     | 
| 
      
 422 
     | 
    
         
            +
            rb_cpSpacePointQuery(int argc, VALUE *argv, VALUE self) {
         
     | 
| 
      
 423 
     | 
    
         
            +
              VALUE point, layers, group, block;
         
     | 
| 
      
 424 
     | 
    
         
            +
              rb_scan_args(argc, argv, "12&", &point, &layers, &group, &block);
         
     | 
| 
      
 425 
     | 
    
         
            +
             
     | 
| 
      
 426 
     | 
    
         
            +
              cpSpacePointQuery(
         
     | 
| 
      
 427 
     | 
    
         
            +
                SPACE(self), *VGET(point), get_layers(layers), get_group(group),
         
     | 
| 
      
 428 
     | 
    
         
            +
                (cpSpacePointQueryFunc)pointQueryCallback, (void *)block
         
     | 
| 
      
 429 
     | 
    
         
            +
                );
         
     | 
| 
      
 430 
     | 
    
         
            +
             
     | 
| 
      
 431 
     | 
    
         
            +
              return Qnil;
         
     | 
| 
       450 
432 
     | 
    
         
             
            }
         
     | 
| 
       451 
433 
     | 
    
         | 
| 
       452 
434 
     | 
    
         
             
            static VALUE
         
     | 
| 
       453 
     | 
    
         
            -
            rb_cpSpacePointQueryFirst(int argc, VALUE *argv, VALUE self)
         
     | 
| 
       454 
     | 
    
         
            -
             
     | 
| 
       455 
     | 
    
         
            -
             
     | 
| 
       456 
     | 
    
         
            -
             
     | 
| 
       457 
     | 
    
         
            -
             
     | 
| 
       458 
     | 
    
         
            -
             
     | 
| 
       459 
     | 
    
         
            -
            		SPACE(self), *VGET(point),
         
     | 
| 
      
 435 
     | 
    
         
            +
            rb_cpSpacePointQueryFirst(int argc, VALUE *argv, VALUE self) {
         
     | 
| 
      
 436 
     | 
    
         
            +
              VALUE point, layers, group;
         
     | 
| 
      
 437 
     | 
    
         
            +
              rb_scan_args(argc, argv, "12", &point, &layers, &group);
         
     | 
| 
      
 438 
     | 
    
         
            +
             
     | 
| 
      
 439 
     | 
    
         
            +
              cpShape *shape = cpSpacePointQueryFirst(
         
     | 
| 
      
 440 
     | 
    
         
            +
                SPACE(self), *VGET(point),
         
     | 
| 
       460 
441 
     | 
    
         
             
                get_layers(layers), get_group(group)
         
     | 
| 
       461 
     | 
    
         
            -
             
     | 
| 
       462 
     | 
    
         
            -
             
     | 
| 
       463 
     | 
    
         
            -
             
     | 
| 
      
 442 
     | 
    
         
            +
                );
         
     | 
| 
      
 443 
     | 
    
         
            +
             
     | 
| 
      
 444 
     | 
    
         
            +
              return (shape ? (VALUE)shape->data : Qnil);
         
     | 
| 
       464 
445 
     | 
    
         
             
            }
         
     | 
| 
       465 
446 
     | 
    
         | 
| 
       466 
447 
     | 
    
         
             
            static void
         
     | 
| 
       467 
     | 
    
         
            -
            segmentQueryCallback(cpShape *shape, cpFloat t, cpVect n, VALUE block)
         
     | 
| 
       468 
     | 
    
         
            -
             
     | 
| 
       469 
     | 
    
         
            -
            	rb_funcall(block, id_call, 1, (VALUE)shape->data, rb_float_new(t), VNEW(n));
         
     | 
| 
      
 448 
     | 
    
         
            +
            segmentQueryCallback(cpShape *shape, cpFloat t, cpVect n, VALUE block) {
         
     | 
| 
      
 449 
     | 
    
         
            +
              rb_funcall(block, id_call, 1, (VALUE)shape->data, rb_float_new(t), VNEW(n));
         
     | 
| 
       470 
450 
     | 
    
         
             
            }
         
     | 
| 
       471 
451 
     | 
    
         | 
| 
       472 
452 
     | 
    
         
             
            static VALUE
         
     | 
| 
       473 
     | 
    
         
            -
            rb_cpSpaceSegmentQuery(int argc, VALUE *argv, VALUE self)
         
     | 
| 
       474 
     | 
    
         
            -
             
     | 
| 
       475 
     | 
    
         
            -
             
     | 
| 
       476 
     | 
    
         
            -
             
     | 
| 
       477 
     | 
    
         
            -
             
     | 
| 
       478 
     | 
    
         
            -
             
     | 
| 
       479 
     | 
    
         
            -
            		SPACE(self), *VGET(a), *VGET(b),
         
     | 
| 
       480 
     | 
    
         
            -
                get_layers(layers), get_group(group),
         
     | 
| 
       481 
     | 
    
         
            -
            		(cpSpaceSegmentQueryFunc)segmentQueryCallback, (void *)block
         
     | 
| 
       482 
     | 
    
         
            -
            	);
         
     | 
| 
       483 
     | 
    
         
            -
            	
         
     | 
| 
       484 
     | 
    
         
            -
            	return Qnil;
         
     | 
| 
       485 
     | 
    
         
            -
            }
         
     | 
| 
       486 
     | 
    
         
            -
             
     | 
| 
       487 
     | 
    
         
            -
            static VALUE
         
     | 
| 
       488 
     | 
    
         
            -
            rb_cpSpaceSegmentQueryFirst(int argc, VALUE *argv, VALUE self)
         
     | 
| 
       489 
     | 
    
         
            -
            {
         
     | 
| 
       490 
     | 
    
         
            -
            	VALUE a, b, layers, group, block;
         
     | 
| 
       491 
     | 
    
         
            -
              cpSegmentQueryInfo info = {NULL, 1.0f, cpvzero};
         
     | 
| 
       492 
     | 
    
         
            -
              
         
     | 
| 
       493 
     | 
    
         
            -
              rb_scan_args(argc, argv, "22&", &a, &b, &layers, &group, &block);  	
         
     | 
| 
       494 
     | 
    
         
            -
            	
         
     | 
| 
       495 
     | 
    
         
            -
            	cpSpaceSegmentQueryFirst(
         
     | 
| 
       496 
     | 
    
         
            -
            		SPACE(self), *VGET(a), *VGET(b), 
         
     | 
| 
      
 453 
     | 
    
         
            +
            rb_cpSpaceSegmentQuery(int argc, VALUE *argv, VALUE self) {
         
     | 
| 
      
 454 
     | 
    
         
            +
              VALUE a, b, layers, group, block;
         
     | 
| 
      
 455 
     | 
    
         
            +
              rb_scan_args(argc, argv, "22&", &a, &b, &layers, &group, &block);
         
     | 
| 
      
 456 
     | 
    
         
            +
             
     | 
| 
      
 457 
     | 
    
         
            +
              cpSpaceSegmentQuery(
         
     | 
| 
      
 458 
     | 
    
         
            +
                SPACE(self), *VGET(a), *VGET(b),
         
     | 
| 
       497 
459 
     | 
    
         
             
                get_layers(layers), get_group(group),
         
     | 
| 
       498 
     | 
    
         
            -
             
     | 
| 
       499 
     | 
    
         
            -
             
     | 
| 
       500 
     | 
    
         
            -
             
     | 
| 
       501 
     | 
    
         
            -
             
     | 
| 
       502 
     | 
    
         
            -
             
     | 
| 
       503 
     | 
    
         
            -
             
     | 
| 
      
 460 
     | 
    
         
            +
                (cpSpaceSegmentQueryFunc)segmentQueryCallback, (void *)block
         
     | 
| 
      
 461 
     | 
    
         
            +
                );
         
     | 
| 
      
 462 
     | 
    
         
            +
             
     | 
| 
      
 463 
     | 
    
         
            +
              return Qnil;
         
     | 
| 
      
 464 
     | 
    
         
            +
            }
         
     | 
| 
      
 465 
     | 
    
         
            +
             
     | 
| 
      
 466 
     | 
    
         
            +
            static VALUE
         
     | 
| 
      
 467 
     | 
    
         
            +
            rb_cpSpaceSegmentQueryFirst(int argc, VALUE *argv, VALUE self) {
         
     | 
| 
      
 468 
     | 
    
         
            +
              VALUE a, b, layers, group, block;
         
     | 
| 
      
 469 
     | 
    
         
            +
              cpSegmentQueryInfo info = { NULL, 1.0f, cpvzero};
         
     | 
| 
      
 470 
     | 
    
         
            +
             
     | 
| 
      
 471 
     | 
    
         
            +
              rb_scan_args(argc, argv, "22&", &a, &b, &layers, &group, &block);
         
     | 
| 
      
 472 
     | 
    
         
            +
             
     | 
| 
      
 473 
     | 
    
         
            +
              cpSpaceSegmentQueryFirst(SPACE(self), *VGET(a), *VGET(b),
         
     | 
| 
      
 474 
     | 
    
         
            +
                                       get_layers(layers), get_group(group), &info);
         
     | 
| 
      
 475 
     | 
    
         
            +
              // contrary to the standard chipmunk bindings, we also return a
         
     | 
| 
      
 476 
     | 
    
         
            +
              // struct here with then needed values.
         
     | 
| 
      
 477 
     | 
    
         
            +
              if(info.shape) {
         
     | 
| 
      
 478 
     | 
    
         
            +
                return rb_cpSegmentQueryInfoNew((VALUE)info.shape->data, rb_float_new(info.t), VNEW(info.n));
         
     | 
| 
       504 
479 
     | 
    
         
             
              }
         
     | 
| 
       505 
480 
     | 
    
         
             
              return Qnil;
         
     | 
| 
       506 
     | 
    
         
            -
             
     | 
| 
      
 481 
     | 
    
         
            +
             
     | 
| 
       507 
482 
     | 
    
         
             
            }
         
     | 
| 
       508 
483 
     | 
    
         | 
| 
       509 
484 
     | 
    
         | 
| 
       510 
485 
     | 
    
         
             
            static void
         
     | 
| 
       511 
     | 
    
         
            -
            bbQueryCallback(cpShape *shape, VALUE block)
         
     | 
| 
       512 
     | 
    
         
            -
            {
         
     | 
| 
      
 486 
     | 
    
         
            +
            bbQueryCallback(cpShape *shape, VALUE block) {
         
     | 
| 
       513 
487 
     | 
    
         
             
              rb_funcall(block, id_call, 1, (VALUE)shape->data);
         
     | 
| 
       514 
488 
     | 
    
         
             
            }
         
     | 
| 
       515 
489 
     | 
    
         | 
| 
       516 
490 
     | 
    
         
             
            /* Bounding box query. */
         
     | 
| 
       517 
491 
     | 
    
         
             
            static VALUE
         
     | 
| 
       518 
     | 
    
         
            -
            rb_cpSpaceBBQuery(int argc, VALUE *argv, VALUE self)
         
     | 
| 
       519 
     | 
    
         
            -
            {
         
     | 
| 
      
 492 
     | 
    
         
            +
            rb_cpSpaceBBQuery(int argc, VALUE *argv, VALUE self) {
         
     | 
| 
       520 
493 
     | 
    
         
             
              VALUE bb, layers, group, block;
         
     | 
| 
       521 
494 
     | 
    
         
             
              unsigned int l = ~0;
         
     | 
| 
       522 
     | 
    
         
            -
              unsigned int g =  0; 
     | 
| 
      
 495 
     | 
    
         
            +
              unsigned int g =  0;
         
     | 
| 
       523 
496 
     | 
    
         
             
              rb_scan_args(argc, argv, "12&", &bb, &layers, &group, &block);
         
     | 
| 
       524 
     | 
    
         
            -
             
     | 
| 
      
 497 
     | 
    
         
            +
             
     | 
| 
       525 
498 
     | 
    
         
             
              if (!NIL_P(layers)) l = NUM2UINT(layers);
         
     | 
| 
       526 
     | 
    
         
            -
              if (!NIL_P(group)) 
     | 
| 
       527 
     | 
    
         
            -
             
     | 
| 
      
 499 
     | 
    
         
            +
              if (!NIL_P(group)) g = NUM2UINT(group);
         
     | 
| 
      
 500 
     | 
    
         
            +
             
     | 
| 
       528 
501 
     | 
    
         
             
              cpSpaceBBQuery(
         
     | 
| 
       529 
502 
     | 
    
         
             
                SPACE(self), *BBGET(bb), l, g,
         
     | 
| 
       530 
503 
     | 
    
         
             
                (cpSpaceBBQueryFunc)bbQueryCallback, (void *)block
         
     | 
| 
       531 
     | 
    
         
            -
             
     | 
| 
       532 
     | 
    
         
            -
             
     | 
| 
      
 504 
     | 
    
         
            +
                );
         
     | 
| 
      
 505 
     | 
    
         
            +
             
     | 
| 
       533 
506 
     | 
    
         
             
              return Qnil;
         
     | 
| 
       534 
507 
     | 
    
         
             
            }
         
     | 
| 
       535 
508 
     | 
    
         | 
| 
       536 
509 
     | 
    
         
             
            static void
         
     | 
| 
       537 
     | 
    
         
            -
            shapeQueryCallback(cpShape *shape, cpContactPointSet *points, VALUE block)
         
     | 
| 
       538 
     | 
    
         
            -
            {
         
     | 
| 
      
 510 
     | 
    
         
            +
            shapeQueryCallback(cpShape *shape, cpContactPointSet *points, VALUE block) {
         
     | 
| 
       539 
511 
     | 
    
         
             
              rb_funcall(block, id_call, 1, (VALUE)shape->data);
         
     | 
| 
       540 
512 
     | 
    
         
             
            }
         
     | 
| 
       541 
513 
     | 
    
         | 
| 
       542 
514 
     | 
    
         
             
            /* Shape query. */
         
     | 
| 
       543 
515 
     | 
    
         
             
            static VALUE
         
     | 
| 
       544 
     | 
    
         
            -
            rb_cpSpaceShapeQuery(int argc, VALUE *argv, VALUE self)
         
     | 
| 
       545 
     | 
    
         
            -
            {
         
     | 
| 
      
 516 
     | 
    
         
            +
            rb_cpSpaceShapeQuery(int argc, VALUE *argv, VALUE self) {
         
     | 
| 
       546 
517 
     | 
    
         
             
              VALUE shape, block;
         
     | 
| 
       547 
518 
     | 
    
         
             
              rb_scan_args(argc, argv, "1&", &shape, &block);
         
     | 
| 
       548 
     | 
    
         
            -
             
     | 
| 
      
 519 
     | 
    
         
            +
             
     | 
| 
       549 
520 
     | 
    
         
             
              cpSpaceShapeQuery(
         
     | 
| 
       550 
521 
     | 
    
         
             
                SPACE(self), SHAPE(shape),
         
     | 
| 
       551 
522 
     | 
    
         
             
                (cpSpaceShapeQueryFunc)shapeQueryCallback, (void *)block
         
     | 
| 
       552 
     | 
    
         
            -
             
     | 
| 
       553 
     | 
    
         
            -
             
     | 
| 
      
 523 
     | 
    
         
            +
                );
         
     | 
| 
      
 524 
     | 
    
         
            +
             
     | 
| 
       554 
525 
     | 
    
         
             
              return Qnil;
         
     | 
| 
       555 
526 
     | 
    
         
             
            }
         
     | 
| 
       556 
527 
     | 
    
         | 
| 
       557 
528 
     | 
    
         
             
            static VALUE
         
     | 
| 
       558 
     | 
    
         
            -
            rb_cpSpaceStep(VALUE self, VALUE dt)
         
     | 
| 
       559 
     | 
    
         
            -
             
     | 
| 
       560 
     | 
    
         
            -
             
     | 
| 
       561 
     | 
    
         
            -
            	return Qnil;
         
     | 
| 
      
 529 
     | 
    
         
            +
            rb_cpSpaceStep(VALUE self, VALUE dt) {
         
     | 
| 
      
 530 
     | 
    
         
            +
              cpSpaceStep(SPACE(self), NUM2DBL(dt));
         
     | 
| 
      
 531 
     | 
    
         
            +
              return Qnil;
         
     | 
| 
       562 
532 
     | 
    
         
             
            }
         
     | 
| 
       563 
533 
     | 
    
         | 
| 
       564 
534 
     | 
    
         
             
            static VALUE
         
     | 
| 
         @@ -574,138 +544,136 @@ rb_cpSpaceSetData(VALUE self, VALUE val) { 
     | 
|
| 
       574 
544 
     | 
    
         | 
| 
       575 
545 
     | 
    
         | 
| 
       576 
546 
     | 
    
         
             
            static VALUE
         
     | 
| 
       577 
     | 
    
         
            -
            rb_cpSpaceActivateShapesTouchingShape(VALUE self, VALUE shape)
         
     | 
| 
       578 
     | 
    
         
            -
            {
         
     | 
| 
      
 547 
     | 
    
         
            +
            rb_cpSpaceActivateShapesTouchingShape(VALUE self, VALUE shape) {
         
     | 
| 
       579 
548 
     | 
    
         
             
              cpSpaceActivateShapesTouchingShape(SPACE(self), SHAPE(shape));
         
     | 
| 
       580 
549 
     | 
    
         
             
              return self;
         
     | 
| 
       581 
550 
     | 
    
         
             
            }
         
     | 
| 
       582 
551 
     | 
    
         | 
| 
       583 
552 
     | 
    
         | 
| 
       584 
553 
     | 
    
         
             
            /** in chipmunk 6
         
     | 
| 
       585 
     | 
    
         
            -
            static VALUE
         
     | 
| 
       586 
     | 
    
         
            -
            rb_cpSpaceUseSpatialHash(VALUE self, VALUE dim, VALUE count) {
         
     | 
| 
       587 
     | 
    
         
            -
             
     | 
| 
       588 
     | 
    
         
            -
             
     | 
| 
       589 
     | 
    
         
            -
            }
         
     | 
| 
       590 
     | 
    
         
            -
            */
         
     | 
| 
      
 554 
     | 
    
         
            +
               static VALUE
         
     | 
| 
      
 555 
     | 
    
         
            +
               rb_cpSpaceUseSpatialHash(VALUE self, VALUE dim, VALUE count) {
         
     | 
| 
      
 556 
     | 
    
         
            +
               cpSpaceUseSpatialHash(SPACE(self), NUM2DBL(dim), NUM2INT(count));
         
     | 
| 
      
 557 
     | 
    
         
            +
               return Qnil;
         
     | 
| 
      
 558 
     | 
    
         
            +
               }
         
     | 
| 
      
 559 
     | 
    
         
            +
             */
         
     | 
| 
       591 
560 
     | 
    
         | 
| 
       592 
561 
     | 
    
         | 
| 
       593 
562 
     | 
    
         | 
| 
       594 
563 
     | 
    
         
             
            void
         
     | 
| 
       595 
     | 
    
         
            -
            Init_cpSpace(void)
         
     | 
| 
       596 
     | 
    
         
            -
             
     | 
| 
       597 
     | 
    
         
            -
             
     | 
| 
       598 
     | 
    
         
            -
             
     | 
| 
       599 
     | 
    
         
            -
             
     | 
| 
       600 
     | 
    
         
            -
             
     | 
| 
       601 
     | 
    
         
            -
             
     | 
| 
       602 
     | 
    
         
            -
             
     | 
| 
       603 
     | 
    
         
            -
             
     | 
| 
       604 
     | 
    
         
            -
             
     | 
| 
       605 
     | 
    
         
            -
             
     | 
| 
       606 
     | 
    
         
            -
             
     | 
| 
       607 
     | 
    
         
            -
             
     | 
| 
       608 
     | 
    
         
            -
             
     | 
| 
       609 
     | 
    
         
            -
             
     | 
| 
       610 
     | 
    
         
            -
             
     | 
| 
       611 
     | 
    
         
            -
             
     | 
| 
       612 
     | 
    
         
            -
             
     | 
| 
       613 
     | 
    
         
            -
             
     | 
| 
       614 
     | 
    
         
            -
             
     | 
| 
       615 
     | 
    
         
            -
             
     | 
| 
       616 
     | 
    
         
            -
             
     | 
| 
       617 
     | 
    
         
            -
             
     | 
| 
       618 
     | 
    
         
            -
             
     | 
| 
       619 
     | 
    
         
            -
             
     | 
| 
       620 
     | 
    
         
            -
             
     | 
| 
       621 
     | 
    
         
            -
             
     | 
| 
       622 
     | 
    
         
            -
             
     | 
| 
       623 
     | 
    
         
            -
             
     | 
| 
       624 
     | 
    
         
            -
             
     | 
| 
       625 
     | 
    
         
            -
             
     | 
| 
       626 
     | 
    
         
            -
             
     | 
| 
       627 
     | 
    
         
            -
              
         
     | 
| 
       628 
     | 
    
         
            -
             
     | 
| 
       629 
     | 
    
         
            -
                rb_cpSpaceRemoveCollisionHandler, 2);
         
     | 
| 
      
 564 
     | 
    
         
            +
            Init_cpSpace(void) {
         
     | 
| 
      
 565 
     | 
    
         
            +
              id_call       = rb_intern("call");
         
     | 
| 
      
 566 
     | 
    
         
            +
              id_begin      = rb_intern("begin");
         
     | 
| 
      
 567 
     | 
    
         
            +
              id_pre_solve  = rb_intern("pre_solve");
         
     | 
| 
      
 568 
     | 
    
         
            +
              id_post_solve = rb_intern("post_solve");
         
     | 
| 
      
 569 
     | 
    
         
            +
              id_separate   = rb_intern("separate");
         
     | 
| 
      
 570 
     | 
    
         
            +
             
     | 
| 
      
 571 
     | 
    
         
            +
              c_cpSpace     = rb_define_class_under(m_Chipmunk, "Space", rb_cObject);
         
     | 
| 
      
 572 
     | 
    
         
            +
              rb_define_alloc_func(c_cpSpace, rb_cpSpaceAlloc);
         
     | 
| 
      
 573 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "initialize", rb_cpSpaceInitialize, 0);
         
     | 
| 
      
 574 
     | 
    
         
            +
             
     | 
| 
      
 575 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "iterations", rb_cpSpaceGetIterations, 0);
         
     | 
| 
      
 576 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "iterations=", rb_cpSpaceSetIterations, 1);
         
     | 
| 
      
 577 
     | 
    
         
            +
             
     | 
| 
      
 578 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "elastic_iterations", rb_cpSpaceGetElasticIterations, 0);
         
     | 
| 
      
 579 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "elastic_iterations=", rb_cpSpaceSetElasticIterations, 1);
         
     | 
| 
      
 580 
     | 
    
         
            +
             
     | 
| 
      
 581 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "damping", rb_cpSpaceGetDamping, 0);
         
     | 
| 
      
 582 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "damping=", rb_cpSpaceSetDamping, 1);
         
     | 
| 
      
 583 
     | 
    
         
            +
             
     | 
| 
      
 584 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "gravity", rb_cpSpaceGetGravity, 0);
         
     | 
| 
      
 585 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "gravity=", rb_cpSpaceSetGravity, 1);
         
     | 
| 
      
 586 
     | 
    
         
            +
             
     | 
| 
      
 587 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "add_collision_func",
         
     | 
| 
      
 588 
     | 
    
         
            +
                               rb_cpSpaceAddCollisionHandler, -1);
         
     | 
| 
      
 589 
     | 
    
         
            +
             
     | 
| 
      
 590 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "add_collision_handler",
         
     | 
| 
      
 591 
     | 
    
         
            +
                               rb_cpSpaceAddCollisionHandler, -1);
         
     | 
| 
      
 592 
     | 
    
         
            +
             
     | 
| 
      
 593 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "on_collision",
         
     | 
| 
      
 594 
     | 
    
         
            +
                               rb_cpSpaceAddCollisionHandler, -1);
         
     | 
| 
      
 595 
     | 
    
         
            +
             
     | 
| 
      
 596 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "remove_collision_func",
         
     | 
| 
      
 597 
     | 
    
         
            +
                               rb_cpSpaceRemoveCollisionHandler, 2);
         
     | 
| 
       630 
598 
     | 
    
         | 
| 
       631 
599 
     | 
    
         
             
              rb_define_method(c_cpSpace, "remove_collision_handler",
         
     | 
| 
       632 
     | 
    
         
            -
             
     | 
| 
      
 600 
     | 
    
         
            +
                               rb_cpSpaceRemoveCollisionHandler, 2);
         
     | 
| 
       633 
601 
     | 
    
         
             
              rb_define_method(c_cpSpace, "remove_collision",
         
     | 
| 
       634 
     | 
    
         
            -
             
     | 
| 
      
 602 
     | 
    
         
            +
                               rb_cpSpaceRemoveCollisionHandler, 2);
         
     | 
| 
       635 
603 
     | 
    
         | 
| 
       636 
604 
     | 
    
         
             
              rb_define_method(c_cpSpace, "set_default_collision_func",
         
     | 
| 
       637 
     | 
    
         
            -
             
     | 
| 
       638 
     | 
    
         
            -
             
     | 
| 
       639 
     | 
    
         
            -
             
     | 
| 
      
 605 
     | 
    
         
            +
                               rb_cpSpaceSetDefaultCollisionHandler, -1);
         
     | 
| 
      
 606 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "set_default_collision_handler",
         
     | 
| 
      
 607 
     | 
    
         
            +
                               rb_cpSpaceSetDefaultCollisionHandler, -1);
         
     | 
| 
       640 
608 
     | 
    
         
             
              rb_define_method(c_cpSpace, "on_default_collision",
         
     | 
| 
       641 
     | 
    
         
            -
             
     | 
| 
       642 
     | 
    
         
            -
             
     | 
| 
       643 
     | 
    
         
            -
             
     | 
| 
       644 
     | 
    
         
            -
             
     | 
| 
      
 609 
     | 
    
         
            +
                               rb_cpSpaceSetDefaultCollisionHandler, -1);
         
     | 
| 
      
 610 
     | 
    
         
            +
             
     | 
| 
      
 611 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "add_post_step_callback",
         
     | 
| 
      
 612 
     | 
    
         
            +
                               rb_cpSpaceAddPostStepCallback, -1);
         
     | 
| 
       645 
613 
     | 
    
         
             
              rb_define_method(c_cpSpace, "on_post_step",
         
     | 
| 
       646 
     | 
    
         
            -
             
     | 
| 
       647 
     | 
    
         
            -
             
     | 
| 
       648 
     | 
    
         
            -
             
     | 
| 
       649 
     | 
    
         
            -
             
     | 
| 
       650 
     | 
    
         
            -
             
     | 
| 
       651 
     | 
    
         
            -
             
     | 
| 
       652 
     | 
    
         
            -
             
     | 
| 
       653 
     | 
    
         
            -
             
     | 
| 
       654 
     | 
    
         
            -
             
     | 
| 
       655 
     | 
    
         
            -
             
     | 
| 
       656 
     | 
    
         
            -
             
     | 
| 
       657 
     | 
    
         
            -
             
     | 
| 
       658 
     | 
    
         
            -
             
     | 
| 
       659 
     | 
    
         
            -
             
     | 
| 
       660 
     | 
    
         
            -
             
     | 
| 
       661 
     | 
    
         
            -
             
     | 
| 
       662 
     | 
    
         
            -
             
     | 
| 
       663 
     | 
    
         
            -
             
     | 
| 
       664 
     | 
    
         
            -
             
     | 
| 
       665 
     | 
    
         
            -
             
     | 
| 
       666 
     | 
    
         
            -
             
     | 
| 
       667 
     | 
    
         
            -
             
     | 
| 
       668 
     | 
    
         
            -
             
     | 
| 
       669 
     | 
    
         
            -
             
     | 
| 
       670 
     | 
    
         
            -
             
     | 
| 
       671 
     | 
    
         
            -
             
     | 
| 
       672 
     | 
    
         
            -
             
     | 
| 
       673 
     | 
    
         
            -
             
     | 
| 
       674 
     | 
    
         
            -
              rb_define_method(c_cpSpace, "bb_query" 
     | 
| 
       675 
     | 
    
         
            -
              rb_define_method(c_cpSpace, "shape_query" 
     | 
| 
       676 
     | 
    
         
            -
             
     | 
| 
       677 
     | 
    
         
            -
             
     | 
| 
       678 
     | 
    
         
            -
             
     | 
| 
       679 
     | 
    
         
            -
             
     | 
| 
       680 
     | 
    
         
            -
              rb_define_method(c_cpSpace, "object" 
     | 
| 
      
 614 
     | 
    
         
            +
                               rb_cpSpaceAddPostStepCallback, -1);
         
     | 
| 
      
 615 
     | 
    
         
            +
             
     | 
| 
      
 616 
     | 
    
         
            +
             
     | 
| 
      
 617 
     | 
    
         
            +
             
     | 
| 
      
 618 
     | 
    
         
            +
             
     | 
| 
      
 619 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "add_shape", rb_cpSpaceAddShape, 1);
         
     | 
| 
      
 620 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "add_static_shape", rb_cpSpaceAddStaticShape, 1);
         
     | 
| 
      
 621 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "add_body", rb_cpSpaceAddBody, 1);
         
     | 
| 
      
 622 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "add_constraint", rb_cpSpaceAddConstraint, 1);
         
     | 
| 
      
 623 
     | 
    
         
            +
             
     | 
| 
      
 624 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "remove_shape", rb_cpSpaceRemoveShape, 1);
         
     | 
| 
      
 625 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "remove_static_shape", rb_cpSpaceRemoveStaticShape, 1);
         
     | 
| 
      
 626 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "remove_body", rb_cpSpaceRemoveBody, 1);
         
     | 
| 
      
 627 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "remove_constraint", rb_cpSpaceRemoveConstraint, 1);
         
     | 
| 
      
 628 
     | 
    
         
            +
             
     | 
| 
      
 629 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "resize_static_hash", rb_cpSpaceResizeStaticHash, 2);
         
     | 
| 
      
 630 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "resize_active_hash", rb_cpSpaceResizeActiveHash, 2);
         
     | 
| 
      
 631 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "rehash_static", rb_cpSpaceRehashStatic, 0);
         
     | 
| 
      
 632 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "rehash_shape", rb_cpSpaceRehashShape, 1);
         
     | 
| 
      
 633 
     | 
    
         
            +
             
     | 
| 
      
 634 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "point_query", rb_cpSpacePointQuery, -1);
         
     | 
| 
      
 635 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "point_query_first", rb_cpSpacePointQueryFirst, -1);
         
     | 
| 
      
 636 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "shape_point_query", rb_cpSpacePointQueryFirst, -1);
         
     | 
| 
      
 637 
     | 
    
         
            +
             
     | 
| 
      
 638 
     | 
    
         
            +
             
     | 
| 
      
 639 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "segment_query", rb_cpSpaceSegmentQuery, -1);
         
     | 
| 
      
 640 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "segment_query_first", rb_cpSpaceSegmentQueryFirst, -1);
         
     | 
| 
      
 641 
     | 
    
         
            +
             
     | 
| 
      
 642 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "bb_query", rb_cpSpaceBBQuery, -1);
         
     | 
| 
      
 643 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "shape_query", rb_cpSpaceShapeQuery, -1);
         
     | 
| 
      
 644 
     | 
    
         
            +
             
     | 
| 
      
 645 
     | 
    
         
            +
             
     | 
| 
      
 646 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "step", rb_cpSpaceStep, 1);
         
     | 
| 
      
 647 
     | 
    
         
            +
             
     | 
| 
      
 648 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "object", rb_cpSpaceGetData, 0);
         
     | 
| 
       681 
649 
     | 
    
         
             
              rb_define_method(c_cpSpace, "object=", rb_cpSpaceSetData, 1);
         
     | 
| 
       682 
     | 
    
         
            -
             
     | 
| 
       683 
     | 
    
         
            -
              rb_define_method(c_cpSpace, "sleep_time_threshold=", 
     | 
| 
      
 650 
     | 
    
         
            +
             
     | 
| 
      
 651 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "sleep_time_threshold=",
         
     | 
| 
       684 
652 
     | 
    
         
             
                               rb_cpSpaceSetSleepTimeThreshold, 1);
         
     | 
| 
       685 
     | 
    
         
            -
              rb_define_method(c_cpSpace, "sleep_time_threshold", 
     | 
| 
      
 653 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "sleep_time_threshold",
         
     | 
| 
       686 
654 
     | 
    
         
             
                               rb_cpSpaceGetSleepTimeThreshold, 0);
         
     | 
| 
       687 
     | 
    
         
            -
              rb_define_method(c_cpSpace, "idle_speed_threshold=", 
     | 
| 
      
 655 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "idle_speed_threshold=",
         
     | 
| 
       688 
656 
     | 
    
         
             
                               rb_cpSpaceSetIdleSpeedThreshold, 1);
         
     | 
| 
       689 
     | 
    
         
            -
              rb_define_method(c_cpSpace, "idle_speed_threshold", 
     | 
| 
      
 657 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "idle_speed_threshold",
         
     | 
| 
       690 
658 
     | 
    
         
             
                               rb_cpSpaceGetIdleSpeedThreshold, 0);
         
     | 
| 
       691 
     | 
    
         
            -
             
     | 
| 
      
 659 
     | 
    
         
            +
             
     | 
| 
       692 
660 
     | 
    
         
             
              // also define slghtly less verbose API
         
     | 
| 
       693 
     | 
    
         
            -
              rb_define_method(c_cpSpace, "sleep_time=", 
     | 
| 
      
 661 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "sleep_time=",
         
     | 
| 
       694 
662 
     | 
    
         
             
                               rb_cpSpaceSetSleepTimeThreshold, 1);
         
     | 
| 
       695 
     | 
    
         
            -
              rb_define_method(c_cpSpace, "sleep_time", 
     | 
| 
      
 663 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "sleep_time",
         
     | 
| 
       696 
664 
     | 
    
         
             
                               rb_cpSpaceGetSleepTimeThreshold, 0);
         
     | 
| 
       697 
     | 
    
         
            -
              rb_define_method(c_cpSpace, "idle_speed=", 
     | 
| 
      
 665 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "idle_speed=",
         
     | 
| 
       698 
666 
     | 
    
         
             
                               rb_cpSpaceSetIdleSpeedThreshold, 1);
         
     | 
| 
       699 
     | 
    
         
            -
              rb_define_method(c_cpSpace, "idle_speed", 
     | 
| 
      
 667 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "idle_speed",
         
     | 
| 
       700 
668 
     | 
    
         
             
                               rb_cpSpaceGetIdleSpeedThreshold, 0);
         
     | 
| 
       701 
     | 
    
         
            -
             
     | 
| 
       702 
     | 
    
         
            -
              rb_define_method(c_cpSpace, "activate_shapes_touching_shape", 
     | 
| 
      
 669 
     | 
    
         
            +
             
     | 
| 
      
 670 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "activate_shapes_touching_shape",
         
     | 
| 
       703 
671 
     | 
    
         
             
                               rb_cpSpaceActivateShapesTouchingShape, 1);
         
     | 
| 
       704 
     | 
    
         
            -
             
     | 
| 
       705 
     | 
    
         
            -
              // this is nicer, though :) 
     | 
| 
       706 
     | 
    
         
            -
              rb_define_method(c_cpSpace, "activate_touching", 
     | 
| 
      
 672 
     | 
    
         
            +
             
     | 
| 
      
 673 
     | 
    
         
            +
              // this is nicer, though :)
         
     | 
| 
      
 674 
     | 
    
         
            +
              rb_define_method(c_cpSpace, "activate_touching",
         
     | 
| 
       707 
675 
     | 
    
         
             
                               rb_cpSpaceActivateShapesTouchingShape, 1);
         
     | 
| 
       708 
     | 
    
         
            -
             
     | 
| 
       709 
     | 
    
         
            -
             
     | 
| 
       710 
     | 
    
         
            -
             
     | 
| 
      
 676 
     | 
    
         
            +
             
     | 
| 
      
 677 
     | 
    
         
            +
             
     | 
| 
      
 678 
     | 
    
         
            +
             
     | 
| 
       711 
679 
     | 
    
         
             
            }
         
     |