]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/windows/com/com.factor
factor: FUNCTION: rename by hand...
[factor.git] / basis / windows / com / com.factor
index 46ae1ae154d1a07b0d3754ea4de83436ee1e6c8b..15abd924d827b6cb82bda3d3d06572e0ddf745e3 100644 (file)
@@ -52,7 +52,7 @@ CONSTANT: STGM_READ 0
 CONSTANT: STGM_WRITE 1
 CONSTANT: STGM_READWRITE 2
 
-CONSTANT: STG_E_INVALIDFUNCTION HEX: 80030001
+CONSTANT: STG_E_INVALIDFUNCTION 0x80030001
 
 CONSTANT: STGTY_STORAGE   1
 CONSTANT: STGTY_STREAM    2
@@ -80,25 +80,23 @@ COM-INTERFACE: IStream ISequentialStream {0000000C-0000-0000-C000-000000000046}
     HRESULT Stat ( STATSTG* pstatstg, DWORD grfStatFlag )
     HRESULT Clone ( IStream** ppstm ) ;
 
-FUNCTION: HRESULT RegisterDragDrop ( HWND hWnd, IDropTarget* pDropTarget ) ;
-FUNCTION: HRESULT RevokeDragDrop ( HWND hWnd ) ;
-FUNCTION: void ReleaseStgMedium ( LPSTGMEDIUM pmedium ) ;
+FUNCTION: HRESULT RegisterDragDrop ( HWND hWnd, IDropTarget* pDropTarget )
+FUNCTION: HRESULT RevokeDragDrop ( HWND hWnd )
+FUNCTION: void ReleaseStgMedium ( LPSTGMEDIUM pmedium )
 
 : com-query-interface ( interface iid -- interface' )
-    [
-        void* malloc-object &free
-        [ IUnknown::QueryInterface ole32-error ] keep *void*
-    ] with-destructors ;
+    { void* }
+    [ IUnknown::QueryInterface check-ole32-error ]
+    with-out-parameters ;
 
 : com-add-ref ( interface -- interface )
      [ IUnknown::AddRef drop ] keep ; inline
 
+ERROR: null-com-release ;
 : com-release ( interface -- )
-    IUnknown::Release drop ; inline
+    [ IUnknown::Release drop ] [ null-com-release ] if* ; inline
 
 : with-com-interface ( interface quot -- )
     over [ com-release ] curry [ ] cleanup ; inline
 
 DESTRUCTOR: com-release
-
-