]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/io/backend/windows/windows.factor
Make sure io.backend.windows loads the implementations for the generics it defines...
[factor.git] / basis / io / backend / windows / windows.factor
index e0dd8062122794b15442dfdf31fee84e2e61eac3..7ecb5765a18869dc94d9c646feeb8940e9e5e691 100755 (executable)
@@ -1,18 +1,24 @@
 ! Copyright (C) 2004, 2010 Mackenzie Straight, Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors alien.c-types classes.struct destructors
-io.backend kernel literals windows.errors windows.handles
-windows.kernel32 ;
+io.backend io.timeouts kernel literals windows.errors
+windows.handles windows.kernel32 vocabs.loader ;
 IN: io.backend.windows
 
 HOOK: CreateFile-flags io-backend ( DWORD -- DWORD )
 HOOK: FileArgs-overlapped io-backend ( port -- overlapped/f )
-HOOK: add-completion io-backend ( port -- )
+HOOK: add-completion io-backend ( port -- port )
 
+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 ;
+    
 : opened-file ( handle -- win32-file )
-    dup invalid-handle?
-    <win32-file> |dispose
-    dup add-completion ;
+    check-invalid-handle <win32-file> |dispose add-completion ;
 
 CONSTANT: share-mode
     flags{
@@ -24,3 +30,5 @@ CONSTANT: share-mode
 : default-security-attributes ( -- obj )
     SECURITY_ATTRIBUTES <struct>
     SECURITY_ATTRIBUTES heap-size >>nLength ;
+
+"io.files.windows" require
\ No newline at end of file