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