1 USING: kernel windows.com windows.com.syntax windows.ole32
2 windows.types alien alien.data alien.syntax tools.test libc
3 alien.c-types namespaces arrays continuations accessors math
4 windows.com.wrapper windows.com.wrapper.private destructors
5 effects compiler.units ;
8 COM-INTERFACE: ISimple IUnknown {216fb341-0eb2-44b1-8edb-60b76e353abc}
10 HRESULT returnError ( ) ;
12 COM-INTERFACE: IInherited ISimple {9620ecec-8438-423b-bb14-86f835aa40dd}
14 void setX ( int newX ) ;
16 COM-INTERFACE: IUnrelated IUnknown {b06ac3f4-30e4-406b-a7cd-c29cead4552c}
18 int xMulAdd ( int mul, int add ) ;
20 COM-INTERFACE: ISelfReferential IUnknown {d4f45bf8-f720-4701-a09d-e8e341981121}
21 ISelfReferential* selfReference ( ) ;
23 { GUID: {216fb341-0eb2-44b1-8edb-60b76e353abc} } [ ISimple-iid ] unit-test
24 { GUID: {9620ecec-8438-423b-bb14-86f835aa40dd} } [ IInherited-iid ] unit-test
25 { GUID: {00000000-0000-0000-C000-000000000046} } [ IUnknown-iid ] unit-test
26 { GUID: {b06ac3f4-30e4-406b-a7cd-c29cead4552c} } [ IUnrelated-iid ] unit-test
28 { ( -- iid ) } [ \ ISimple-iid stack-effect ] unit-test
29 { ( this -- HRESULT ) } [ \ ISimple::returnOK stack-effect ] unit-test
30 { ( this -- int ) } [ \ IInherited::getX stack-effect ] unit-test
31 { ( this newX -- ) } [ \ IInherited::setX stack-effect ] unit-test
32 { ( this mul add -- int ) } [ \ IUnrelated::xMulAdd stack-effect ] unit-test
34 SYMBOL: +test-wrapper+
35 SYMBOL: +guinea-pig-implementation+
36 SYMBOL: +orig-wrapped-objects+
38 +wrapped-objects+ get-global clone +orig-wrapped-objects+ set-global
40 TUPLE: test-implementation x ;
41 C: <test-implementation> test-implementation
47 [ drop S_OK ] ! ISimple::returnOK
48 [ drop E_FAIL ] ! ISimple::returnError
49 [ x>> ] ! IInherited::getX
50 [ >>x drop ] ! IInherited::setX
53 [ [ x>> ] [ + ] bi* ] ! IUnrelated::xPlus
54 [ [ x>> ] [ * ] [ + ] tri* ] ! IUnrelated::xMulAdd
57 dup +test-wrapper+ set [
59 0 <test-implementation> swap com-wrap
60 dup +guinea-pig-implementation+ set [
63 S_OK 1array [ +guinea-pig-implementation+ get ISimple::returnOK ] unit-test
64 E_FAIL long <ref> long deref 1array [ +guinea-pig-implementation+ get ISimple::returnError ] unit-test
66 +guinea-pig-implementation+ get
67 [ 20 IInherited::setX ]
68 [ IInherited::getX ] bi
71 +guinea-pig-implementation+ get
72 IUnrelated-iid com-query-interface
73 [ 20 20 IUnrelated::xMulAdd ] with-com-interface
76 +guinea-pig-implementation+ get
77 IUnrelated-iid com-query-interface
78 [ 20 IUnrelated::xPlus ] with-com-interface
81 +guinea-pig-implementation+ get 1array [
82 +guinea-pig-implementation+ get com-add-ref
85 { } [ +guinea-pig-implementation+ get com-release ] unit-test
87 +guinea-pig-implementation+ get 1array [
88 +guinea-pig-implementation+ get IUnknown-iid com-query-interface
91 +guinea-pig-implementation+ get 1array [
92 +guinea-pig-implementation+ get ISimple-iid com-query-interface
95 void* heap-size +guinea-pig-implementation+ get <displaced-alien>
96 +guinea-pig-implementation+ get
98 +guinea-pig-implementation+ get IUnrelated-iid com-query-interface
99 dup ISimple-iid com-query-interface
100 over com-release dup com-release
104 ] with-compilation-unit
107 ! Ensure that we freed +guinea-pig-implementation
108 +orig-wrapped-objects+ get-global 1array [ +wrapped-objects+ get-global ] unit-test