1 USING: kernel windows.com windows.com.syntax windows.ole32
2 alien alien.syntax tools.test libc alien.c-types
3 namespaces arrays continuations accessors math windows.com.wrapper
4 windows.com.wrapper.private destructors effects compiler.units ;
7 COM-INTERFACE: ISimple IUnknown {216fb341-0eb2-44b1-8edb-60b76e353abc}
9 HRESULT returnError ( ) ;
11 COM-INTERFACE: IInherited ISimple {9620ecec-8438-423b-bb14-86f835aa40dd}
13 void setX ( int newX ) ;
15 COM-INTERFACE: IUnrelated IUnknown {b06ac3f4-30e4-406b-a7cd-c29cead4552c}
17 int xMulAdd ( int mul, int add ) ;
19 { GUID: {216fb341-0eb2-44b1-8edb-60b76e353abc} } [ ISimple-iid ] unit-test
20 { GUID: {9620ecec-8438-423b-bb14-86f835aa40dd} } [ IInherited-iid ] unit-test
21 { GUID: {00000000-0000-0000-C000-000000000046} } [ IUnknown-iid ] unit-test
22 { GUID: {b06ac3f4-30e4-406b-a7cd-c29cead4552c} } [ IUnrelated-iid ] unit-test
24 { (( -- iid )) } [ \ ISimple-iid stack-effect ] unit-test
25 { (( this -- HRESULT )) } [ \ ISimple::returnOK stack-effect ] unit-test
26 { (( this -- int )) } [ \ IInherited::getX stack-effect ] unit-test
27 { (( this newX -- )) } [ \ IInherited::setX stack-effect ] unit-test
28 { (( this mul add -- int )) } [ \ IUnrelated::xMulAdd stack-effect ] unit-test
30 SYMBOL: +test-wrapper+
31 SYMBOL: +guinea-pig-implementation+
32 SYMBOL: +orig-wrapped-objects+
34 +wrapped-objects+ get-global clone +orig-wrapped-objects+ set-global
36 TUPLE: test-implementation x ;
37 C: <test-implementation> test-implementation
42 [ drop S_OK ] ! ISimple::returnOK
43 [ drop E_FAIL ] ! ISimple::returnError
44 [ x>> ] ! IInherited::getX
45 [ >>x drop ] ! IInherited::setX
48 [ [ x>> ] [ + ] bi* ] ! IUnrelated::xPlus
49 [ [ x>> ] [ * ] [ + ] tri* ] ! IUnrelated::xMulAdd
52 dup +test-wrapper+ set [
54 0 <test-implementation> swap com-wrap
55 dup +guinea-pig-implementation+ set [ drop
57 S_OK 1array [ +guinea-pig-implementation+ get ISimple::returnOK ] unit-test
58 E_FAIL <long> *long 1array [ +guinea-pig-implementation+ get ISimple::returnError ] unit-test
60 +guinea-pig-implementation+ get
61 [ 20 IInherited::setX ]
62 [ IInherited::getX ] bi
65 +guinea-pig-implementation+ get
66 IUnrelated-iid com-query-interface
67 [ 20 20 IUnrelated::xMulAdd ] with-com-interface
70 +guinea-pig-implementation+ get
71 IUnrelated-iid com-query-interface
72 [ 20 IUnrelated::xPlus ] with-com-interface
75 +guinea-pig-implementation+ get 1array [
76 +guinea-pig-implementation+ get com-add-ref
79 { } [ +guinea-pig-implementation+ get com-release ] unit-test
81 +guinea-pig-implementation+ get 1array [
82 +guinea-pig-implementation+ get IUnknown-iid com-query-interface
85 +guinea-pig-implementation+ get 1array [
86 +guinea-pig-implementation+ get ISimple-iid com-query-interface
89 void* heap-size +guinea-pig-implementation+ get <displaced-alien>
90 +guinea-pig-implementation+ get
92 +guinea-pig-implementation+ get IUnrelated-iid com-query-interface
93 dup ISimple-iid com-query-interface
94 over com-release dup com-release
100 ] with-compilation-unit
102 ! Ensure that we freed +guinea-pig-implementation
103 +orig-wrapped-objects+ get-global 1array [ +wrapped-objects+ get-global ] unit-test