]> gitweb.factorcode.org Git - factor.git/commitdiff
windows.directx.dinput.constants: fix breakage if image is saved and restarted
authorSlava Pestov <slava@factorcode.org>
Tue, 4 May 2010 07:31:36 +0000 (02:31 -0500)
committerSlava Pestov <slava@factorcode.org>
Tue, 4 May 2010 07:31:36 +0000 (02:31 -0500)
basis/windows/directx/dinput/constants/constants.factor [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 6a2d9b1..98ea261
@@ -1,8 +1,8 @@
-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
@@ -20,21 +20,21 @@ SYMBOLS:
 
 <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' )
 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 ;
+    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* ;
+    [ (field-spec-of) type>> array-base-type heap-size ] [ drop 1 ] if* ;
 
 : (flag) ( thing -- integer )
     {
@@ -832,8 +832,7 @@ MACRO: <DIDATAFORMAT> ( dwFlags dwDataSize struct rgodf-array -- alien )
 [ define-constants ] "windows.directx.dinput.constants" add-startup-hook
 
 : uninitialize ( variable quot -- )
-    [ '[ _ when* f ] change-global ]
-    [ drop global delete-at ] 2bi ; inline
+    [ [ get-global ] dip when* ] [ drop global delete-at ] 2bi ; inline
 
 : free-dinput-constants ( -- )
     {