]> gitweb.factorcode.org Git - factor.git/blob - basis/windows/handles/handles.factor
scryfall: make decks better, import from moxfield
[factor.git] / basis / windows / handles / handles.factor
1 ! Copyright (C) 2010 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors destructors kernel windows.errors
4 windows.kernel32 windows.types ;
5 IN: windows.handles
6
7 TUPLE: win32-handle < disposable handle ;
8
9 : set-inherit ( handle ? -- )
10     [ handle>> HANDLE_FLAG_INHERIT ] dip
11     >BOOLEAN SetHandleInformation win32-error=0/f ;
12
13 : new-win32-handle ( handle class -- win32-handle )
14     new-disposable swap >>handle
15     dup f set-inherit ;
16
17 : <win32-handle> ( handle -- win32-handle )
18     win32-handle new-win32-handle ;
19
20 M: win32-handle dispose*
21     handle>> CloseHandle win32-error=0/f ;