]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/alien/complex/functor/functor.factor
factor: trim using lists
[factor.git] / basis / alien / complex / functor / functor.factor
index cb66175a29817717b28a1466013893528f8f3464..a28002b8debb1c4d1fa5ab7841cff220304b19a3 100644 (file)
@@ -1,11 +1,12 @@
 ! Copyright (C) 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors alien.structs alien.c-types classes.struct math
-math.functions sequences arrays kernel functors vocabs.parser
-namespaces quotations ;
+USING: accessors alien alien.c-types classes.struct functors
+kernel math quotations ;
 IN: alien.complex.functor
 
-FUNCTOR: define-complex-type ( N T -- )
+<FUNCTOR: define-complex-type ( N T -- )
+
+N-type IS ${N}
 
 T-class DEFINES-CLASS ${T}
 
@@ -14,19 +15,18 @@ T-class DEFINES-CLASS ${T}
 
 WHERE
 
-STRUCT: T-class { real N } { imaginary N } ;
+STRUCT: T-class { real N-type } { imaginary N-type } ;
 
 : <T> ( z -- alien )
-    >rect T-class <struct-boa> ;
+    >rect T-class boa >c-ptr ;
 
 : *T ( alien -- z )
     T-class memory>struct [ real>> ] [ imaginary>> ] bi rect> ; inline
 
-T-class c-type
+T-class lookup-c-type
 <T> 1quotation >>unboxer-quot
 *T 1quotation >>boxer-quot
-number >>boxed-class
-T set-array-class
+complex >>boxed-class
 drop
 
-;FUNCTOR
+;FUNCTOR>