# HG changeset patch # User Extrawurst # Date 1292272856 -3600 # Node ID 4541ca17975b853d1324552563b8fd278f702a4f # Parent b45f0b140d85df93854b97288243b8b87b8b00f2 use __gshared as chipmunk heavily relies on globals and D would otherwise make them TLS diff -r b45f0b140d85 -r 4541ca17975b trunk/chipmunkd/constraints/cpConstraint.d --- a/trunk/chipmunkd/constraints/cpConstraint.d Mon Dec 13 21:24:12 2010 +0100 +++ b/trunk/chipmunkd/constraints/cpConstraint.d Mon Dec 13 21:40:56 2010 +0100 @@ -95,7 +95,7 @@ public import chipmunkd.constraints.cpSimpleMotor; -cpFloat cp_constraint_bias_coef = 0.1f; +__gshared cpFloat cp_constraint_bias_coef = 0.1f; void cpConstraintDestroy(cpConstraint *constraint){} diff -r b45f0b140d85 -r 4541ca17975b trunk/chipmunkd/constraints/cpDampedRotarySpring.d --- a/trunk/chipmunkd/constraints/cpDampedRotarySpring.d Mon Dec 13 21:24:12 2010 +0100 +++ b/trunk/chipmunkd/constraints/cpDampedRotarySpring.d Mon Dec 13 21:40:56 2010 +0100 @@ -81,7 +81,7 @@ return 0.0f; } -static /+const+/ cpConstraintClass klass = { +__gshared /+const+/ cpConstraintClass klass = { cast(cpConstraintPreStepFunction)&preStep, cast(cpConstraintApplyImpulseFunction)&applyImpulse, cast(cpConstraintGetImpulseFunction)&getImpulse, diff -r b45f0b140d85 -r 4541ca17975b trunk/chipmunkd/constraints/cpDampedSpring.d --- a/trunk/chipmunkd/constraints/cpDampedSpring.d Mon Dec 13 21:24:12 2010 +0100 +++ b/trunk/chipmunkd/constraints/cpDampedSpring.d Mon Dec 13 21:40:56 2010 +0100 @@ -91,7 +91,7 @@ return 0.0f; } -static /+const+/ cpConstraintClass klass = { +__gshared /+const+/ cpConstraintClass klass = { cast(cpConstraintPreStepFunction)&preStep, cast(cpConstraintApplyImpulseFunction)&applyImpulse, cast(cpConstraintGetImpulseFunction)&getImpulse, diff -r b45f0b140d85 -r 4541ca17975b trunk/chipmunkd/constraints/cpGearJoint.d --- a/trunk/chipmunkd/constraints/cpGearJoint.d Mon Dec 13 21:24:12 2010 +0100 +++ b/trunk/chipmunkd/constraints/cpGearJoint.d Mon Dec 13 21:40:56 2010 +0100 @@ -75,7 +75,7 @@ return cpfabs(joint.jAcc); } -static /+const+/ cpConstraintClass klass = { +__gshared /+const+/ cpConstraintClass klass = { cast(cpConstraintPreStepFunction)&preStep, cast(cpConstraintApplyImpulseFunction)&applyImpulse, cast(cpConstraintGetImpulseFunction)&getImpulse, diff -r b45f0b140d85 -r 4541ca17975b trunk/chipmunkd/constraints/cpGrooveJoint.d --- a/trunk/chipmunkd/constraints/cpGrooveJoint.d Mon Dec 13 21:24:12 2010 +0100 +++ b/trunk/chipmunkd/constraints/cpGrooveJoint.d Mon Dec 13 21:40:56 2010 +0100 @@ -112,7 +112,7 @@ return cpvlength(joint.jAcc); } -static /+const+/ cpConstraintClass klass = { +__gshared /+const+/ cpConstraintClass klass = { cast(cpConstraintPreStepFunction)&preStep, cast(cpConstraintApplyImpulseFunction)&applyImpulse, cast(cpConstraintGetImpulseFunction)&getImpulse, diff -r b45f0b140d85 -r 4541ca17975b trunk/chipmunkd/constraints/cpPinJoint.d --- a/trunk/chipmunkd/constraints/cpPinJoint.d Mon Dec 13 21:24:12 2010 +0100 +++ b/trunk/chipmunkd/constraints/cpPinJoint.d Mon Dec 13 21:40:56 2010 +0100 @@ -83,7 +83,7 @@ return cpfabs(joint.jnAcc); } -static /+const+/ cpConstraintClass klass = { +__gshared /+const+/ cpConstraintClass klass = { cast(cpConstraintPreStepFunction)&preStep, cast(cpConstraintApplyImpulseFunction)&applyImpulse, cast(cpConstraintGetImpulseFunction)&getImpulse, diff -r b45f0b140d85 -r 4541ca17975b trunk/chipmunkd/constraints/cpPivotJoint.d --- a/trunk/chipmunkd/constraints/cpPivotJoint.d Mon Dec 13 21:24:12 2010 +0100 +++ b/trunk/chipmunkd/constraints/cpPivotJoint.d Mon Dec 13 21:40:56 2010 +0100 @@ -77,7 +77,7 @@ return cpvlength((cast(cpPivotJoint *)joint).jAcc); } -static /+const+/ cpConstraintClass klass = { +__gshared /+const+/ cpConstraintClass klass = { cast(cpConstraintPreStepFunction)&preStep, cast(cpConstraintApplyImpulseFunction)&applyImpulse, cast(cpConstraintGetImpulseFunction)&getImpulse, diff -r b45f0b140d85 -r 4541ca17975b trunk/chipmunkd/constraints/cpRatchetJoint.d --- a/trunk/chipmunkd/constraints/cpRatchetJoint.d Mon Dec 13 21:24:12 2010 +0100 +++ b/trunk/chipmunkd/constraints/cpRatchetJoint.d Mon Dec 13 21:40:56 2010 +0100 @@ -94,7 +94,7 @@ return cpfabs(joint.jAcc); } -static /+const+/ cpConstraintClass klass = { +__gshared /+const+/ cpConstraintClass klass = { cast(cpConstraintPreStepFunction)&preStep, cast(cpConstraintApplyImpulseFunction)&applyImpulse, cast(cpConstraintGetImpulseFunction)&getImpulse, diff -r b45f0b140d85 -r 4541ca17975b trunk/chipmunkd/constraints/cpRotaryLimitJoint.d --- a/trunk/chipmunkd/constraints/cpRotaryLimitJoint.d Mon Dec 13 21:24:12 2010 +0100 +++ b/trunk/chipmunkd/constraints/cpRotaryLimitJoint.d Mon Dec 13 21:40:56 2010 +0100 @@ -90,7 +90,7 @@ return cpfabs(joint.jAcc); } -static /+const+/ cpConstraintClass klass = { +__gshared /+const+/ cpConstraintClass klass = { cast(cpConstraintPreStepFunction)&preStep, cast(cpConstraintApplyImpulseFunction)&applyImpulse, cast(cpConstraintGetImpulseFunction)&getImpulse, diff -r b45f0b140d85 -r 4541ca17975b trunk/chipmunkd/constraints/cpSimpleMotor.d --- a/trunk/chipmunkd/constraints/cpSimpleMotor.d Mon Dec 13 21:24:12 2010 +0100 +++ b/trunk/chipmunkd/constraints/cpSimpleMotor.d Mon Dec 13 21:40:56 2010 +0100 @@ -66,7 +66,7 @@ return cpfabs(joint.jAcc); } -static /+const+/ cpConstraintClass klass = { +__gshared /+const+/ cpConstraintClass klass = { cast(cpConstraintPreStepFunction)&preStep, cast(cpConstraintApplyImpulseFunction)&applyImpulse, cast(cpConstraintGetImpulseFunction)&getImpulse, diff -r b45f0b140d85 -r 4541ca17975b trunk/chipmunkd/constraints/cpSlideJoint.d --- a/trunk/chipmunkd/constraints/cpSlideJoint.d Mon Dec 13 21:24:12 2010 +0100 +++ b/trunk/chipmunkd/constraints/cpSlideJoint.d Mon Dec 13 21:40:56 2010 +0100 @@ -102,7 +102,7 @@ return cpfabs((cast(cpSlideJoint *)joint).jnAcc); } -static /+const+/ cpConstraintClass klass = { +__gshared /+const+/ cpConstraintClass klass = { cast(cpConstraintPreStepFunction)&preStep, cast(cpConstraintApplyImpulseFunction)&applyImpulse, cast(cpConstraintGetImpulseFunction)&getImpulse, diff -r b45f0b140d85 -r 4541ca17975b trunk/chipmunkd/cpArbiter.d --- a/trunk/chipmunkd/cpArbiter.d Mon Dec 13 21:24:12 2010 +0100 +++ b/trunk/chipmunkd/cpArbiter.d Mon Dec 13 21:40:56 2010 +0100 @@ -183,8 +183,8 @@ // cpArbiter.c -------------------------- -cpFloat cp_bias_coef = 0.1f; -cpFloat cp_collision_slop = 0.1f; +__gshared cpFloat cp_bias_coef = 0.1f; +__gshared cpFloat cp_collision_slop = 0.1f; cpContact* cpContactInit(cpContact *con, cpVect p, cpVect n, cpFloat dist, cpHashValue hash) diff -r b45f0b140d85 -r 4541ca17975b trunk/chipmunkd/cpBody.d --- a/trunk/chipmunkd/cpBody.d Mon Dec 13 21:24:12 2010 +0100 +++ b/trunk/chipmunkd/cpBody.d Mon Dec 13 21:40:56 2010 +0100 @@ -220,7 +220,7 @@ //void cpApplyDampedSpring(cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2, cpFloat rlen, cpFloat k, cpFloat dmp, cpFloat dt); // initialized in cpInitChipmunk() -cpBody cpStaticBodySingleton; +__gshared cpBody cpStaticBodySingleton; cpBody* cpBodyAlloc() @@ -228,8 +228,8 @@ return cast(cpBody *)cpmalloc(cpBody.sizeof); } -cpBodyVelocityFunc cpBodyUpdateVelocityDefault = &cpBodyUpdateVelocity; -cpBodyPositionFunc cpBodyUpdatePositionDefault = &cpBodyUpdatePosition; +__gshared cpBodyVelocityFunc cpBodyUpdateVelocityDefault = &cpBodyUpdateVelocity; +__gshared cpBodyPositionFunc cpBodyUpdatePositionDefault = &cpBodyUpdatePosition; cpBody* cpBodyInit(cpBody *_body, cpFloat m, cpFloat i) diff -r b45f0b140d85 -r 4541ca17975b trunk/chipmunkd/cpCollision.d --- a/trunk/chipmunkd/cpCollision.d Mon Dec 13 21:24:12 2010 +0100 +++ b/trunk/chipmunkd/cpCollision.d Mon Dec 13 21:40:56 2010 +0100 @@ -351,7 +351,7 @@ &poly2poly, ]; -static collisionFunc[cpShapeType.CP_NUM_SHAPES * cpShapeType.CP_NUM_SHAPES] colfuncs = builtinCollisionFuncs; +__gshared collisionFunc[cpShapeType.CP_NUM_SHAPES * cpShapeType.CP_NUM_SHAPES] colfuncs = builtinCollisionFuncs; static void addColFunc(const cpShapeType a, const cpShapeType b, collisionFunc func) diff -r b45f0b140d85 -r 4541ca17975b trunk/chipmunkd/cpPolyShape.d --- a/trunk/chipmunkd/cpPolyShape.d Mon Dec 13 21:24:12 2010 +0100 +++ b/trunk/chipmunkd/cpPolyShape.d Mon Dec 13 21:40:56 2010 +0100 @@ -195,7 +195,7 @@ } } -static /+const+/ cpShapeClass polyClass = { +__gshared /+const+/ cpShapeClass polyClass = { cpShapeType.CP_POLY_SHAPE, &cpPolyShapeCacheData, &cpPolyShapeDestroy, diff -r b45f0b140d85 -r 4541ca17975b trunk/chipmunkd/cpShape.d --- a/trunk/chipmunkd/cpShape.d Mon Dec 13 21:24:12 2010 +0100 +++ b/trunk/chipmunkd/cpShape.d Mon Dec 13 21:40:56 2010 +0100 @@ -168,7 +168,7 @@ return cpvdist(start, end)*info.t; } -cpHashValue SHAPE_ID_COUNTER = 0; +__gshared cpHashValue SHAPE_ID_COUNTER = 0; void cpResetShapeIdCounter() @@ -309,7 +309,7 @@ circleSegmentQuery(shape, circle.tc, circle.r, a, b, info); } -static /+const+/ cpShapeClass cpCircleShapeClass = { +__gshared /+const+/ cpShapeClass cpCircleShapeClass = { cpShapeType.CP_CIRCLE_SHAPE, &cpCircleShapeCacheData, null, @@ -459,7 +459,7 @@ } } -static /+const+/ cpShapeClass cpSegmentShapeClass = { +__gshared /+const+/ cpShapeClass cpSegmentShapeClass = { cpShapeType.CP_SEGMENT_SHAPE, &cpSegmentShapeCacheData, null, diff -r b45f0b140d85 -r 4541ca17975b trunk/chipmunkd/cpSpace.d --- a/trunk/chipmunkd/cpSpace.d Mon Dec 13 21:24:12 2010 +0100 +++ b/trunk/chipmunkd/cpSpace.d Mon Dec 13 21:40:56 2010 +0100 @@ -185,7 +185,7 @@ //void cpSpaceStep(cpSpace *space, cpFloat dt); -cpTimestamp cp_contact_persistence = 3; +__gshared cpTimestamp cp_contact_persistence = 3; // Equal function for contactSet. static cpBool @@ -256,7 +256,7 @@ enum DEFAULT_ITERATIONS = 10; enum DEFAULT_ELASTIC_ITERATIONS = 0; -cpCollisionHandler defaultHandler = {0, 0, &alwaysCollide, &alwaysCollide, ¬hing, ¬hing, null}; +__gshared cpCollisionHandler defaultHandler = {0, 0, &alwaysCollide, &alwaysCollide, ¬hing, ¬hing, null}; cpSpace* cpSpaceInit(cpSpace *space)