diff --git a/basis/compiler/tree/dead-code/branches/branches.factor b/basis/compiler/tree/dead-code/branches/branches.factor index f09593824e..6cef45a9c9 100644 --- a/basis/compiler/tree/dead-code/branches/branches.factor +++ b/basis/compiler/tree/dead-code/branches/branches.factor @@ -31,7 +31,7 @@ M: #branch remove-dead-code* pad-with-bottom >>phi-in-d drop ; : live-value-indices ( values -- indices ) - [ length ] keep live-values get + [ length iota ] keep live-values get '[ _ nth _ key? ] filter ; inline : drop-indexed-values ( values indices -- node ) diff --git a/basis/io/monitors/linux/linux.factor b/basis/io/monitors/linux/linux.factor index 9b3688d023..3e1e919217 100644 --- a/basis/io/monitors/linux/linux.factor +++ b/basis/io/monitors/linux/linux.factor @@ -5,7 +5,7 @@ io.files io.pathnames io.buffers io.ports io.timeouts io.backend.unix io.encodings.utf8 unix.linux.inotify assocs namespaces make threads continuations init math math.bitwise sets alien alien.strings alien.c-types vocabs.loader accessors -system hashtables destructors unix ; +system hashtables destructors unix classes.struct ; IN: io.monitors.linux SYMBOL: watches @@ -82,30 +82,30 @@ M: linux-monitor dispose* ( monitor -- ) ] { } make prune ; : parse-event-name ( event -- name ) - dup inotify-event-len zero? - [ drop "" ] [ inotify-event-name utf8 alien>string ] if ; + dup len>> zero? + [ drop "" ] [ name>> utf8 alien>string ] if ; : parse-file-notify ( buffer -- path changed ) - dup inotify-event-mask ignore-flags? [ + dup mask>> ignore-flags? [ drop f f ] [ - [ parse-event-name ] [ inotify-event-mask parse-action ] bi + [ parse-event-name ] [ mask>> parse-action ] bi ] if ; : events-exhausted? ( i buffer -- ? ) fill>> >= ; -: inotify-event@ ( i buffer -- alien ) - ptr>> ; +: inotify-event@ ( i buffer -- inotify-event ) + ptr>> inotify-event memory>struct ; : next-event ( i buffer -- i buffer ) 2dup inotify-event@ - inotify-event-len "inotify-event" heap-size + + len>> inotify-event heap-size + swap [ + ] dip ; : parse-file-notifications ( i buffer -- ) 2dup events-exhausted? [ 2drop ] [ - 2dup inotify-event@ dup inotify-event-wd wd>monitor + 2dup inotify-event@ dup wd>> wd>monitor [ parse-file-notify ] dip queue-change next-event parse-file-notifications ] if ; diff --git a/basis/unix/linux/inotify/inotify.factor b/basis/unix/linux/inotify/inotify.factor index e3d40b5b28..5f9bf5d462 100644 --- a/basis/unix/linux/inotify/inotify.factor +++ b/basis/unix/linux/inotify/inotify.factor @@ -1,15 +1,14 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: alien.syntax math math.bitwise ; +USING: alien.syntax math math.bitwise classes.struct ; IN: unix.linux.inotify -C-STRUCT: inotify-event - { "int" "wd" } ! watch descriptor - { "uint" "mask" } ! watch mask - { "uint" "cookie" } ! cookie to synchronize two events - { "uint" "len" } ! length (including nulls) of name - { "char[0]" "name" } ! stub for possible name - ; +STRUCT: inotify-event + { wd int } + { mask uint } + { cookie uint } + { len uint } + { name char[0] } ; CONSTANT: IN_ACCESS HEX: 1 ! File was accessed CONSTANT: IN_MODIFY HEX: 2 ! File was modified @@ -28,8 +27,8 @@ CONSTANT: IN_UNMOUNT HEX: 2000 ! Backing fs was unmounted CONSTANT: IN_Q_OVERFLOW HEX: 4000 ! Event queued overflowed CONSTANT: IN_IGNORED HEX: 8000 ! File was ignored -: IN_CLOSE ( -- n ) IN_CLOSE_WRITE IN_CLOSE_NOWRITE bitor ; inline ! close -: IN_MOVE ( -- n ) IN_MOVED_FROM IN_MOVED_TO bitor ; inline ! moves +: IN_CLOSE ( -- n ) { IN_CLOSE_WRITE IN_CLOSE_NOWRITE } flags ; foldable ! close +: IN_MOVE ( -- n ) { IN_MOVED_FROM IN_MOVED_TO } flags ; foldable ! moves CONSTANT: IN_ONLYDIR HEX: 1000000 ! only watch the path if it is a directory CONSTANT: IN_DONT_FOLLOW HEX: 2000000 ! don't follow a sym link diff --git a/core/sequences/sequences.factor b/core/sequences/sequences.factor index 90103a79f9..4accabb8d6 100755 --- a/core/sequences/sequences.factor +++ b/core/sequences/sequences.factor @@ -99,8 +99,8 @@ M: f like drop [ f ] when-empty ; inline INSTANCE: f immutable-sequence ! Integers used to support the sequence protocol -M: integer length ; inline deprecated -M: integer nth-unsafe drop ; inline deprecated +M: integer length ; inline +M: integer nth-unsafe drop ; inline INSTANCE: integer immutable-sequence