]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/io/backend/windows/windows.factor
Move win32-handle to windows.handles and update using lists to avoid pulling in the...
[factor.git] / basis / io / backend / windows / windows.factor
index 8864dff9ada6cf353d42829f2369429a2b4af2e8..e0dd8062122794b15442dfdf31fee84e2e61eac3 100755 (executable)
@@ -1,37 +1,10 @@
-! Copyright (C) 2004, 2008 Mackenzie Straight, Doug Coleman.
+! Copyright (C) 2004, 2010 Mackenzie Straight, Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien alien.c-types arrays destructors io io.backend
-io.buffers io.files io.ports io.binary io.timeouts system
-strings kernel math namespaces sequences windows.errors
-windows.kernel32 windows.shell32 windows.types splitting
-continuations math.bitwise accessors init sets assocs
-classes.struct classes literals ;
+USING: accessors alien.c-types classes.struct destructors
+io.backend kernel literals windows.errors windows.handles
+windows.kernel32 ;
 IN: io.backend.windows
 
-TUPLE: win32-handle < disposable handle ;
-
-: set-inherit ( handle ? -- )
-    [ handle>> HANDLE_FLAG_INHERIT ] dip
-    >BOOLEAN SetHandleInformation win32-error=0/f ;
-
-: new-win32-handle ( handle class -- win32-handle )
-    new-disposable swap >>handle
-    dup f set-inherit ;
-
-: <win32-handle> ( handle -- win32-handle )
-    win32-handle new-win32-handle ;
-
-M: win32-handle dispose* ( handle -- )
-    handle>> CloseHandle win32-error=0/f ;
-
-TUPLE: win32-file < win32-handle ptr ;
-
-: <win32-file> ( handle -- win32-file )
-    win32-file new-win32-handle ;
-
-M: win32-file dispose
-    [ cancel-operation ] [ call-next-method ] bi ;
-
 HOOK: CreateFile-flags io-backend ( DWORD -- DWORD )
 HOOK: FileArgs-overlapped io-backend ( port -- overlapped/f )
 HOOK: add-completion io-backend ( port -- )
@@ -47,7 +20,7 @@ CONSTANT: share-mode
         FILE_SHARE_WRITE
         FILE_SHARE_DELETE
     }
-
+    
 : default-security-attributes ( -- obj )
     SECURITY_ATTRIBUTES <struct>
     SECURITY_ATTRIBUTES heap-size >>nLength ;