]> gitweb.factorcode.org Git - factor.git/commitdiff
Update windows.dinput for specialized-arrays
authorU-SLAVA-DFB8FF805\Slava <Slava@slava-dfb8ff805.(none)>
Wed, 3 Dec 2008 15:55:11 +0000 (09:55 -0600)
committerU-SLAVA-DFB8FF805\Slava <Slava@slava-dfb8ff805.(none)>
Wed, 3 Dec 2008 15:55:11 +0000 (09:55 -0600)
basis/windows/dinput/constants/constants.factor [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 182c174..e3bec6d
@@ -1,7 +1,8 @@
 USING: windows.dinput windows.kernel32 windows.ole32 windows.com
 windows.com.syntax alien alien.c-types alien.syntax kernel system namespaces
 combinators sequences symbols fry math accessors macros words quotations
-libc continuations generalizations splitting locals assocs init ;
+libc continuations generalizations splitting locals assocs init
+struct-arrays ;
 IN: windows.dinput.constants
 
 ! Some global variables aren't provided by the DirectInput DLL (they're in the
@@ -52,14 +53,14 @@ SYMBOLS:
     } cleave
     "DIOBJECTDATAFORMAT" <c-object> (DIOBJECTDATAFORMAT) ;
 
-: malloc-DIOBJECTDATAFORMAT-array ( struct array -- alien )
-    [ nip length "DIOBJECTDATAFORMAT" malloc-array dup ]
-    [
-        -rot [| args i alien struct |
+:: malloc-DIOBJECTDATAFORMAT-array ( struct array -- alien )
+    [let | alien [ array length "DIOBJECTDATAFORMAT" malloc-struct-array ] |
+        array [| args i |
             struct args <DIOBJECTDATAFORMAT>
-            i alien set-DIOBJECTDATAFORMAT-nth
-        ] 2curry each-index
-    ] 2bi ;
+            i alien set-nth
+        ] each-index
+        alien underlying>>
+    ] ;
 
 : (DIDATAFORMAT) ( dwSize dwObjSize dwFlags dwDataSize dwNumObjs rgodf alien -- alien )
     [ {