factor/extra/io/unix/macosx/macosx.factor

24 lines
689 B
Factor
Raw Normal View History

2008-04-11 08:15:26 -04:00
! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: io.unix.bsd io.backend io.monitors core-foundation.fsevents
2008-04-11 09:35:21 -04:00
continuations kernel sequences namespaces arrays system locals
accessors ;
2008-04-02 21:09:56 -04:00
IN: io.unix.macosx
2008-02-12 03:21:47 -05:00
2008-04-11 08:15:26 -04:00
TUPLE: macosx-monitor < monitor handle ;
2008-02-12 03:21:47 -05:00
: enqueue-notifications ( triples monitor -- )
2008-04-11 09:35:21 -04:00
[
>r first { +modify-file+ } r> queue-change
] curry each ;
2008-04-11 08:15:26 -04:00
M:: macosx (monitor) ( path recursive? mailbox -- monitor )
path mailbox macosx-monitor construct-monitor
2008-02-12 03:21:47 -05:00
dup [ enqueue-notifications ] curry
2008-04-11 08:15:26 -04:00
path 1array 0 0 <event-stream> >>handle ;
2008-02-12 03:21:47 -05:00
M: macosx-monitor dispose
2008-04-11 08:15:26 -04:00
handle>> dispose ;
2008-04-11 09:35:21 -04:00
macosx set-io-backend