diff --git a/basis/calendar/backend/authors.txt b/basis/calendar/backend/authors.txt deleted file mode 100755 index 7c1b2f2279..0000000000 --- a/basis/calendar/backend/authors.txt +++ /dev/null @@ -1 +0,0 @@ -Doug Coleman diff --git a/basis/calendar/backend/backend.factor b/basis/calendar/backend/backend.factor deleted file mode 100644 index 56ccf9e6cc..0000000000 --- a/basis/calendar/backend/backend.factor +++ /dev/null @@ -1,4 +0,0 @@ -USING: kernel system ; -IN: calendar.backend - -HOOK: gmt-offset os ( -- hours minutes seconds ) diff --git a/basis/calendar/calendar-docs.factor b/basis/calendar/calendar-docs.factor index 8ee104d16e..127dc4c60a 100644 --- a/basis/calendar/calendar-docs.factor +++ b/basis/calendar/calendar-docs.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2008 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. USING: arrays kernel math strings help.markup help.syntax -calendar.backend math.order ; +math.order ; IN: calendar HELP: duration @@ -278,8 +278,6 @@ HELP: time- } } ; -{ time+ time- } related-words - HELP: convert-timezone { $values { "timestamp" timestamp } { "duration" duration } { "timestamp" timestamp } } { $description "Converts the " { $snippet "timestamp" } "'s " { $snippet "gmt-offset" } " to the GMT offset represented by the " { $snippet "duration" } "." } @@ -299,3 +297,28 @@ HELP: >local-time "t" } } ; + +HELP: >gmt +{ $values { "timestamp" timestamp } { "timestamp" timestamp } } +{ $description "Converts the " { $snippet "timestamp" } " to the GMT timezone." } +{ $examples + { $example "USING: accessors calendar kernel prettyprint ;" + "now >gmt gmt-offset>> hour>> ." + "0" + } +} ; + +HELP: time* +{ $values { "obj1" object } { "obj2" object } { "obj3" object } } +{ $description "Multiplies each time slot of a timestamp or duration by a number and make a new duration from the result. Used in the implementation of " { $link before } "." } ; +{ time+ time- time* } related-words + +HELP: before +{ $values { "duration" duration } { "-duration" duration } } +{ $description "Negates a duration." } +{ $examples + { $example "USING: accessors calendar prettyprint ;" + "3 hours before now noon time+ hour>> ." + "9" + } +} ; diff --git a/basis/calendar/calendar.factor b/basis/calendar/calendar.factor index ff002bb16c..5710949af5 100755 --- a/basis/calendar/calendar.factor +++ b/basis/calendar/calendar.factor @@ -1,11 +1,13 @@ ! Copyright (C) 2007 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. USING: arrays kernel math math.functions namespaces sequences -strings system vocabs.loader calendar.backend threads -accessors combinators locals classes.tuple math.order -memoize summary combinators.short-circuit ; +strings system vocabs.loader threads accessors combinators +locals classes.tuple math.order summary +combinators.short-circuit ; IN: calendar +HOOK: gmt-offset os ( -- hours minutes seconds ) + TUPLE: duration { year real } { month real } @@ -304,14 +306,14 @@ M: timestamp time- M: duration time- before time+ ; -MEMO: ( -- timestamp ) -0 0 0 0 0 0 instant ; +: ( -- timestamp ) + 0 0 0 0 0 0 instant ; : valid-timestamp? ( timestamp -- ? ) clone instant >>gmt-offset dup time- time+ = ; -MEMO: unix-1970 ( -- timestamp ) +: unix-1970 ( -- timestamp ) 1970 1 1 0 0 0 instant ; : millis>timestamp ( n -- timestamp ) diff --git a/basis/calendar/unix/unix.factor b/basis/calendar/unix/unix.factor index 6383d4ec42..1da554e0f1 100644 --- a/basis/calendar/unix/unix.factor +++ b/basis/calendar/unix/unix.factor @@ -1,5 +1,5 @@ -USING: alien alien.c-types arrays calendar.backend -kernel structs math unix.time namespaces system ; +USING: alien alien.c-types arrays calendar kernel structs +math unix.time namespaces system ; IN: calendar.unix : get-time ( -- alien ) diff --git a/basis/calendar/windows/windows.factor b/basis/calendar/windows/windows.factor index b621d3bde3..508cbb0a49 100755 --- a/basis/calendar/windows/windows.factor +++ b/basis/calendar/windows/windows.factor @@ -1,5 +1,5 @@ -USING: calendar.backend namespaces alien.c-types system -windows windows.kernel32 kernel math combinators ; +USING: calendar namespaces alien.c-types system windows +windows.kernel32 kernel math combinators ; IN: calendar.windows M: windows gmt-offset ( -- hours minutes seconds ) diff --git a/basis/editors/gvim/backend/authors.txt b/basis/editors/gvim/backend/authors.txt deleted file mode 100755 index 7c1b2f2279..0000000000 --- a/basis/editors/gvim/backend/authors.txt +++ /dev/null @@ -1 +0,0 @@ -Doug Coleman diff --git a/basis/editors/gvim/backend/backend.factor b/basis/editors/gvim/backend/backend.factor deleted file mode 100644 index e2e2f0626e..0000000000 --- a/basis/editors/gvim/backend/backend.factor +++ /dev/null @@ -1,4 +0,0 @@ -USING: io.backend ; -IN: editors.gvim.backend - -HOOK: gvim-path io-backend ( -- path ) diff --git a/basis/editors/gvim/backend/tags.txt b/basis/editors/gvim/backend/tags.txt deleted file mode 100644 index 6bf68304bb..0000000000 --- a/basis/editors/gvim/backend/tags.txt +++ /dev/null @@ -1 +0,0 @@ -unportable diff --git a/basis/editors/gvim/gvim.factor b/basis/editors/gvim/gvim.factor index 041f3db675..4cc9de17a1 100755 --- a/basis/editors/gvim/gvim.factor +++ b/basis/editors/gvim/gvim.factor @@ -1,10 +1,12 @@ USING: io.backend io.files kernel math math.parser namespaces sequences system combinators -editors.vim editors.gvim.backend vocabs.loader ; +editors.vim vocabs.loader ; IN: editors.gvim SINGLETON: gvim +HOOK: gvim-path io-backend ( -- path ) + M: gvim vim-command ( file line -- string ) [ gvim-path , swap , "+" swap number>string append , ] { } make ; diff --git a/basis/editors/gvim/unix/unix.factor b/basis/editors/gvim/unix/unix.factor index 3b8f7454c1..82b6bf199d 100644 --- a/basis/editors/gvim/unix/unix.factor +++ b/basis/editors/gvim/unix/unix.factor @@ -1,4 +1,4 @@ -USING: io.unix.backend kernel namespaces editors.gvim.backend +USING: io.unix.backend kernel namespaces editors.gvim system ; IN: editors.gvim.unix diff --git a/basis/editors/gvim/windows/windows.factor b/basis/editors/gvim/windows/windows.factor index daf5409c94..8c4e1aaacb 100755 --- a/basis/editors/gvim/windows/windows.factor +++ b/basis/editors/gvim/windows/windows.factor @@ -1,4 +1,4 @@ -USING: editors.gvim.backend io.files io.windows kernel namespaces +USING: editors.gvim io.files io.windows kernel namespaces sequences windows.shell32 io.paths system ; IN: editors.gvim.windows