]> gitweb.factorcode.org Git - factor.git/commitdiff
rearrange stuff in alien.arrays and alien.data to eliminate libc dependency from...
authorJoe Groff <arcata@gmail.com>
Thu, 15 Apr 2010 04:40:29 +0000 (21:40 -0700)
committerJoe Groff <arcata@gmail.com>
Thu, 15 Apr 2010 04:40:29 +0000 (21:40 -0700)
basis/alien/arrays/arrays.factor
basis/alien/data/data.factor

index ce6eb85245509c51183f4b3b43be997d59d95575..e112a38d25144e58753c3d1a376cdfa585790939 100644 (file)
@@ -1,8 +1,8 @@
 ! Copyright (C) 2008, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien alien.strings alien.c-types alien.data alien.accessors
+USING: alien alien.strings alien.c-types alien.accessors
 arrays words sequences math kernel namespaces fry cpu.architecture
-io.encodings.binary io.encodings.utf8 accessors ;
+io.encodings.binary io.encodings.utf8 accessors compiler.units ;
 IN: alien.arrays
 
 INSTANCE: array value-type
@@ -34,11 +34,6 @@ M: array box-return drop void* box-return ;
 
 M: array stack-size drop void* stack-size ;
 
-M: array c-type-boxer-quot
-    unclip [ array-length ] dip [ <c-direct-array> ] 2curry ;
-
-M: array c-type-unboxer-quot drop [ >c-ptr ] ;
-
 PREDICATE: string-type < pair
     first2 [ c-string = ] [ word? ] bi* and ;
 
@@ -100,5 +95,5 @@ M: string-type c-type-getter
 M: string-type c-type-setter
     drop [ set-alien-cell ] ;
 
-{ c-string utf8 } c-string typedef
+[ { c-string utf8 } c-string typedef ] with-compilation-unit
 
index 2d572e9f135b5a86363ceae97b31f646aac98063..a0450d512252579e1eec794759a1009069b1bf13 100644 (file)
@@ -1,5 +1,5 @@
 ! (c)2009, 2010 Slava Pestov, Joe Groff bsd license
-USING: accessors alien alien.c-types alien.strings arrays
+USING: accessors alien alien.c-types alien.arrays alien.strings arrays
 byte-arrays cpu.architecture fry io io.encodings.binary
 io.files io.streams.memory kernel libc math sequences words
 byte-vectors ;
@@ -78,3 +78,9 @@ M: value-type c-type-getter
 M: value-type c-type-setter ( type -- quot )
     [ c-type-getter ] [ c-type-unboxer-quot ] [ heap-size ] tri
     '[ @ swap @ _ memcpy ] ;
+
+M: array c-type-boxer-quot
+    unclip [ array-length ] dip [ <c-direct-array> ] 2curry ;
+
+M: array c-type-unboxer-quot drop [ >c-ptr ] ;
+