windows.directx.dinput.constants: fix breakage if image is saved and restarted

db4
Slava Pestov 2010-05-04 02:31:36 -05:00
parent f46a56024c
commit 1bd7b85b03
1 changed files with 11 additions and 12 deletions

23
basis/windows/directx/dinput/constants/constants.factor Normal file → Executable file
View File

@ -1,8 +1,8 @@
USING: windows.directx.dinput windows.kernel32 windows.ole32 windows.com USING: windows.directx.dinput windows.kernel32 windows.ole32
windows.com.syntax alien alien.c-types alien.data alien.syntax windows.com windows.com.syntax alien alien.c-types alien.data
kernel system namespaces combinators sequences fry math accessors alien.syntax kernel system namespaces combinators sequences fry
macros words quotations libc continuations generalizations math accessors macros words quotations libc continuations
splitting locals assocs init specialized-arrays memoize generalizations splitting locals assocs init specialized-arrays
classes.struct strings arrays literals ; classes.struct strings arrays literals ;
SPECIALIZED-ARRAY: DIOBJECTDATAFORMAT SPECIALIZED-ARRAY: DIOBJECTDATAFORMAT
IN: windows.directx.dinput.constants IN: windows.directx.dinput.constants
@ -20,21 +20,21 @@ SYMBOLS:
<PRIVATE <PRIVATE
<< : initialize ( variable quot -- )
call swap set-global ; inline
MEMO: c-type* ( name -- c-type ) c-type ; <<
MEMO: heap-size* ( c-type -- n ) heap-size ;
GENERIC: array-base-type ( c-type -- c-type' ) GENERIC: array-base-type ( c-type -- c-type' )
M: object array-base-type ; M: object array-base-type ;
M: array array-base-type first ; M: array array-base-type first ;
: (field-spec-of) ( field struct -- field-spec ) : (field-spec-of) ( field struct -- field-spec )
c-type* fields>> [ name>> = ] with find nip ; c-type fields>> [ name>> = ] with find nip ;
: (offsetof) ( field struct -- offset ) : (offsetof) ( field struct -- offset )
[ (field-spec-of) offset>> ] [ drop 0 ] if* ; [ (field-spec-of) offset>> ] [ drop 0 ] if* ;
: (sizeof) ( field struct -- size ) : (sizeof) ( field struct -- size )
[ (field-spec-of) type>> array-base-type heap-size* ] [ drop 1 ] if* ; [ (field-spec-of) type>> array-base-type heap-size ] [ drop 1 ] if* ;
: (flag) ( thing -- integer ) : (flag) ( thing -- integer )
{ {
@ -832,8 +832,7 @@ MACRO: <DIDATAFORMAT> ( dwFlags dwDataSize struct rgodf-array -- alien )
[ define-constants ] "windows.directx.dinput.constants" add-startup-hook [ define-constants ] "windows.directx.dinput.constants" add-startup-hook
: uninitialize ( variable quot -- ) : uninitialize ( variable quot -- )
[ '[ _ when* f ] change-global ] [ [ get-global ] dip when* ] [ drop global delete-at ] 2bi ; inline
[ drop global delete-at ] 2bi ; inline
: free-dinput-constants ( -- ) : free-dinput-constants ( -- )
{ {