change data-map( ) syntax to work with c-type[symbolic-constant] types
parent
a37bc4828f
commit
7830082154
|
@ -92,9 +92,11 @@ IN: alien.data.map.tests
|
||||||
: vmerge-transpose ( a b c d -- ac bd ac bd )
|
: vmerge-transpose ( a b c d -- ac bd ac bd )
|
||||||
[ (vmerge) ] bi-curry@ bi* ; inline
|
[ (vmerge) ] bi-curry@ bi* ; inline
|
||||||
|
|
||||||
|
CONSTANT: plane-count 4
|
||||||
|
|
||||||
: fold-rgba-planes ( r g b a -- rgba )
|
: fold-rgba-planes ( r g b a -- rgba )
|
||||||
[ vmerge-transpose vmerge-transpose ]
|
[ vmerge-transpose vmerge-transpose ]
|
||||||
data-map( uchar-16 uchar-16 uchar-16 uchar-16 -- uchar-16[4] ) ;
|
data-map( uchar-16 uchar-16 uchar-16 uchar-16 -- uchar-16[plane-count] ) ;
|
||||||
|
|
||||||
[
|
[
|
||||||
B{
|
B{
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
USING: accessors alien alien.c-types alien.data alien.parser arrays
|
USING: accessors alien alien.c-types alien.data alien.parser arrays
|
||||||
byte-arrays combinators effects.parser fry generalizations kernel
|
byte-arrays combinators effects.parser fry generalizations kernel
|
||||||
lexer locals macros make math math.ranges parser sequences sequences.private ;
|
lexer locals macros make math math.ranges parser sequences sequences.private ;
|
||||||
|
FROM: alien.arrays => array-length ;
|
||||||
IN: alien.data.map
|
IN: alien.data.map
|
||||||
|
|
||||||
ERROR: bad-data-map-input-length byte-length iter-size remainder ;
|
ERROR: bad-data-map-input-length byte-length iter-size remainder ;
|
||||||
|
@ -36,7 +37,7 @@ M: data-map-param nth-unsafe
|
||||||
INSTANCE: data-map-param immutable-sequence
|
INSTANCE: data-map-param immutable-sequence
|
||||||
|
|
||||||
: c-type-count ( in/out -- c-type count iter-length )
|
: c-type-count ( in/out -- c-type count iter-length )
|
||||||
dup array? [ unclip swap product >fixnum ] [ 1 ] if
|
dup array? [ unclip swap array-length >fixnum ] [ 1 ] if
|
||||||
2dup swap heap-size * >fixnum ; inline
|
2dup swap heap-size * >fixnum ; inline
|
||||||
|
|
||||||
MACRO: >param ( in -- quot: ( array -- param ) )
|
MACRO: >param ( in -- quot: ( array -- param ) )
|
||||||
|
|
Loading…
Reference in New Issue