1 ! Copyright (C) 2007, 2008 Doug Coleman, Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: alien alien.c-types arrays destructors io io.backend.windows libc
4 windows.types math.bitwise windows.kernel32 windows namespaces
5 make kernel sequences windows.errors assocs math.parser system
6 random combinators accessors io.pipes io.ports ;
7 IN: io.pipes.windows.nt
9 ! This code is based on
10 ! http://twistedmatrix.com/trac/browser/trunk/twisted/internet/iocpreactor/process.py
12 : create-named-pipe ( name -- handle )
13 { PIPE_ACCESS_INBOUND FILE_FLAG_OVERLAPPED } flags
19 default-security-attributes
20 CreateNamedPipe opened-file ;
22 : open-other-end ( name -- handle )
24 { FILE_SHARE_READ FILE_SHARE_WRITE } flags
25 default-security-attributes
29 CreateFile opened-file ;
31 : unique-pipe-name ( -- string )
33 "\\\\.\\pipe\\factor-" %
41 M: winnt (pipe) ( -- pipe )
44 [ create-named-pipe ] [ open-other-end ] bi