Merge branch 'master' of git://factorcode.org/git/factor

db4
Eduardo Cavazos 2008-09-01 18:24:44 -05:00
commit 2b8f2b3589
12 changed files with 43 additions and 27 deletions

View File

@ -1 +0,0 @@
Doug Coleman

View File

@ -1,4 +0,0 @@
USING: kernel system ;
IN: calendar.backend
HOOK: gmt-offset os ( -- hours minutes seconds )

View File

@ -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"
}
} ;

View File

@ -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: <zero> ( -- timestamp )
0 0 0 0 0 0 instant <timestamp> ;
: <zero> ( -- timestamp )
0 0 0 0 0 0 instant <timestamp> ;
: valid-timestamp? ( timestamp -- ? )
clone instant >>gmt-offset
dup <zero> time- <zero> time+ = ;
MEMO: unix-1970 ( -- timestamp )
: unix-1970 ( -- timestamp )
1970 1 1 0 0 0 instant <timestamp> ;
: millis>timestamp ( n -- timestamp )

View File

@ -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 )

View File

@ -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 )

View File

@ -1 +0,0 @@
Doug Coleman

View File

@ -1,4 +0,0 @@
USING: io.backend ;
IN: editors.gvim.backend
HOOK: gvim-path io-backend ( -- path )

View File

@ -1 +0,0 @@
unportable

View File

@ -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 ;

View File

@ -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

View File

@ -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