Merge branch 'master' of git://github.com/erikcharlebois/factor
commit
a1037f9657
|
@ -48,7 +48,7 @@ SYMBOL: error-hook
|
|||
|
||||
: call-error-hook ( error -- )
|
||||
error-continuation get error-hook get
|
||||
call( error continuation -- ) ;
|
||||
call( continuation error -- ) ;
|
||||
|
||||
[ drop print-error-and-restarts ] error-hook set-global
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ ARTICLE: "polynomials" "Polynomials"
|
|||
p-
|
||||
p*
|
||||
p-sq
|
||||
p^
|
||||
powers
|
||||
n*p
|
||||
p/mod
|
||||
|
@ -74,6 +75,11 @@ HELP: p-sq
|
|||
{ $description "Squares a polynomial." }
|
||||
{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 1 2 0 } p-sq ." "{ 1 4 4 0 0 }" } } ;
|
||||
|
||||
HELP: p^
|
||||
{ $values { "p" "a polynomial" } { "n" number } { "p^n" "a polynomial" } }
|
||||
{ $description "Computes " { $snippet "p" } " to the power of " { $snippet "n" } "." }
|
||||
{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 1 2 0 } 3 p^ ." "{ 1 6 12 8 0 0 0 }" } } ;
|
||||
|
||||
HELP: p/mod
|
||||
{ $values { "p" "a polynomial" } { "q" "a polynomial" } { "z" "a polynomial" } { "w" "a polynomial" } }
|
||||
{ $description "Computes to quotient " { $snippet "z" } " and remainder " { $snippet "w" } " of dividing " { $snippet "p" } " by " { $snippet "q" } "." }
|
||||
|
|
|
@ -15,6 +15,8 @@ IN: math.polynomials.tests
|
|||
[ { 0 0 0 } ] [ { 0 0 0 } { 0 0 0 } p- ] unit-test
|
||||
[ { 0 0 0 } ] [ 4 { 0 0 0 } n*p ] unit-test
|
||||
[ { 4 8 0 12 } ] [ 4 { 1 2 0 3 } n*p ] unit-test
|
||||
[ { 1 4 4 0 0 } ] [ { 1 2 0 } p-sq ] unit-test
|
||||
[ { 1 6 12 8 0 0 0 } ] [ { 1 2 0 } 3 p^ ] unit-test
|
||||
[ { 1 4 7 6 0 0 0 0 0 } ] [ { 1 2 3 0 0 0 } { 1 2 0 0 } p* ] unit-test
|
||||
[ V{ 7 -2 1 } V{ -20 0 0 } ] [ { 1 1 1 1 } { 3 1 } p/mod ] unit-test
|
||||
[ V{ 0 0 } V{ 1 1 } ] [ { 1 1 } { 1 1 1 1 } p/mod ] unit-test
|
||||
|
|
|
@ -38,6 +38,15 @@ PRIVATE>
|
|||
: p-sq ( p -- p^2 )
|
||||
dup p* ;
|
||||
|
||||
ERROR: negative-power-polynomial p n ;
|
||||
|
||||
: p^ ( p n -- p^n )
|
||||
{
|
||||
{ [ dup 0 > ] [ 1 - dupd [ p* ] with times ] }
|
||||
{ [ dup 0 = ] [ 2drop { 1 } ] }
|
||||
{ [ dup 0 < ] [ negative-power-polynomial ] }
|
||||
} cond ;
|
||||
|
||||
<PRIVATE
|
||||
|
||||
: p/mod-setup ( p p -- p p n )
|
||||
|
|
|
@ -2258,3 +2258,10 @@ CONSTANT: GL_COMPRESSED_RGBA_S3TC_DXT1_EXT HEX: 83F1
|
|||
CONSTANT: GL_COMPRESSED_RGBA_S3TC_DXT3_EXT HEX: 83F2
|
||||
CONSTANT: GL_COMPRESSED_RGBA_S3TC_DXT5_EXT HEX: 83F3
|
||||
|
||||
! GL_EXT_texture_compression_latc
|
||||
|
||||
CONSTANT: GL_COMPRESSED_LUMINANCE_LATC1_EXT HEX: 8C70
|
||||
CONSTANT: GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT HEX: 8C71
|
||||
CONSTANT: GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT HEX: 8C72
|
||||
CONSTANT: GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT HEX: 8C73
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Erik Charlebois
|
|
@ -0,0 +1,845 @@
|
|||
! Copyright (C) 2010 Erik Charlebois
|
||||
! See http:// factorcode.org/license.txt for BSD license.
|
||||
USING: accessors alien.c-types alien.syntax classes.struct combinators
|
||||
combinators.short-circuit kernel math math.order sequences
|
||||
specialized-arrays.instances.alien.c-types.void* typed
|
||||
specialized-arrays locals system alien.libraries ;
|
||||
IN: chipmunk
|
||||
|
||||
<< "chipmunk" {
|
||||
{ [ os windows? ] [ "chipmunk.dll" ] }
|
||||
{ [ os macosx? ] [ "libchipmunk.dylib" ] }
|
||||
{ [ os unix? ] [ "libchipmunk.so" ] }
|
||||
} cond "cdecl" add-library >>
|
||||
LIBRARY: chipmunk
|
||||
|
||||
! chipmunk_types.h
|
||||
TYPEDEF: double cpFloat
|
||||
STRUCT: cpVect
|
||||
{ x cpFloat }
|
||||
{ y cpFloat } ;
|
||||
SPECIALIZED-ARRAY: cpVect
|
||||
|
||||
TYPEDEF: uint cpHashValue
|
||||
TYPEDEF: void* cpDataPointer
|
||||
TYPEDEF: uint cpCollisionType
|
||||
TYPEDEF: uint cpLayers
|
||||
TYPEDEF: uint cpGroup
|
||||
|
||||
CONSTANT: CP_NO_GROUP 0
|
||||
CONSTANT: CP_ALL_LAYERS HEX: ffffffff
|
||||
|
||||
! cpVect.h
|
||||
TYPED: cpv ( x y -- v: cpVect )
|
||||
cpVect <struct-boa> ; inline
|
||||
|
||||
TYPED: cpvzero ( -- v: cpVect )
|
||||
0.0 0.0 cpv ; inline
|
||||
|
||||
FUNCTION: cpFloat cpvlength ( cpVect v ) ;
|
||||
FUNCTION: cpVect cpvslerp ( cpVect v1, cpVect v2, cpFloat t ) ;
|
||||
FUNCTION: cpVect cpvslerpconst ( cpVect v1, cpVect v2, cpFloat a ) ;
|
||||
FUNCTION: cpVect cpvforangle ( cpFloat a ) ;
|
||||
FUNCTION: cpFloat cpvtoangle ( cpVect v ) ;
|
||||
FUNCTION: char* cpvstr ( cpVect v ) ;
|
||||
|
||||
TYPED: cpvadd ( v1: cpVect v2: cpVect -- v3: cpVect )
|
||||
[ [ x>> ] bi@ + ]
|
||||
[ [ y>> ] bi@ + ] 2bi cpv ; inline
|
||||
|
||||
TYPED: cpvneg ( v1: cpVect -- v2: cpVect )
|
||||
[ x>> ] [ y>> ] bi [ neg ] bi@ cpv ; inline
|
||||
|
||||
TYPED: cpvsub ( v1: cpVect v2: cpVect -- v3: cpVect )
|
||||
[ [ x>> ] bi@ - ]
|
||||
[ [ y>> ] bi@ - ] 2bi cpv ; inline
|
||||
|
||||
TYPED: cpvmult ( v1: cpVect s -- v2: cpVect )
|
||||
[ swap x>> * ]
|
||||
[ swap y>> * ] 2bi cpv ; inline
|
||||
|
||||
TYPED: cpvdot ( v1: cpVect v2: cpVect -- s )
|
||||
[ [ x>> ] bi@ * ]
|
||||
[ [ y>> ] bi@ * ] 2bi + ; inline
|
||||
|
||||
TYPED: cpvcross ( v1: cpVect v2: cpVect -- s )
|
||||
[ [ x>> ] [ y>> ] bi* * ]
|
||||
[ [ y>> ] [ x>> ] bi* * ] 2bi - ; inline
|
||||
|
||||
TYPED: cpvperp ( v1: cpVect -- v2: cpVect )
|
||||
[ y>> neg ] [ x>> ] bi cpv ; inline
|
||||
|
||||
TYPED: cpvrperp ( v1: cpVect -- v2: cpVect )
|
||||
[ y>> ] [ x>> neg ] bi cpv ; inline
|
||||
|
||||
TYPED: cpvproject ( v1: cpVect v2: cpVect -- v3: cpVect )
|
||||
[ nip ]
|
||||
[ cpvdot ]
|
||||
[ nip dup cpvdot ]
|
||||
2tri / cpvmult ; inline
|
||||
|
||||
TYPED: cpvrotate ( v1: cpVect v2: cpVect -- v3: cpVect )
|
||||
[
|
||||
[ [ x>> ] bi@ * ]
|
||||
[ [ y>> ] bi@ * ] 2bi -
|
||||
]
|
||||
[
|
||||
[ [ x>> ] [ y>> ] bi* * ]
|
||||
[ [ y>> ] [ x>> ] bi* * ] 2bi +
|
||||
] 2bi cpv ; inline
|
||||
|
||||
TYPED: cpvunrotate ( v1: cpVect v2: cpVect -- v3: cpVect )
|
||||
[
|
||||
[ [ x>> ] bi@ * ]
|
||||
[ [ y>> ] bi@ * ] 2bi +
|
||||
]
|
||||
[
|
||||
[ [ y>> ] [ x>> ] bi* * ]
|
||||
[ [ x>> ] [ y>> ] bi* * ] 2bi -
|
||||
] 2bi cpv ; inline
|
||||
|
||||
TYPED: cpvlengthsq ( v: cpVect -- s )
|
||||
dup cpvdot ; inline
|
||||
|
||||
TYPED: cpvlerp ( v1: cpVect v2: cpVect s -- v3: cpVect )
|
||||
[ nip 1.0 swap - cpvmult ]
|
||||
[ cpvmult nip ] 3bi cpvadd ; inline
|
||||
|
||||
TYPED: cpvnormalize ( v1: cpVect -- v2: cpVect )
|
||||
dup cpvlength 1.0 swap / cpvmult ; inline
|
||||
|
||||
TYPED: cpvnormalize_safe ( v1: cpVect -- v2: cpVect )
|
||||
dup [ x>> 0.0 = ] [ y>> 0.0 = ] bi and
|
||||
[ drop cpvzero ]
|
||||
[ cpvnormalize ] if ; inline
|
||||
|
||||
TYPED: cpvclamp ( v1: cpVect len -- v2: cpVect )
|
||||
2dup
|
||||
[ dup cpvdot ]
|
||||
[ sq ] 2bi* >
|
||||
[ [ cpvnormalize ] dip cpvmult ]
|
||||
[ drop ] if ; inline
|
||||
|
||||
TYPED: cpvlerpconst ( v1: cpVect v2: cpVect d -- v3: cpVect )
|
||||
[ 2drop ]
|
||||
[ [ swap cpvsub ] dip cpvclamp ] 3bi cpvadd ; inline
|
||||
|
||||
TYPED: cpvdist ( v1: cpVect v2: cpVect -- dist )
|
||||
cpvsub cpvlength ; inline
|
||||
|
||||
TYPED: cpvdistsq ( v1: cpVect v2: cpVect -- distsq )
|
||||
cpvsub cpvlengthsq ; inline
|
||||
|
||||
TYPED: cpvnear ( v1: cpVect v2: cpVect dist -- ? )
|
||||
[ cpvdistsq ] dip sq < ; inline
|
||||
|
||||
! cpBB.h
|
||||
STRUCT: cpBB
|
||||
{ l cpFloat }
|
||||
{ b cpFloat }
|
||||
{ r cpFloat }
|
||||
{ t cpFloat } ;
|
||||
|
||||
TYPED: cpBBNew ( l b r t -- cpbb: cpBB )
|
||||
cpBB <struct-boa> ; inline
|
||||
|
||||
TYPED: cpBBintersects ( a: cpBB b: cpBB -- ? )
|
||||
{
|
||||
[ [ l>> ] [ r>> ] bi* <= ]
|
||||
[ [ r>> ] [ l>> ] bi* > ]
|
||||
[ [ b>> ] [ t>> ] bi* <= ]
|
||||
[ [ t>> ] [ b>> ] bi* > ]
|
||||
} 2&& ; inline
|
||||
|
||||
TYPED: cpBBcontainsBB ( bb: cpBB other: cpBB -- ? )
|
||||
{
|
||||
[ [ l>> ] bi@ < ]
|
||||
[ [ r>> ] bi@ > ]
|
||||
[ [ b>> ] bi@ < ]
|
||||
[ [ t>> ] bi@ > ]
|
||||
} 2&& ; inline
|
||||
|
||||
TYPED: cpBBcontainsVect ( bb: cpBB v: cpVect -- ? )
|
||||
{
|
||||
[ [ l>> ] [ x>> ] bi* < ]
|
||||
[ [ r>> ] [ x>> ] bi* > ]
|
||||
[ [ b>> ] [ y>> ] bi* < ]
|
||||
[ [ t>> ] [ y>> ] bi* > ]
|
||||
} 2&& ; inline
|
||||
|
||||
TYPED: cpBBmerge ( a: cpBB b: cpBB -- c: cpBB )
|
||||
{
|
||||
[ [ l>> ] bi@ min ]
|
||||
[ [ b>> ] bi@ min ]
|
||||
[ [ r>> ] bi@ max ]
|
||||
[ [ t>> ] bi@ max ]
|
||||
} 2cleave cpBBNew ; inline
|
||||
|
||||
TYPED: cpBBexpand ( bb: cpBB v: cpVect -- b: cpBB )
|
||||
{
|
||||
[ [ l>> ] [ x>> ] bi* min ]
|
||||
[ [ b>> ] [ y>> ] bi* min ]
|
||||
[ [ r>> ] [ x>> ] bi* max ]
|
||||
[ [ t>> ] [ y>> ] bi* max ]
|
||||
} 2cleave cpBBNew ; inline
|
||||
|
||||
FUNCTION: cpVect cpBBClampVect ( cpBB bb, cpVect v ) ;
|
||||
FUNCTION: cpVect cpBBWrapVect ( cpBB bb, cpVect v ) ;
|
||||
|
||||
! cpBody.h
|
||||
C-TYPE: cpBody
|
||||
CALLBACK: void cpBodyVelocityFunc ( cpBody* body, cpVect gravity, cpFloat damping, cpFloat dt ) ;
|
||||
CALLBACK: void cpBodyPositionFunc ( cpBody* body, cpFloat dt ) ;
|
||||
|
||||
STRUCT: cpBody
|
||||
{ velocity_func cpBodyVelocityFunc }
|
||||
{ position_func cpBodyPositionFunc }
|
||||
{ m cpFloat }
|
||||
{ m_inv cpFloat }
|
||||
{ i cpFloat }
|
||||
{ i_inv cpFloat }
|
||||
{ p cpVect }
|
||||
{ v cpVect }
|
||||
{ f cpVect }
|
||||
{ a cpFloat }
|
||||
{ w cpFloat }
|
||||
{ t cpFloat }
|
||||
{ rot cpVect }
|
||||
{ data cpDataPointer }
|
||||
{ v_limit cpFloat }
|
||||
{ w_limit cpFloat }
|
||||
{ v_bias cpVect }
|
||||
{ w_bias cpFloat } ;
|
||||
|
||||
FUNCTION: cpBody* cpBodyAlloc ( ) ;
|
||||
FUNCTION: cpBody* cpBodyInit ( cpBody* body, cpFloat m, cpFloat i ) ;
|
||||
FUNCTION: cpBody* cpBodyNew ( cpFloat m, cpFloat i ) ;
|
||||
FUNCTION: void cpBodyDestroy ( cpBody* body ) ;
|
||||
FUNCTION: void cpBodyFree ( cpBody* body ) ;
|
||||
FUNCTION: void cpBodySetMass ( cpBody* body, cpFloat m ) ;
|
||||
FUNCTION: void cpBodySetMoment ( cpBody* body, cpFloat i ) ;
|
||||
FUNCTION: void cpBodySetAngle ( cpBody* body, cpFloat a ) ;
|
||||
FUNCTION: void cpBodySlew ( cpBody* body, cpVect pos, cpFloat dt ) ;
|
||||
FUNCTION: void cpBodyUpdateVelocity ( cpBody* body, cpVect gravity, cpFloat damping, cpFloat dt ) ;
|
||||
FUNCTION: void cpBodyUpdatePosition ( cpBody* body, cpFloat dt ) ;
|
||||
|
||||
TYPED: cpBodyLocal2World ( body: cpBody v: cpVect -- v2: cpVect )
|
||||
[ drop p>> ]
|
||||
[ swap rot>> cpvrotate ] 2bi cpvadd ; inline
|
||||
|
||||
TYPED: cpBodyWorld2Local ( body: cpBody v: cpVect -- v2: cpVect )
|
||||
[ swap p>> cpvsub ]
|
||||
[ drop rot>> ] 2bi cpvunrotate ; inline
|
||||
|
||||
TYPED: cpBodyApplyImpulse ( body: cpBody j: cpVect r: cpVect -- )
|
||||
[
|
||||
drop
|
||||
[ drop dup v>> ]
|
||||
[ swap m_inv>> cpvmult ] 2bi cpvadd >>v drop
|
||||
]
|
||||
[
|
||||
[ 2drop dup w_bias>> ]
|
||||
[ swap cpvcross [ i_inv>> ] dip * ] 3bi + >>w_bias drop
|
||||
] 3bi ; inline
|
||||
|
||||
FUNCTION: void cpBodyResetForces ( cpBody* body ) ;
|
||||
FUNCTION: void cpBodyApplyForce ( cpBody* body, cpVect f, cpVect r ) ;
|
||||
FUNCTION: void cpApplyDampedSpring ( cpBody* a, cpBody* b, cpVect anchr1, cpVect anchr2, cpFloat rlen, cpFloat k, cpFloat dmp, cpFloat dt ) ;
|
||||
|
||||
! cpArray.h
|
||||
STRUCT: cpArray
|
||||
{ num int }
|
||||
{ max int }
|
||||
{ arr void** } ;
|
||||
|
||||
CALLBACK: void cpArrayIter ( void* ptr, void* data ) ;
|
||||
|
||||
FUNCTION: cpArray* cpArrayAlloc ( ) ;
|
||||
FUNCTION: cpArray* cpArrayInit ( cpArray* arr, int size ) ;
|
||||
FUNCTION: cpArray* cpArrayNew ( int size ) ;
|
||||
FUNCTION: void cpArrayDestroy ( cpArray* arr ) ;
|
||||
FUNCTION: void cpArrayFree ( cpArray* arr ) ;
|
||||
FUNCTION: void cpArrayPush ( cpArray* arr, void* object ) ;
|
||||
FUNCTION: void cpArrayDeleteIndex ( cpArray* arr, int idx ) ;
|
||||
FUNCTION: void cpArrayDeleteObj ( cpArray* arr, void* obj ) ;
|
||||
FUNCTION: void cpArrayEach ( cpArray* arr, cpArrayIter iterFunc, void* data ) ;
|
||||
FUNCTION: int cpArrayContains ( cpArray* arr, void* ptr ) ;
|
||||
|
||||
! cpHashSet.h
|
||||
STRUCT: cpHashSetBin
|
||||
{ elt void* }
|
||||
{ hash cpHashValue }
|
||||
{ next cpHashSetBin* } ;
|
||||
|
||||
CALLBACK: int cpHashSetEqlFunc ( void* ptr, void* elt ) ;
|
||||
CALLBACK: void* cpHashSetTransFunc ( void* ptr, void* data ) ;
|
||||
CALLBACK: void cpHashSetIterFunc ( void* elt, void* data ) ;
|
||||
CALLBACK: int cpHashSetFilterFunc ( void* elt, void* data ) ;
|
||||
|
||||
STRUCT: cpHashSet
|
||||
{ entries int }
|
||||
{ size int }
|
||||
{ eql cpHashSetEqlFunc }
|
||||
{ trans cpHashSetTransFunc }
|
||||
{ default_value void* }
|
||||
{ table cpHashSetBin** } ;
|
||||
|
||||
FUNCTION: void cpHashSetDestroy ( cpHashSet* set ) ;
|
||||
FUNCTION: void cpHashSetFree ( cpHashSet* set ) ;
|
||||
FUNCTION: cpHashSet* cpHashSetAlloc ( ) ;
|
||||
FUNCTION: cpHashSet* cpHashSetInit ( cpHashSet* set, int size, cpHashSetEqlFunc eqlFunc, cpHashSetTransFunc trans ) ;
|
||||
FUNCTION: cpHashSet* cpHashSetNew ( int size, cpHashSetEqlFunc eqlFunc, cpHashSetTransFunc trans ) ;
|
||||
FUNCTION: void* cpHashSetInsert ( cpHashSet* set, cpHashValue hash, void* ptr, void* data ) ;
|
||||
FUNCTION: void* cpHashSetRemove ( cpHashSet* set, cpHashValue hash, void* ptr ) ;
|
||||
FUNCTION: void* cpHashSetFind ( cpHashSet* set, cpHashValue hash, void* ptr ) ;
|
||||
FUNCTION: void cpHashSetEach ( cpHashSet* set, cpHashSetIterFunc func, void* data ) ;
|
||||
FUNCTION: void cpHashSetFilter ( cpHashSet* set, cpHashSetFilterFunc func, void* data ) ;
|
||||
|
||||
! cpSpaceHash.h
|
||||
STRUCT: cpHandle
|
||||
{ obj void* }
|
||||
{ retain int }
|
||||
{ stamp int } ;
|
||||
|
||||
STRUCT: cpSpaceHashBin
|
||||
{ handle cpHandle* }
|
||||
{ next cpSpaceHashBin* } ;
|
||||
|
||||
CALLBACK: cpBB cpSpaceHashBBFunc ( void* obj ) ;
|
||||
|
||||
STRUCT: cpSpaceHash
|
||||
{ numcells int }
|
||||
{ celldim cpFloat }
|
||||
{ bbfunc cpSpaceHashBBFunc }
|
||||
{ handleSet cpHashSet* }
|
||||
{ table cpSpaceHashBin** }
|
||||
{ bins cpSpaceHashBin* }
|
||||
{ stamp int } ;
|
||||
|
||||
FUNCTION: cpSpaceHash* cpSpaceHashAlloc ( ) ;
|
||||
FUNCTION: cpSpaceHash* cpSpaceHashInit ( cpSpaceHash* hash, cpFloat celldim, int cells, cpSpaceHashBBFunc bbfunc ) ;
|
||||
FUNCTION: cpSpaceHash* cpSpaceHashNew ( cpFloat celldim, int cells, cpSpaceHashBBFunc bbfunc ) ;
|
||||
FUNCTION: void cpSpaceHashDestroy ( cpSpaceHash* hash ) ;
|
||||
FUNCTION: void cpSpaceHashFree ( cpSpaceHash* hash ) ;
|
||||
FUNCTION: void cpSpaceHashResize ( cpSpaceHash* hash, cpFloat celldim, int numcells ) ;
|
||||
FUNCTION: void cpSpaceHashInsert ( cpSpaceHash* hash, void* obj, cpHashValue id, cpBB bb ) ;
|
||||
FUNCTION: void cpSpaceHashRemove ( cpSpaceHash* hash, void* obj, cpHashValue id ) ;
|
||||
CALLBACK: void cpSpaceHashIterator ( void* obj, void* data ) ;
|
||||
FUNCTION: void cpSpaceHashEach ( cpSpaceHash* hash, cpSpaceHashIterator func, void* data ) ;
|
||||
FUNCTION: void cpSpaceHashRehash ( cpSpaceHash* hash ) ;
|
||||
FUNCTION: void cpSpaceHashRehashObject ( cpSpaceHash* hash, void* obj, cpHashValue id ) ;
|
||||
CALLBACK: void cpSpaceHashQueryFunc ( void* obj1, void* obj2, void* data ) ;
|
||||
FUNCTION: void cpSpaceHashPointQuery ( cpSpaceHash* hash, cpVect point, cpSpaceHashQueryFunc func, void* data ) ;
|
||||
FUNCTION: void cpSpaceHashQuery ( cpSpaceHash* hash, void* obj, cpBB bb, cpSpaceHashQueryFunc func, void* data ) ;
|
||||
FUNCTION: void cpSpaceHashQueryRehash ( cpSpaceHash* hash, cpSpaceHashQueryFunc func, void* data ) ;
|
||||
CALLBACK: cpFloat cpSpaceHashSegmentQueryFunc ( void* obj1, void* obj2, void* data ) ;
|
||||
FUNCTION: void cpSpaceHashSegmentQuery ( cpSpaceHash* hash, void* obj, cpVect a, cpVect b, cpFloat t_exit, cpSpaceHashSegmentQueryFunc func, void* data ) ;
|
||||
|
||||
! cpShape.h
|
||||
C-TYPE: cpShape
|
||||
C-TYPE: cpShapeClass
|
||||
|
||||
STRUCT: cpSegmentQueryInfo
|
||||
{ shape cpShape* }
|
||||
{ t cpFloat }
|
||||
{ n cpVect } ;
|
||||
|
||||
C-ENUM:
|
||||
CP_CIRCLE_SHAPE
|
||||
CP_SEGMENT_SHAPE
|
||||
CP_POLY_SHAPE
|
||||
CP_NUM_SHAPES ;
|
||||
TYPEDEF: int cpShapeType
|
||||
|
||||
CALLBACK: cpBB cacheData_cb ( cpShape* shape, cpVect p, cpVect rot ) ;
|
||||
CALLBACK: void destroy_cb ( cpShape* shape ) ;
|
||||
CALLBACK: int pointQuery_cb ( cpShape* shape, cpVect p ) ;
|
||||
CALLBACK: void segmentQuery_cb ( cpShape* shape, cpVect a, cpVect b, cpSegmentQueryInfo* info ) ;
|
||||
|
||||
STRUCT: cpShapeClass
|
||||
{ type cpShapeType }
|
||||
{ cacheData cacheData_cb }
|
||||
{ destroy destroy_cb }
|
||||
{ pointQuery pointQuery_cb }
|
||||
{ segmentQuery segmentQuery_cb } ;
|
||||
|
||||
STRUCT: cpShape
|
||||
{ klass cpShapeClass* }
|
||||
{ body cpBody* }
|
||||
{ bb cpBB }
|
||||
{ sensor int }
|
||||
{ e cpFloat }
|
||||
{ u cpFloat }
|
||||
{ surface_v cpVect }
|
||||
{ data cpDataPointer }
|
||||
{ collision_type cpCollisionType }
|
||||
{ group cpGroup }
|
||||
{ layers cpLayers }
|
||||
{ hashid cpHashValue } ;
|
||||
|
||||
FUNCTION: cpShape* cpShapeInit ( cpShape* shape, cpShapeClass* klass, cpBody* body ) ;
|
||||
FUNCTION: void cpShapeDestroy ( cpShape* shape ) ;
|
||||
FUNCTION: void cpShapeFree ( cpShape* shape ) ;
|
||||
FUNCTION: cpBB cpShapeCacheBB ( cpShape* shape ) ;
|
||||
FUNCTION: int cpShapePointQuery ( cpShape* shape, cpVect p ) ;
|
||||
|
||||
STRUCT: cpCircleShape
|
||||
{ shape cpShape }
|
||||
{ c cpVect }
|
||||
{ r cpFloat }
|
||||
{ tc cpVect } ;
|
||||
|
||||
FUNCTION: cpCircleShape* cpCircleShapeAlloc ( ) ;
|
||||
FUNCTION: cpCircleShape* cpCircleShapeInit ( cpCircleShape* circle, cpBody* body, cpFloat radius, cpVect offset ) ;
|
||||
FUNCTION: cpShape* cpCircleShapeNew ( cpBody* body, cpFloat radius, cpVect offset ) ;
|
||||
|
||||
STRUCT: cpSegmentShape
|
||||
{ shape cpShape }
|
||||
{ a cpVect }
|
||||
{ b cpVect }
|
||||
{ n cpVect }
|
||||
{ r cpFloat }
|
||||
{ ta cpVect }
|
||||
{ tb cpVect }
|
||||
{ tn cpVect } ;
|
||||
|
||||
FUNCTION: cpSegmentShape* cpSegmentShapeAlloc ( ) ;
|
||||
FUNCTION: cpSegmentShape* cpSegmentShapeInit ( cpSegmentShape* seg, cpBody* body, cpVect a, cpVect b, cpFloat radius ) ;
|
||||
FUNCTION: cpShape* cpSegmentShapeNew ( cpBody* body, cpVect a, cpVect b, cpFloat radius ) ;
|
||||
FUNCTION: void cpResetShapeIdCounter ( ) ;
|
||||
FUNCTION: void cpSegmentQueryInfoPrint ( cpSegmentQueryInfo* info ) ;
|
||||
FUNCTION: int cpShapeSegmentQuery ( cpShape* shape, cpVect a, cpVect b, cpSegmentQueryInfo* info ) ;
|
||||
|
||||
TYPED: cpSegmentQueryHitPoint ( start: cpVect end: cpVect info: cpSegmentQueryInfo -- hit-point: cpVect )
|
||||
t>> cpvlerp ; inline
|
||||
|
||||
TYPED: cpSegmentQueryHitDist ( start: cpVect end: cpVect info: cpSegmentQueryInfo -- hit-dist )
|
||||
t>> [ cpvdist ] dip * ; inline
|
||||
|
||||
! cpPolyShape.h
|
||||
STRUCT: cpPolyShapeAxis
|
||||
{ n cpVect }
|
||||
{ d cpFloat } ;
|
||||
SPECIALIZED-ARRAY: cpPolyShapeAxis
|
||||
|
||||
STRUCT: cpPolyShape
|
||||
{ shape cpShape }
|
||||
{ numVerts int }
|
||||
{ verts cpVect* }
|
||||
{ axes cpPolyShapeAxis* }
|
||||
{ tVerts cpVect* }
|
||||
{ tAxes cpPolyShapeAxis* } ;
|
||||
|
||||
FUNCTION: cpPolyShape* cpPolyShapeAlloc ( ) ;
|
||||
FUNCTION: cpPolyShape* cpPolyShapeInit ( cpPolyShape* poly, cpBody* body, int numVerts, cpVect* verts, cpVect offset ) ;
|
||||
FUNCTION: cpShape* cpPolyShapeNew ( cpBody* body, int numVerts, cpVect* verts, cpVect offset ) ;
|
||||
FUNCTION: int cpPolyValidate ( cpVect* verts, int numVerts ) ;
|
||||
FUNCTION: int cpPolyShapeGetNumVerts ( cpShape* shape ) ;
|
||||
FUNCTION: cpVect cpPolyShapeGetVert ( cpShape* shape, int idx ) ;
|
||||
|
||||
TYPED: cpPolyShapeValueOnAxis ( poly: cpPolyShape n: cpVect d -- min-dist )
|
||||
swap rot [ numVerts>> ] [ tVerts>> swap <direct-cpVect-array> ] bi swap
|
||||
[ cpvdot ] curry [ min ] reduce swap - ; inline
|
||||
|
||||
TYPED: cpPolyShapeContainsVert ( poly: cpPolyShape v: cpVect -- ? )
|
||||
swap [ numVerts>> ] [ tAxes>> swap <direct-cpPolyShapeAxis-array> ] bi swap
|
||||
[
|
||||
[ [ n>> ] dip cpvdot ] [ drop d>> ] 2bi -
|
||||
] curry [ max ] reduce 0.0 <= ; inline
|
||||
|
||||
TYPED: cpPolyShapeContainsVertPartial ( poly: cpPolyShape v: cpVect n: cpVect -- ? )
|
||||
rot [ numVerts>> ] [ tAxes>> swap <direct-cpPolyShapeAxis-array> ] bi -rot
|
||||
[| axis v n |
|
||||
axis n>> n cpvdot 0.0 < 0
|
||||
[ 0.0 ]
|
||||
[ axis n>> v cpvdot axis d>> - ]
|
||||
if
|
||||
] 2curry [ max ] reduce 0.0 <= ; inline
|
||||
|
||||
! cpArbiter.h
|
||||
C-TYPE: cpArbiter
|
||||
C-TYPE: cpSpace
|
||||
C-TYPE: cpCollisionHandler
|
||||
|
||||
STRUCT: cpContact
|
||||
{ p cpVect }
|
||||
{ n cpVect }
|
||||
{ dist cpFloat }
|
||||
{ r1 cpVect }
|
||||
{ r2 cpVect }
|
||||
{ nMass cpFloat }
|
||||
{ tMass cpFloat }
|
||||
{ bounce cpFloat }
|
||||
{ jnAcc cpFloat }
|
||||
{ jtAcc cpFloat }
|
||||
{ jBias cpFloat }
|
||||
{ bias cpFloat }
|
||||
{ hash cpHashValue } ;
|
||||
|
||||
FUNCTION: cpContact* cpContactInit ( cpContact* con, cpVect p, cpVect n, cpFloat dist, cpHashValue hash ) ;
|
||||
|
||||
C-ENUM:
|
||||
cpArbiterStateNormal
|
||||
cpArbiterStateFirstColl
|
||||
cpArbiterStateIgnore ;
|
||||
TYPEDEF: int cpArbiterState
|
||||
|
||||
STRUCT: cpArbiter
|
||||
{ numContacts int }
|
||||
{ contacts cpContact* }
|
||||
{ a cpShape* }
|
||||
{ b cpShape* }
|
||||
{ e cpFloat }
|
||||
{ u cpFloat }
|
||||
{ surface_vr cpVect }
|
||||
{ stamp int }
|
||||
{ handler cpCollisionHandler* }
|
||||
{ swappedColl char }
|
||||
{ state char } ;
|
||||
|
||||
FUNCTION: cpArbiter* cpArbiterAlloc ( ) ;
|
||||
FUNCTION: cpArbiter* cpArbiterInit ( cpArbiter* arb, cpShape* a, cpShape* b ) ;
|
||||
FUNCTION: cpArbiter* cpArbiterNew ( cpShape* a, cpShape* b ) ;
|
||||
FUNCTION: void cpArbiterDestroy ( cpArbiter* arb ) ;
|
||||
FUNCTION: void cpArbiterFree ( cpArbiter* arb ) ;
|
||||
FUNCTION: void cpArbiterUpdate ( cpArbiter* arb, cpContact* contacts, int numContacts, cpCollisionHandler* handler, cpShape* a, cpShape* b ) ;
|
||||
FUNCTION: void cpArbiterPreStep ( cpArbiter* arb, cpFloat dt_inv ) ;
|
||||
FUNCTION: void cpArbiterApplyCachedImpulse ( cpArbiter* arb ) ;
|
||||
FUNCTION: void cpArbiterApplyImpulse ( cpArbiter* arb, cpFloat eCoef ) ;
|
||||
FUNCTION: cpVect cpArbiterTotalImpulse ( cpArbiter* arb ) ;
|
||||
FUNCTION: cpVect cpArbiterTotalImpulseWithFriction ( cpArbiter* arb ) ;
|
||||
FUNCTION: void cpArbiterIgnore ( cpArbiter* arb ) ;
|
||||
|
||||
TYPED: cpArbiterGetShapes ( arb: cpArbiter -- a: cpShape b: cpShape )
|
||||
dup swappedColl>> 0 = [
|
||||
[ a>> cpShape memory>struct ] [ b>> cpShape memory>struct ] bi
|
||||
] [
|
||||
[ b>> cpShape memory>struct ] [ a>> cpShape memory>struct ] bi
|
||||
] if ; inline
|
||||
|
||||
TYPED: cpArbiterIsFirstContact ( arb: cpArbiter -- ? )
|
||||
state>> cpArbiterStateFirstColl = ; inline
|
||||
|
||||
TYPED: cpArbiterGetNormal ( arb: cpArbiter i -- n: cpVect )
|
||||
[
|
||||
swap
|
||||
[ numContacts>> ]
|
||||
[ contacts>> swap <direct-void*-array> ] bi nth cpContact memory>struct n>>
|
||||
]
|
||||
[
|
||||
drop swappedColl>> 0 = [ ] [ cpvneg ] if
|
||||
] 2bi ; inline
|
||||
|
||||
TYPED: cpArbiterGetPoint ( arb: cpArbiter i -- p: cpVect )
|
||||
swap
|
||||
[ numContacts>> ]
|
||||
[ contacts>> swap <direct-void*-array> ] bi
|
||||
nth cpContact memory>struct p>> ; inline
|
||||
|
||||
! cpCollision.h
|
||||
FUNCTION: int cpCollideShapes ( cpShape* a, cpShape* b, cpContact** arr ) ;
|
||||
|
||||
! cpConstraint.h
|
||||
|
||||
C-TYPE: cpConstraintClass
|
||||
C-TYPE: cpConstraint
|
||||
|
||||
CALLBACK: void cpConstraintPreStepFunction ( cpConstraint* constraint, cpFloat dt, cpFloat dt_inv ) ;
|
||||
CALLBACK: void cpConstraintApplyImpulseFunction ( cpConstraint* constraint ) ;
|
||||
CALLBACK: cpFloat cpConstraintGetImpulseFunction ( cpConstraint* constraint ) ;
|
||||
|
||||
STRUCT: cpConstraintClass
|
||||
{ preStep cpConstraintPreStepFunction }
|
||||
{ applyImpulse cpConstraintApplyImpulseFunction }
|
||||
{ getImpulse cpConstraintGetImpulseFunction } ;
|
||||
|
||||
STRUCT: cpConstraint
|
||||
{ klass cpConstraintClass* }
|
||||
{ a cpBody* }
|
||||
{ b cpBody* }
|
||||
{ maxForce cpFloat }
|
||||
{ biasCoef cpFloat }
|
||||
{ maxBias cpFloat }
|
||||
{ data cpDataPointer } ;
|
||||
|
||||
FUNCTION: void cpConstraintDestroy ( cpConstraint* constraint ) ;
|
||||
FUNCTION: void cpConstraintFree ( cpConstraint* constraint ) ;
|
||||
FUNCTION: void cpConstraintCheckCast ( cpConstraint* constraint, cpConstraintClass* klass ) ;
|
||||
|
||||
! cpPinJoint.h
|
||||
FUNCTION: cpConstraintClass* cpPinJointGetClass ( ) ;
|
||||
|
||||
STRUCT: cpPinJoint
|
||||
{ constraint cpConstraint }
|
||||
{ anchr1 cpVect }
|
||||
{ anchr2 cpVect }
|
||||
{ dist cpFloat }
|
||||
{ r1 cpVect }
|
||||
{ r2 cpVect }
|
||||
{ n cpVect }
|
||||
{ nMass cpFloat }
|
||||
{ jnAcc cpFloat }
|
||||
{ jnMax cpFloat }
|
||||
{ bias cpFloat } ;
|
||||
|
||||
FUNCTION: cpPinJoint* cpPinJointAlloc ( ) ;
|
||||
FUNCTION: cpPinJoint* cpPinJointInit ( cpPinJoint* joint, cpBody* a, cpBody* b, cpVect anchr1, cpVect anchr2 ) ;
|
||||
FUNCTION: cpConstraint* cpPinJointNew ( cpBody* a, cpBody* b, cpVect anchr1, cpVect anchr2 ) ;
|
||||
|
||||
! cpSlideJoint.h
|
||||
FUNCTION: cpConstraintClass* cpSlideJointGetClass ( ) ;
|
||||
|
||||
STRUCT: cpSlideJoint
|
||||
{ constraint cpConstraint }
|
||||
{ anchr1 cpVect }
|
||||
{ anchr2 cpVect }
|
||||
{ min cpFloat }
|
||||
{ max cpFloat }
|
||||
{ r1 cpVect }
|
||||
{ r2 cpVect }
|
||||
{ n cpVect }
|
||||
{ nMass cpFloat }
|
||||
{ jnAcc cpFloat }
|
||||
{ jnMax cpFloat }
|
||||
{ bias cpFloat } ;
|
||||
|
||||
FUNCTION: cpSlideJoint* cpSlideJointAlloc ( ) ;
|
||||
FUNCTION: cpSlideJoint* cpSlideJointInit ( cpSlideJoint* joint, cpBody* a, cpBody* b, cpVect anchr1, cpVect anchr2, cpFloat min, cpFloat max ) ;
|
||||
FUNCTION: cpConstraint* cpSlideJointNew ( cpBody* a, cpBody* b, cpVect anchr1, cpVect anchr2, cpFloat min, cpFloat max ) ;
|
||||
|
||||
! cpPivotJoint.h
|
||||
FUNCTION: cpConstraintClass* cpPivotJointGetClass ( ) ;
|
||||
|
||||
STRUCT: cpPivotJoint
|
||||
{ constraint cpConstraint }
|
||||
{ anchr1 cpVect }
|
||||
{ anchr2 cpVect }
|
||||
{ r1 cpVect }
|
||||
{ r2 cpVect }
|
||||
{ k1 cpVect }
|
||||
{ k2 cpVect }
|
||||
{ jAcc cpVect }
|
||||
{ jMaxLen cpFloat }
|
||||
{ bias cpVect } ;
|
||||
|
||||
FUNCTION: cpPivotJoint* cpPivotJointAlloc ( ) ;
|
||||
FUNCTION: cpPivotJoint* cpPivotJointInit ( cpPivotJoint* joint, cpBody* a, cpBody* b, cpVect anchr1, cpVect anchr2 ) ;
|
||||
FUNCTION: cpConstraint* cpPivotJointNew ( cpBody* a, cpBody* b, cpVect pivot ) ;
|
||||
FUNCTION: cpConstraint* cpPivotJointNew2 ( cpBody* a, cpBody* b, cpVect anchr1, cpVect anchr2 ) ;
|
||||
|
||||
! cpGrooveJoint.h
|
||||
FUNCTION: cpConstraintClass* cpGrooveJointGetClass ( ) ;
|
||||
|
||||
STRUCT: cpGrooveJoint
|
||||
{ constraint cpConstraint }
|
||||
{ grv_n cpVect }
|
||||
{ grv_a cpVect }
|
||||
{ grv_b cpVect }
|
||||
{ anchr2 cpVect }
|
||||
{ grv_tn cpVect }
|
||||
{ clamp cpFloat }
|
||||
{ r1 cpVect }
|
||||
{ r2 cpVect }
|
||||
{ k1 cpVect }
|
||||
{ k2 cpVect }
|
||||
{ jAcc cpVect }
|
||||
{ jMaxLen cpFloat }
|
||||
{ bias cpVect } ;
|
||||
|
||||
FUNCTION: cpGrooveJoint* cpGrooveJointAlloc ( ) ;
|
||||
FUNCTION: cpGrooveJoint* cpGrooveJointInit ( cpGrooveJoint* joint, cpBody* a, cpBody* b, cpVect groove_a, cpVect groove_b, cpVect anchr2 ) ;
|
||||
FUNCTION: cpConstraint* cpGrooveJointNew ( cpBody* a, cpBody* b, cpVect groove_a, cpVect groove_b, cpVect anchr2 ) ;
|
||||
|
||||
! cpDampedSpring.h
|
||||
CALLBACK: cpFloat cpDampedSpringForceFunc ( cpConstraint* spring, cpFloat dist ) ;
|
||||
FUNCTION: cpConstraintClass* cpDampedSpringGetClass ( ) ;
|
||||
|
||||
STRUCT: cpDampedSpring
|
||||
{ constraint cpConstraint }
|
||||
{ anchr1 cpVect }
|
||||
{ anchr2 cpVect }
|
||||
{ restLength cpFloat }
|
||||
{ stiffness cpFloat }
|
||||
{ damping cpFloat }
|
||||
{ springForceFunc cpDampedSpringForceFunc }
|
||||
{ dt cpFloat }
|
||||
{ target_vrn cpFloat }
|
||||
{ r1 cpVect }
|
||||
{ r2 cpVect }
|
||||
{ nMass cpFloat }
|
||||
{ n cpVect } ;
|
||||
|
||||
FUNCTION: cpDampedSpring* cpDampedSpringAlloc ( ) ;
|
||||
FUNCTION: cpDampedSpring* cpDampedSpringInit ( cpDampedSpring* joint, cpBody* a, cpBody* b, cpVect anchr1, cpVect anchr2, cpFloat restLength, cpFloat stiffness, cpFloat damping ) ;
|
||||
FUNCTION: cpConstraint* cpDampedSpringNew ( cpBody* a, cpBody* b, cpVect anchr1, cpVect anchr2, cpFloat restLength, cpFloat stiffness, cpFloat damping ) ;
|
||||
|
||||
! cpDampedRotarySpring.h
|
||||
CALLBACK: cpFloat cpDampedRotarySpringTorqueFunc ( cpConstraint* spring, cpFloat relativeAngle ) ;
|
||||
FUNCTION: cpConstraintClass* cpDampedRotarySpringGetClass ( ) ;
|
||||
|
||||
STRUCT: cpDampedRotarySpring
|
||||
{ constraint cpConstraint }
|
||||
{ restAngle cpFloat }
|
||||
{ stiffness cpFloat }
|
||||
{ damping cpFloat }
|
||||
{ springTorqueFunc cpDampedRotarySpringTorqueFunc }
|
||||
{ dt cpFloat }
|
||||
{ target_wrn cpFloat }
|
||||
{ iSum cpFloat } ;
|
||||
|
||||
FUNCTION: cpDampedRotarySpring* cpDampedRotarySpringAlloc ( ) ;
|
||||
FUNCTION: cpDampedRotarySpring* cpDampedRotarySpringInit ( cpDampedRotarySpring* joint, cpBody* a, cpBody* b, cpFloat restAngle, cpFloat stiffness, cpFloat damping ) ;
|
||||
FUNCTION: cpConstraint* cpDampedRotarySpringNew ( cpBody* a, cpBody* b, cpFloat restAngle, cpFloat stiffness, cpFloat damping ) ;
|
||||
|
||||
! cpRotaryLimitJoint.h
|
||||
FUNCTION: cpConstraintClass* cpRotaryLimitJointGetClass ( ) ;
|
||||
|
||||
STRUCT: cpRotaryLimitJoint
|
||||
{ constraint cpConstraint }
|
||||
{ min cpFloat }
|
||||
{ max cpFloat }
|
||||
{ iSum cpFloat }
|
||||
{ bias cpFloat }
|
||||
{ jAcc cpFloat }
|
||||
{ jMax cpFloat } ;
|
||||
|
||||
FUNCTION: cpRotaryLimitJoint* cpRotaryLimitJointAlloc ( ) ;
|
||||
FUNCTION: cpRotaryLimitJoint* cpRotaryLimitJointInit ( cpRotaryLimitJoint* joint, cpBody* a, cpBody* b, cpFloat min, cpFloat max ) ;
|
||||
FUNCTION: cpConstraint* cpRotaryLimitJointNew ( cpBody* a, cpBody* b, cpFloat min, cpFloat max ) ;
|
||||
|
||||
! cpRatchetJoint.h
|
||||
FUNCTION: cpConstraintClass* cpRatchetJointGetClass ( ) ;
|
||||
|
||||
STRUCT: cpRatchetJoint
|
||||
{ constraint cpConstraint }
|
||||
{ angle cpFloat }
|
||||
{ phase cpFloat }
|
||||
{ ratchet cpFloat }
|
||||
{ iSum cpFloat }
|
||||
{ bias cpFloat }
|
||||
{ jAcc cpFloat }
|
||||
{ jMax cpFloat } ;
|
||||
|
||||
FUNCTION: cpRatchetJoint* cpRatchetJointAlloc ( ) ;
|
||||
FUNCTION: cpRatchetJoint* cpRatchetJointInit ( cpRatchetJoint* joint, cpBody* a, cpBody* b, cpFloat phase, cpFloat ratchet ) ;
|
||||
FUNCTION: cpConstraint* cpRatchetJointNew ( cpBody* a, cpBody* b, cpFloat phase, cpFloat ratchet ) ;
|
||||
|
||||
! cpGearJoint.h
|
||||
FUNCTION: cpConstraintClass* cpGearJointGetClass ( ) ;
|
||||
|
||||
STRUCT: cpGearJoint
|
||||
{ constraint cpConstraint }
|
||||
{ phase cpFloat }
|
||||
{ ratio cpFloat }
|
||||
{ ratio_inv cpFloat }
|
||||
{ iSum cpFloat }
|
||||
{ bias cpFloat }
|
||||
{ jAcc cpFloat }
|
||||
{ jMax cpFloat } ;
|
||||
|
||||
FUNCTION: cpGearJoint* cpGearJointAlloc ( ) ;
|
||||
FUNCTION: cpGearJoint* cpGearJointInit ( cpGearJoint* joint, cpBody* a, cpBody* b, cpFloat phase, cpFloat ratio ) ;
|
||||
FUNCTION: cpConstraint* cpGearJointNew ( cpBody* a, cpBody* b, cpFloat phase, cpFloat ratio ) ;
|
||||
FUNCTION: void cpGearJointSetRatio ( cpConstraint* constraint, cpFloat value ) ;
|
||||
|
||||
! cpSimpleMotor.h
|
||||
FUNCTION: cpConstraintClass* cpSimpleMotorGetClass ( ) ;
|
||||
|
||||
STRUCT: cpSimpleMotor
|
||||
{ constraint cpConstraint }
|
||||
{ rate cpFloat }
|
||||
{ iSum cpFloat }
|
||||
{ jAcc cpFloat }
|
||||
{ jMax cpFloat } ;
|
||||
|
||||
FUNCTION: cpSimpleMotor* cpSimpleMotorAlloc ( ) ;
|
||||
FUNCTION: cpSimpleMotor* cpSimpleMotorInit ( cpSimpleMotor* joint, cpBody* a, cpBody* b, cpFloat rate ) ;
|
||||
FUNCTION: cpConstraint* cpSimpleMotorNew ( cpBody* a, cpBody* b, cpFloat rate ) ;
|
||||
|
||||
! cpSpace.h
|
||||
C-TYPE: cpSpace
|
||||
|
||||
CALLBACK: int cpCollisionBeginFunc ( cpArbiter* arb, cpSpace* space, void* data ) ;
|
||||
CALLBACK: int cpCollisionPreSolveFunc ( cpArbiter* arb, cpSpace* space, void* data ) ;
|
||||
CALLBACK: void cpCollisionPostSolveFunc ( cpArbiter* arb, cpSpace* space, void* data ) ;
|
||||
CALLBACK: void cpCollisionSeparateFunc ( cpArbiter* arb, cpSpace* space, void* data ) ;
|
||||
|
||||
STRUCT: cpCollisionHandler
|
||||
{ a cpCollisionType }
|
||||
{ b cpCollisionType }
|
||||
{ begin cpCollisionBeginFunc }
|
||||
{ preSolve cpCollisionPreSolveFunc }
|
||||
{ postSolve cpCollisionPostSolveFunc }
|
||||
{ separate cpCollisionSeparateFunc }
|
||||
{ data void* } ;
|
||||
|
||||
STRUCT: cpSpace
|
||||
{ iterations int }
|
||||
{ elasticIterations int }
|
||||
{ gravity cpVect }
|
||||
{ damping cpFloat }
|
||||
{ stamp int }
|
||||
{ staticShapes cpSpaceHash* }
|
||||
{ activeShapes cpSpaceHash* }
|
||||
{ bodies cpArray* }
|
||||
{ arbiters cpArray* }
|
||||
{ contactSet cpHashSet* }
|
||||
{ constraints cpArray* }
|
||||
{ collFuncSet cpHashSet* }
|
||||
{ defaultHandler cpCollisionHandler }
|
||||
{ postStepCallbacks cpHashSet* } ;
|
||||
|
||||
FUNCTION: cpSpace* cpSpaceAlloc ( ) ;
|
||||
FUNCTION: cpSpace* cpSpaceInit ( cpSpace* space ) ;
|
||||
FUNCTION: cpSpace* cpSpaceNew ( ) ;
|
||||
FUNCTION: void cpSpaceDestroy ( cpSpace* space ) ;
|
||||
FUNCTION: void cpSpaceFree ( cpSpace* space ) ;
|
||||
FUNCTION: void cpSpaceFreeChildren ( cpSpace* space ) ;
|
||||
FUNCTION: void cpSpaceSetDefaultCollisionHandler (
|
||||
cpSpace* space,
|
||||
cpCollisionBeginFunc begin,
|
||||
cpCollisionPreSolveFunc preSolve,
|
||||
cpCollisionPostSolveFunc postSolve,
|
||||
cpCollisionSeparateFunc separate,
|
||||
void* data ) ;
|
||||
FUNCTION: void cpSpaceAddCollisionHandler (
|
||||
cpSpace* space,
|
||||
cpCollisionType a,
|
||||
cpCollisionType b,
|
||||
cpCollisionBeginFunc begin,
|
||||
cpCollisionPreSolveFunc preSolve,
|
||||
cpCollisionPostSolveFunc postSolve,
|
||||
cpCollisionSeparateFunc separate,
|
||||
void* data ) ;
|
||||
FUNCTION: void cpSpaceRemoveCollisionHandler ( cpSpace* space, cpCollisionType a, cpCollisionType b ) ;
|
||||
FUNCTION: cpShape* cpSpaceAddShape ( cpSpace* space, cpShape* shape ) ;
|
||||
FUNCTION: cpShape* cpSpaceAddStaticShape ( cpSpace* space, cpShape* shape ) ;
|
||||
FUNCTION: cpBody* cpSpaceAddBody ( cpSpace* space, cpBody* body ) ;
|
||||
FUNCTION: cpConstraint* cpSpaceAddConstraint ( cpSpace* space, cpConstraint* constraint ) ;
|
||||
FUNCTION: void cpSpaceRemoveShape ( cpSpace* space, cpShape* shape ) ;
|
||||
FUNCTION: void cpSpaceRemoveStaticShape ( cpSpace* space, cpShape* shape ) ;
|
||||
FUNCTION: void cpSpaceRemoveBody ( cpSpace* space, cpBody* body ) ;
|
||||
FUNCTION: void cpSpaceRemoveConstraint ( cpSpace* space, cpConstraint* constraint ) ;
|
||||
CALLBACK: void cpPostStepFunc ( cpSpace* space, void* obj, void* data ) ;
|
||||
FUNCTION: void cpSpaceAddPostStepCallback ( cpSpace* space, cpPostStepFunc func, void* obj, void* data ) ;
|
||||
CALLBACK: void cpSpacePointQueryFunc ( cpShape* shape, void* data ) ;
|
||||
FUNCTION: void cpSpacePointQuery ( cpSpace* space, cpVect point, cpLayers layers, cpGroup group, cpSpacePointQueryFunc func, void* data ) ;
|
||||
FUNCTION: cpShape* cpSpacePointQueryFirst ( cpSpace* space, cpVect point, cpLayers layers, cpGroup group ) ;
|
||||
CALLBACK: void cpSpaceSegmentQueryFunc ( cpShape* shape, cpFloat t, cpVect n, void* data ) ;
|
||||
FUNCTION: int cpSpaceSegmentQuery ( cpSpace* space, cpVect start, cpVect end, cpLayers layers, cpGroup group, cpSpaceSegmentQueryFunc func, void* data ) ;
|
||||
FUNCTION: cpShape* cpSpaceSegmentQueryFirst ( cpSpace* space, cpVect start, cpVect end, cpLayers layers, cpGroup group, cpSegmentQueryInfo* out ) ;
|
||||
CALLBACK: void cpSpaceBBQueryFunc ( cpShape* shape, void* data ) ;
|
||||
FUNCTION: void cpSpaceBBQuery ( cpSpace* space, cpBB bb, cpLayers layers, cpGroup group, cpSpaceBBQueryFunc func, void* data ) ;
|
||||
CALLBACK: void cpSpaceBodyIterator ( cpBody* body, void* data ) ;
|
||||
FUNCTION: void cpSpaceEachBody ( cpSpace* space, cpSpaceBodyIterator func, void* data ) ;
|
||||
FUNCTION: void cpSpaceResizeStaticHash ( cpSpace* space, cpFloat dim, int count ) ;
|
||||
FUNCTION: void cpSpaceResizeActiveHash ( cpSpace* space, cpFloat dim, int count ) ;
|
||||
FUNCTION: void cpSpaceRehashStatic ( cpSpace* space ) ;
|
||||
FUNCTION: void cpSpaceStep ( cpSpace* space, cpFloat dt ) ;
|
||||
|
||||
! chipmunk.h
|
||||
FUNCTION: void cpInitChipmunk ( ) ;
|
||||
FUNCTION: cpFloat cpMomentForCircle ( cpFloat m, cpFloat r1, cpFloat r2, cpVect offset ) ;
|
||||
FUNCTION: cpFloat cpMomentForSegment ( cpFloat m, cpVect a, cpVect b ) ;
|
||||
FUNCTION: cpFloat cpMomentForPoly ( cpFloat m, int numVerts, cpVect* verts, cpVect offset ) ;
|
||||
|
|
@ -0,0 +1 @@
|
|||
Erik Charlebois
|
|
@ -0,0 +1,151 @@
|
|||
! Copyright (C) 2010 Erik Charlebois
|
||||
! See http:// factorcode.org/license.txt for BSD license.
|
||||
USING: accessors chipmunk classes.struct game.loop game.worlds gpu
|
||||
gpu.util.wasd kernel literals locals math method-chains opengl.gl
|
||||
random sequences specialized-arrays
|
||||
specialized-arrays.instances.alien.c-types.void* ui.gadgets.worlds
|
||||
ui.pixel-formats ;
|
||||
IN: chipmunk.demo
|
||||
|
||||
CONSTANT: image-width 188
|
||||
CONSTANT: image-height 35
|
||||
CONSTANT: image-row-length 24
|
||||
|
||||
CONSTANT: image-bitmap B{
|
||||
15 -16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 -64 15 63 -32 -2 0 0 0 0 0 0 0
|
||||
0 0 0 0 0 0 0 0 0 0 0 31 -64 15 127 -125 -1 -128 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
0 0 0 127 -64 15 127 15 -1 -64 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -1 -64 15 -2
|
||||
31 -1 -64 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -1 -64 0 -4 63 -1 -32 0 0 0 0 0 0
|
||||
0 0 0 0 0 0 0 0 0 0 1 -1 -64 15 -8 127 -1 -32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
1 -1 -64 0 -8 -15 -1 -32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -31 -1 -64 15 -8 -32
|
||||
-1 -32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 -15 -1 -64 9 -15 -32 -1 -32 0 0 0 0 0
|
||||
0 0 0 0 0 0 0 0 0 0 31 -15 -1 -64 0 -15 -32 -1 -32 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
0 0 63 -7 -1 -64 9 -29 -32 127 -61 -16 63 15 -61 -1 -8 31 -16 15 -8 126 7 -31
|
||||
-8 31 -65 -7 -1 -64 9 -29 -32 0 7 -8 127 -97 -25 -1 -2 63 -8 31 -4 -1 15 -13
|
||||
-4 63 -1 -3 -1 -64 9 -29 -32 0 7 -8 127 -97 -25 -1 -2 63 -8 31 -4 -1 15 -13
|
||||
-2 63 -1 -3 -1 -64 9 -29 -32 0 7 -8 127 -97 -25 -1 -1 63 -4 63 -4 -1 15 -13
|
||||
-2 63 -33 -1 -1 -32 9 -25 -32 0 7 -8 127 -97 -25 -1 -1 63 -4 63 -4 -1 15 -13
|
||||
-1 63 -33 -1 -1 -16 9 -25 -32 0 7 -8 127 -97 -25 -1 -1 63 -4 63 -4 -1 15 -13
|
||||
-1 63 -49 -1 -1 -8 9 -57 -32 0 7 -8 127 -97 -25 -8 -1 63 -2 127 -4 -1 15 -13
|
||||
-1 -65 -49 -1 -1 -4 9 -57 -32 0 7 -8 127 -97 -25 -8 -1 63 -2 127 -4 -1 15 -13
|
||||
-1 -65 -57 -1 -1 -2 9 -57 -32 0 7 -8 127 -97 -25 -8 -1 63 -2 127 -4 -1 15 -13
|
||||
-1 -1 -57 -1 -1 -1 9 -57 -32 0 7 -1 -1 -97 -25 -8 -1 63 -1 -1 -4 -1 15 -13 -1
|
||||
-1 -61 -1 -1 -1 -119 -57 -32 0 7 -1 -1 -97 -25 -8 -1 63 -1 -1 -4 -1 15 -13 -1
|
||||
-1 -61 -1 -1 -1 -55 -49 -32 0 7 -1 -1 -97 -25 -8 -1 63 -1 -1 -4 -1 15 -13 -1
|
||||
-1 -63 -1 -1 -1 -23 -49 -32 127 -57 -1 -1 -97 -25 -1 -1 63 -1 -1 -4 -1 15 -13
|
||||
-1 -1 -63 -1 -1 -1 -16 -49 -32 -1 -25 -1 -1 -97 -25 -1 -1 63 -33 -5 -4 -1 15
|
||||
-13 -1 -1 -64 -1 -9 -1 -7 -49 -32 -1 -25 -8 127 -97 -25 -1 -1 63 -33 -5 -4 -1
|
||||
15 -13 -1 -1 -64 -1 -13 -1 -32 -49 -32 -1 -25 -8 127 -97 -25 -1 -2 63 -49 -13
|
||||
-4 -1 15 -13 -1 -1 -64 127 -7 -1 -119 -17 -15 -1 -25 -8 127 -97 -25 -1 -2 63
|
||||
-49 -13 -4 -1 15 -13 -3 -1 -64 127 -8 -2 15 -17 -1 -1 -25 -8 127 -97 -25 -1
|
||||
-8 63 -49 -13 -4 -1 15 -13 -3 -1 -64 63 -4 120 0 -17 -1 -1 -25 -8 127 -97 -25
|
||||
-8 0 63 -57 -29 -4 -1 15 -13 -4 -1 -64 63 -4 0 15 -17 -1 -1 -25 -8 127 -97
|
||||
-25 -8 0 63 -57 -29 -4 -1 -1 -13 -4 -1 -64 31 -2 0 0 103 -1 -1 -57 -8 127 -97
|
||||
-25 -8 0 63 -57 -29 -4 -1 -1 -13 -4 127 -64 31 -2 0 15 103 -1 -1 -57 -8 127
|
||||
-97 -25 -8 0 63 -61 -61 -4 127 -1 -29 -4 127 -64 15 -8 0 0 55 -1 -1 -121 -8
|
||||
127 -97 -25 -8 0 63 -61 -61 -4 127 -1 -29 -4 63 -64 15 -32 0 0 23 -1 -2 3 -16
|
||||
63 15 -61 -16 0 31 -127 -127 -8 31 -1 -127 -8 31 -128 7 -128 0 0 }
|
||||
|
||||
:: get-pixel ( x y -- z )
|
||||
x -3 shift y image-row-length * + image-bitmap nth
|
||||
x bitnot 7 bitand neg shift 1 bitand 1 = ;
|
||||
|
||||
:: make-ball ( x y -- shape )
|
||||
cpBodyAlloc 1.0 NAN: 0 cpBodyInit cpBody memory>struct
|
||||
x y cpv >>p :> body
|
||||
cpCircleShapeAlloc body 0.95 0 0 cpv cpCircleShapeInit cpCircleShape memory>struct
|
||||
[ shape>> 0 >>e ] [ shape>> 0 >>u ] bi drop ;
|
||||
|
||||
TUPLE: chipmunk-world < wasd-world
|
||||
space ;
|
||||
|
||||
AFTER: chipmunk-world tick-game-world
|
||||
space>> 1.0 60.0 / cpSpaceStep ;
|
||||
|
||||
SPECIALIZED-ARRAY: cpContact
|
||||
M:: chipmunk-world draw-world* ( world -- )
|
||||
1 1 1 0 glClearColor
|
||||
GL_COLOR_BUFFER_BIT glClear
|
||||
GL_PROJECTION glMatrixMode
|
||||
glLoadIdentity
|
||||
-320 320 -240 240 -1 1 glOrtho
|
||||
0.5 0.5 0 glTranslatef
|
||||
GL_VERTEX_ARRAY glEnableClientState
|
||||
|
||||
world space>> :> space
|
||||
|
||||
3 glPointSize
|
||||
0 0 0 glColor3f
|
||||
GL_POINTS glBegin
|
||||
space bodies>> cpArray memory>struct
|
||||
[ num>> ] [ arr>> swap <direct-void*-array> ] bi [
|
||||
cpBody memory>struct p>> [ x>> ] [ y>> ] bi glVertex2f
|
||||
] each
|
||||
glEnd
|
||||
|
||||
2 glPointSize
|
||||
1 0 0 glColor3f
|
||||
GL_POINTS glBegin
|
||||
space arbiters>> cpArray memory>struct
|
||||
[ num>> ] [ arr>> swap <direct-void*-array> ] bi [
|
||||
cpArbiter memory>struct
|
||||
[ numContacts>> ] [ contacts>> swap <direct-cpContact-array> ] bi [
|
||||
p>> [ x>> ] [ y>> ] bi glVertex2f
|
||||
] each
|
||||
] each
|
||||
glEnd ;
|
||||
|
||||
M:: chipmunk-world begin-game-world ( world -- )
|
||||
cpInitChipmunk
|
||||
init-gpu
|
||||
world { -0.2 0.13 0.1 } 1.1 0.2 set-wasd-view drop
|
||||
|
||||
cpSpaceAlloc cpSpaceInit cpSpace memory>struct :> space
|
||||
|
||||
world space >>space drop
|
||||
space 2.0 10000 cpSpaceResizeActiveHash
|
||||
space 1 >>iterations drop
|
||||
|
||||
image-height iota [| y |
|
||||
image-width iota [| x |
|
||||
x y get-pixel [
|
||||
x image-width 2 / - 0.05 0.0 1.0 uniform-random-float * + 2 *
|
||||
image-height 2 / y - 0.05 0.0 1.0 uniform-random-float * + 2 *
|
||||
make-ball :> shape
|
||||
space shape body>> cpSpaceAddBody drop
|
||||
space shape cpSpaceAddShape drop
|
||||
] when
|
||||
] each
|
||||
] each
|
||||
|
||||
space cpBodyAlloc NAN: 0 dup cpBodyInit cpSpaceAddBody cpBody memory>struct :> body
|
||||
body -1000 -10 cpv >>p drop
|
||||
body 400 0 cpv >>v drop
|
||||
|
||||
space cpCircleShapeAlloc body 8 0 0 cpv cpCircleShapeInit cpSpaceAddShape cpCircleShape memory>struct :> shape
|
||||
shape
|
||||
[ shape>> 0 >>e drop ]
|
||||
[ shape>> 0 >>u drop ] bi ;
|
||||
|
||||
M: chipmunk-world end-game-world
|
||||
space>>
|
||||
[ cpSpaceFreeChildren ]
|
||||
[ cpSpaceFree ] bi ;
|
||||
|
||||
M: chipmunk-world wasd-movement-speed drop 1/160. ;
|
||||
M: chipmunk-world wasd-near-plane drop 1/32. ;
|
||||
M: chipmunk-world wasd-far-plane drop 256.0 ;
|
||||
|
||||
GAME: chipmunk-demo {
|
||||
{ world-class chipmunk-world }
|
||||
{ title "Chipmunk Physics Demo" }
|
||||
{ pixel-format-attributes {
|
||||
windowed
|
||||
double-buffered
|
||||
T{ depth-bits { value 24 } }
|
||||
} }
|
||||
{ grab-input? t }
|
||||
{ use-game-input? t }
|
||||
{ pref-dim { 640 480 } }
|
||||
{ tick-interval-micros $[ 60 fps ] }
|
||||
} ;
|
|
@ -0,0 +1 @@
|
|||
Demonstration of Chipmunk library bindings.
|
|
@ -0,0 +1 @@
|
|||
FFI bindings to the Chipmunk 2D physics library.
|
|
@ -8,7 +8,7 @@ IN: fuel.remote
|
|||
<PRIVATE
|
||||
|
||||
: start-listener ( -- )
|
||||
[ [ print-error-and-restarts ] error-hook set listener ] with-scope ;
|
||||
[ [ print-error-and-restarts drop ] error-hook set listener ] with-scope ;
|
||||
|
||||
: server ( port -- server )
|
||||
utf8 <threaded-server>
|
||||
|
|
|
@ -31,7 +31,7 @@ HELP: feedback-format:
|
|||
|
||||
HELP: GLSL-PROGRAM:
|
||||
{ $syntax "GLSL-PROGRAM: program-name shader shader ... [vertex-format vertex-format ...] [feedback-format: vertex-format] ;" }
|
||||
{ $description "Defines a new " { $link program } " named " { $snippet "program-name" } ". When the program is instantiated with " { $link <program-instance> } ", it will link together instances of all of the specified " { $link shader } "s to create the program instance. If any " { $link vertex-format } "s are specified, their attributes will be pre-assigned attribute indexes at link time, to ensure that their indexes remain constant if the program is refreshed with " { $link refresh-program } ". A trasform feedback vertex format may optionally be specified with " { $link POSTPONE: feedback-format: } "; if the program is used to collect transform feedback, the given vertex format will be used for the output." }
|
||||
{ $description "Defines a new " { $link program } " named " { $snippet "program-name" } ". When the program is instantiated with " { $link <program-instance> } ", it will link together instances of all of the specified " { $link shader } "s to create the program instance. If any " { $link vertex-format } "s are specified, their attributes will be pre-assigned attribute indexes at link time, to ensure that their indexes remain constant if the program is refreshed with " { $link refresh-program } ". A transform feedback vertex format may optionally be specified with " { $link POSTPONE: feedback-format: } "; if the program is used to collect transform feedback, the given vertex format will be used for the output." }
|
||||
{ $notes "Transform feedback requires OpenGL 3.0 or one of the " { $snippet "GL_EXT_transform_feedback" } " or " { $snippet "GL_ARB_transform_feedback" } " extensions." } ;
|
||||
|
||||
HELP: GLSL-SHADER-FILE:
|
||||
|
|
|
@ -101,6 +101,8 @@
|
|||
(,fuel-syntax--brace-words-regex 1 'factor-font-lock-parsing-word)
|
||||
(,fuel-syntax--alien-function-regex (1 'factor-font-lock-type-name)
|
||||
(2 'factor-font-lock-word))
|
||||
(,fuel-syntax--alien-callback-regex (1 'factor-font-lock-type-name)
|
||||
(2 'factor-font-lock-word))
|
||||
(,fuel-syntax--vocab-ref-regexp 2 'factor-font-lock-vocabulary-name)
|
||||
(,fuel-syntax--constructor-decl-regex
|
||||
(1 'factor-font-lock-word)
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
'(":" "::" ";" "&:" "<<" "<PRIVATE" ">>"
|
||||
"ABOUT:" "ALIAS:" "ALIEN:" "ARTICLE:"
|
||||
"B" "BIN:"
|
||||
"C:" "C-ENUM:" "C-STRUCT:" "C-UNION:" "CHAR:" "CONSTANT:" "call-next-method"
|
||||
"C:" "CALLBACK:" "C-ENUM:" "C-STRUCT:" "C-TYPE:" "C-UNION:" "CHAR:" "CONSTANT:" "call-next-method"
|
||||
"DEFER:"
|
||||
"EBNF:" ";EBNF" "ERROR:" "EXCLUDE:"
|
||||
"f" "FORGET:" "FROM:" "FUNCTION:"
|
||||
|
@ -61,7 +61,7 @@
|
|||
"POSTPONE:" "PREDICATE:" "PRIMITIVE:" "PRIVATE>" "PROVIDE:"
|
||||
"QUALIFIED-WITH:" "QUALIFIED:"
|
||||
"read-only" "RENAME:" "REQUIRE:" "REQUIRES:"
|
||||
"SINGLETON:" "SINGLETONS:" "SLOT:" "STRING:" "SYMBOL:" "SYMBOLS:" "SYNTAX:"
|
||||
"SINGLETON:" "SINGLETONS:" "SLOT:" "SPECIALIZED-ARRAY:" "SPECIALIZED-ARRAYS:" "STRING:" "STRUCT:" "SYMBOL:" "SYMBOLS:" "SYNTAX:"
|
||||
"TUPLE:" "t" "t?" "TYPEDEF:" "TYPED:" "TYPED::"
|
||||
"UNIFORM-TUPLE:" "UNION:" "USE:" "USING:"
|
||||
"VARS:" "VERTEX-FORMAT:"))
|
||||
|
@ -125,7 +125,7 @@
|
|||
|
||||
(defconst fuel-syntax--type-definition-regex
|
||||
(fuel-syntax--second-word-regex
|
||||
'("C-STRUCT:" "C-UNION:" "MIXIN:" "TUPLE:" "SINGLETON:" "UNION:")))
|
||||
'("C-STRUCT:" "C-UNION:" "MIXIN:" "TUPLE:" "SINGLETON:" "SPECIALIZED-ARRAY:" "STRUCT:" "UNION:")))
|
||||
|
||||
(defconst fuel-syntax--tuple-decl-regex
|
||||
"^TUPLE: +\\([^ \n]+\\) +< +\\([^ \n]+\\)\\_>")
|
||||
|
@ -152,6 +152,9 @@
|
|||
(defconst fuel-syntax--alien-function-regex
|
||||
"\\_<FUNCTION: \\(\\w+\\) \\(\\w+\\)")
|
||||
|
||||
(defconst fuel-syntax--alien-callback-regex
|
||||
"\\_<CALLBACK: \\(\\w+\\) \\(\\w+\\)")
|
||||
|
||||
(defconst fuel-syntax--indent-def-starts '("" ":"
|
||||
"C-ENUM" "C-STRUCT" "C-UNION"
|
||||
"FROM" "FUNCTION:"
|
||||
|
@ -169,6 +172,7 @@
|
|||
(defconst fuel-syntax--no-indent-def-starts '("ARTICLE"
|
||||
"HELP"
|
||||
"SINGLETONS"
|
||||
"SPECIALIZED-ARRAYS"
|
||||
"SYMBOLS"
|
||||
"VARS"))
|
||||
|
||||
|
@ -186,7 +190,7 @@
|
|||
(defconst fuel-syntax--single-liner-regex
|
||||
(regexp-opt '("ABOUT:"
|
||||
"ALIAS:"
|
||||
"CONSTANT:" "C:"
|
||||
"CONSTANT:" "C:" "C-TYPE:"
|
||||
"DEFER:"
|
||||
"FORGET:"
|
||||
"GAME:" "GENERIC:" "GENERIC#" "GLSL-PROGRAM:"
|
||||
|
@ -198,7 +202,7 @@
|
|||
"POSTPONE:" "PRIVATE>" "<PRIVATE"
|
||||
"QUALIFIED-WITH:" "QUALIFIED:"
|
||||
"RENAME:"
|
||||
"SINGLETON:" "SLOT:" "SYMBOL:"
|
||||
"SINGLETON:" "SLOT:" "SPECIALIZED-ARRAY:" "SYMBOL:"
|
||||
"TYPEDEF:"
|
||||
"USE:"
|
||||
"VAR:")))
|
||||
|
@ -271,7 +275,7 @@
|
|||
("\\_<C-ENUM:\\( \\|\n\\)" (1 "<b"))
|
||||
("\\_<TUPLE: +\\w+? +< +\\w+? *\\( \\|\n\\)\\([^;]\\|$\\)" (1 "<b"))
|
||||
("\\_<TUPLE: +\\w+? *\\( \\|\n\\)\\([^;<\n]\\|\\_>\\)" (1 "<b"))
|
||||
("\\_<\\(SYMBOLS\\|VARS\\|SINGLETONS\\): *?\\( \\|\n\\)\\([^;\n]\\|\\_>\\)"
|
||||
("\\_<\\(SYMBOLS\\|VARS\\|SPECIALIZED-ARRAYS\\|SINGLETONS\\): *?\\( \\|\n\\)\\([^;\n]\\|\\_>\\)"
|
||||
(2 "<b"))
|
||||
("\\(\n\\| \\);\\_>" (1 ">b"))
|
||||
;; Let and lambda:
|
||||
|
|
Loading…
Reference in New Issue