From 782cc78c1413286d9c8bc6a05faaffa40a02cedd Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 11 May 2009 18:01:35 -0500 Subject: [PATCH] windows.dinput.constants: fix deployment --- basis/struct-arrays/struct-arrays.factor | 2 +- basis/windows/dinput/constants/constants.factor | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/basis/struct-arrays/struct-arrays.factor b/basis/struct-arrays/struct-arrays.factor index ba0524009f..5aaf2c2ea6 100755 --- a/basis/struct-arrays/struct-arrays.factor +++ b/basis/struct-arrays/struct-arrays.factor @@ -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 ; + [ heap-size calloc ] 2keep ; inline INSTANCE: struct-array sequence diff --git a/basis/windows/dinput/constants/constants.factor b/basis/windows/dinput/constants/constants.factor index 74238abed2..ccc28c00e9 100755 --- a/basis/windows/dinput/constants/constants.factor +++ b/basis/windows/dinput/constants/constants.factor @@ -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: > [ 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" (DIDATAFORMAT) ; +: initialize ( symbol quot -- ) + call swap set-global ; inline + : (malloc-guid-symbol) ( symbol guid -- ) '[ _ execute( -- value )