Move win32-handle to windows.handles and update using lists to avoid pulling in the io backend where not necessary

release
Doug Coleman 2010-09-16 15:40:36 -05:00
parent 77db248759
commit 5c8316be07
9 changed files with 60 additions and 60 deletions

View File

@ -1,11 +1,10 @@
USING: alien alien.c-types alien.data alien.syntax arrays assocs USING: accessors alien alien.c-types alien.data alien.syntax
combinators continuations destructors io io.backend io.ports arrays assocs classes.struct combinators
io.timeouts io.backend.windows io.files.windows combinators.short-circuit destructors io io.backend
io.files.windows.nt io.files io.pathnames io.buffers io.backend.windows io.buffers io.files.windows io.ports
io.streams.c io.streams.null libc kernel math namespaces io.streams.c io.streams.null io.timeouts kernel libc locals
sequences threads windows windows.errors windows.kernel32 math namespaces sequences system threads windows.errors
strings splitting ascii system accessors locals classes.struct windows.handles windows.kernel32 ;
combinators.short-circuit ;
IN: io.backend.windows.nt IN: io.backend.windows.nt
! Global variable with assoc mapping overlapped to threads ! Global variable with assoc mapping overlapped to threads

View File

@ -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. ! See http://factorcode.org/license.txt for BSD license.
USING: alien alien.c-types arrays destructors io io.backend USING: accessors alien.c-types classes.struct destructors
io.buffers io.files io.ports io.binary io.timeouts system io.backend kernel literals windows.errors windows.handles
strings kernel math namespaces sequences windows.errors windows.kernel32 ;
windows.kernel32 windows.shell32 windows.types splitting
continuations math.bitwise accessors init sets assocs
classes.struct classes literals ;
IN: io.backend.windows 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: CreateFile-flags io-backend ( DWORD -- DWORD )
HOOK: FileArgs-overlapped io-backend ( port -- overlapped/f ) HOOK: FileArgs-overlapped io-backend ( port -- overlapped/f )
HOOK: add-completion io-backend ( port -- ) HOOK: add-completion io-backend ( port -- )
@ -47,7 +20,7 @@ CONSTANT: share-mode
FILE_SHARE_WRITE FILE_SHARE_WRITE
FILE_SHARE_DELETE FILE_SHARE_DELETE
} }
: default-security-attributes ( -- obj ) : default-security-attributes ( -- obj )
SECURITY_ATTRIBUTES <struct> SECURITY_ATTRIBUTES <struct>
SECURITY_ATTRIBUTES heap-size >>nLength ; SECURITY_ATTRIBUTES heap-size >>nLength ;

View File

@ -1,11 +1,10 @@
! Copyright (C) 2007, 2008 Doug Coleman, Slava Pestov. ! Copyright (C) 2007, 2008 Doug Coleman, Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien alien.c-types arrays continuations destructors io USING: accessors alien.c-types combinators destructors
io.backend.windows libc io.ports io.pipes windows.types math io.backend io.backend.windows io.files.windows io.launcher
windows.kernel32 windows namespaces make io.launcher kernel io.launcher.windows io.pipes io.ports kernel locals strings
sequences windows.errors assocs splitting system strings system windows.errors windows.handles windows.kernel32
io.launcher.windows io.files.windows io.backend io.files windows.types ;
io.files.private combinators shuffle accessors locals ;
IN: io.launcher.windows.nt IN: io.launcher.windows.nt
: duplicate-handle ( handle -- handle' ) : duplicate-handle ( handle -- handle' )

View File

@ -1,8 +1,7 @@
USING: alien alien.c-types arrays destructors generic io.mmap USING: accessors destructors io.backend.windows.privileges
io.ports io.backend.windows io.files.windows io.backend.windows.privileges io.files.windows io.mmap io.mmap.private kernel literals locals
io.mmap.private kernel libc math math.bitwise namespaces quotations sequences math math.bitwise system windows.errors windows.handles
windows windows.advapi32 windows.kernel32 io.backend system windows.kernel32 ;
accessors locals windows.errors literals ;
IN: io.mmap.windows IN: io.mmap.windows
: create-file-mapping ( hFile lpAttributes flProtect dwMaximumSizeHigh dwMaximumSizeLow lpName -- HANDLE ) : create-file-mapping ( hFile lpAttributes flProtect dwMaximumSizeHigh dwMaximumSizeLow lpName -- HANDLE )

View File

@ -1,8 +1,9 @@
! Copyright (C) 2007, 2009 Slava Pestov, Doug Coleman. ! Copyright (C) 2007, 2009 Slava Pestov, Doug Coleman.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: kernel accessors io.sockets io.sockets.private USING: accessors alien.c-types classes.struct combinators
io.backend.windows io.backend windows.winsock system destructors destructors io.backend io.backend.windows io.sockets
alien.c-types classes.struct combinators ; io.sockets.private kernel system windows.handles
windows.winsock ;
FROM: namespaces => get ; FROM: namespaces => get ;
IN: io.sockets.windows IN: io.sockets.windows

View File

@ -1,8 +1,7 @@
USING: accessors alien.c-types alien.data byte-arrays USING: accessors alien.data byte-arrays continuations
combinators.short-circuit continuations destructors init kernel destructors init kernel literals locals namespaces random
locals namespaces random windows.advapi32 windows.errors sequences windows.advapi32 windows.errors windows.handles
windows.kernel32 windows.types math.bitwise sequences fry windows.types ;
literals io.backend.windows ;
IN: random.windows IN: random.windows
TUPLE: windows-crypto-context < win32-handle provider type ; TUPLE: windows-crypto-context < win32-handle provider type ;

View File

@ -0,0 +1 @@
Doug Coleman

View File

@ -0,0 +1,29 @@
! Copyright (C) 2010 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors destructors io.timeouts kernel windows.errors
windows.kernel32 windows.types ;
IN: windows.handles
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 ;

View File

@ -2,7 +2,7 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien alien.c-types kernel math windows.errors USING: alien alien.c-types kernel math windows.errors
windows.kernel32 windows.types namespaces calendar math.bitwise windows.kernel32 windows.types namespaces calendar math.bitwise
accessors classes.struct ; accessors classes.struct windows.handles ;
IN: windows.time IN: windows.time
: >64bit ( lo hi -- n ) : >64bit ( lo hi -- n )