diff --git a/extra/alarms/alarms-docs.factor b/extra/alarms/alarms-docs.factor index b609878c77..fcb2de8b6b 100755 --- a/extra/alarms/alarms-docs.factor +++ b/extra/alarms/alarms-docs.factor @@ -5,11 +5,11 @@ HELP: alarm { $class-description "An alarm. Cancel passed to " { $link cancel-alarm } "." } ; HELP: add-alarm -{ $values { "quot" quotation } { "time" timestamp } { "frequency" "a " { $link dt } " or " { $link f } } { "alarm" alarm } } +{ $values { "quot" quotation } { "time" timestamp } { "frequency" "a " { $link duration } " or " { $link f } } { "alarm" alarm } } { $description "Creates and registers an alarm. If " { $snippet "frequency" } " is " { $link f } ", this will be a one-time alarm, otherwise it will fire with the given frequency. The quotation will be called from the alarm thread." } ; HELP: later -{ $values { "quot" quotation } { "time" dt } { "alarm" alarm } } +{ $values { "quot" quotation } { "time" duration } { "alarm" alarm } } { $description "Creates and registers an alarm which calls the quotation once at " { $snippet "time" } { $link from-now } "." } ; HELP: cancel-alarm diff --git a/extra/alarms/alarms.factor b/extra/alarms/alarms.factor index 651744d07f..a50e1817e1 100755 --- a/extra/alarms/alarms.factor +++ b/extra/alarms/alarms.factor @@ -16,7 +16,7 @@ SYMBOL: alarm-thread alarm-thread get-global interrupt ; : check-alarm - dup dt? over not or [ "Not a dt" throw ] unless + dup duration? over not or [ "Not a duration" throw ] unless over timestamp? [ "Not a timestamp" throw ] unless pick callable? [ "Not a quotation" throw ] unless ; inline diff --git a/extra/calendar/calendar.factor b/extra/calendar/calendar.factor index 7bd655b002..044553067b 100755 --- a/extra/calendar/calendar.factor +++ b/extra/calendar/calendar.factor @@ -255,12 +255,12 @@ M: timestamp <=> ( ts1 ts2 -- n ) : now ( -- timestamp ) gmt >local-time ; : before ( dt -- -dt ) - [ year>> neg ] keep - [ month>> neg ] keep - [ day>> neg ] keep - [ hour>> neg ] keep + [ year>> neg ] keep + [ month>> neg ] keep + [ day>> neg ] keep + [ hour>> neg ] keep [ minute>> neg ] keep - [ second>> neg ] keep + second>> neg ; : from-now ( dt -- timestamp ) now swap time+ ; diff --git a/extra/concurrency/semaphores/semaphores-docs.factor b/extra/concurrency/semaphores/semaphores-docs.factor index 7f8b9b017a..76a87f2077 100755 --- a/extra/concurrency/semaphores/semaphores-docs.factor +++ b/extra/concurrency/semaphores/semaphores-docs.factor @@ -9,7 +9,7 @@ HELP: { $description "Creates a counting semaphore with the specified initial count." } ; HELP: acquire-timeout -{ $values { "semaphore" semaphore } { "timeout" "a " { $link dt } " or " { $link f } } { "value" object } } +{ $values { "semaphore" semaphore } { "timeout" "a " { $link duration } " or " { $link f } } { "value" object } } { $description "If the semaphore has a non-zero count, decrements it and returns immediately. Otherwise, if the timeout is " { $link f } ", waits indefinitely for the semaphore to be released. If the timeout is not " { $link f } ", waits a certain period of time, and if the semaphore still has not been released, throws an error." } { $errors "Throws an error if the timeout expires before the semaphore is released." } ; @@ -22,7 +22,7 @@ HELP: release { $description "Increments a semaphore's count. If the count was previously zero, any threads waiting on the semaphore are woken up." } ; HELP: with-semaphore-timeout -{ $values { "semaphore" semaphore } { "timeout" "a " { $link dt } " or " { $link f } } { "quot" quotation } } +{ $values { "semaphore" semaphore } { "timeout" "a " { $link duration } " or " { $link f } } { "quot" quotation } } { $description "Calls the quotation with the semaphore held." } ; HELP: with-semaphore diff --git a/extra/io/launcher/launcher-docs.factor b/extra/io/launcher/launcher-docs.factor index 48b2a01b7d..96639dee87 100755 --- a/extra/io/launcher/launcher-docs.factor +++ b/extra/io/launcher/launcher-docs.factor @@ -78,7 +78,7 @@ $nl "This is used in situations where you want a spawn child process with some overridden environment variables." } ; HELP: +timeout+ -{ $description "Launch descriptor key. If set to a " { $link dt } ", specifies a maximum running time for the process. If the process runs longer than this time, it will be killed." } ; +{ $description "Launch descriptor key. If set to a " { $link duration } ", specifies a maximum running time for the process. If the process runs longer than this time, it will be killed." } ; HELP: default-descriptor { $description "Association storing default values for launch descriptor keys." } ; diff --git a/extra/io/paths/paths.factor b/extra/io/paths/paths.factor index 8980eacc3d..fae07643d5 100755 --- a/extra/io/paths/paths.factor +++ b/extra/io/paths/paths.factor @@ -34,19 +34,17 @@ TUPLE: directory-iterator path bfs queue ; drop r> r> r> 3drop f ] if ; inline -: prepare-find-file ( path bfs? quot -- iter quot' ) - >r r> [ keep and ] curry ; inline - : find-file ( path bfs? quot -- path/f ) - prepare-find-file iterate-directory ; + >r r> + [ keep and ] curry iterate-directory ; inline + +: each-file ( path bfs? quot -- ) + >r r> + [ f ] compose iterate-directory drop ; inline : find-all-files ( path bfs? quot -- paths ) - prepare-find-file V{ } clone [ - [ over [ push ] [ 2drop ] if f ] curry compose - iterate-directory - drop - ] keep ; inline + >r r> + pusher >r iterate-directory drop r> ; inline : recursive-directory ( path bfs? -- paths ) - - [ dup next-file dup ] [ ] [ drop ] unfold nip ; + [ ] accumulator >r each-file r> ; diff --git a/extra/io/timeouts/timeouts-docs.factor b/extra/io/timeouts/timeouts-docs.factor index 347c57a0d6..df7e1389cc 100755 --- a/extra/io/timeouts/timeouts-docs.factor +++ b/extra/io/timeouts/timeouts-docs.factor @@ -2,11 +2,11 @@ IN: io.timeouts USING: help.markup help.syntax math kernel calendar ; HELP: timeout -{ $values { "obj" object } { "dt/f" "a " { $link dt } " or " { $link f } } } +{ $values { "obj" object } { "dt/f" "a " { $link duration } " or " { $link f } } } { $contract "Outputs an object's timeout." } ; HELP: set-timeout -{ $values { "dt/f" "a " { $link dt } " or " { $link f } } { "obj" object } } +{ $values { "dt/f" "a " { $link duration } " or " { $link f } } { "obj" object } } { $contract "Sets an object's timeout." } ; HELP: timed-out diff --git a/extra/models/models-docs.factor b/extra/models/models-docs.factor index ce86905b9f..d514a539aa 100755 --- a/extra/models/models-docs.factor +++ b/extra/models/models-docs.factor @@ -153,7 +153,7 @@ HELP: delay } ; HELP: -{ $values { "model" model } { "timeout" dt } { "delay" delay } } +{ $values { "model" model } { "timeout" duration } { "delay" delay } } { $description "Creates a new instance of " { $link delay } ". The timeout must elapse from the time the underlying model last changed to when the delay model value is changed and its connections are notified." } { $examples "See the example in the documentation for " { $link delay } "." } ;