]> gitweb.factorcode.org Git - factor.git/commitdiff
Make sure io.backend.windows loads the implementations for the generics it defines...
authorDoug Coleman <doug.coleman@gmail.com>
Fri, 17 Sep 2010 19:19:10 +0000 (14:19 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Fri, 17 Sep 2010 19:19:10 +0000 (14:19 -0500)
basis/io/backend/windows/nt/nt.factor
basis/io/backend/windows/windows.factor
basis/io/files/windows/nt/nt.factor
basis/io/files/windows/windows.factor
basis/io/launcher/windows/nt/nt.factor
basis/io/sockets/windows/windows.factor
basis/io/timeouts/timeouts.factor
basis/windows/errors/errors.factor
basis/windows/handles/handles.factor

index 3114073c9d220416cc53dbc42880e26eb3254851..b34902f7f115ab847a5b76c381aff9df064394a6 100755 (executable)
@@ -3,8 +3,8 @@ arrays assocs classes.struct combinators
 combinators.short-circuit destructors io io.backend
 io.backend.windows io.buffers io.files.windows io.ports
 io.streams.c io.streams.null io.timeouts kernel libc locals
-math namespaces sequences system threads windows.errors
-windows.handles windows.kernel32 ;
+math namespaces sequences system threads vocabs.loader
+windows.errors windows.handles windows.kernel32 ;
 IN: io.backend.windows.nt
 
 ! Global variable with assoc mapping overlapped to threads
@@ -32,8 +32,8 @@ SYMBOL: master-completion-port
 : <master-completion-port> ( -- handle )
     INVALID_HANDLE_VALUE f <completion-port> ;
 
-M: winnt add-completion ( win32-handle -- )
-    handle>> master-completion-port get-global <completion-port> drop ;
+M: winnt add-completion ( win32-handle -- win32-handle )
+    dup handle>> master-completion-port get-global <completion-port> drop ;
 
 : eof? ( error -- ? )
     { [ ERROR_HANDLE_EOF = ] [ ERROR_BROKEN_PIPE = ] } 1|| ;
@@ -144,4 +144,5 @@ M: winnt init-stdio
     [ init-c-stdio ]
     [ null-reader null-writer null-writer set-stdio ] if ;
 
+"io.files.windows.nt" require
 winnt set-io-backend
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
index a2d6d90f6b2cdb9f383191053c69d554a4ba5179..4046522a1b120b211e7bdb4c43483a21b594fea5 100644 (file)
@@ -2,8 +2,7 @@ USING: accessors alien.c-types alien.strings classes.struct
 combinators combinators.short-circuit continuations environment
 io.backend io.backend.windows io.encodings.utf16n
 io.files.private io.files.windows io.pathnames kernel math
-sequences specialized-arrays
-specialized-arrays.instances.alien.c-types.ushort system tr
+sequences specialized-arrays system tr
 windows windows.errors windows.kernel32 windows.shell32
 windows.time ;
 SPECIALIZED-ARRAY: ushort
index b0fa0472cab0e55273ad763b85655968e7a0e3e1..3b4df853718b44dd54b25d28033b655916edc958 100644 (file)
@@ -2,9 +2,9 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors alien.c-types alien.data combinators
 destructors io.backend.windows io.binary io.buffers io.files
-io.files.types io.ports kernel literals make math.bitwise
-system windows.errors windows.handles windows.kernel32
-windows.time windows.types ;
+io.files.types io.ports kernel literals make
+math.bitwise system windows.errors windows.handles
+windows.kernel32 windows.time windows.types vocabs.loader ;
 IN: io.files.windows
 
 : open-file ( path access-mode create-mode flags -- handle )
@@ -98,7 +98,7 @@ SYMBOLS: +read-only+ +hidden+ +system+
 +sparse-file+ +reparse-point+ +compressed+ +offline+
 +not-content-indexed+ +encrypted+ ;
 
-: win32-file-attribute ( n attr symbol -- )
+: win32-file-attribute ( n symbol attr -- )
     rot mask? [ , ] [ drop ] if ;
 
 : win32-file-attributes ( n -- seq )
@@ -127,3 +127,5 @@ SYMBOLS: +read-only+ +hidden+ +system+
 : (set-file-times) ( handle timestamp/f timestamp/f timestamp/f -- )
     [ timestamp>FILETIME ] tri@
     SetFileTime win32-error=0/f ;
+
+"io.files.windows.nt" require
\ No newline at end of file
index 3651785242dce89c016a53a42d88118a6832bcb3..a9c66d202efb6f7984c17e390d9a07178a68b39e 100644 (file)
@@ -23,7 +23,7 @@ IN: io.launcher.windows.nt
     (pipe) [ in>> &dispose ] [ out>> dispose ] bi ;
 
 : null-output ( -- pipe )
-    (pipe) [ in>> dispose ] [ out>> &dispose ] bi ;
+    (pipe) [ out>> &dispose ] [ in>> dispose ] bi ;
 
 : null-pipe ( mode -- pipe )
     {
@@ -48,7 +48,7 @@ IN: io.launcher.windows.nt
     create-mode
     FILE_ATTRIBUTE_NORMAL ! flags and attributes
     f ! template file
-    CreateFile dup invalid-handle? <win32-file> &dispose ;
+    CreateFile check-invalid-handle <win32-file> &dispose ;
 
 : redirect-append ( path access-mode create-mode -- handle )
     [ path>> ] 2dip
index 3d9b3a6e14c9e04ba98a108ded0f850edf11d3ae..d41240d1b3437f13cbaa4311b62cec59873d42d3 100755 (executable)
@@ -38,7 +38,7 @@ M: win32-socket dispose* ( stream -- )
     [ empty-sockaddr/size ] [ protocol-family ] bi pick family<< ;\r
 \r
 : opened-socket ( handle -- win32-socket )\r
-    <win32-socket> |dispose dup add-completion ;\r
+    <win32-socket> |dispose add-completion ;\r
 \r
 : open-socket ( addrspec type -- win32-socket )\r
     [ protocol-family ] dip\r
index 68110ded1599ca22f914d9f6bd2d74a076d4c679..c024e498566a9edf03aa8481eec11505ac008a74 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2008 Slava Pestov, Doug Coleman\r
 ! See http://factorcode.org/license.txt for BSD license.\r
-USING: kernel calendar timers io io.encodings accessors\r
-namespaces fry io.streams.null ;\r
+USING: accessors fry io io.encodings io.streams.null kernel\r
+namespaces timers ;\r
 IN: io.timeouts\r
 \r
 GENERIC: timeout ( obj -- dt/f )\r
index a4943ef87727ee7020dd0c6e33270d24cf9a7030..99284bdb8051beeafc40c8bd5a016633f0fc8a95 100755 (executable)
@@ -734,10 +734,8 @@ ERROR: windows-error n string ;
 : win32-error<0 ( n -- ) 0 < [ win32-error ] when ;
 : win32-error<>0 ( n -- ) zero? [ win32-error ] unless ;
 
-: invalid-handle? ( handle -- )
-    INVALID_HANDLE_VALUE = [
-        win32-error-string throw
-    ] when ;
+: check-invalid-handle ( handle -- handle )
+    dup INVALID_HANDLE_VALUE = [ win32-error-string throw ] when ;
 
 CONSTANT: expected-io-errors
     ${
index 70ffdf80a61730c66521b09e78d0cf3f553f2117..07d6c8f5d2fd66eb02c01dbf15f3966b6f45beed 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2010 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors destructors io.timeouts kernel windows.errors
+USING: accessors destructors kernel windows.errors
 windows.kernel32 windows.types ;
 IN: windows.handles
 
@@ -19,11 +19,3 @@ TUPLE: win32-handle < disposable 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 ;