1 ! Copyright (C) 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: alien.c-types combinators fry kernel parser math math.parser
4 math.vectors.simd.functor sequences splitting vocabs.generated
5 vocabs.loader vocabs.parser words accessors vocabs compiler.units
7 QUALIFIED-WITH: alien.c-types c
10 ERROR: bad-base-type type ;
14 : simd-vocab ( base-type -- vocab )
15 name>> "math.vectors.simd.instances." prepend ;
17 : parse-base-type ( c-type -- c-type )
18 dup { c:char c:uchar c:short c:ushort c:int c:uint c:longlong c:ulonglong c:float c:double } member-eq?
19 [ bad-base-type ] unless ;
21 : forget-instances ( -- )
23 "math.vectors.simd.instances" child-vocabs
25 ] with-compilation-unit ;
29 : define-simd-vocab ( type -- vocab )
31 [ simd-vocab ] keep '[
34 [ define-simd-256 ] bi
38 scan-word define-simd-vocab use-vocab ;
41 \ ; parse-until [ define-simd-vocab use-vocab ] each ;