]> gitweb.factorcode.org Git - factor.git/blob - basis/compiler/tests/redefine24.factor
stack-checker.alien: now that C types are words, the compiler can add dependencies...
[factor.git] / basis / compiler / tests / redefine24.factor
1 USING: alien alien.syntax eval math tools.test ;
2 QUALIFIED: alien.c-types
3 IN: compiler.tests.redefine24
4
5 TYPEDEF: alien.c-types:int type-1
6
7 TYPEDEF: alien.c-types:int type-3
8
9 : callback ( -- ptr )
10     type-3 { type-1 type-1 } "cdecl" [ + >integer ] alien-callback ;
11
12 TYPEDEF: alien.c-types:float type-2
13
14 : indirect ( x y ptr -- z  )
15     type-3 { type-2 type-2 } "cdecl" alien-indirect ;
16
17 [ ] [
18     "USING: alien.c-types alien.syntax ;
19     IN: compiler.tests.redefine24 TYPEDEF: int type-2" eval( -- )
20 ] unit-test
21
22 [ 3 ] [ 1 2 callback indirect ] unit-test
23
24 [ ] [
25     "USING: alien.c-types alien.syntax ;
26     IN: compiler.tests.redefine24
27     TYPEDEF: float type-1
28     TYPEDEF: float type-2" eval( -- )
29 ] unit-test
30
31 [ 3 ] [ 1.0 2.0 callback indirect ] unit-test
32
33 [ ] [
34     "USING: alien.c-types alien.syntax ;
35     IN: compiler.tests.redefine24
36     TYPEDEF: float type-3" eval( -- )
37 ] unit-test
38
39 [ 3.0 ] [ 1.0 2.0 callback indirect ] unit-test