-USING: windows.directx.dinput windows.kernel32 windows.ole32 windows.com
-windows.com.syntax alien alien.c-types alien.data alien.syntax
-kernel system namespaces combinators sequences fry math accessors
-macros words quotations libc continuations generalizations
-splitting locals assocs init specialized-arrays memoize
+USING: windows.directx.dinput windows.kernel32 windows.ole32
+windows.com windows.com.syntax alien alien.c-types alien.data
+alien.syntax kernel system namespaces combinators sequences fry
+math accessors macros words quotations libc continuations
+generalizations splitting locals assocs init specialized-arrays
 classes.struct strings arrays literals ;
 SPECIALIZED-ARRAY: DIOBJECTDATAFORMAT
 IN: windows.directx.dinput.constants


<PRIVATE

<<

MEMO: c-type* ( name -- c-type ) c-type ;
MEMO: heap-size* ( c-type -- n ) heap-size ;

GENERIC: array-base-type ( c-type -- c-type' )
M: object array-base-type ;
M: array array-base-type first ;

: (field-spec-of) ( field struct -- field-spec )
    c-type* fields>> [ name>> = ] with find nip ;
: (offsetof) ( field struct -- offset )
    [ (field-spec-of) offset>> ] [ drop 0 ] if* ;
: (sizeof) ( field struct -- size )
    [ (field-spec-of) type>> array-base-type heap-size* ] [ drop 1 ] if* ;

: (flag) ( thing -- integer )
    {

[ define-constants ] "windows.directx.dinput.constants" add-startup-hook

: uninitialize ( variable quot -- )
    [ [ get-global ] dip when* ] [ drop global delete-at ] 2bi ; inline

: free-dinput-constants ( -- )
    {
