]> gitweb.factorcode.org Git - factor.git/commitdiff
windows.dinput.constants: fix deployment
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Mon, 11 May 2009 23:01:35 +0000 (18:01 -0500)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Mon, 11 May 2009 23:01:35 +0000 (18:01 -0500)
basis/struct-arrays/struct-arrays.factor
basis/windows/dinput/constants/constants.factor

index ba0524009f0b6e1cb6e34ddf158c3b112730c12a..5aaf2c2ea63da53092e26644fdf9d5eef8376318 100755 (executable)
@@ -35,6 +35,6 @@ ERROR: bad-byte-array-length byte-array ;
     heap-size struct-array boa ; inline
 
 : malloc-struct-array ( length c-type -- struct-array )
-    [ heap-size calloc ] 2keep <direct-struct-array> ;
+    [ heap-size calloc ] 2keep <direct-struct-array> ; inline
 
 INSTANCE: struct-array sequence
index 74238abed2aa7681f0638906447c01c8846a7eae..ccc28c00e999d99e061f17de75eb666805877a9d 100755 (executable)
@@ -2,7 +2,7 @@ USING: windows.dinput windows.kernel32 windows.ole32 windows.com
 windows.com.syntax alien alien.c-types alien.syntax kernel system namespaces
 combinators sequences fry math accessors macros words quotations
 libc continuations generalizations splitting locals assocs init
-struct-arrays ;
+struct-arrays memoize ;
 IN: windows.dinput.constants
 
 ! Some global variables aren't provided by the DirectInput DLL (they're in the
@@ -18,12 +18,15 @@ SYMBOLS:
 
 <PRIVATE
 
+MEMO: c-type* ( name -- c-type ) c-type ;
+MEMO: heap-size* ( c-type -- n ) heap-size ;
+
 : (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>> "[" split1 drop heap-size ] [ drop 1 ] if* ;
+    [ (field-spec-of) type>> "[" split1 drop heap-size* ] [ drop 1 ] if* ;
 
 : (flag) ( thing -- integer )
     {
@@ -79,6 +82,9 @@ SYMBOLS:
     [ nip length ] [ malloc-DIOBJECTDATAFORMAT-array ] 2bi
     "DIDATAFORMAT" <c-object> (DIDATAFORMAT) ;
 
+: initialize ( symbol quot -- )
+    call swap set-global ; inline
+
 : (malloc-guid-symbol) ( symbol guid -- )
     '[
         _ execute( -- value )