Cleanups found with lint tool
parent
e563824cd2
commit
933319f401
|
@ -33,19 +33,19 @@ TUPLE: timestamp
|
||||||
C: <timestamp> timestamp
|
C: <timestamp> timestamp
|
||||||
|
|
||||||
: gmt-offset-duration ( -- duration )
|
: gmt-offset-duration ( -- duration )
|
||||||
0 0 0 gmt-offset <duration> ;
|
0 0 0 gmt-offset <duration> ; inline
|
||||||
|
|
||||||
: <date> ( year month day -- timestamp )
|
: <date> ( year month day -- timestamp )
|
||||||
0 0 0 gmt-offset-duration <timestamp> ;
|
0 0 0 gmt-offset-duration <timestamp> ; inline
|
||||||
|
|
||||||
: <date-gmt> ( year month day -- timestamp )
|
: <date-gmt> ( year month day -- timestamp )
|
||||||
0 0 0 instant <timestamp> ;
|
0 0 0 instant <timestamp> ; inline
|
||||||
|
|
||||||
: <year> ( year -- timestamp )
|
: <year> ( year -- timestamp )
|
||||||
1 1 <date> ;
|
1 1 <date> ; inline
|
||||||
|
|
||||||
: <year-gmt> ( year -- timestamp )
|
: <year-gmt> ( year -- timestamp )
|
||||||
1 1 <date-gmt> ;
|
1 1 <date-gmt> ; inline
|
||||||
|
|
||||||
ERROR: not-a-month ;
|
ERROR: not-a-month ;
|
||||||
M: not-a-month summary
|
M: not-a-month summary
|
||||||
|
@ -352,14 +352,14 @@ M: duration time-
|
||||||
before time+ ;
|
before time+ ;
|
||||||
|
|
||||||
: <zero> ( -- timestamp )
|
: <zero> ( -- timestamp )
|
||||||
0 0 0 0 0 0 instant <timestamp> ;
|
0 0 0 <date-gmt> ; inline
|
||||||
|
|
||||||
: valid-timestamp? ( timestamp -- ? )
|
: valid-timestamp? ( timestamp -- ? )
|
||||||
clone instant >>gmt-offset
|
clone instant >>gmt-offset
|
||||||
dup <zero> time- <zero> time+ = ;
|
dup <zero> time- <zero> time+ = ;
|
||||||
|
|
||||||
: unix-1970 ( -- timestamp )
|
: unix-1970 ( -- timestamp )
|
||||||
1970 1 1 0 0 0 instant <timestamp> ;
|
1970 <year-gmt> ; inline
|
||||||
|
|
||||||
: millis>timestamp ( x -- timestamp )
|
: millis>timestamp ( x -- timestamp )
|
||||||
[ unix-1970 ] dip milliseconds time+ ;
|
[ unix-1970 ] dip milliseconds time+ ;
|
||||||
|
@ -529,16 +529,16 @@ M: timestamp end-of-year 12 >>month 31 >>day ;
|
||||||
M: integer end-of-year 12 31 <date> ;
|
M: integer end-of-year 12 31 <date> ;
|
||||||
|
|
||||||
: time-since-midnight ( timestamp -- duration )
|
: time-since-midnight ( timestamp -- duration )
|
||||||
dup midnight time- ;
|
dup midnight time- ; inline
|
||||||
|
|
||||||
: since-1970 ( duration -- timestamp )
|
: since-1970 ( duration -- timestamp )
|
||||||
unix-1970 time+ ;
|
unix-1970 time+ ; inline
|
||||||
|
|
||||||
: timestamp>unix-time ( timestamp -- seconds )
|
: timestamp>unix-time ( timestamp -- seconds )
|
||||||
unix-1970 time- second>> ;
|
unix-1970 time- second>> ; inline
|
||||||
|
|
||||||
: unix-time>timestamp ( seconds -- timestamp )
|
: unix-time>timestamp ( seconds -- timestamp )
|
||||||
seconds unix-1970 time+ ;
|
seconds since-1970 ; inline
|
||||||
|
|
||||||
{
|
{
|
||||||
{ [ os unix? ] [ "calendar.unix" ] }
|
{ [ os unix? ] [ "calendar.unix" ] }
|
||||||
|
|
|
@ -205,7 +205,7 @@ ERROR: invalid-timestamp-format ;
|
||||||
read-sp checked-number >>year
|
read-sp checked-number >>year
|
||||||
":" read-token checked-number >>hour
|
":" read-token checked-number >>hour
|
||||||
":" read-token checked-number >>minute
|
":" read-token checked-number >>minute
|
||||||
" " read-token checked-number >>second
|
read-sp checked-number >>second
|
||||||
readln parse-rfc822-gmt-offset >>gmt-offset ;
|
readln parse-rfc822-gmt-offset >>gmt-offset ;
|
||||||
|
|
||||||
: rfc822>timestamp ( str -- timestamp )
|
: rfc822>timestamp ( str -- timestamp )
|
||||||
|
@ -224,7 +224,7 @@ ERROR: invalid-timestamp-format ;
|
||||||
read-sp checked-number >>year
|
read-sp checked-number >>year
|
||||||
":" read-token checked-number >>hour
|
":" read-token checked-number >>hour
|
||||||
":" read-token checked-number >>minute
|
":" read-token checked-number >>minute
|
||||||
" " read-token checked-number >>second
|
read-sp checked-number >>second
|
||||||
readln parse-rfc822-gmt-offset >>gmt-offset ;
|
readln parse-rfc822-gmt-offset >>gmt-offset ;
|
||||||
|
|
||||||
: cookie-string>timestamp-1 ( str -- timestamp )
|
: cookie-string>timestamp-1 ( str -- timestamp )
|
||||||
|
@ -237,7 +237,7 @@ ERROR: invalid-timestamp-format ;
|
||||||
read-sp checked-number >>day
|
read-sp checked-number >>day
|
||||||
":" read-token checked-number >>hour
|
":" read-token checked-number >>hour
|
||||||
":" read-token checked-number >>minute
|
":" read-token checked-number >>minute
|
||||||
" " read-token checked-number >>second
|
read-sp checked-number >>second
|
||||||
read-sp checked-number >>year
|
read-sp checked-number >>year
|
||||||
readln parse-rfc822-gmt-offset >>gmt-offset ;
|
readln parse-rfc822-gmt-offset >>gmt-offset ;
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,7 @@ IN: core-foundation.time
|
||||||
TYPEDEF: double CFTimeInterval
|
TYPEDEF: double CFTimeInterval
|
||||||
TYPEDEF: double CFAbsoluteTime
|
TYPEDEF: double CFAbsoluteTime
|
||||||
|
|
||||||
: >CFTimeInterval ( duration -- interval )
|
ALIAS: >CFTimeInterval duration>seconds
|
||||||
duration>seconds ; inline
|
|
||||||
|
|
||||||
MEMO: epoch ( -- micros )
|
MEMO: epoch ( -- micros )
|
||||||
T{ timestamp { year 2001 } { month 1 } { day 1 } } timestamp>micros ;
|
T{ timestamp { year 2001 } { month 1 } { day 1 } } timestamp>micros ;
|
||||||
|
|
|
@ -33,11 +33,11 @@ MACRO: set-firstn ( n -- )
|
||||||
bi-curry '[ _ _ bi ]
|
bi-curry '[ _ _ bi ]
|
||||||
] if ;
|
] if ;
|
||||||
|
|
||||||
: nappend-as ( n exemplar -- seq )
|
|
||||||
[ narray concat ] dip like ; inline
|
|
||||||
|
|
||||||
: nappend ( n -- seq ) narray concat ; inline
|
: nappend ( n -- seq ) narray concat ; inline
|
||||||
|
|
||||||
|
: nappend-as ( n exemplar -- seq )
|
||||||
|
[ nappend ] dip like ; inline
|
||||||
|
|
||||||
MACRO: nmin-length ( n -- )
|
MACRO: nmin-length ( n -- )
|
||||||
dup 1 - [ min ] n*quot
|
dup 1 - [ min ] n*quot
|
||||||
'[ [ length ] _ napply @ ] ;
|
'[ [ length ] _ napply @ ] ;
|
||||||
|
|
|
@ -10,16 +10,16 @@ IN: unicode.case.tests
|
||||||
[ t ] [ "hello how are you?" lower? ] unit-test
|
[ t ] [ "hello how are you?" lower? ] unit-test
|
||||||
[
|
[
|
||||||
[ f ] [ i-dot? ] unit-test
|
[ f ] [ i-dot? ] unit-test
|
||||||
[ f ] [ lt? ] unit-test
|
[ f ] [ lithuanian? ] unit-test
|
||||||
"tr" locale set
|
"tr" locale set
|
||||||
[ t ] [ i-dot? ] unit-test
|
[ t ] [ i-dot? ] unit-test
|
||||||
[ f ] [ lt? ] unit-test
|
[ f ] [ lithuanian? ] unit-test
|
||||||
[ "i\u000131i \u000131jj" ] [ "i\u000131I\u000307 IJj" >lower ] unit-test
|
[ "i\u000131i \u000131jj" ] [ "i\u000131I\u000307 IJj" >lower ] unit-test
|
||||||
[ "I\u000307\u000131i Ijj" ] [ "i\u000131I\u000307 IJj" >title ] unit-test
|
[ "I\u000307\u000131i Ijj" ] [ "i\u000131I\u000307 IJj" >title ] unit-test
|
||||||
[ "I\u000307II\u000307 IJJ" ] [ "i\u000131I\u000307 IJj" >upper ] unit-test
|
[ "I\u000307II\u000307 IJJ" ] [ "i\u000131I\u000307 IJj" >upper ] unit-test
|
||||||
"lt" locale set
|
"lt" locale set
|
||||||
[ f ] [ i-dot? ] unit-test
|
[ f ] [ i-dot? ] unit-test
|
||||||
[ t ] [ lt? ] unit-test
|
[ t ] [ lithuanian? ] unit-test
|
||||||
[ "i\u000307\u000300" ] [ HEX: CC 1string nfd >lower ] unit-test
|
[ "i\u000307\u000300" ] [ HEX: CC 1string nfd >lower ] unit-test
|
||||||
[ "\u00012f\u000307" ] [ HEX: 12E 1string nfd >lower nfc ] unit-test
|
[ "\u00012f\u000307" ] [ HEX: 12E 1string nfd >lower nfc ] unit-test
|
||||||
[ "I\u000300" ] [ "i\u000307\u000300" >upper ] unit-test
|
[ "I\u000300" ] [ "i\u000307\u000300" >upper ] unit-test
|
||||||
|
|
|
@ -20,9 +20,6 @@ SYMBOL: locale ! Just casing locale, or overall?
|
||||||
: i-dot? ( -- ? )
|
: i-dot? ( -- ? )
|
||||||
locale get { "tr" "az" } member? ;
|
locale get { "tr" "az" } member? ;
|
||||||
|
|
||||||
: lt? ( -- ? )
|
|
||||||
locale get "lt" = ;
|
|
||||||
|
|
||||||
: lithuanian? ( -- ? ) locale get "lt" = ;
|
: lithuanian? ( -- ? ) locale get "lt" = ;
|
||||||
|
|
||||||
: lithuanian>upper ( string -- lower )
|
: lithuanian>upper ( string -- lower )
|
||||||
|
@ -87,7 +84,7 @@ PRIVATE>
|
||||||
|
|
||||||
: >lower ( string -- lower )
|
: >lower ( string -- lower )
|
||||||
i-dot? [ turk>lower ] when
|
i-dot? [ turk>lower ] when
|
||||||
lt? [ lithuanian>lower ] when
|
lithuanian? [ lithuanian>lower ] when
|
||||||
final-sigma
|
final-sigma
|
||||||
[ lower>> ] [ ch>lower ] map-case ;
|
[ lower>> ] [ ch>lower ] map-case ;
|
||||||
|
|
||||||
|
@ -95,7 +92,7 @@ HINTS: >lower string ;
|
||||||
|
|
||||||
: >upper ( string -- upper )
|
: >upper ( string -- upper )
|
||||||
i-dot? [ turk>upper ] when
|
i-dot? [ turk>upper ] when
|
||||||
lt? [ lithuanian>upper ] when
|
lithuanian? [ lithuanian>upper ] when
|
||||||
[ upper>> ] [ ch>upper ] map-case ;
|
[ upper>> ] [ ch>upper ] map-case ;
|
||||||
|
|
||||||
HINTS: >upper string ;
|
HINTS: >upper string ;
|
||||||
|
@ -104,7 +101,7 @@ HINTS: >upper string ;
|
||||||
|
|
||||||
: (>title) ( string -- title )
|
: (>title) ( string -- title )
|
||||||
i-dot? [ turk>upper ] when
|
i-dot? [ turk>upper ] when
|
||||||
lt? [ lithuanian>upper ] when
|
lithuanian? [ lithuanian>upper ] when
|
||||||
[ title>> ] [ ch>title ] map-case ; inline
|
[ title>> ] [ ch>title ] map-case ; inline
|
||||||
|
|
||||||
PRIVATE>
|
PRIVATE>
|
||||||
|
|
Loading…
Reference in New Issue