Merge remote-tracking branch 'origin/master' into modern-harvey3
commit
08a09f70ff
|
@ -31,6 +31,8 @@ addons:
|
|||
- cmake
|
||||
- libaio-dev
|
||||
- libsnappy-dev
|
||||
- libgtk2.0-dev
|
||||
- gtk2-engines-pixbuf
|
||||
before_install:
|
||||
- uname -s
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./build.sh deps-macosx ; else ./build.sh deps-apt-get ; fi
|
||||
|
|
13
GNUmakefile
13
GNUmakefile
|
@ -5,9 +5,20 @@ ifdef CONFIG
|
|||
DEBUG ?= 0
|
||||
REPRODUCIBLE ?= 0
|
||||
|
||||
# gmake's default CXX is g++, we prefer c++
|
||||
SHELL_CXX = $(shell printenv CXX)
|
||||
ifeq ($(SHELL_CXX),)
|
||||
CXX=c++
|
||||
else
|
||||
CXX=$(SHELL_CXX)
|
||||
endif
|
||||
|
||||
XCODE_PATH ?= /Applications/Xcode.app
|
||||
MACOSX_SDK ?= MacOSX10.13.sdk
|
||||
|
||||
include $(CONFIG)
|
||||
|
||||
CFLAGS = -Wall \
|
||||
CFLAGS += -Wall \
|
||||
-pedantic \
|
||||
-DFACTOR_VERSION="$(VERSION)" \
|
||||
-DFACTOR_GIT_LABEL="$(GIT_LABEL)" \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2018, Slava Pestov, et al.
|
||||
Copyright (c) 2019, Slava Pestov, et al.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -34,8 +34,8 @@ To check out Factor:
|
|||
To build the latest complete Factor system from git, either use the
|
||||
build script:
|
||||
|
||||
* Windows: `build.cmd`
|
||||
* Unix: `./build.sh update`
|
||||
* Windows: `build.cmd`
|
||||
|
||||
or download the correct boot image for your system from
|
||||
http://downloads.factorcode.org/images/master/, put it in the factor
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
USING: base64 io.encodings.ascii io.encodings.string kernel
|
||||
sequences splitting strings tools.test ;
|
||||
USING: base64 byte-arrays io.encodings.ascii io.encodings.string
|
||||
kernel sequences splitting strings tools.test ;
|
||||
|
||||
{ t } [ 256 <iota> >byte-array dup >base64 base64> = ] unit-test
|
||||
|
||||
{ "abcdefghijklmnopqrstuvwxyz" } [ "abcdefghijklmnopqrstuvwxyz" ascii encode >base64 base64> ascii decode
|
||||
] unit-test
|
||||
|
@ -39,3 +41,9 @@ sequences splitting strings tools.test ;
|
|||
"eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJKb2UifQ.ipevRNuRP6HflG8cFKnmUPtypruRC4fb1DWtoLL62SY"
|
||||
"." split [ base64> ] map
|
||||
] unit-test
|
||||
|
||||
{ "01a+b/cd" } [ "\xd3V\xbeo\xf7\x1d" >base64 "" like ] unit-test
|
||||
{ "\xd3V\xbeo\xf7\x1d" } [ "01a+b/cd" base64> "" like ] unit-test
|
||||
|
||||
{ "01a-b_cd" } [ "\xd3V\xbeo\xf7\x1d" >urlsafe-base64 "" like ] unit-test
|
||||
{ "\xd3V\xbeo\xf7\x1d" } [ "01a-b_cd" urlsafe-base64> "" like ] unit-test
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
! Copyright (C) 2008 Doug Coleman, Daniel Ehrenberg.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: arrays combinators fry io io.binary io.encodings.binary
|
||||
io.streams.byte-array kernel literals math namespaces sbufs
|
||||
sequences ;
|
||||
USING: arrays assocs byte-arrays combinators fry io io.binary
|
||||
io.encodings.binary io.streams.byte-array kernel literals math
|
||||
namespaces sbufs sequences ;
|
||||
IN: base64
|
||||
|
||||
ERROR: malformed-base64 ;
|
||||
|
@ -10,8 +10,10 @@ ERROR: malformed-base64 ;
|
|||
<PRIVATE
|
||||
|
||||
<<
|
||||
CONSTANT: alphabet
|
||||
CONSTANT: alphabet $[
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
|
||||
>byte-array
|
||||
]
|
||||
|
||||
: alphabet-inverse ( alphabet -- seq )
|
||||
dup supremum 1 + f <array> [
|
||||
|
@ -100,3 +102,21 @@ PRIVATE>
|
|||
|
||||
: >base64-lines ( seq -- base64 )
|
||||
binary [ binary [ encode-base64-lines ] with-byte-reader ] with-byte-writer ;
|
||||
|
||||
: >urlsafe-base64 ( seq -- base64 )
|
||||
>base64 H{
|
||||
{ ch'+ ch'- }
|
||||
{ ch'/ ch'_ }
|
||||
} substitute ;
|
||||
|
||||
: urlsafe-base64> ( base64 -- seq )
|
||||
H{
|
||||
{ ch'- ch'+ }
|
||||
{ ch'_ ch'/ }
|
||||
} substitute base64> ;
|
||||
|
||||
: >urlsafe-base64-lines ( seq -- base64 )
|
||||
>base64-lines H{
|
||||
{ ch'+ ch'- }
|
||||
{ ch'/ ch'_ }
|
||||
} substitute ;
|
||||
|
|
|
@ -1 +1 @@
|
|||
Base64 encoding/decoding
|
||||
Base64 encoding/decoding (RFC 3548)
|
||||
|
|
|
@ -7,10 +7,10 @@ unicode multiline ;
|
|||
IN: globs
|
||||
|
||||
: not-path-separator ( -- sep )
|
||||
os windows? R/ [^\\/\\]/ R/ [^\\/]/ ? ; foldable
|
||||
os windows? R/ [^\/\\]/ R/ [^\/]/ ? ; foldable
|
||||
|
||||
: wild-path-separator ( -- sep )
|
||||
os windows? R/ [^\\/\\][\\/\\]|[^\\/\\]/ R/ [^\\/][\\/]|[^\\/]/ ? ; foldable
|
||||
os windows? R/ [^\/\\][\/\\]|[^\/\\]/ R/ [^\/][\/]|[^\/]/ ? ; foldable
|
||||
|
||||
EBNF: <glob> [=[
|
||||
|
||||
|
|
|
@ -13,3 +13,16 @@ USING: io.crlf tools.test io.streams.string io ;
|
|||
|
||||
{ "foo\nbar" } [ "foo\n\rbar" crlf>lf ] unit-test
|
||||
{ "foo\r\nbar" } [ "foo\nbar" lf>crlf ] unit-test
|
||||
|
||||
{ f } [ "" [ read1-ignoring-crlf ] with-string-reader ] unit-test
|
||||
{ ch'a } [ "a" [ read1-ignoring-crlf ] with-string-reader ] unit-test
|
||||
{ ch'b } [ "\nb" [ read1-ignoring-crlf ] with-string-reader ] unit-test
|
||||
{ ch'c } [ "\r\nc" [ read1-ignoring-crlf ] with-string-reader ] unit-test
|
||||
|
||||
{ f } [ "" [ 5 read-ignoring-crlf ] with-string-reader ] unit-test
|
||||
{ "a" } [ "a" [ 5 read-ignoring-crlf ] with-string-reader ] unit-test
|
||||
{ "ab" } [ "a\nb" [ 5 read-ignoring-crlf ] with-string-reader ] unit-test
|
||||
{ "abc" } [ "a\nb\r\nc" [ 5 read-ignoring-crlf ] with-string-reader ] unit-test
|
||||
{ "abcd" } [ "a\nb\r\ncd" [ 5 read-ignoring-crlf ] with-string-reader ] unit-test
|
||||
{ "abcde" } [ "a\nb\r\ncd\r\ne" [ 5 read-ignoring-crlf ] with-string-reader ] unit-test
|
||||
{ "abcde" } [ "a\nb\r\ncd\r\ne\nfghi" [ 5 read-ignoring-crlf ] with-string-reader ] unit-test
|
||||
|
|
|
@ -1,21 +1,62 @@
|
|||
! Copyright (C) 2009 Daniel Ehrenberg, Slava Pestov
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: io kernel sequences splitting ;
|
||||
USING: byte-vectors io io.private kernel locals math namespaces
|
||||
sbufs sequences splitting ;
|
||||
IN: io.crlf
|
||||
|
||||
: crlf ( -- )
|
||||
"\r\n" write ;
|
||||
|
||||
:: stream-read-crlf ( stream -- seq )
|
||||
"\r" stream stream-read-until [
|
||||
ch'\r assert= stream stream-read1 ch'\n assert=
|
||||
] [ f like ] if* ;
|
||||
|
||||
: read-crlf ( -- seq )
|
||||
"\r" read-until
|
||||
[ ch'\r assert= read1 ch'\n assert= ] [ f like ] if* ;
|
||||
input-stream get stream-read-crlf ;
|
||||
|
||||
:: stream-read-?crlf ( stream -- seq )
|
||||
"\r\n" stream stream-read-until [
|
||||
ch'\r = [ stream stream-read1 ch'\n assert= ] when
|
||||
] [ f like ] if* ;
|
||||
|
||||
: read-?crlf ( -- seq )
|
||||
"\r\n" read-until
|
||||
[ ch'\r = [ read1 ch'\n assert= ] when ] [ f like ] if* ;
|
||||
input-stream get stream-read-?crlf ;
|
||||
|
||||
: crlf>lf ( str -- str' )
|
||||
ch'\r swap remove ;
|
||||
|
||||
: lf>crlf ( str -- str' )
|
||||
"\n" split "\r\n" join ;
|
||||
|
||||
:: stream-read1-ignoring-crlf ( stream -- ch )
|
||||
stream stream-read1 dup "\r\n" member?
|
||||
[ drop stream stream-read1-ignoring-crlf ] when ; inline recursive
|
||||
|
||||
: read1-ignoring-crlf ( -- ch )
|
||||
input-stream get stream-read1-ignoring-crlf ;
|
||||
|
||||
: push-ignoring-crlf ( elt seq -- )
|
||||
[ "\r\n" member? not ] swap push-if ;
|
||||
|
||||
: push-all-ignoring-crlf ( src dst -- )
|
||||
[ push-ignoring-crlf ] curry each ;
|
||||
|
||||
:: stream-read-ignoring-crlf ( n stream -- seq/f )
|
||||
n stream stream-read dup [
|
||||
dup [ "\r\n" member? ] any? [
|
||||
stream stream-element-type +byte+ =
|
||||
[ n <byte-vector> ] [ n <sbuf> ] if :> accum
|
||||
accum push-all-ignoring-crlf
|
||||
|
||||
[ accum length n < and ] [
|
||||
n accum length - stream stream-read
|
||||
[ accum push-all-ignoring-crlf ] keep
|
||||
] do while
|
||||
|
||||
accum stream stream-exemplar like
|
||||
] when
|
||||
] when ;
|
||||
|
||||
: read-ignoring-crlf ( n -- seq/f )
|
||||
input-stream get stream-read-ignoring-crlf ;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
USING: combinators fry io.directories io.directories.hierarchy
|
||||
io.directories.search io.files.unique io.pathnames kernel
|
||||
namespaces sequences sorting splitting strings system
|
||||
tools.test ;
|
||||
USING: combinators fry grouping io.directories
|
||||
io.directories.hierarchy io.directories.search io.files.unique
|
||||
io.pathnames kernel math namespaces sequences sorting splitting
|
||||
splitting.monotonic strings tools.test ;
|
||||
|
||||
{ t } [
|
||||
[
|
||||
|
@ -47,49 +47,42 @@ tools.test ;
|
|||
[ drop f ] find-up-to-root
|
||||
] unit-test
|
||||
|
||||
os linux? [
|
||||
[
|
||||
{
|
||||
V{ 1 2 3 2 3 1 2 3 2 3 1 2 3 2 3 }
|
||||
V{ 1 1 1 2 2 2 2 2 2 3 3 3 3 3 3 }
|
||||
"/a"
|
||||
"/a/a"
|
||||
"/a/a/a"
|
||||
"/a/b"
|
||||
"/a/b/a"
|
||||
"/b"
|
||||
"/b/a"
|
||||
"/b/a/a"
|
||||
"/b/b"
|
||||
"/b/b/a"
|
||||
"/c"
|
||||
"/c/a"
|
||||
"/c/a/a"
|
||||
"/c/b"
|
||||
"/c/b/a"
|
||||
}
|
||||
{
|
||||
"/a"
|
||||
"/b"
|
||||
"/c"
|
||||
"/a/a"
|
||||
"/a/b"
|
||||
"/b/a"
|
||||
"/b/b"
|
||||
"/c/a"
|
||||
"/c/b"
|
||||
"/a/a/a"
|
||||
"/a/b/a"
|
||||
"/b/a/a"
|
||||
"/b/b/a"
|
||||
"/c/a/a"
|
||||
"/c/b/a"
|
||||
}
|
||||
] [
|
||||
{
|
||||
V{
|
||||
"/a"
|
||||
"/a/a"
|
||||
"/a/a/a"
|
||||
"/a/b"
|
||||
"/a/b/a"
|
||||
"/b"
|
||||
"/b/a"
|
||||
"/b/a/a"
|
||||
"/b/b"
|
||||
"/b/b/a"
|
||||
"/c"
|
||||
"/c/a"
|
||||
"/c/a/a"
|
||||
"/c/b"
|
||||
"/c/b/a"
|
||||
}
|
||||
V{
|
||||
"/a"
|
||||
"/b"
|
||||
"/c"
|
||||
"/a/a"
|
||||
"/a/b"
|
||||
"/b/a"
|
||||
"/b/b"
|
||||
"/c/a"
|
||||
"/c/b"
|
||||
"/a/a/a"
|
||||
"/a/b/a"
|
||||
"/b/a/a"
|
||||
"/b/b/a"
|
||||
"/c/a/a"
|
||||
"/c/b/a"
|
||||
}
|
||||
}
|
||||
] if [
|
||||
[
|
||||
"a" make-directory
|
||||
"a/a" make-directory
|
||||
|
@ -110,16 +103,21 @@ os linux? [
|
|||
+depth-first+ traversal-method [
|
||||
"." recursive-directory-files
|
||||
current-directory get '[ _ ?head drop ] map
|
||||
|
||||
! preserve file traversal order, but sort
|
||||
! alphabetically for cross-platform testing
|
||||
dup length 3 / group natural-sort
|
||||
[ natural-sort ] map concat
|
||||
] with-variable
|
||||
|
||||
+breadth-first+ traversal-method [
|
||||
"." recursive-directory-files
|
||||
current-directory get '[ _ ?head drop ] map
|
||||
] with-variable
|
||||
|
||||
! Linux doesn't return alphabetic ordering
|
||||
os linux? [
|
||||
[ [ path-components length ] map ] bi@
|
||||
] when
|
||||
! preserve file traversal order, but sort
|
||||
! alphabetically for cross-platform testing
|
||||
[ [ length ] bi@ = ] monotonic-split
|
||||
[ natural-sort ] map concat
|
||||
] with-variable
|
||||
] with-test-directory
|
||||
] unit-test
|
||||
|
|
|
@ -346,9 +346,9 @@ PRIVATE>
|
|||
M: windows canonicalize-path
|
||||
remove-unicode-prefix canonicalize-path* ;
|
||||
|
||||
M: object root-path remove-unicode-prefix root-path* ;
|
||||
M: windows root-path remove-unicode-prefix root-path* ;
|
||||
|
||||
M: object relative-path remove-unicode-prefix relative-path* ;
|
||||
M: windows relative-path remove-unicode-prefix relative-path* ;
|
||||
|
||||
M: windows normalize-path ( string -- string' )
|
||||
dup unc-path? [
|
||||
|
|
|
@ -107,7 +107,7 @@ M: ipv4 empty-sockaddr drop sockaddr-in <struct> ;
|
|||
sockaddr-in <struct>
|
||||
AF_INET >>family
|
||||
swap
|
||||
port>> htons >>port ; inline
|
||||
port>> 0 or htons >>port ; inline
|
||||
|
||||
M: ipv4 make-sockaddr ( inet -- sockaddr )
|
||||
[ make-sockaddr-part ]
|
||||
|
@ -122,7 +122,7 @@ M: ipv4 make-sockaddr-outgoing ( inet -- sockaddr )
|
|||
M: ipv4 parse-sockaddr ( sockaddr-in addrspec -- newaddrspec )
|
||||
[ addr>> uint <ref> ] dip inet-ntop <ipv4> ;
|
||||
|
||||
TUPLE: inet4 < ipv4 { port integer read-only } ;
|
||||
TUPLE: inet4 < ipv4 { port maybe{ integer } read-only } ;
|
||||
|
||||
: <inet4> ( host port -- inet4 )
|
||||
over check-ipv4 inet4 boa ;
|
||||
|
@ -179,7 +179,7 @@ M: ipv6 empty-sockaddr drop sockaddr-in6 <struct> ;
|
|||
sockaddr-in6 <struct>
|
||||
AF_INET6 >>family
|
||||
swap
|
||||
port>> htons >>port ; inline
|
||||
port>> 0 or htons >>port ; inline
|
||||
|
||||
M: ipv6 make-sockaddr ( inet -- sockaddr )
|
||||
[ make-sockaddr-in6-part ]
|
||||
|
@ -201,7 +201,7 @@ M: ipv6 present
|
|||
[ host>> ] [ scope-id>> ] bi
|
||||
[ number>string "%" glue ] unless-zero ;
|
||||
|
||||
TUPLE: inet6 < ipv6 { port integer read-only } ;
|
||||
TUPLE: inet6 < ipv6 { port maybe{ integer } read-only } ;
|
||||
|
||||
: <inet6> ( host port -- inet6 )
|
||||
[ dup check-ipv6 0 ] dip inet6 boa ;
|
||||
|
|
|
@ -16,9 +16,6 @@ TUPLE: delay < model model timeout timer ;
|
|||
[ add-dependency ] keep ;
|
||||
|
||||
M: delay model-changed
|
||||
! BUG: timer can't be "restart-timer" inside of its quotation?
|
||||
! nip timer>> restart-timer ;
|
||||
nip timer>> [ stop-timer ] [ start-timer ] bi ;
|
||||
|
||||
nip timer>> restart-timer ;
|
||||
|
||||
M: delay model-activated update-delay-model ;
|
||||
|
|
|
@ -113,10 +113,10 @@ ARTICLE: "prettyprint-literal" "Literal prettyprinting protocol"
|
|||
"TUPLE: rect w h ;"
|
||||
""
|
||||
"SYNTAX: RECT["
|
||||
" scan-word"
|
||||
" scan-word \\ * assert="
|
||||
" scan-word"
|
||||
" scan-word \\ ] assert="
|
||||
" scan-number"
|
||||
" scan-token \"*\" assert="
|
||||
" scan-number"
|
||||
" scan-token \"]\" assert="
|
||||
" <rect> suffix! ;"
|
||||
}
|
||||
"An example literal might be:"
|
||||
|
@ -126,7 +126,7 @@ ARTICLE: "prettyprint-literal" "Literal prettyprinting protocol"
|
|||
"However, we can define three methods easily enough:"
|
||||
{ $code
|
||||
"M: rect pprint-delims drop \\ RECT[ \\ ] ;"
|
||||
"M: rect >pprint-sequence dup rect-w \\ * rot rect-h 3array ;"
|
||||
"M: rect >pprint-sequence dup w>> \\ * rot h>> 3array ;"
|
||||
"M: rect pprint* pprint-object ;"
|
||||
}
|
||||
"Now, it will be printed in a custom way:"
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
USING: accessors arrays assocs combinators
|
||||
combinators.short-circuit interval-maps kernel locals
|
||||
math.parser memoize multiline peg.ebnf regexp.ast regexp.classes
|
||||
sequences sets splitting strings unicode unicode.data unicode.script ;
|
||||
sequences sets splitting strings unicode unicode.data
|
||||
unicode.script ;
|
||||
IN: regexp.parser
|
||||
|
||||
: allowed-char? ( ch -- ? )
|
||||
|
@ -70,12 +71,15 @@ MEMO: simple-category-table ( -- table )
|
|||
|
||||
: lookup-escape ( char -- ast )
|
||||
{
|
||||
{ ch't [ ch'\t ] }
|
||||
{ ch'n [ ch'\n ] }
|
||||
{ ch'r [ ch'\r ] }
|
||||
{ ch'f [ 0xc ] }
|
||||
{ ch'a [ 0x7 ] }
|
||||
{ ch'e [ 0x1b ] }
|
||||
{ ch'f [ 0xc ] }
|
||||
! { ch'f [ ch'\f ] }
|
||||
{ ch'n [ ch'\n ] }
|
||||
{ ch'r [ ch'\r ] }
|
||||
{ ch't [ ch'\t ] }
|
||||
{ ch'v [ ch'\v ] }
|
||||
{ ch'0 [ ch'\0 ] }
|
||||
{ ch'\\ [ ch'\\ ] }
|
||||
|
||||
{ ch'w [ c-identifier-class <primitive-class> ] }
|
||||
|
|
|
@ -7,7 +7,7 @@ IN: regexp.prettyprint
|
|||
M: regexp pprint*
|
||||
[
|
||||
[
|
||||
[ raw>> "\\/" "\\\\/" replace "R/ " % % "/" % ]
|
||||
[ raw>> "/" "\\/" replace "R/ " % % "/" % ]
|
||||
[ options>> options>string % ] bi
|
||||
] "" make
|
||||
] keep present-text ;
|
||||
|
|
|
@ -49,6 +49,9 @@ IN: regexp.tests
|
|||
{ t } [ "a" ".+" <regexp> matches? ] unit-test
|
||||
{ t } [ "ab" ".+" <regexp> matches? ] unit-test
|
||||
|
||||
{ t } [ "\0" "[\\0]" <regexp> matches? ] unit-test
|
||||
{ f } [ "0" "[\\0]" <regexp> matches? ] unit-test
|
||||
|
||||
{ t } [ " " "[\\s]" <regexp> matches? ] unit-test
|
||||
{ f } [ "a" "[\\s]" <regexp> matches? ] unit-test
|
||||
{ f } [ " " "[\\S]" <regexp> matches? ] unit-test
|
||||
|
@ -335,6 +338,10 @@ unit-test
|
|||
{ "XhXXlXlXoX XwXoXrXlXdX" } [ "hello world" R/ e*/ "X" re-replace ] unit-test
|
||||
{ "-- title --" } [ "== title ==" R/ =/ "-" re-replace ] unit-test
|
||||
|
||||
{ "abc" } [ "a/ \\bc" "/.*\\" <regexp> "" re-replace ] unit-test
|
||||
{ "ac" } [ "a/ \\bc" R/ \/.*\\./ "" re-replace ] unit-test
|
||||
{ "abc" } [ "a/ \\bc" R/ \/.*\\/ "" re-replace ] unit-test
|
||||
|
||||
{ "" } [ "ab" "a(?!b)" <regexp> first-match >string ] unit-test
|
||||
{ "a" } [ "ac" "a(?!b)" <regexp> first-match >string ] unit-test
|
||||
{ t } [ "fxxbar" ".{3}(?!foo)bar" <regexp> matches? ] unit-test
|
||||
|
|
|
@ -201,10 +201,11 @@ PRIVATE>
|
|||
: take-until ( lexer -- string )
|
||||
dup skip-blank [
|
||||
dupd [
|
||||
[ ch'/ -rot index-from ] keep
|
||||
over [ "Unterminated regexp" throw ] unless
|
||||
2dup [ 1 - ] dip nth ch'\\ =
|
||||
[ [ [ 1 + ] dip ] when ] keep
|
||||
[ [ "\\/" member? ] find-from ] keep swap [
|
||||
ch'\ = [ [ 2 + ] dip t ] [ f ] if
|
||||
] [
|
||||
"Unterminated regexp" throw
|
||||
] if*
|
||||
] loop over [ subseq ] dip 1 +
|
||||
] change-lexer-column ;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
! Copyright (C) 2018 Doug Coleman.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: base85 combinators command-line escape-strings fry
|
||||
USING: base91 combinators command-line escape-strings fry
|
||||
io.backend io.directories io.directories.search
|
||||
io.encodings.binary io.encodings.utf8 io.files io.files.info
|
||||
io.pathnames kernel locals math namespaces sequences
|
||||
|
@ -28,9 +28,9 @@ IN: tools.directory-to-file
|
|||
{ [ dup file-info directory? ] [ directory-repr ] }
|
||||
{ [ dup file-is-text? ] [ dup utf8 file-contents escape-string file-repr ] }
|
||||
[
|
||||
dup binary file-contents >base85
|
||||
dup binary file-contents >base91
|
||||
"" like escape-string
|
||||
"base85" prepend file-repr
|
||||
"base91" prepend file-repr
|
||||
]
|
||||
} cond
|
||||
] map
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
! Copyright (C) 2018 Doug Coleman.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: base85 combinators command-line fry io.directories
|
||||
USING: base91 combinators command-line fry io.directories
|
||||
io.encodings.binary io.encodings.utf8 io.files io.pathnames
|
||||
kernel modern modern.out namespaces sequences splitting strings ;
|
||||
IN: tools.file-to-directory
|
||||
|
@ -18,8 +18,8 @@ ERROR: expected-modern-path got ;
|
|||
[
|
||||
second first2
|
||||
[ second >string ] [
|
||||
first3 nip swap "base85" head? [
|
||||
base85> binary
|
||||
first3 nip swap "base91" head? [
|
||||
base91> binary
|
||||
] [
|
||||
utf8
|
||||
] if
|
||||
|
|
|
@ -149,7 +149,7 @@ M: word (print-input)
|
|||
[ interactor-yield ] [ interactor-finish ] bi ;
|
||||
|
||||
M: interactor stream-readln
|
||||
interactor-read dup [ first ] when ;
|
||||
interactor-read ?first ;
|
||||
|
||||
: (call-listener) ( quot command listener -- )
|
||||
input>> dup interactor-busy? [ 3drop ] [
|
||||
|
|
|
@ -65,7 +65,7 @@ IN: validators
|
|||
v-regexp ;
|
||||
|
||||
: v-url ( str -- str )
|
||||
"url"R/ (?:ftp|http|https):\\/\\/\S+/ v-regexp ;
|
||||
"url" R/ (?:ftp|http|https):\/\/\S+/ v-regexp ;
|
||||
|
||||
: v-captcha ( str -- str )
|
||||
dup empty? [ "must remain blank" throw ] unless ;
|
||||
|
|
|
@ -25,12 +25,26 @@ COM-INTERFACE: IDataObject IUnknown {0000010E-0000-0000-C000-000000000046}
|
|||
HRESULT DUnadvise ( DWORD pdwConnection )
|
||||
HRESULT EnumDAdvise ( IEnumSTATDATA** ppenumAdvise ) ;
|
||||
|
||||
COM-INTERFACE: IDropSource IUnknown {00000121-0000-0000-C000-000000000046}
|
||||
HRESULT GiveFeedback ( DWORD dwEffect )
|
||||
HRESULT QueryContinueDrag ( BOOL fEscapePressed, DWORD grfKeyState ) ;
|
||||
|
||||
COM-INTERFACE: IDropTarget IUnknown {00000122-0000-0000-C000-000000000046}
|
||||
HRESULT DragEnter ( IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect )
|
||||
HRESULT DragOver ( DWORD grfKeyState, POINTL pt, DWORD* pdwEffect )
|
||||
HRESULT DragLeave ( )
|
||||
HRESULT Drop ( IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect ) ;
|
||||
|
||||
TYPEDEF: IDataObject* LPDATAOBJECT
|
||||
TYPEDEF: IDropSource* LPDROPSOURCE
|
||||
|
||||
FUNCTION: HRESULT DoDragDrop (
|
||||
LPDATAOBJECT pDataObj,
|
||||
LPDROPSOURCE pDropSource,
|
||||
DWORD dwOKEffects,
|
||||
LPDWORD pdwEffect
|
||||
)
|
||||
|
||||
COM-INTERFACE: ISequentialStream IUnknown {0C733A30-2A1C-11CE-ADE5-00AA0044773D}
|
||||
HRESULT Read ( void* pv, ULONG cb, ULONG* pcbRead )
|
||||
HRESULT Write ( void* pv, ULONG cb, ULONG* pcbWritten ) ;
|
||||
|
|
|
@ -1,19 +1,12 @@
|
|||
! Copyright (C) 2008, 2009 Joe Groff, Slava Pestov.
|
||||
! Copyright (C) 2017-2018 Alexander Ilin.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors alien.accessors alien.c-types alien.data
|
||||
alien.strings classes.struct io.encodings.utf16n kernel make
|
||||
math namespaces prettyprint sequences specialized-arrays
|
||||
ui.backend.windows ui.gadgets.worlds ui.gestures
|
||||
ui.tools.listener windows.com windows.com.wrapper
|
||||
windows.dropfiles windows.kernel32 windows.ole32 windows.shell32
|
||||
windows.types ;
|
||||
SPECIALIZED-ARRAY: ushort
|
||||
SPECIALIZED-ARRAY: WCHAR
|
||||
USING: accessors alien.accessors classes.struct kernel
|
||||
namespaces sequences ui.backend.windows ui.gadgets.worlds
|
||||
ui.gestures windows.com windows.com.wrapper windows.dropfiles
|
||||
windows.kernel32 windows.ole32 windows.user32 ;
|
||||
IN: windows.dragdrop-listener
|
||||
|
||||
CONSTANT: E_OUTOFMEMORY -2147024882 ! 0x8007000e
|
||||
|
||||
: handle-data-object ( handler: ( hdrop -- x ) data-object -- filenames )
|
||||
FORMATETC <struct>
|
||||
CF_HDROP >>cfFormat
|
||||
|
|
|
@ -270,6 +270,20 @@ STRUCT: TIME_ZONE_INFORMATION
|
|||
{ DaylightDate SYSTEMTIME }
|
||||
{ DaylightBias LONG } ;
|
||||
|
||||
STRUCT: DYNAMIC_TIME_ZONE_INFORMATION
|
||||
{ Bias LONG }
|
||||
{ StandardName WCHAR[32] }
|
||||
{ StandardDate SYSTEMTIME }
|
||||
{ StandardBias LONG }
|
||||
{ DaylightName WCHAR[32] }
|
||||
{ DaylightDate SYSTEMTIME }
|
||||
{ DaylightBias LONG }
|
||||
{ TimeZoneKeyName WCHAR[128] }
|
||||
{ DynamicDaylightTimeDisabled BOOLEAN } ;
|
||||
|
||||
TYPEDEF: DYNAMIC_TIME_ZONE_INFORMATION* PDYNAMIC_TIME_ZONE_INFORMATION
|
||||
|
||||
|
||||
STRUCT: FILETIME
|
||||
{ dwLowDateTime DWORD }
|
||||
{ dwHighDateTime DWORD } ;
|
||||
|
@ -1366,6 +1380,9 @@ ALIAS: GetDiskFreeSpaceEx GetDiskFreeSpaceExW
|
|||
! FUNCTION: GetDriveTypeA
|
||||
FUNCTION: UINT GetDriveTypeW ( LPCTSTR lpRootPathName )
|
||||
ALIAS: GetDriveType GetDriveTypeW
|
||||
|
||||
FUNCTION: DWORD GetDynamicTimeZoneInformation ( PDYNAMIC_TIME_ZONE_INFORMATION pTimeZoneInformation )
|
||||
|
||||
FUNCTION: void* GetEnvironmentStringsW ( )
|
||||
! FUNCTION: GetEnvironmentStringsA
|
||||
ALIAS: GetEnvironmentStrings GetEnvironmentStringsW
|
||||
|
|
|
@ -29,8 +29,15 @@ FUNCTION: HRESULT CLSIDFromString ( LPOLESTR lpsz, REFGUID out_rguid )
|
|||
|
||||
CONSTANT: S_OK 0
|
||||
CONSTANT: S_FALSE 1
|
||||
CONSTANT: DRAGDROP_S_DROP 0x00040100
|
||||
CONSTANT: DRAGDROP_S_CANCEL 0x00040101
|
||||
CONSTANT: DRAGDROP_S_USEDEFAULTCURSORS 0x00040102
|
||||
|
||||
CONSTANT: E_NOTIMPL 0x80004001
|
||||
CONSTANT: E_NOINTERFACE 0x80004002
|
||||
CONSTANT: E_FAIL 0x80004005
|
||||
CONSTANT: E_UNEXPECTED 0x8000FFFF
|
||||
CONSTANT: E_OUTOFMEMORY 0x8007000E
|
||||
CONSTANT: E_INVALIDARG 0x80070057
|
||||
|
||||
CONSTANT: MK_ALT 0x20
|
||||
|
@ -45,30 +52,6 @@ CONSTANT: DD_DEFSCROLLINTERVAL 50
|
|||
CONSTANT: DD_DEFDRAGDELAY 200
|
||||
CONSTANT: DD_DEFDRAGMINDIST 2
|
||||
|
||||
CONSTANT: CF_TEXT 1
|
||||
CONSTANT: CF_BITMAP 2
|
||||
CONSTANT: CF_METAFILEPICT 3
|
||||
CONSTANT: CF_SYLK 4
|
||||
CONSTANT: CF_DIF 5
|
||||
CONSTANT: CF_TIFF 6
|
||||
CONSTANT: CF_OEMTEXT 7
|
||||
CONSTANT: CF_DIB 8
|
||||
CONSTANT: CF_PALETTE 9
|
||||
CONSTANT: CF_PENDATA 10
|
||||
CONSTANT: CF_RIFF 11
|
||||
CONSTANT: CF_WAVE 12
|
||||
CONSTANT: CF_UNICODETEXT 13
|
||||
CONSTANT: CF_ENHMETAFILE 14
|
||||
CONSTANT: CF_HDROP 15
|
||||
CONSTANT: CF_LOCALE 16
|
||||
CONSTANT: CF_MAX 17
|
||||
|
||||
CONSTANT: CF_OWNERDISPLAY 0x0080
|
||||
CONSTANT: CF_DSPTEXT 0x0081
|
||||
CONSTANT: CF_DSPBITMAP 0x0082
|
||||
CONSTANT: CF_DSPMETAFILEPICT 0x0083
|
||||
CONSTANT: CF_DSPENHMETAFILE 0x008E
|
||||
|
||||
CONSTANT: DVASPECT_CONTENT 1
|
||||
CONSTANT: DVASPECT_THUMBNAIL 2
|
||||
CONSTANT: DVASPECT_ICON 4
|
||||
|
|
|
@ -243,6 +243,10 @@ TYPEDEF: ITEMIDLIST* LPCITEMIDLIST
|
|||
TYPEDEF: ITEMIDLIST ITEMID_CHILD
|
||||
TYPEDEF: ITEMID_CHILD* PITEMID_CHILD
|
||||
TYPEDEF: ITEMID_CHILD* PCUITEMID_CHILD
|
||||
TYPEDEF: ITEMIDLIST ITEMIDLIST_RELATIVE
|
||||
TYPEDEF: ITEMIDLIST ITEMIDLIST_ABSOLUTE
|
||||
TYPEDEF: ITEMIDLIST_ABSOLUTE* PIDLIST_ABSOLUTE
|
||||
TYPEDEF: ITEMIDLIST_ABSOLUTE* PCIDLIST_ABSOLUTE
|
||||
|
||||
CONSTANT: STRRET_WSTR 0
|
||||
CONSTANT: STRRET_OFFSET 1
|
||||
|
@ -379,3 +383,483 @@ STRUCT: NOTIFYICONDATA
|
|||
TYPEDEF: NOTIFYICONDATA* PNOTIFYICONDATA
|
||||
|
||||
FUNCTION: BOOL Shell_NotifyIcon ( DWORD dwMessage, PNOTIFYICONDATA lpdata )
|
||||
|
||||
TYPEDEF: HRESULT SHSTDAPI
|
||||
|
||||
FUNCTION: SHSTDAPI SHBindToParent (
|
||||
PCIDLIST_ABSOLUTE pidl,
|
||||
REFIID riid,
|
||||
void **ppv,
|
||||
PCUITEMID_CHILD *ppidlLast
|
||||
)
|
||||
|
||||
! FUNCTION: AppCompat_RunDLLW
|
||||
! FUNCTION: AssocCreateForClasses
|
||||
! FUNCTION: AssocGetDetailsOfPropKey
|
||||
! FUNCTION: CDefFolderMenu_Create2
|
||||
! FUNCTION: CheckEscapesW
|
||||
! FUNCTION: CIDLData_CreateFromIDArray
|
||||
! FUNCTION: CommandLineToArgvW
|
||||
! FUNCTION: Control_RunDLL
|
||||
! FUNCTION: Control_RunDLLA
|
||||
! FUNCTION: Control_RunDLLAsUserW
|
||||
! FUNCTION: Control_RunDLLW
|
||||
! FUNCTION: CreateStorageItemFromPath_FullTrustCaller
|
||||
! FUNCTION: CreateStorageItemFromPath_FullTrustCaller_ForPackage
|
||||
! FUNCTION: CreateStorageItemFromPath_PartialTrustCaller
|
||||
! FUNCTION: CreateStorageItemFromShellItem_FullTrustCaller
|
||||
! FUNCTION: CreateStorageItemFromShellItem_FullTrustCaller_ForPackage
|
||||
! FUNCTION: CreateStorageItemFromShellItem_FullTrustCaller_ForPackage_WithProcessHandle
|
||||
! FUNCTION: CreateStorageItemFromShellItem_FullTrustCaller_UseImplicitFlagsAndPackage
|
||||
! FUNCTION: CStorageItem_GetValidatedStorageItemObject
|
||||
! FUNCTION: DAD_AutoScroll
|
||||
! FUNCTION: DAD_DragEnterEx
|
||||
! FUNCTION: DAD_DragEnterEx2
|
||||
! FUNCTION: DAD_DragLeave
|
||||
! FUNCTION: DAD_DragMove
|
||||
! FUNCTION: DAD_SetDragImage
|
||||
! FUNCTION: DAD_ShowDragImage
|
||||
! FUNCTION: DllCanUnloadNow
|
||||
! FUNCTION: DllGetActivationFactory
|
||||
! FUNCTION: DllGetClassObject
|
||||
! FUNCTION: DllGetVersion
|
||||
! FUNCTION: DllInstall
|
||||
! FUNCTION: DllRegisterServer
|
||||
! FUNCTION: DllUnregisterServer
|
||||
! FUNCTION: DoEnvironmentSubstA
|
||||
! FUNCTION: DoEnvironmentSubstW
|
||||
! FUNCTION: DragQueryFileA
|
||||
! FUNCTION: DragQueryFileAorW
|
||||
! FUNCTION: DriveType
|
||||
! FUNCTION: DuplicateIcon
|
||||
! FUNCTION: ExtractAssociatedIconA
|
||||
! FUNCTION: ExtractAssociatedIconExA
|
||||
! FUNCTION: ExtractAssociatedIconExW
|
||||
! FUNCTION: ExtractAssociatedIconW
|
||||
! FUNCTION: ExtractIconA
|
||||
! FUNCTION: ExtractIconEx
|
||||
! FUNCTION: ExtractIconExA
|
||||
! FUNCTION: ExtractIconExW
|
||||
! FUNCTION: ExtractIconW
|
||||
! FUNCTION: FindExecutableA
|
||||
! FUNCTION: FindExecutableW
|
||||
! FUNCTION: FreeIconList
|
||||
! FUNCTION: GetCurrentProcessExplicitAppUserModelID
|
||||
! FUNCTION: GetFileNameFromBrowse
|
||||
! FUNCTION: GetSystemPersistedStorageItemList
|
||||
! FUNCTION: ILAppendID
|
||||
! FUNCTION: ILClone
|
||||
! FUNCTION: ILCloneFirst
|
||||
! FUNCTION: ILCombine
|
||||
! FUNCTION: ILCreateFromPath
|
||||
! FUNCTION: ILCreateFromPathA
|
||||
! FUNCTION: ILCreateFromPathW
|
||||
! FUNCTION: ILFindChild
|
||||
! FUNCTION: ILFindLastID
|
||||
! FUNCTION: ILFree
|
||||
! FUNCTION: ILGetNext
|
||||
! FUNCTION: ILGetSize
|
||||
! FUNCTION: ILIsEqual
|
||||
! FUNCTION: ILIsParent
|
||||
! FUNCTION: ILLoadFromStreamEx
|
||||
! FUNCTION: ILRemoveLastID
|
||||
! FUNCTION: ILSaveToStream
|
||||
! FUNCTION: InitNetworkAddressControl
|
||||
! FUNCTION: InternalExtractIconListA
|
||||
! FUNCTION: InternalExtractIconListW
|
||||
! FUNCTION: IsDesktopExplorerProcess
|
||||
! FUNCTION: IsLFNDrive
|
||||
! FUNCTION: IsLFNDriveA
|
||||
! FUNCTION: IsLFNDriveW
|
||||
! FUNCTION: IsNetDrive
|
||||
! FUNCTION: IsProcessAnExplorer
|
||||
! FUNCTION: LaunchMSHelp_RunDLLW
|
||||
! FUNCTION: OpenAs_RunDLL
|
||||
! FUNCTION: OpenAs_RunDLLA
|
||||
! FUNCTION: OpenAs_RunDLLW
|
||||
! FUNCTION: OpenRegStream
|
||||
! FUNCTION: Options_RunDLL
|
||||
! FUNCTION: Options_RunDLLA
|
||||
! FUNCTION: Options_RunDLLW
|
||||
! FUNCTION: PathCleanupSpec
|
||||
! FUNCTION: PathGetShortPath
|
||||
! FUNCTION: PathIsExe
|
||||
! FUNCTION: PathIsSlowA
|
||||
! FUNCTION: PathIsSlowW
|
||||
! FUNCTION: PathMakeUniqueName
|
||||
! FUNCTION: PathQualify
|
||||
! FUNCTION: PathResolve
|
||||
! FUNCTION: PathYetAnotherMakeUniqueName
|
||||
! FUNCTION: PickIconDlg
|
||||
! FUNCTION: PifMgr_CloseProperties
|
||||
! FUNCTION: PifMgr_GetProperties
|
||||
! FUNCTION: PifMgr_OpenProperties
|
||||
! FUNCTION: PifMgr_SetProperties
|
||||
! FUNCTION: PrepareDiscForBurnRunDllW
|
||||
! FUNCTION: PrintersGetCommand_RunDLL
|
||||
! FUNCTION: PrintersGetCommand_RunDLLA
|
||||
! FUNCTION: PrintersGetCommand_RunDLLW
|
||||
! FUNCTION: ReadCabinetState
|
||||
! FUNCTION: RealDriveType
|
||||
! FUNCTION: RealShellExecuteA
|
||||
! FUNCTION: RealShellExecuteExA
|
||||
! FUNCTION: RealShellExecuteExW
|
||||
! FUNCTION: RealShellExecuteW
|
||||
! FUNCTION: RegenerateUserEnvironment
|
||||
! FUNCTION: RestartDialog
|
||||
! FUNCTION: RestartDialogEx
|
||||
! FUNCTION: RunAsNewUser_RunDLLW
|
||||
! FUNCTION: SetCurrentProcessExplicitAppUserModelID
|
||||
! FUNCTION: SHAddDefaultPropertiesByExt
|
||||
! FUNCTION: SHAddFromPropSheetExtArray
|
||||
! FUNCTION: SHAddToRecentDocs
|
||||
! FUNCTION: SHAlloc
|
||||
! FUNCTION: SHAppBarMessage
|
||||
! FUNCTION: SHAssocEnumHandlers
|
||||
! FUNCTION: SHAssocEnumHandlersForProtocolByApplication
|
||||
! FUNCTION: SHBindToFolderIDListParent
|
||||
! FUNCTION: SHBindToFolderIDListParentEx
|
||||
! FUNCTION: SHBindToObject
|
||||
! FUNCTION: SHBrowseForFolder
|
||||
! FUNCTION: SHBrowseForFolderA
|
||||
! FUNCTION: SHBrowseForFolderW
|
||||
! FUNCTION: SHChangeNotification_Lock
|
||||
! FUNCTION: SHChangeNotification_Unlock
|
||||
! FUNCTION: SHChangeNotify
|
||||
! FUNCTION: SHChangeNotifyDeregister
|
||||
! FUNCTION: SHChangeNotifyRegister
|
||||
! FUNCTION: SHChangeNotifyRegisterThread
|
||||
! FUNCTION: SHChangeNotifySuspendResume
|
||||
! FUNCTION: SHCloneSpecialIDList
|
||||
! FUNCTION: SHCLSIDFromString
|
||||
! FUNCTION: SHCoCreateInstance
|
||||
! FUNCTION: SHCoCreateInstanceWorker
|
||||
! FUNCTION: SHCreateAssociationRegistration
|
||||
! FUNCTION: SHCreateCategoryEnum
|
||||
! FUNCTION: SHCreateDataObject
|
||||
! FUNCTION: SHCreateDefaultContextMenu
|
||||
! FUNCTION: SHCreateDefaultExtractIcon
|
||||
! FUNCTION: SHCreateDefaultPropertiesOp
|
||||
! FUNCTION: SHCreateDirectory
|
||||
! FUNCTION: SHCreateDirectoryExA
|
||||
! FUNCTION: SHCreateDirectoryExW
|
||||
! FUNCTION: SHCreateDrvExtIcon
|
||||
! FUNCTION: SHCreateFileExtractIconW
|
||||
! FUNCTION: SHCreateItemFromIDList
|
||||
! FUNCTION: SHCreateItemFromParsingName
|
||||
! FUNCTION: SHCreateItemFromRelativeName
|
||||
! FUNCTION: SHCreateItemInKnownFolder
|
||||
! FUNCTION: SHCreateItemWithParent
|
||||
! FUNCTION: SHCreateLocalServerRunDll
|
||||
! FUNCTION: SHCreateProcessAsUserW
|
||||
! FUNCTION: SHCreatePropSheetExtArray
|
||||
! FUNCTION: SHCreateQueryCancelAutoPlayMoniker
|
||||
! FUNCTION: SHCreateShellFolderView
|
||||
! FUNCTION: SHCreateShellFolderViewEx
|
||||
! FUNCTION: SHCreateShellItem
|
||||
! FUNCTION: SHCreateShellItemArray
|
||||
! FUNCTION: SHCreateShellItemArrayFromDataObject
|
||||
! FUNCTION: SHCreateShellItemArrayFromIDLists
|
||||
! FUNCTION: SHCreateShellItemArrayFromShellItem
|
||||
! FUNCTION: SHCreateStdEnumFmtEtc
|
||||
! FUNCTION: SHDefExtractIconA
|
||||
! FUNCTION: SHDefExtractIconW
|
||||
! FUNCTION: SHDestroyPropSheetExtArray
|
||||
! FUNCTION: SHDoDragDrop
|
||||
! FUNCTION: SheChangeDirA
|
||||
! FUNCTION: SheChangeDirExW
|
||||
! FUNCTION: SheGetDirA
|
||||
! FUNCTION: SHELL32_AddToBackIconTable
|
||||
! FUNCTION: SHELL32_AddToFrontIconTable
|
||||
! FUNCTION: SHELL32_AreAllItemsAvailable
|
||||
! FUNCTION: SHELL32_BindToFilePlaceholderHandler
|
||||
! FUNCTION: SHELL32_CallFileCopyHooks
|
||||
! FUNCTION: SHELL32_CanDisplayWin8CopyDialog
|
||||
! FUNCTION: SHELL32_CCommonPlacesFolder_CreateInstance
|
||||
! FUNCTION: SHELL32_CDBurn_CloseSession
|
||||
! FUNCTION: SHELL32_CDBurn_DriveSupportedForDataBurn
|
||||
! FUNCTION: SHELL32_CDBurn_Erase
|
||||
! FUNCTION: SHELL32_CDBurn_GetCDInfo
|
||||
! FUNCTION: SHELL32_CDBurn_GetLiveFSDiscInfo
|
||||
! FUNCTION: SHELL32_CDBurn_GetStagingPathOrNormalPath
|
||||
! FUNCTION: SHELL32_CDBurn_GetTaskInfo
|
||||
! FUNCTION: SHELL32_CDBurn_IsBlankDisc
|
||||
! FUNCTION: SHELL32_CDBurn_IsBlankDisc2
|
||||
! FUNCTION: SHELL32_CDBurn_IsLiveFS
|
||||
! FUNCTION: SHELL32_CDBurn_OnDeviceChange
|
||||
! FUNCTION: SHELL32_CDBurn_OnEject
|
||||
! FUNCTION: SHELL32_CDBurn_OnMediaChange
|
||||
! FUNCTION: SHELL32_CDefFolderMenu_Create2
|
||||
! FUNCTION: SHELL32_CDefFolderMenu_Create2Ex
|
||||
! FUNCTION: SHELL32_CDefFolderMenu_MergeMenu
|
||||
! FUNCTION: SHELL32_CDrives_CreateSFVCB
|
||||
! FUNCTION: SHELL32_CDrivesContextMenu_Create
|
||||
! FUNCTION: SHELL32_CDrivesDropTarget_Create
|
||||
! FUNCTION: SHELL32_CFillPropertiesTask_CreateInstance
|
||||
! FUNCTION: SHELL32_CFSDropTarget_CreateInstance
|
||||
! FUNCTION: SHELL32_CFSFolderCallback_Create
|
||||
! FUNCTION: SHELL32_CLibraryDropTarget_CreateInstance
|
||||
! FUNCTION: SHELL32_CLocationContextMenu_Create
|
||||
! FUNCTION: SHELL32_CLocationFolderUI_CreateInstance
|
||||
! FUNCTION: SHELL32_CloseAutoplayPrompt
|
||||
! FUNCTION: SHELL32_CMountPoint_DoAutorun
|
||||
! FUNCTION: SHELL32_CMountPoint_DoAutorunPrompt
|
||||
! FUNCTION: SHELL32_CMountPoint_IsAutoRunDriveAndEnabledByPolicy
|
||||
! FUNCTION: SHELL32_CMountPoint_ProcessAutoRunFile
|
||||
! FUNCTION: SHELL32_CMountPoint_WantAutorunUI
|
||||
! FUNCTION: SHELL32_CMountPoint_WantAutorunUIGetReady
|
||||
! FUNCTION: SHELL32_CommandLineFromMsiDescriptor
|
||||
! FUNCTION: SHELL32_CopyFilePlaceholderToNewFile
|
||||
! FUNCTION: SHELL32_CopySecondaryTiles
|
||||
! FUNCTION: SHELL32_CPL_CategoryIdArrayFromVariant
|
||||
! FUNCTION: SHELL32_CPL_IsLegacyCanonicalNameListedUnderKey
|
||||
! FUNCTION: SHELL32_CPL_ModifyWowDisplayName
|
||||
! FUNCTION: SHELL32_Create_IEnumUICommand
|
||||
! FUNCTION: SHELL32_CreateConfirmationInterrupt
|
||||
! FUNCTION: SHELL32_CreateConflictInterrupt
|
||||
! FUNCTION: SHELL32_CreateDefaultOperationDataProvider
|
||||
! FUNCTION: SHELL32_CreateFileFolderContextMenu
|
||||
! FUNCTION: SHELL32_CreateLinkInfoW
|
||||
! FUNCTION: SHELL32_CreatePlaceholderFile
|
||||
! FUNCTION: SHELL32_CreateQosRecorder
|
||||
! FUNCTION: SHELL32_CreateSharePointView
|
||||
! FUNCTION: SHELL32_CRecentDocsContextMenu_CreateInstance
|
||||
! FUNCTION: SHELL32_CSyncRootManager_CreateInstance
|
||||
! FUNCTION: SHELL32_CTransferConfirmation_CreateInstance
|
||||
! FUNCTION: SHELL32_DestroyLinkInfo
|
||||
! FUNCTION: SHELL32_EncryptDirectory
|
||||
! FUNCTION: SHELL32_EncryptedFileKeyInfo
|
||||
! FUNCTION: SHELL32_EnumCommonTasks
|
||||
! FUNCTION: SHELL32_FilePlaceholder_BindToPrimaryStream
|
||||
! FUNCTION: SHELL32_FilePlaceholder_CreateInstance
|
||||
! FUNCTION: SHELL32_FreeEncryptedFileKeyInfo
|
||||
! FUNCTION: SHELL32_GenerateAppID
|
||||
! FUNCTION: SHELL32_GetAppIDRoot
|
||||
! FUNCTION: SHELL32_GetCommandProviderForFolderType
|
||||
! FUNCTION: SHELL32_GetDiskCleanupPath
|
||||
! FUNCTION: SHELL32_GetDPIAdjustedLogicalSize
|
||||
! FUNCTION: SHELL32_GetFileNameFromBrowse
|
||||
! FUNCTION: SHELL32_GetIconOverlayManager
|
||||
! FUNCTION: SHELL32_GetLinkInfoData
|
||||
! FUNCTION: SHELL32_GetPlaceholderStatesFromFileAttributesAndReparsePointTag
|
||||
! FUNCTION: SHELL32_GetRatingBucket
|
||||
! FUNCTION: SHELL32_GetSkyDriveNetworkStates
|
||||
! FUNCTION: SHELL32_GetSqmableFileName
|
||||
! FUNCTION: SHELL32_GetThumbnailAdornerFromFactory
|
||||
! FUNCTION: SHELL32_GetThumbnailAdornerFromFactory2
|
||||
! FUNCTION: SHELL32_HandleUnrecognizedFileSystem
|
||||
! FUNCTION: SHELL32_IconCache_AboutToExtractIcons
|
||||
! FUNCTION: SHELL32_IconCache_DoneExtractingIcons
|
||||
! FUNCTION: SHELL32_IconCache_ExpandEnvAndSearchPath
|
||||
! FUNCTION: SHELL32_IconCache_RememberRecentlyExtractedIconsW
|
||||
! FUNCTION: SHELL32_IconCacheCreate
|
||||
! FUNCTION: SHELL32_IconCacheDestroy
|
||||
! FUNCTION: SHELL32_IconCacheHandleAssociationChanged
|
||||
! FUNCTION: SHELL32_IconCacheRestore
|
||||
! FUNCTION: SHELL32_IconOverlayManagerInit
|
||||
! FUNCTION: SHELL32_IsGetKeyboardLayoutPresent
|
||||
! FUNCTION: SHELL32_IsSystemUpgradeInProgress
|
||||
! FUNCTION: SHELL32_IsValidLinkInfo
|
||||
! FUNCTION: SHELL32_LegacyEnumSpecialTasksByType
|
||||
! FUNCTION: SHELL32_LegacyEnumTasks
|
||||
! FUNCTION: SHELL32_LookupBackIconIndex
|
||||
! FUNCTION: SHELL32_LookupFrontIconIndex
|
||||
! FUNCTION: SHELL32_NormalizeRating
|
||||
! FUNCTION: SHELL32_NotifyLinkTrackingServiceOfMove
|
||||
! FUNCTION: SHELL32_PifMgr_CloseProperties
|
||||
! FUNCTION: SHELL32_PifMgr_GetProperties
|
||||
! FUNCTION: SHELL32_PifMgr_OpenProperties
|
||||
! FUNCTION: SHELL32_PifMgr_SetProperties
|
||||
! FUNCTION: SHELL32_Printers_CreateBindInfo
|
||||
! FUNCTION: SHELL32_Printjob_GetPidl
|
||||
! FUNCTION: SHELL32_PurgeSystemIcon
|
||||
! FUNCTION: SHELL32_RefreshOverlayImages
|
||||
! FUNCTION: SHELL32_ResolveLinkInfoW
|
||||
! FUNCTION: SHELL32_SendToMenu_InvokeTargetedCommand
|
||||
! FUNCTION: SHELL32_SendToMenu_VerifyTargetedCommand
|
||||
! FUNCTION: SHELL32_SetPlaceholderReparsePointAttribute
|
||||
! FUNCTION: SHELL32_SetPlaceholderReparsePointAttribute2
|
||||
! FUNCTION: SHELL32_SHAddSparseIcon
|
||||
! FUNCTION: SHELL32_SHCreateByValueOperationInterrupt
|
||||
! FUNCTION: SHELL32_SHCreateDefaultContextMenu
|
||||
! FUNCTION: SHELL32_SHCreateLocalServer
|
||||
! FUNCTION: SHELL32_SHCreateShellFolderView
|
||||
! FUNCTION: SHELL32_SHDuplicateEncryptionInfoFile
|
||||
! FUNCTION: SHELL32_SHEncryptFile
|
||||
! FUNCTION: SHELL32_SHFormatDriveAsync
|
||||
! FUNCTION: SHELL32_SHGetThreadUndoManager
|
||||
! FUNCTION: SHELL32_SHGetUserNameW
|
||||
! FUNCTION: SHELL32_SHIsVirtualDevice
|
||||
! FUNCTION: SHELL32_SHLaunchPropSheet
|
||||
! FUNCTION: SHELL32_SHLogILFromFSIL
|
||||
! FUNCTION: SHELL32_SHOpenWithDialog
|
||||
! FUNCTION: SHELL32_ShowHideIconOnlyOnDesktop
|
||||
! FUNCTION: SHELL32_SHStartNetConnectionDialogW
|
||||
! FUNCTION: SHELL32_SHUICommandFromGUID
|
||||
! FUNCTION: SHELL32_SimpleRatingToFilterCondition
|
||||
! FUNCTION: SHELL32_StampIconForFile
|
||||
! FUNCTION: SHELL32_SuspendUndo
|
||||
! FUNCTION: SHELL32_TryVirtualDiscImageDriveEject
|
||||
! FUNCTION: SHELL32_UpdateFilePlaceholderStates
|
||||
! FUNCTION: SHELL32_VerifySaferTrust
|
||||
! FUNCTION: Shell_GetCachedImageIndex
|
||||
! FUNCTION: Shell_GetCachedImageIndexA
|
||||
! FUNCTION: Shell_GetCachedImageIndexW
|
||||
! FUNCTION: Shell_GetImageLists
|
||||
! FUNCTION: Shell_MergeMenus
|
||||
! FUNCTION: Shell_NotifyIconA
|
||||
! FUNCTION: Shell_NotifyIconGetRect
|
||||
! FUNCTION: Shell_NotifyIconW
|
||||
! FUNCTION: ShellAboutA
|
||||
! FUNCTION: ShellAboutW
|
||||
! FUNCTION: ShellExec_RunDLL
|
||||
! FUNCTION: ShellExec_RunDLLA
|
||||
! FUNCTION: ShellExec_RunDLLW
|
||||
! FUNCTION: ShellExecuteA
|
||||
! FUNCTION: ShellExecuteEx
|
||||
! FUNCTION: ShellExecuteExA
|
||||
! FUNCTION: ShellExecuteExW
|
||||
! FUNCTION: ShellHookProc
|
||||
! FUNCTION: ShellMessageBoxA
|
||||
! FUNCTION: ShellMessageBoxW
|
||||
! FUNCTION: SHEmptyRecycleBinA
|
||||
! FUNCTION: SHEmptyRecycleBinW
|
||||
! FUNCTION: SHEnableServiceObject
|
||||
! FUNCTION: SHEnumerateUnreadMailAccountsW
|
||||
! FUNCTION: SheSetCurDrive
|
||||
! FUNCTION: SHEvaluateSystemCommandTemplate
|
||||
! FUNCTION: SHExtractIconsW
|
||||
! FUNCTION: SHFileOperation
|
||||
! FUNCTION: SHFileOperationA
|
||||
! FUNCTION: SHFileOperationW
|
||||
! FUNCTION: SHFind_InitMenuPopup
|
||||
! FUNCTION: SHFindFiles
|
||||
! FUNCTION: SHFlushSFCache
|
||||
! FUNCTION: SHFormatDrive
|
||||
! FUNCTION: SHFree
|
||||
! FUNCTION: SHFreeNameMappings
|
||||
! FUNCTION: SHGetAttributesFromDataObject
|
||||
! FUNCTION: SHGetDataFromIDListA
|
||||
! FUNCTION: SHGetDataFromIDListW
|
||||
! FUNCTION: SHGetDiskFreeSpaceA
|
||||
! FUNCTION: SHGetDiskFreeSpaceExA
|
||||
! FUNCTION: SHGetDiskFreeSpaceExW
|
||||
! FUNCTION: SHGetDriveMedia
|
||||
! FUNCTION: SHGetFileInfo
|
||||
! FUNCTION: SHGetFileInfoA
|
||||
! FUNCTION: SHGetFolderLocation
|
||||
! FUNCTION: SHGetFolderPathA
|
||||
! FUNCTION: SHGetFolderPathAndSubDirA
|
||||
! FUNCTION: SHGetFolderPathAndSubDirW
|
||||
! FUNCTION: SHGetFolderPathEx
|
||||
! FUNCTION: SHGetIconOverlayIndexA
|
||||
! FUNCTION: SHGetIconOverlayIndexW
|
||||
! FUNCTION: SHGetIDListFromObject
|
||||
! FUNCTION: SHGetImageList
|
||||
! FUNCTION: SHGetInstanceExplorer
|
||||
! FUNCTION: SHGetItemFromDataObject
|
||||
! FUNCTION: SHGetItemFromObject
|
||||
! FUNCTION: SHGetKnownFolderIDList
|
||||
! FUNCTION: SHGetKnownFolderItem
|
||||
! FUNCTION: SHGetKnownFolderPath
|
||||
! FUNCTION: SHGetLocalizedName
|
||||
! FUNCTION: SHGetMalloc
|
||||
! FUNCTION: SHGetNameFromIDList
|
||||
! FUNCTION: SHGetNewLinkInfo
|
||||
! FUNCTION: SHGetNewLinkInfoA
|
||||
! FUNCTION: SHGetNewLinkInfoW
|
||||
! FUNCTION: SHGetPathFromIDList
|
||||
! FUNCTION: SHGetPathFromIDListA
|
||||
! FUNCTION: SHGetPathFromIDListEx
|
||||
! FUNCTION: SHGetPathFromIDListW
|
||||
! FUNCTION: SHGetPropertyStoreForWindow
|
||||
! FUNCTION: SHGetPropertyStoreFromIDList
|
||||
! FUNCTION: SHGetPropertyStoreFromParsingName
|
||||
! FUNCTION: SHGetRealIDL
|
||||
! FUNCTION: SHGetSetFolderCustomSettings
|
||||
! FUNCTION: SHGetSetSettings
|
||||
! FUNCTION: SHGetSettings
|
||||
! FUNCTION: SHGetSpecialFolderLocation
|
||||
! FUNCTION: SHGetSpecialFolderPathA
|
||||
! FUNCTION: SHGetSpecialFolderPathW
|
||||
! FUNCTION: SHGetStockIconInfo
|
||||
! FUNCTION: SHGetTemporaryPropertyForItem
|
||||
! FUNCTION: SHGetUnreadMailCountW
|
||||
! FUNCTION: SHHandleUpdateImage
|
||||
! FUNCTION: SHHelpShortcuts_RunDLL
|
||||
! FUNCTION: SHHelpShortcuts_RunDLLA
|
||||
! FUNCTION: SHHelpShortcuts_RunDLLW
|
||||
! FUNCTION: SHILCreateFromPath
|
||||
! FUNCTION: SHInvokePrinterCommandA
|
||||
! FUNCTION: SHInvokePrinterCommandW
|
||||
! FUNCTION: SHIsFileAvailableOffline
|
||||
! FUNCTION: SHLimitInputEdit
|
||||
! FUNCTION: SHLoadInProc
|
||||
! FUNCTION: SHLoadNonloadedIconOverlayIdentifiers
|
||||
! FUNCTION: SHMapPIDLToSystemImageListIndex
|
||||
! FUNCTION: SHMultiFileProperties
|
||||
! FUNCTION: SHObjectProperties
|
||||
! FUNCTION: SHOpenFolderAndSelectItems
|
||||
! FUNCTION: SHOpenPropSheetW
|
||||
! FUNCTION: SHOpenWithDialog
|
||||
! FUNCTION: SHParseDisplayName
|
||||
! FUNCTION: SHPathPrepareForWriteA
|
||||
! FUNCTION: SHPathPrepareForWriteW
|
||||
! FUNCTION: SHPropStgCreate
|
||||
! FUNCTION: SHPropStgReadMultiple
|
||||
! FUNCTION: SHPropStgWriteMultiple
|
||||
! FUNCTION: SHQueryRecycleBinA
|
||||
! FUNCTION: SHQueryRecycleBinW
|
||||
! FUNCTION: SHQueryUserNotificationState
|
||||
! FUNCTION: SHRemoveLocalizedName
|
||||
! FUNCTION: SHReplaceFromPropSheetExtArray
|
||||
! FUNCTION: SHResolveLibrary
|
||||
! FUNCTION: SHRestricted
|
||||
! FUNCTION: SHSetDefaultProperties
|
||||
! FUNCTION: SHSetFolderPathA
|
||||
! FUNCTION: SHSetFolderPathW
|
||||
! FUNCTION: SHSetInstanceExplorer
|
||||
! FUNCTION: SHSetKnownFolderPath
|
||||
! FUNCTION: SHSetLocalizedName
|
||||
! FUNCTION: SHSetTemporaryPropertyForItem
|
||||
! FUNCTION: SHSetUnreadMailCountW
|
||||
! FUNCTION: SHShellFolderView_Message
|
||||
! FUNCTION: SHShowManageLibraryUI
|
||||
! FUNCTION: SHSimpleIDListFromPath
|
||||
! FUNCTION: SHStartNetConnectionDialogW
|
||||
! FUNCTION: SHTestTokenMembership
|
||||
! FUNCTION: SHUpdateImageA
|
||||
! FUNCTION: SHUpdateImageW
|
||||
! FUNCTION: SHUpdateRecycleBinIcon
|
||||
! FUNCTION: SHValidateUNC
|
||||
! FUNCTION: SignalFileOpen
|
||||
! FUNCTION: StgMakeUniqueName
|
||||
! FUNCTION: StrChrA
|
||||
! FUNCTION: StrChrIA
|
||||
! FUNCTION: StrChrIW
|
||||
! FUNCTION: StrChrW
|
||||
! FUNCTION: StrCmpNA
|
||||
! FUNCTION: StrCmpNIA
|
||||
! FUNCTION: StrCmpNIW
|
||||
! FUNCTION: StrCmpNW
|
||||
! FUNCTION: StrNCmpA
|
||||
! FUNCTION: StrNCmpIA
|
||||
! FUNCTION: StrNCmpIW
|
||||
! FUNCTION: StrNCmpW
|
||||
! FUNCTION: StrRChrA
|
||||
! FUNCTION: StrRChrIA
|
||||
! FUNCTION: StrRChrIW
|
||||
! FUNCTION: StrRChrW
|
||||
! FUNCTION: StrRStrA
|
||||
! FUNCTION: StrRStrIA
|
||||
! FUNCTION: StrRStrIW
|
||||
! FUNCTION: StrRStrW
|
||||
! FUNCTION: StrStrA
|
||||
! FUNCTION: StrStrIA
|
||||
! FUNCTION: StrStrIW
|
||||
! FUNCTION: StrStrW
|
||||
! FUNCTION: UsersLibrariesFolderUI_CreateInstance
|
||||
! FUNCTION: WaitForExplorerRestartW
|
||||
! FUNCTION: Win32DeleteFile
|
||||
! FUNCTION: WOWShellExecute
|
||||
! FUNCTION: WriteCabinetState
|
||||
|
|
|
@ -183,11 +183,11 @@ CONSTANT: CF_LOCALE 16
|
|||
CONSTANT: CF_DIBV5 17
|
||||
CONSTANT: CF_MAX 18
|
||||
|
||||
CONSTANT: CF_OWNERDISPLAY 0x0080
|
||||
CONSTANT: CF_DSPTEXT 0x0081
|
||||
CONSTANT: CF_DSPBITMAP 0x0082
|
||||
CONSTANT: CF_DSPMETAFILEPICT 0x0083
|
||||
CONSTANT: CF_DSPENHMETAFILE 0x008E
|
||||
CONSTANT: CF_OWNERDISPLAY 0x0080
|
||||
CONSTANT: CF_DSPTEXT 0x0081
|
||||
CONSTANT: CF_DSPBITMAP 0x0082
|
||||
CONSTANT: CF_DSPMETAFILEPICT 0x0083
|
||||
CONSTANT: CF_DSPENHMETAFILE 0x008E
|
||||
|
||||
! "Private" formats don't get GlobalFree()'d
|
||||
CONSTANT: CF_PRIVATEFIRST 0x200
|
||||
|
|
5
build.sh
5
build.sh
|
@ -689,7 +689,7 @@ make_boot_image() {
|
|||
}
|
||||
|
||||
install_deps_apt() {
|
||||
sudo apt install --yes libc6-dev libpango1.0-dev libx11-dev xorg-dev libgtk2.0-dev gtk2-engines-pixbuf libgtkglext1-dev wget git git-doc rlwrap clang gcc make screen tmux libssl-dev g++
|
||||
sudo apt install --yes libc6-dev libpango1.0-dev libx11-dev xorg-dev libgtk2.0-dev gtk2-engines-pixbuf libgtkglext1-dev wget git git-doc rlwrap clang make screen tmux libssl-dev
|
||||
check_ret sudo
|
||||
}
|
||||
|
||||
|
@ -732,6 +732,8 @@ usage() {
|
|||
$ECHO " self-update - git pull, recompile, make local boot image, bootstrap"
|
||||
$ECHO " quick-update - git pull, refresh-all, save"
|
||||
$ECHO " update|latest - git pull, recompile, download a boot image, bootstrap"
|
||||
$ECHO " compile - compile the binary"
|
||||
$ECHO " recompile - recompile the binary"
|
||||
$ECHO " bootstrap - bootstrap with existing boot image"
|
||||
$ECHO " net-bootstrap - recompile, download a boot image, bootstrap"
|
||||
$ECHO " make-target - find and print the os-arch-cpu string"
|
||||
|
@ -773,6 +775,7 @@ case "$1" in
|
|||
quick-update) update; refresh_image ;;
|
||||
update|latest) update; download_and_bootstrap ;;
|
||||
compile) find_build_info; make_factor ;;
|
||||
recompile) find_build_info; make_clean; make_factor ;;
|
||||
bootstrap) get_config_info; bootstrap ;;
|
||||
net-bootstrap) net_bootstrap_no_pull ;;
|
||||
make-target) FIND_MAKE_TARGET=true; ECHO=false; find_build_info; exit_script ;;
|
||||
|
|
|
@ -24,7 +24,7 @@ IN: ascii
|
|||
[ [ 1 ] when-zero cut-slice swap ]
|
||||
[ f 0 rot [ length ] keep <slice> ] if*
|
||||
] produce nip ;
|
||||
: capitalize ( str -- str' ) unclip [ >lower ] [ ch>upper ] bi* prefix ;
|
||||
: capitalize ( str -- str' ) >lower 0 over [ ch>upper ] change-nth ;
|
||||
: >title ( str -- title ) >words [ capitalize ] map concat ;
|
||||
|
||||
HINTS: >lower string ;
|
||||
|
|
|
@ -40,8 +40,8 @@ HELP: checksum-file
|
|||
{ $examples
|
||||
{ $example
|
||||
"USING: checksums checksums.crc32 prettyprint ;"
|
||||
"\"resource:LICENSE.txt\" crc32 checksum-file ."
|
||||
"B{ 125 29 106 28 }"
|
||||
"\"resource:core/checksums/crc32/crc-me.txt\" crc32 checksum-file ."
|
||||
"B{ 196 202 117 155 }"
|
||||
}
|
||||
} ;
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
crc me 123
|
|
@ -1,8 +1,8 @@
|
|||
! Copyright (C) 2006, 2010 Slava Pestov, Daniel Ehrenberg.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors arrays assocs hashtables kernel kernel.private
|
||||
make math math.order math.private quotations sequences
|
||||
sequences.private sets sorting words ;
|
||||
USING: accessors arrays assocs byte-arrays hashtables kernel
|
||||
kernel.private make math math.order math.private quotations
|
||||
sequences sequences.private sets sorting words ;
|
||||
IN: combinators
|
||||
|
||||
! Most of these combinators have compile-time expansions in
|
||||
|
@ -198,6 +198,8 @@ M: sequence hashcode* [ sequence-hashcode ] recursive-hashcode ;
|
|||
|
||||
M: array hashcode* [ sequence-hashcode ] recursive-hashcode ;
|
||||
|
||||
M: byte-array hashcode* [ sequence-hashcode ] recursive-hashcode ;
|
||||
|
||||
M: reversed hashcode* [ sequence-hashcode ] recursive-hashcode ;
|
||||
|
||||
M: slice hashcode* [ sequence-hashcode ] recursive-hashcode ;
|
||||
|
|
|
@ -99,6 +99,12 @@ IN: generalizations.tests
|
|||
{ { 1 2 } { 3 4 } { 5 6 } }
|
||||
[ 1 2 3 4 5 6 [ 2array ] 2 3 mnapply ] unit-test
|
||||
|
||||
{ 1 4 9 16 }
|
||||
[ 1 1 2 2 3 3 4 4 [ * ] 2 4 mnapply ] unit-test
|
||||
|
||||
{ 1 8 27 64 125 }
|
||||
[ 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 [ * * ] 3 5 mnapply ] unit-test
|
||||
|
||||
{ { 1 2 3 } { 4 5 6 } }
|
||||
[ 1 2 3 4 5 6 [ 3array ] 3 2 mnapply ] unit-test
|
||||
|
||||
|
|
|
@ -92,10 +92,10 @@ MACRO: nspread* ( m n -- quot )
|
|||
[ drop [ ] ] [
|
||||
[ * 0 ] [ drop neg ] 2bi
|
||||
<range> rest >array dup length <iota> <reversed>
|
||||
[
|
||||
'[ [ [ _ ndip ] curry ] _ ndip ]
|
||||
] 2map dup rest-slice [ [ compose ] compose ] map! drop
|
||||
[ ] concat-as [ call ] compose
|
||||
[ '[ [ [ _ ndip ] curry ] _ ndip ] ] 2map
|
||||
[ [ ] concat-as ]
|
||||
[ length 1 - [ compose ] <array> concat append ] bi
|
||||
[ call ] compose
|
||||
] if-zero ;
|
||||
|
||||
MACRO: cleave* ( n -- quot )
|
||||
|
|
|
@ -25,7 +25,5 @@ HOOK: normalize-path io-backend ( path -- path' )
|
|||
io-backend set-global init-io init-stdio
|
||||
"io.files" startup-hooks get at call( -- ) ;
|
||||
|
||||
! Note that we have 'alien' in our using list so that the alien
|
||||
! init hook runs before this one.
|
||||
[ init-io embedded? [ init-stdio ] unless ]
|
||||
"io.backend" add-startup-hook
|
||||
|
|
|
@ -4,7 +4,9 @@ USING: accessors arrays classes combinators compiler.units
|
|||
continuations definitions effects io io.encodings.utf8 io.files
|
||||
kernel lexer math.parser namespaces parser.notes quotations
|
||||
sequences sets slots source-files splitting syntax.modern
|
||||
vectors vocabs vocabs.parser words words.symbol ;
|
||||
vectors vocabs vocabs.parser words words.symbol
|
||||
sequences sets slots source-files vectors vocabs vocabs.parser
|
||||
words words.symbol ;
|
||||
IN: parser
|
||||
|
||||
: location ( -- loc )
|
||||
|
@ -217,7 +219,7 @@ INITIALIZED-SYMBOL: print-use-hook [ [ ] ]
|
|||
: filter-moved ( set1 set2 -- seq )
|
||||
swap diff members [
|
||||
{
|
||||
{ [ dup where dup [ first ] when current-source-file get path>> = not ] [ f ] }
|
||||
{ [ dup where ?first current-source-file get path>> = not ] [ f ] }
|
||||
{ [ dup reader-method? ] [ f ] }
|
||||
{ [ dup writer-method? ] [ f ] }
|
||||
[ t ]
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
John Benediktsson
|
|
@ -0,0 +1,14 @@
|
|||
USING: base16 byte-arrays kernel sequences tools.test ;
|
||||
|
||||
{ t } [ 256 <iota> >byte-array dup >base16 base16> = ] unit-test
|
||||
|
||||
{ "00" } [ B{ 0 } >base16 "" like ] unit-test
|
||||
{ "01" } [ B{ 1 } >base16 "" like ] unit-test
|
||||
{ "0102" } [ B{ 1 2 } >base16 "" like ] unit-test
|
||||
|
||||
{ B{ 0 } } [ "00" base16> ] unit-test
|
||||
{ B{ 1 } } [ "01" base16> ] unit-test
|
||||
{ B{ 1 2 } } [ "0102" base16> ] unit-test
|
||||
|
||||
[ "0" base16> ] [ malformed-base16? ] must-fail-with
|
||||
[ "Z" base16> ] [ malformed-base16? ] must-fail-with
|
|
@ -0,0 +1,57 @@
|
|||
! Copyright (C) 2019 John Benediktsson.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: base64.private byte-arrays combinators io
|
||||
io.encodings.binary io.streams.byte-array kernel literals locals
|
||||
math namespaces sequences ;
|
||||
IN: base16
|
||||
|
||||
ERROR: malformed-base16 ;
|
||||
|
||||
! XXX: Optional handle lower-case input
|
||||
|
||||
<PRIVATE
|
||||
|
||||
<<
|
||||
CONSTANT: alphabet $[ "0123456789ABCDEF" >byte-array ]
|
||||
>>
|
||||
|
||||
: ch>base16 ( ch -- ch )
|
||||
alphabet nth ; inline
|
||||
|
||||
: base16>ch ( ch -- ch )
|
||||
$[ alphabet alphabet-inverse ] nth
|
||||
[ malformed-base16 ] unless* ; inline
|
||||
|
||||
:: (encode-base16) ( stream -- )
|
||||
stream stream-read1 [
|
||||
16 /mod [ ch>base16 write1 ] bi@
|
||||
stream (encode-base16)
|
||||
] when* ;
|
||||
|
||||
PRIVATE>
|
||||
|
||||
: encode-base16 ( -- )
|
||||
input-stream get (encode-base16) ;
|
||||
|
||||
<PRIVATE
|
||||
|
||||
: decode2 ( seq -- n )
|
||||
first2 [ base16>ch ] bi@ [ 16 * ] [ + ] bi* ;
|
||||
|
||||
:: (decode-base16) ( stream -- )
|
||||
2 stream stream-read dup length {
|
||||
{ 0 [ drop ] }
|
||||
{ 2 [ decode2 write1 stream (decode-base16) ] }
|
||||
[ malformed-base16 ]
|
||||
} case ;
|
||||
|
||||
PRIVATE>
|
||||
|
||||
: decode-base16 ( -- )
|
||||
input-stream get (decode-base16) ;
|
||||
|
||||
: >base16 ( seq -- base16 )
|
||||
binary [ binary [ encode-base16 ] with-byte-reader ] with-byte-writer ;
|
||||
|
||||
: base16> ( base16 -- seq )
|
||||
binary [ binary [ decode-base16 ] with-byte-reader ] with-byte-writer ;
|
|
@ -0,0 +1 @@
|
|||
Base 16 encoding/decoding (RFC 3548)
|
|
@ -0,0 +1 @@
|
|||
John Benediktsson
|
|
@ -0,0 +1,20 @@
|
|||
! Copyright (C) 2019 John Benediktsson
|
||||
! See http://factorcode.org/license.txt for BSD license
|
||||
|
||||
USING: base32-crockford tools.test ;
|
||||
|
||||
{ "16J" } [ 1234 base32-crockford> ] unit-test
|
||||
{ "16JD" } [ 1234 base32-crockford-checksum> ] unit-test
|
||||
{ "0" } [ 0 base32-crockford> ] unit-test
|
||||
{ "00" } [ 0 base32-crockford-checksum> ] unit-test
|
||||
[ -1 base32-crockford> ] must-fail
|
||||
[ 1.0 base32-crockford> ] must-fail
|
||||
|
||||
{ 1234 } [ "16J" >base32-crockford ] unit-test
|
||||
{ 1234 } [ "I6J" >base32-crockford ] unit-test
|
||||
{ 1234 } [ "i6J" >base32-crockford ] unit-test
|
||||
{ 1234 } [ "16JD" >base32-crockford-checksum ] unit-test
|
||||
{ 1234 } [ "I6JD" >base32-crockford-checksum ] unit-test
|
||||
{ 1234 } [ "i6JD" >base32-crockford-checksum ] unit-test
|
||||
{ 0 } [ "0" >base32-crockford ] unit-test
|
||||
{ 0 } [ "00" >base32-crockford-checksum ] unit-test
|
|
@ -0,0 +1,43 @@
|
|||
! Copyright (C) 2019 John Benediktsson
|
||||
! See http://factorcode.org/license.txt for BSD license
|
||||
|
||||
USING: ascii assocs byte-arrays kernel literals math sequences ;
|
||||
|
||||
IN: base32-crockford
|
||||
|
||||
<PRIVATE
|
||||
|
||||
<<
|
||||
CONSTANT: ALPHABET $[ "0123456789ABCDEFGHJKMNPQRSTVWXYZ" >byte-array ]
|
||||
>>
|
||||
|
||||
CONSTANT: INVERSE $[ 256 [ ALPHABET index 0xff or ] B{ } map-integers ]
|
||||
|
||||
CONSTANT: CHECKSUM $[ ALPHABET "*~$=U" append ]
|
||||
|
||||
: normalize-base32 ( seq -- seq' )
|
||||
CHAR: - swap remove >upper H{
|
||||
{ CHAR: I CHAR: 1 }
|
||||
{ CHAR: L CHAR: 1 }
|
||||
{ CHAR: O CHAR: 0 }
|
||||
} substitute ;
|
||||
|
||||
: parse-base32 ( seq -- base32 )
|
||||
0 swap [ [ 32 * ] [ INVERSE nth + ] bi* ] each ;
|
||||
|
||||
PRIVATE>
|
||||
|
||||
: >base32-crockford ( seq -- base32 )
|
||||
normalize-base32 parse-base32 ;
|
||||
|
||||
: base32-crockford> ( base32 -- seq )
|
||||
dup 0 < [ non-negative-integer-expected ] when
|
||||
[ dup 0 > ] [ 32 /mod ALPHABET nth ] "" produce-as nip
|
||||
[ "0" ] when-empty reverse! ;
|
||||
|
||||
: >base32-crockford-checksum ( seq -- base32 )
|
||||
normalize-base32 unclip-last [ parse-base32 ] dip
|
||||
CHECKSUM index over 37 mod assert= ;
|
||||
|
||||
: base32-crockford-checksum> ( base32 -- seq )
|
||||
[ base32-crockford> ] keep 37 mod CHECKSUM nth suffix ;
|
|
@ -0,0 +1 @@
|
|||
Douglas Crockford's Base 32 encoding/decoding
|
|
@ -0,0 +1 @@
|
|||
John Benediktsson
|
|
@ -1,20 +1,24 @@
|
|||
! Copyright (C) 2019 John Benediktsson
|
||||
! See http://factorcode.org/license.txt for BSD license
|
||||
|
||||
USING: base32 tools.test ;
|
||||
USING: base32 byte-arrays kernel sequences tools.test ;
|
||||
|
||||
{ "16J" } [ 1234 base32> ] unit-test
|
||||
{ "16JD" } [ 1234 base32-checksum> ] unit-test
|
||||
{ "0" } [ 0 base32> ] unit-test
|
||||
{ "00" } [ 0 base32-checksum> ] unit-test
|
||||
[ -1 base32> ] must-fail
|
||||
[ 1.0 base32> ] must-fail
|
||||
{ t } [ 256 <iota> >byte-array dup >base32 base32> = ] unit-test
|
||||
|
||||
{ 1234 } [ "16J" >base32 ] unit-test
|
||||
{ 1234 } [ "I6J" >base32 ] unit-test
|
||||
{ 1234 } [ "i6J" >base32 ] unit-test
|
||||
{ 1234 } [ "16JD" >base32-checksum ] unit-test
|
||||
{ 1234 } [ "I6JD" >base32-checksum ] unit-test
|
||||
{ 1234 } [ "i6JD" >base32-checksum ] unit-test
|
||||
{ 0 } [ "0" >base32 ] unit-test
|
||||
{ 0 } [ "00" >base32-checksum ] unit-test
|
||||
{ B{ } } [ f >base32 ] unit-test
|
||||
{ B{ } } [ B{ } >base32 ] unit-test
|
||||
{ "AA======" } [ "\0" >base32 "" like ] unit-test
|
||||
{ "ME======" } [ "a" >base32 "" like ] unit-test
|
||||
{ "MFRA====" } [ "ab" >base32 "" like ] unit-test
|
||||
{ "MFRGG===" } [ "abc" >base32 "" like ] unit-test
|
||||
{ "MFRGGZA=" } [ "abcd" >base32 "" like ] unit-test
|
||||
{ "MFRGGZDF" } [ "abcde" >base32 "" like ] unit-test
|
||||
|
||||
{ B{ } } [ f base32> ] unit-test
|
||||
{ B{ } } [ B{ } base32> ] unit-test
|
||||
{ "\0" } [ "AA======" base32> "" like ] unit-test
|
||||
{ "a" } [ "ME======" base32> "" like ] unit-test
|
||||
{ "ab" } [ "MFRA====" base32> "" like ] unit-test
|
||||
{ "abc" } [ "MFRGG===" base32> "" like ] unit-test
|
||||
{ "abcd" } [ "MFRGGZA=" base32> "" like ] unit-test
|
||||
{ "abcde" } [ "MFRGGZDF" base32> "" like ] unit-test
|
||||
|
|
|
@ -1,41 +1,77 @@
|
|||
! Copyright (C) 2019 John Benediktsson
|
||||
! See http://factorcode.org/license.txt for BSD license
|
||||
|
||||
USING: ascii assocs kernel literals math sequences ;
|
||||
|
||||
USING: base64.private byte-arrays combinators fry io io.binary
|
||||
io.encodings.binary io.streams.byte-array kernel literals math
|
||||
namespaces sequences ;
|
||||
IN: base32
|
||||
|
||||
ERROR: malformed-base32 ;
|
||||
|
||||
! XXX: Optional map 0 as O
|
||||
! XXX: Optional map 1 as L or I
|
||||
! XXX: Optional handle lower-case input
|
||||
|
||||
<PRIVATE
|
||||
|
||||
<<
|
||||
CONSTANT: ALPHABET "0123456789ABCDEFGHJKMNPQRSTVWXYZ"
|
||||
CONSTANT: alphabet $[ "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567" >byte-array ]
|
||||
>>
|
||||
CONSTANT: CHECKSUM $[ ALPHABET "*~$=U" append ]
|
||||
|
||||
: normalize-base32 ( seq -- seq' )
|
||||
CHAR: - swap remove >upper H{
|
||||
{ CHAR: I CHAR: 1 }
|
||||
{ CHAR: L CHAR: 1 }
|
||||
{ CHAR: O CHAR: 0 }
|
||||
} substitute ;
|
||||
: ch>base32 ( ch -- ch )
|
||||
alphabet nth ; inline
|
||||
|
||||
: parse-base32 ( seq -- base32 )
|
||||
0 swap [ [ 32 * ] [ ALPHABET index + ] bi* ] each ;
|
||||
: base32>ch ( ch -- ch )
|
||||
$[ alphabet alphabet-inverse 0 CHAR: = pick set-nth ] nth
|
||||
[ malformed-base32 ] unless* ; inline
|
||||
|
||||
: encode5 ( seq -- byte-array )
|
||||
be> { -35 -30 -25 -20 -15 -10 -5 0 } '[
|
||||
shift 0x1f bitand ch>base32
|
||||
] with B{ } map-as ; inline
|
||||
|
||||
: encode-pad ( seq n -- byte-array )
|
||||
[ 5 0 pad-tail encode5 ] [ B{ 0 2 4 5 7 } nth ] bi* head-slice
|
||||
8 CHAR: = pad-tail ; inline
|
||||
|
||||
: (encode-base32) ( stream column -- )
|
||||
5 pick stream-read dup length {
|
||||
{ 0 [ 3drop ] }
|
||||
{ 5 [ encode5 write-lines (encode-base32) ] }
|
||||
[ encode-pad write-lines (encode-base32) ]
|
||||
} case ;
|
||||
|
||||
PRIVATE>
|
||||
|
||||
: encode-base32 ( -- )
|
||||
input-stream get f (encode-base32) ;
|
||||
|
||||
: encode-base32-lines ( -- )
|
||||
input-stream get 0 (encode-base32) ;
|
||||
|
||||
<PRIVATE
|
||||
|
||||
: decode8 ( seq -- )
|
||||
[ 0 [ base32>ch swap 5 shift bitor ] reduce 5 >be ]
|
||||
[ [ CHAR: = = ] count ] bi
|
||||
[ write ] [ B{ 0 4 0 3 2 0 1 } nth head-slice write ] if-zero ; inline
|
||||
|
||||
: (decode-base32) ( stream -- )
|
||||
8 "\n\r" pick read-ignoring dup length {
|
||||
{ 0 [ 2drop ] }
|
||||
{ 8 [ decode8 (decode-base32) ] }
|
||||
[ drop 8 CHAR: = pad-tail decode8 (decode-base32) ]
|
||||
} case ;
|
||||
|
||||
PRIVATE>
|
||||
|
||||
: decode-base32 ( -- )
|
||||
input-stream get (decode-base32) ;
|
||||
|
||||
: >base32 ( seq -- base32 )
|
||||
normalize-base32 parse-base32 ;
|
||||
binary [ binary [ encode-base32 ] with-byte-reader ] with-byte-writer ;
|
||||
|
||||
: base32> ( base32 -- seq )
|
||||
dup 0 < [ non-negative-integer-expected ] when
|
||||
[ dup 0 > ] [
|
||||
32 /mod ALPHABET nth
|
||||
] "" produce-as nip [ "0" ] when-empty reverse! ;
|
||||
binary [ binary [ decode-base32 ] with-byte-reader ] with-byte-writer ;
|
||||
|
||||
: >base32-checksum ( seq -- base32 )
|
||||
normalize-base32 unclip-last [ parse-base32 ] dip
|
||||
CHECKSUM index over 37 mod assert= ;
|
||||
|
||||
: base32-checksum> ( base32 -- seq )
|
||||
[ base32> ] keep 37 mod CHECKSUM nth suffix ;
|
||||
: >base32-lines ( seq -- base32 )
|
||||
binary [ binary [ encode-base32-lines ] with-byte-reader ] with-byte-writer ;
|
||||
|
|
|
@ -1 +1 @@
|
|||
Douglas Crockford's Base 32 encoding/decoding
|
||||
Base 32 encoding/decoding (RFC 3548)
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
USING: base85 kernel strings tools.test ;
|
||||
USING: base85 byte-arrays kernel sequences strings tools.test ;
|
||||
|
||||
{ t } [ "Hello, world" dup >base85 base85> >string = ] unit-test
|
||||
{ t } [ "ready" dup >base85 base85> >string = ] unit-test
|
||||
{ t } [ 256 <iota> >byte-array dup >base85 base85> = ] unit-test
|
||||
|
||||
{ "NM!" } [ "He" >base85 >string ] unit-test
|
||||
{ t } [ "He" dup >base85 base85> >string = ] unit-test
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
! Copyright (C) 2013 John Benediktsson.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: base64.private combinators io io.binary
|
||||
USING: base64.private byte-arrays combinators io io.binary
|
||||
io.encodings.binary io.streams.byte-array kernel literals math
|
||||
namespaces sequences ;
|
||||
IN: base85
|
||||
|
@ -10,9 +10,12 @@ ERROR: malformed-base85 ;
|
|||
<PRIVATE
|
||||
|
||||
<<
|
||||
CONSTANT: alphabet
|
||||
CONSTANT: alphabet $[
|
||||
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~"
|
||||
>byte-array
|
||||
]
|
||||
>>
|
||||
|
||||
: ch>base85 ( ch -- ch )
|
||||
alphabet nth ; inline
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
John Benediktsson
|
|
@ -0,0 +1,23 @@
|
|||
USING: base91 byte-arrays kernel sequences tools.test ;
|
||||
|
||||
{ t } [ 256 <iota> >byte-array dup >base91 base91> = ] unit-test
|
||||
|
||||
{ B{ } } [ f >base91 ] unit-test
|
||||
{ "AA" } [ B{ 0 } >base91 "" like ] unit-test
|
||||
{ "GB" } [ "a" >base91 "" like ] unit-test
|
||||
{ "#GD" } [ "ab" >base91 "" like ] unit-test
|
||||
{ "#G(I" } [ "abc" >base91 "" like ] unit-test
|
||||
{ "#G(IZ" } [ "abcd" >base91 "" like ] unit-test
|
||||
{ "#G(Ic,A" } [ "abcde" >base91 "" like ] unit-test
|
||||
{ "#G(Ic,WC" } [ "abcdef" >base91 "" like ] unit-test
|
||||
{ "#G(Ic,5pG" } [ "abcdefg" >base91 "" like ] unit-test
|
||||
|
||||
{ B{ } } [ f base91> ] unit-test
|
||||
{ "\0" } [ "AA" base91> "" like ] unit-test
|
||||
{ "a" } [ "GB" base91> "" like ] unit-test
|
||||
{ "ab" } [ "#GD" base91> "" like ] unit-test
|
||||
{ "abc" } [ "#G(I" base91> "" like ] unit-test
|
||||
{ "abcd" } [ "#G(IZ" base91> "" like ] unit-test
|
||||
{ "abcde" } [ "#G(Ic,A" base91> "" like ] unit-test
|
||||
{ "abcdef" } [ "#G(Ic,WC" base91> "" like ] unit-test
|
||||
{ "abcdefg" } [ "#G(Ic,5pG" base91> "" like ] unit-test
|
|
@ -0,0 +1,83 @@
|
|||
! Copyright (C) 2019 John Benediktsson.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: base64.private byte-arrays kernel literals locals math
|
||||
sequences ;
|
||||
IN: base91
|
||||
|
||||
ERROR: malformed-base91 ;
|
||||
|
||||
<PRIVATE
|
||||
|
||||
<<
|
||||
CONSTANT: alphabet $[
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!#$%&()*+,./:;<=>?@[]^_`{|}~\""
|
||||
>byte-array
|
||||
]
|
||||
>>
|
||||
|
||||
: ch>base91 ( ch -- ch )
|
||||
alphabet nth ; inline
|
||||
|
||||
: base91>ch ( ch -- ch )
|
||||
$[ alphabet alphabet-inverse ] nth
|
||||
[ malformed-base91 ] unless* ; inline
|
||||
|
||||
PRIVATE>
|
||||
|
||||
:: >base91 ( seq -- base91 )
|
||||
0 :> b!
|
||||
0 :> n!
|
||||
BV{ } clone :> accum
|
||||
|
||||
seq [
|
||||
n shift b bitor b!
|
||||
n 8 + n!
|
||||
n 13 > [
|
||||
b 0x1fff bitand dup 88 > [
|
||||
b -13 shift b!
|
||||
n 13 - n!
|
||||
] [
|
||||
drop b 0x3fff bitand
|
||||
b -14 shift b!
|
||||
n 14 - n!
|
||||
] if 91 /mod swap [ ch>base91 accum push ] bi@
|
||||
] when
|
||||
] each
|
||||
|
||||
n 0 > [
|
||||
b 91 mod ch>base91 accum push
|
||||
n 7 > b 90 > or [
|
||||
b 91 /i ch>base91 accum push
|
||||
] when
|
||||
] when
|
||||
|
||||
accum B{ } like ;
|
||||
|
||||
:: base91> ( base91 -- seq )
|
||||
f :> v!
|
||||
0 :> b!
|
||||
0 :> n!
|
||||
BV{ } clone :> accum
|
||||
|
||||
base91 [
|
||||
base91>ch
|
||||
v [
|
||||
91 * v + v!
|
||||
v n shift b bitor b!
|
||||
v 0x1fff bitand 88 > 13 14 ? n + n!
|
||||
[ n 7 > ] [
|
||||
b 0xff bitand accum push
|
||||
b -8 shift b!
|
||||
n 8 - n!
|
||||
] do while
|
||||
f v!
|
||||
] [
|
||||
v!
|
||||
] if
|
||||
] each
|
||||
|
||||
v [
|
||||
b v n shift bitor 0xff bitand accum push
|
||||
] when
|
||||
|
||||
accum B{ } like ;
|
|
@ -0,0 +1 @@
|
|||
Base91 encoding/decoding
|
|
@ -16,7 +16,7 @@ $nl
|
|||
{ $example "USING: byte-arrays checksums checksums.md5 "
|
||||
" checksums.multi checksums.sha ;"
|
||||
"\"test\" >byte-array { md5 sha1 } <multi-checksum> checksum-bytes ."
|
||||
"{
|
||||
"{
|
||||
B{
|
||||
9 143 107 205 70 33 211 115 202 222 78 131 38 39 180 246
|
||||
}
|
||||
|
@ -24,26 +24,10 @@ $nl
|
|||
169 74 143 229 204 177 155 166 28 76 8 115 211 145 233
|
||||
135 152 47 187 211
|
||||
}
|
||||
}" }
|
||||
$nl
|
||||
{ $example "USING: checksums checksums.common checksums.md5 "
|
||||
"checksums.multi checksums.sha io io.encodings.binary namespaces ;"
|
||||
"\"resource:LICENSE.txt\" binary ["
|
||||
" input-stream get { md5 sha1 } <multi-checksum> checksum-stream"
|
||||
"] with-file-reader ."
|
||||
"{
|
||||
B{
|
||||
220 158 207 218 50 163 198 36 234 90 122 65 197 14 224
|
||||
16
|
||||
}"
|
||||
}
|
||||
B{
|
||||
132 132 148 224 101 202 198 114 38 53 127 18 70 170 108
|
||||
53 25 255 174 207
|
||||
}
|
||||
}" }
|
||||
} ;
|
||||
|
||||
|
||||
HELP: <multi-checksum>
|
||||
{ $values
|
||||
{ "checksums" sequence }
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
! Copyright (C) 2018 Alexander Ilin.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: byte-arrays checksums checksums.md5 checksums.multi
|
||||
checksums.sha io io.encodings.binary io.files namespaces tools.test ;
|
||||
checksums.sha tools.test ;
|
||||
IN: checksums.multi.tests
|
||||
|
||||
{
|
||||
{
|
||||
B{ 9 143 107 205 70 33 211 115 202 222 78 131 38 39 180 246 }
|
||||
B{
|
||||
9 143 107 205 70 33 211 115 202 222 78 131 38 39 180 246
|
||||
}
|
||||
B{
|
||||
169 74 143 229 204 177 155 166 28 76 8 115 211 145 233
|
||||
135 152 47 187 211
|
||||
|
@ -15,17 +17,3 @@ IN: checksums.multi.tests
|
|||
} [
|
||||
"test" >byte-array { md5 sha1 } <multi-checksum> checksum-bytes
|
||||
] unit-test
|
||||
|
||||
{
|
||||
{
|
||||
B{ 220 158 207 218 50 163 198 36 234 90 122 65 197 14 224 16 }
|
||||
B{
|
||||
132 132 148 224 101 202 198 114 38 53 127 18 70 170 108
|
||||
53 25 255 174 207
|
||||
}
|
||||
}
|
||||
} [
|
||||
"resource:LICENSE.txt" binary [
|
||||
input-stream get { md5 sha1 } <multi-checksum> checksum-stream
|
||||
] with-file-reader
|
||||
] unit-test
|
||||
|
|
|
@ -1,22 +1,145 @@
|
|||
USING: calendar crontab kernel tools.test ;
|
||||
USING: calendar calendar.format crontab kernel math.order
|
||||
sequences tools.test ;
|
||||
|
||||
{
|
||||
T{ timestamp
|
||||
{ year 2018 }
|
||||
{ month 3 }
|
||||
{ day 9 }
|
||||
{ hour 12 }
|
||||
{ minute 23 }
|
||||
{ gmt-offset T{ duration { hour -8 } } }
|
||||
}
|
||||
} [
|
||||
"23 0-20/2 * * *" parse-cronentry
|
||||
T{ timestamp
|
||||
{ year 2018 }
|
||||
{ month 3 }
|
||||
{ day 9 }
|
||||
{ hour 12 }
|
||||
{ minute 6 }
|
||||
{ gmt-offset T{ duration { hour -8 } } }
|
||||
} [ next-time-after ] keep
|
||||
IN: crontab.tests
|
||||
|
||||
{ +lt+ } [
|
||||
now "*/1 * * * *" parse-cronentry next-time <=>
|
||||
] unit-test
|
||||
|
||||
[ "0 0 30 2 *" parse-cronentry ] [ invalid-cronentry? ] must-fail-with
|
||||
[ "0 0 31 4 *" parse-cronentry ] [ invalid-cronentry? ] must-fail-with
|
||||
|
||||
CONSTANT: start-timestamp T{ timestamp
|
||||
{ year 2019 }
|
||||
{ month 3 }
|
||||
{ day 23 }
|
||||
{ hour 14 }
|
||||
{ second 16+4353/8000 }
|
||||
{ gmt-offset T{ duration { hour -7 } } }
|
||||
}
|
||||
|
||||
: next-few-times ( pattern -- timestamps )
|
||||
parse-cronentry 5 start-timestamp next-times-after
|
||||
[ timestamp>rfc822 ] map ;
|
||||
|
||||
! At 04:05.
|
||||
{
|
||||
{
|
||||
"Sun, 24 Mar 2019 04:05:00 -0700"
|
||||
"Mon, 25 Mar 2019 04:05:00 -0700"
|
||||
"Tue, 26 Mar 2019 04:05:00 -0700"
|
||||
"Wed, 27 Mar 2019 04:05:00 -0700"
|
||||
"Thu, 28 Mar 2019 04:05:00 -0700"
|
||||
}
|
||||
} [ "5 4 * * *" next-few-times ] unit-test
|
||||
|
||||
! At 00:05 in August.
|
||||
{
|
||||
{
|
||||
"Thu, 1 Aug 2019 00:05:00 -0700"
|
||||
"Fri, 2 Aug 2019 00:05:00 -0700"
|
||||
"Sat, 3 Aug 2019 00:05:00 -0700"
|
||||
"Sun, 4 Aug 2019 00:05:00 -0700"
|
||||
"Mon, 5 Aug 2019 00:05:00 -0700"
|
||||
}
|
||||
} [ "5 0 * 8 *" next-few-times ] unit-test
|
||||
|
||||
! At 14:15 on day-of-month 1.
|
||||
{
|
||||
{
|
||||
"Mon, 1 Apr 2019 14:15:00 -0700"
|
||||
"Wed, 1 May 2019 14:15:00 -0700"
|
||||
"Sat, 1 Jun 2019 14:15:00 -0700"
|
||||
"Mon, 1 Jul 2019 14:15:00 -0700"
|
||||
"Thu, 1 Aug 2019 14:15:00 -0700"
|
||||
}
|
||||
} [ "15 14 1 * *" next-few-times ] unit-test
|
||||
|
||||
! At 22:00 on every day-of-week from Monday through Friday.
|
||||
{
|
||||
{
|
||||
"Mon, 25 Mar 2019 22:00:00 -0700"
|
||||
"Tue, 26 Mar 2019 22:00:00 -0700"
|
||||
"Wed, 27 Mar 2019 22:00:00 -0700"
|
||||
"Thu, 28 Mar 2019 22:00:00 -0700"
|
||||
"Fri, 29 Mar 2019 22:00:00 -0700"
|
||||
}
|
||||
} [ "0 22 * * 1-5" next-few-times ] unit-test
|
||||
|
||||
! At minute 23 past every 2nd hour from 0 through 20.
|
||||
{
|
||||
{
|
||||
"Sat, 23 Mar 2019 14:23:00 -0700"
|
||||
"Sat, 23 Mar 2019 16:23:00 -0700"
|
||||
"Sat, 23 Mar 2019 18:23:00 -0700"
|
||||
"Sat, 23 Mar 2019 20:23:00 -0700"
|
||||
"Sun, 24 Mar 2019 00:23:00 -0700"
|
||||
}
|
||||
} [ "23 0-20/2 * * *" next-few-times ] unit-test
|
||||
|
||||
! At 04:05 on Sunday.
|
||||
{
|
||||
{
|
||||
"Sun, 24 Mar 2019 04:05:00 -0700"
|
||||
"Sun, 31 Mar 2019 04:05:00 -0700"
|
||||
"Sun, 7 Apr 2019 04:05:00 -0700"
|
||||
"Sun, 14 Apr 2019 04:05:00 -0700"
|
||||
"Sun, 21 Apr 2019 04:05:00 -0700"
|
||||
}
|
||||
} [ "5 4 * * sun" next-few-times ] unit-test
|
||||
|
||||
! At minute 0 past hour 0 and 12 on day-of-month 1 in every 2nd month.
|
||||
{
|
||||
{
|
||||
"Wed, 1 May 2019 00:00:00 -0700"
|
||||
"Wed, 1 May 2019 12:00:00 -0700"
|
||||
"Mon, 1 Jul 2019 00:00:00 -0700"
|
||||
"Mon, 1 Jul 2019 12:00:00 -0700"
|
||||
"Sun, 1 Sep 2019 00:00:00 -0700"
|
||||
}
|
||||
} [ "0 0,12 1 */2 *" next-few-times ] unit-test
|
||||
|
||||
! At 04:00 on every day-of-month from 8 through 14.
|
||||
{
|
||||
{
|
||||
"Mon, 8 Apr 2019 04:00:00 -0700"
|
||||
"Tue, 9 Apr 2019 04:00:00 -0700"
|
||||
"Wed, 10 Apr 2019 04:00:00 -0700"
|
||||
"Thu, 11 Apr 2019 04:00:00 -0700"
|
||||
"Fri, 12 Apr 2019 04:00:00 -0700"
|
||||
}
|
||||
} [ "0 4 8-14 * *" next-few-times ] unit-test
|
||||
|
||||
! At 00:00 on day-of-month 1 and 15 and on Wednesday.
|
||||
{
|
||||
{
|
||||
"Wed, 27 Mar 2019 00:00:00 -0700"
|
||||
"Mon, 1 Apr 2019 00:00:00 -0700"
|
||||
"Wed, 3 Apr 2019 00:00:00 -0700"
|
||||
"Wed, 10 Apr 2019 00:00:00 -0700"
|
||||
"Mon, 15 Apr 2019 00:00:00 -0700"
|
||||
}
|
||||
} [ "0 0 1,15 * 3" next-few-times ] unit-test
|
||||
|
||||
! At 00:00 on Sunday.
|
||||
{
|
||||
{
|
||||
"Sun, 24 Mar 2019 00:00:00 -0700"
|
||||
"Sun, 31 Mar 2019 00:00:00 -0700"
|
||||
"Sun, 7 Apr 2019 00:00:00 -0700"
|
||||
"Sun, 14 Apr 2019 00:00:00 -0700"
|
||||
"Sun, 21 Apr 2019 00:00:00 -0700"
|
||||
}
|
||||
} [ "@weekly" next-few-times ] unit-test
|
||||
|
||||
! At 00:00 on day-of-month 29 in February.
|
||||
{
|
||||
{
|
||||
"Sat, 29 Feb 2020 00:00:00 -0700"
|
||||
"Thu, 29 Feb 2024 00:00:00 -0700"
|
||||
"Tue, 29 Feb 2028 00:00:00 -0700"
|
||||
"Sun, 29 Feb 2032 00:00:00 -0700"
|
||||
"Fri, 29 Feb 2036 00:00:00 -0700"
|
||||
}
|
||||
} [ "0 0 29 2 *" next-few-times ] unit-test
|
||||
|
|
|
@ -2,11 +2,14 @@
|
|||
! See http://factorcode.org/license.txt for BSD license
|
||||
|
||||
USING: accessors arrays ascii assocs calendar calendar.english
|
||||
calendar.private combinators io kernel literals locals math
|
||||
math.order math.parser math.ranges sequences splitting ;
|
||||
calendar.private combinators combinators.short-circuit io kernel
|
||||
literals locals math math.order math.parser math.ranges
|
||||
sequences splitting ;
|
||||
|
||||
IN: crontab
|
||||
|
||||
ERROR: invalid-cronentry value ;
|
||||
|
||||
:: parse-value ( value quot: ( value -- value' ) seq -- value )
|
||||
value {
|
||||
{ [ ch', over member? ] [
|
||||
|
@ -42,63 +45,92 @@ CONSTANT: aliases H{
|
|||
{ "@hourly" "0 * * * *" }
|
||||
}
|
||||
|
||||
: check-cronentry ( cronentry -- cronentry )
|
||||
dup {
|
||||
[ days-of-week>> [ 0 6 between? ] all? ]
|
||||
[ months>> [ 1 12 between? ] all? ]
|
||||
[
|
||||
[ days>> 1 ] [ months>> ] bi [
|
||||
{ 0 31 29 31 30 31 30 31 31 30 31 30 31 } nth
|
||||
] map supremum [ between? ] 2curry all?
|
||||
]
|
||||
[ minutes>> [ 0 59 between? ] all? ]
|
||||
[ hours>> [ 0 23 between? ] all? ]
|
||||
} 1&& [ invalid-cronentry ] unless ;
|
||||
|
||||
: parse-cronentry ( entry -- cronentry )
|
||||
" " split1 [ aliases ?at drop ] dip " " glue
|
||||
" " split1 " " split1 " " split1 " " split1 " " split1 {
|
||||
[ [ string>number ] T{ range f 0 60 1 } parse-value ]
|
||||
[ [ string>number ] T{ range f 0 24 1 } parse-value ]
|
||||
[ [ string>number ] T{ range f 0 31 1 } parse-value ]
|
||||
[ [ parse-month ] T{ range f 0 12 1 } parse-value ]
|
||||
[ [ string>number ] T{ range f 1 31 1 } parse-value ]
|
||||
[ [ parse-month ] T{ range f 1 12 1 } parse-value ]
|
||||
[ [ parse-day ] T{ range f 0 7 1 } parse-value ]
|
||||
[ ]
|
||||
} spread cronentry boa ;
|
||||
} spread cronentry boa check-cronentry ;
|
||||
|
||||
:: next-time-after ( cronentry timestamp -- )
|
||||
<PRIVATE
|
||||
|
||||
:: (next-time-after) ( cronentry timestamp -- )
|
||||
|
||||
f ! should we keep searching for a matching time
|
||||
|
||||
timestamp month>> :> month
|
||||
cronentry months>> [ month >= ] find nip [
|
||||
dup month = [ drop f ] [ timestamp month<< t ] if
|
||||
] [
|
||||
timestamp cronentry months>> first >>month 1 +year
|
||||
] if* [ cronentry timestamp next-time-after ] when
|
||||
|
||||
timestamp hour>> :> hour
|
||||
cronentry hours>> [ hour >= ] find nip [
|
||||
dup hour = [ drop f ] [
|
||||
timestamp hour<< 0 timestamp minute<< t
|
||||
] if
|
||||
] [
|
||||
timestamp cronentry hours>> first >>hour 1 +day
|
||||
] if* [ cronentry timestamp next-time-after ] when
|
||||
|
||||
timestamp minute>> :> minute
|
||||
cronentry minutes>> [ minute >= ] find nip [
|
||||
dup minute = [ drop f ] [ timestamp minute<< t ] if
|
||||
] [
|
||||
timestamp cronentry minutes>> first >>minute 1 +hour
|
||||
] if* [ cronentry timestamp next-time-after ] when
|
||||
cronentry months>> [ month >= ] find nip
|
||||
dup month = [ drop ] [
|
||||
[ cronentry months>> first timestamp 1 +year drop ] unless*
|
||||
timestamp 1 >>day 0 >>hour 0 >>minute month<< drop t
|
||||
] if
|
||||
|
||||
timestamp day-of-week :> weekday
|
||||
cronentry days-of-week>> [ weekday >= ] find nip [
|
||||
cronentry days-of-week>> first 7 +
|
||||
] unless* weekday -
|
||||
] unless* weekday - :> days-to-weekday
|
||||
|
||||
timestamp day>> :> day
|
||||
cronentry days>> [ day >= ] find nip [
|
||||
day -
|
||||
] [
|
||||
timestamp 1 months time+
|
||||
cronentry days>> first >>day
|
||||
day-of-year timestamp day-of-year -
|
||||
] if*
|
||||
cronentry days>> first timestamp days-in-month +
|
||||
] unless* day - :> days-to-day
|
||||
|
||||
min [
|
||||
timestamp swap +day drop
|
||||
cronentry timestamp next-time-after
|
||||
] unless-zero ;
|
||||
cronentry days-of-week>> T{ range f 0 7 1 } =
|
||||
cronentry days>> T{ range f 1 31 1 } = 2array
|
||||
{
|
||||
{ { f t } [ days-to-weekday ] }
|
||||
{ { t f } [ days-to-day ] }
|
||||
[ drop days-to-weekday days-to-day min ]
|
||||
} case [
|
||||
timestamp 0 >>hour 0 >>minute swap +day 2drop t
|
||||
] unless-zero
|
||||
|
||||
timestamp hour>> :> hour
|
||||
cronentry hours>> [ hour >= ] find nip
|
||||
dup hour = [ drop ] [
|
||||
[ cronentry hours>> first timestamp 1 +day drop ] unless*
|
||||
timestamp 0 >>minute hour<< drop t
|
||||
] if
|
||||
|
||||
timestamp minute>> :> minute
|
||||
cronentry minutes>> [ minute >= ] find nip
|
||||
dup minute = [ drop ] [
|
||||
[ cronentry minutes>> first timestamp 1 +hour drop ] unless*
|
||||
timestamp minute<< drop t
|
||||
] if
|
||||
|
||||
[ cronentry timestamp (next-time-after) ] when ;
|
||||
|
||||
PRIVATE>
|
||||
|
||||
: next-time-after ( cronentry timestamp -- timestamp )
|
||||
1 minutes time+ 0 >>second [ (next-time-after) ] keep ;
|
||||
|
||||
: next-time ( cronentry -- timestamp )
|
||||
now 0 >>second [ next-time-after ] keep ;
|
||||
now next-time-after ;
|
||||
|
||||
: parse-crontab ( -- entries )
|
||||
lines [ [ f ] [ parse-cronentry ] if-empty ] map harvest ;
|
||||
: next-times-after ( cronentry n timestamp -- timestamps )
|
||||
swap [ dupd next-time-after dup ] replicate 2nip ;
|
||||
|
||||
: next-times ( cronentry n -- timestamps )
|
||||
now next-times-after ;
|
||||
|
||||
: read-crontab ( -- entries )
|
||||
lines harvest [ parse-cronentry ] map ;
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
USING: tools.deploy.config ;
|
||||
H{
|
||||
{ deploy-console? f }
|
||||
{ deploy-io 3 }
|
||||
{ deploy-reflection 5 }
|
||||
{ deploy-ui? t }
|
||||
{ deploy-word-defs? f }
|
||||
{ deploy-threads? t }
|
||||
{ "stop-after-last-window?" t }
|
||||
{ deploy-math? t }
|
||||
{ deploy-word-props? f }
|
||||
{ deploy-c-types? f }
|
||||
{ deploy-help? f }
|
||||
{ deploy-name "Game of Life" }
|
||||
{ deploy-unicode? f }
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
John Benediktsson
|
|
@ -0,0 +1,10 @@
|
|||
|
||||
USING: geohash tools.test ;
|
||||
|
||||
{ "tuvz4p141zc1" } [ 27.988056 86.925278 >geohash ] unit-test
|
||||
|
||||
{ 27.9880559630692 86.92527785897255 } [ "tuvz4p141zc1" geohash> ] unit-test
|
||||
|
||||
{ "u4pruydqqvj8" } [ 57.64911 10.40744 >geohash ] unit-test
|
||||
|
||||
{ 57.48046875 10.1953125 } [ "u4pr" geohash> ] unit-test
|
|
@ -0,0 +1,60 @@
|
|||
! Copyright (C) 2019 John Benediktsson
|
||||
! See http://factorcode.org/license.txt for BSD license
|
||||
|
||||
USING: byte-arrays fry kernel literals math math.bitwise
|
||||
sequences ;
|
||||
|
||||
IN: geohash
|
||||
|
||||
<PRIVATE
|
||||
|
||||
: quantize ( lat lon -- lat' lon' )
|
||||
[ 90.0 + 180.0 / ] [ 180.0 + 360.0 / ] bi*
|
||||
[ 32 2^ * >integer 32 bits ] bi@ ;
|
||||
|
||||
: spread-bits ( m -- n )
|
||||
dup 16 shift bitor 0x0000ffff0000ffff bitand
|
||||
dup 8 shift bitor 0x00ff00ff00ff00ff bitand
|
||||
dup 4 shift bitor 0x0f0f0f0f0f0f0f0f bitand
|
||||
dup 2 shift bitor 0x3333333333333333 bitand
|
||||
dup 1 shift bitor 0x5555555555555555 bitand ;
|
||||
|
||||
: interleave-bits ( x y -- z )
|
||||
[ spread-bits ] bi@ 1 shift bitor ;
|
||||
|
||||
: dequantize ( lat lon -- lat' lon' )
|
||||
[ 32 2^ /f ] bi@ [ 180.0 * 90 - ] [ 360.0 * 180.0 - ] bi* ;
|
||||
|
||||
: squash-bits ( m -- n )
|
||||
0x5555555555555555 bitand
|
||||
dup -1 shift bitor 0x3333333333333333 bitand
|
||||
dup -2 shift bitor 0x0f0f0f0f0f0f0f0f bitand
|
||||
dup -4 shift bitor 0x00ff00ff00ff00ff bitand
|
||||
dup -8 shift bitor 0x0000ffff0000ffff bitand
|
||||
dup -16 shift bitor 0x00000000ffffffff bitand ;
|
||||
|
||||
: deinterleave-bits ( z -- x y )
|
||||
dup -1 shift [ squash-bits ] bi@ ;
|
||||
|
||||
<<
|
||||
CONSTANT: base32-alphabet $[ "0123456789bcdefghjkmnpqrstuvwxyz" >byte-array ]
|
||||
>>
|
||||
CONSTANT: base32-inverse $[ 256 [ base32-alphabet index 0xff or ] B{ } map-integers ]
|
||||
|
||||
: base32-encode ( x -- str )
|
||||
-59 12 [
|
||||
dupd [ shift 5 bits base32-alphabet nth ] keep 5 + swap
|
||||
] "" replicate-as 2nip ;
|
||||
|
||||
: base32-decode ( str -- x )
|
||||
[ 0 59 ] dip [
|
||||
base32-inverse nth swap [ shift bitor ] keep 5 -
|
||||
] each drop ;
|
||||
|
||||
PRIVATE>
|
||||
|
||||
: >geohash ( lat lon -- geohash )
|
||||
quantize interleave-bits base32-encode ;
|
||||
|
||||
: geohash> ( geohash -- lat lon )
|
||||
base32-decode deinterleave-bits dequantize ;
|
|
@ -0,0 +1 @@
|
|||
Geohash geocoding system.
|
|
@ -0,0 +1 @@
|
|||
John Benediktsson
|
|
@ -0,0 +1,18 @@
|
|||
! Copyright (C) 2011 John Benediktsson
|
||||
! See http://factorcode.org/license.txt for BSD license
|
||||
|
||||
USING: accessors assocs classes.tuple formatting http.client
|
||||
images.http json.reader kernel sequences strings ;
|
||||
|
||||
IN: gravatar
|
||||
|
||||
TUPLE: info aboutMe accounts currentLocation displayName emails
|
||||
hash id ims name phoneNumbers photos preferredUsername
|
||||
profileBackground profileUrl requestHash thumbnailUrl urls ;
|
||||
|
||||
: gravatar-info ( gravatar-id -- info )
|
||||
"http://gravatar.com/%s.json" sprintf http-get nip
|
||||
>string json> "entry" of first info from-slots ;
|
||||
|
||||
: gravatar. ( gravatar-id -- )
|
||||
gravatar-info thumbnailUrl>> http-image. ;
|
|
@ -0,0 +1 @@
|
|||
Wrapper for the Gravatar service.
|
|
@ -283,11 +283,11 @@ CONSTANT: sky H{
|
|||
|
||||
CONSTANT: re-timestamp R[[\d{6}Z]]
|
||||
CONSTANT: re-station R[[\w{4}]]
|
||||
CONSTANT: re-temperature R[[[M]?\d{2}\\/([M]?\d{2})?]]
|
||||
CONSTANT: re-temperature R[[[M]?\d{2}\/([M]?\d{2})?]]
|
||||
CONSTANT: re-wind R[[(VRB|\d{3})\d{2,3}(G\d{2,3})?KT]]
|
||||
CONSTANT: re-wind-variable R[[\d{3}V\d{3}]]
|
||||
CONSTANT: re-visibility R[[[MP]?\d+(\\/\d+)?SM]]
|
||||
CONSTANT: re-rvr R[[R\d{2}[RLC]?\\/\d{4}(V\d{4})?FT]]
|
||||
CONSTANT: re-visibility R[[[MP]?\d+(\/\d+)?SM]]
|
||||
CONSTANT: re-rvr R[[R\d{2}[RLC]?\/\d{4}(V\d{4})?FT]]
|
||||
CONSTANT: re-weather R[[[+-]?(VC)?(\w{2}|\w{4})]]
|
||||
CONSTANT: re-sky-condition R[[(\w{2,3}\d{3}(\w+)?|\w{3}|CAVOK)]]
|
||||
CONSTANT: re-altimeter R[[[AQ]\d{4}]]
|
||||
|
@ -519,23 +519,23 @@ CONSTANT: re-recent-weather R[[((\w{2})?[BE]\d{2,4}((\w{2})?[BE]\d{2,4})?)+]]
|
|||
{ [ dup R[[1\d{4}]] matches? ] [ parse-6hr-max-temp ] }
|
||||
{ [ dup R[[2\d{4}]] matches? ] [ parse-6hr-min-temp ] }
|
||||
{ [ dup R[[4\d{8}]] matches? ] [ parse-24hr-temp ] }
|
||||
{ [ dup R[[4\\/\d{3}]] matches? ] [ parse-snow-depth ] }
|
||||
{ [ dup R[[4\/\d{3}]] matches? ] [ parse-snow-depth ] }
|
||||
{ [ dup R[[5\d{4}]] matches? ] [ parse-1hr-pressure ] }
|
||||
{ [ dup R[[6[\d\\/]{4}]] matches? ] [ parse-6hr-precipitation ] }
|
||||
{ [ dup R[[6[\d\/]{4}]] matches? ] [ parse-6hr-precipitation ] }
|
||||
{ [ dup R[[7\d{4}]] matches? ] [ parse-24hr-precipitation ] }
|
||||
{ [ dup R[[8\\/\d{3}]] matches? ] [ parse-cloud-cover ] }
|
||||
{ [ dup R[[8\/\d{3}]] matches? ] [ parse-cloud-cover ] }
|
||||
{ [ dup R[[931\d{3}]] matches? ] [ parse-6hr-snowfall ] }
|
||||
{ [ dup R[[933\d{3}]] matches? ] [ parse-water-equivalent-snow ] }
|
||||
{ [ dup R[[98\d{3}]] matches? ] [ parse-duration-of-sunshine ] }
|
||||
{ [ dup R[[T\d{4,8}]] matches? ] [ parse-1hr-temp ] }
|
||||
{ [ dup R[[\d{3}\d{2,3}\\/\d{2,4}]] matches? ] [ parse-peak-wind ] }
|
||||
{ [ dup R[[\d{3}\d{2,3}\/\d{2,4}]] matches? ] [ parse-peak-wind ] }
|
||||
{ [ dup R[[P\d{4}]] matches? ] [ parse-1hr-precipitation ] }
|
||||
{ [ dup R[[SLP\d{3}]] matches? ] [ parse-sea-level-pressure ] }
|
||||
{ [ dup R[[LTG\w+]] matches? ] [ parse-lightning ] }
|
||||
{ [ dup R[[PROB\d+]] matches? ] [ parse-probability ] }
|
||||
{ [ dup R[[\d{3}V\d{3}]] matches? ] [ parse-varying ] }
|
||||
{ [ dup R[[[^-]+(-[^-]+)+]] matches? ] [ parse-from-to ] }
|
||||
{ [ dup R[[[^\\/]+(\\/[^\\/]+)+]] matches? ] [ ] }
|
||||
{ [ dup R[[[^\/]+(\/[^\/]+)+]] matches? ] [ ] }
|
||||
{ [ dup R[[\d+.\d+]] matches? ] [ ] }
|
||||
{ [ dup re-recent-weather matches? ] [ parse-recent-weather ] }
|
||||
{ [ dup re-weather matches? ] [ parse-weather ] }
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
! Copyright (C) 2019 Doug Coleman.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: tools.test resolv-conf ;
|
||||
IN: resolv-conf.tests
|
||||
{
|
||||
T{ resolv.conf
|
||||
{ nameserver V{ "127.0.0.53" } }
|
||||
{ domain V{ } }
|
||||
{ lookup V{ } }
|
||||
{ search V{ "localdomain" } }
|
||||
{ sortlist V{ } }
|
||||
{ options T{ options { edns0? t } } }
|
||||
}
|
||||
} [
|
||||
"nameserver 127.0.0.53
|
||||
options edns0
|
||||
search localdomain" string>resolv.conf
|
||||
] unit-test
|
|
@ -68,6 +68,7 @@ ERROR: unsupported-resolv.conf-option string ;
|
|||
{ [ "rotate" ?head ] [ drop t >>rotate? ] }
|
||||
{ [ "no-check-names" ?head ] [ drop t >>no-check-names? ] }
|
||||
{ [ "inet6" ?head ] [ drop t >>inet6? ] }
|
||||
{ [ "edns0" ?head ] [ drop t >>edns0? ] }
|
||||
[ unsupported-resolv.conf-option ]
|
||||
} cond drop ;
|
||||
|
||||
|
@ -86,12 +87,17 @@ ERROR: unsupported-resolv.conf-line string ;
|
|||
|
||||
PRIVATE>
|
||||
|
||||
: parse-resolve.conf ( path -- resolv.conf )
|
||||
: lines>resolv.conf ( lines -- resolv.conf )
|
||||
[ <resolv.conf> ] dip
|
||||
utf8 file-lines
|
||||
[ [ blank? ] trim ] map harvest
|
||||
[ "#" head? ] reject
|
||||
[ parse-resolv.conf-line ] each ;
|
||||
|
||||
: string>resolv.conf ( string -- resolv.conf )
|
||||
string-lines lines>resolv.conf ;
|
||||
|
||||
: path>resolv.conf ( path -- resolv.conf )
|
||||
utf8 file-lines lines>resolv.conf ;
|
||||
|
||||
: default-resolv.conf ( -- resolv.conf )
|
||||
"/etc/resolv.conf" parse-resolve.conf ;
|
||||
"/etc/resolv.conf" path>resolv.conf ;
|
||||
|
|
|
@ -13,7 +13,7 @@ IN: xkcd
|
|||
|
||||
: comic-image ( url -- image )
|
||||
http-get nip
|
||||
R/ \/\/imgs\.xkcd\.com\\/comics\\/[^\.]+\.(png|jpg)/
|
||||
R/ \/\/imgs\.xkcd\.com\/comics\/[^\.]+\.(png|jpg)/
|
||||
first-match >string "http:" prepend load-http-image ;
|
||||
|
||||
: comic-image. ( url -- )
|
||||
|
|
|
@ -1144,10 +1144,20 @@ Zone Indian/Reunion 3:41:52 - LMT 1911 Jun # Saint-Denis
|
|||
# the switch is from 01:00 to 02:00 ... [Decree No. 25/2017]
|
||||
# http://www.mnec.gov.st/index.php/publicacoes/documentos/file/90-decreto-lei-n-25-2017
|
||||
|
||||
# From Vadim Nasardinov (2018-12-29):
|
||||
# São Tomé and Príncipe is about to do the following on Jan 1, 2019:
|
||||
# https://www.stp-press.st/2018/12/05/governo-jesus-ja-decidiu-repor-hora-legal-sao-tomense/
|
||||
#
|
||||
# From Michael Deckers (2018-12-30):
|
||||
# https://www.legis-palop.org/download.jsp?idFile=102818
|
||||
# ... [The legal time of the country, which coincides with universal
|
||||
# coordinated time, will be restituted at 2 o'clock on day 1 of January, 2019.]
|
||||
|
||||
Zone Africa/Sao_Tome 0:26:56 - LMT 1884
|
||||
-0:36:45 - LMT 1912 Jan 1 00:00u # Lisbon MT
|
||||
0:00 - GMT 2018 Jan 1 01:00
|
||||
1:00 - WAT
|
||||
1:00 - WAT 2019 Jan 1 02:00
|
||||
0:00 - GMT
|
||||
|
||||
# Senegal
|
||||
# See Africa/Abidjan.
|
||||
|
|
|
@ -0,0 +1,173 @@
|
|||
----- Calendrical issues -----
|
||||
|
||||
As mentioned in Theory.html, although calendrical issues are out of
|
||||
scope for tzdb, they indicate the sort of problems that we would run
|
||||
into if we extended tzdb further into the past. The following
|
||||
information and sources go beyond Theory.html's brief discussion.
|
||||
They sometimes disagree.
|
||||
|
||||
|
||||
France
|
||||
|
||||
Gregorian calendar adopted 1582-12-20.
|
||||
French Revolutionary calendar used 1793-11-24 through 1805-12-31,
|
||||
and (in Paris only) 1871-05-06 through 1871-05-23.
|
||||
|
||||
|
||||
Russia
|
||||
|
||||
From Chris Carrier (1996-12-02):
|
||||
On 1929-10-01 the Soviet Union instituted an "Eternal Calendar"
|
||||
with 30-day months plus 5 holidays, with a 5-day week.
|
||||
On 1931-12-01 it changed to a 6-day week; in 1934 it reverted to the
|
||||
Gregorian calendar while retaining the 6-day week; on 1940-06-27 it
|
||||
reverted to the 7-day week. With the 6-day week the usual days
|
||||
off were the 6th, 12th, 18th, 24th and 30th of the month.
|
||||
(Source: Evitiar Zerubavel, _The Seven Day Circle_)
|
||||
|
||||
|
||||
Mark Brader reported a similar story in "The Book of Calendars", edited
|
||||
by Frank Parise (1982, Facts on File, ISBN 0-8719-6467-8), page 377. But:
|
||||
|
||||
From: Petteri Sulonen (via Usenet)
|
||||
Date: 14 Jan 1999 00:00:00 GMT
|
||||
...
|
||||
|
||||
If your source is correct, how come documents between 1929 and 1940 were
|
||||
still dated using the conventional, Gregorian calendar?
|
||||
|
||||
I can post a scan of a document dated December 1, 1934, signed by
|
||||
Yenukidze, the secretary, on behalf of Kalinin, the President of the
|
||||
Executive Committee of the Supreme Soviet, if you like.
|
||||
|
||||
|
||||
|
||||
Sweden (and Finland)
|
||||
|
||||
From: Mark Brader
|
||||
Subject: Re: Gregorian reform - a part of locale?
|
||||
<news:1996Jul6.012937.29190@sq.com>
|
||||
Date: 1996-07-06
|
||||
|
||||
In 1700, Denmark made the transition from Julian to Gregorian. Sweden
|
||||
decided to *start* a transition in 1700 as well, but rather than have one of
|
||||
those unsightly calendar gaps :-), they simply decreed that the next leap
|
||||
year after 1696 would be in 1744 - putting the whole country on a calendar
|
||||
different from both Julian and Gregorian for a period of 40 years.
|
||||
|
||||
However, in 1704 something went wrong and the plan was not carried through;
|
||||
they did, after all, have a leap year that year. And one in 1708. In 1712
|
||||
they gave it up and went back to Julian, putting 30 days in February that
|
||||
year!...
|
||||
|
||||
Then in 1753, Sweden made the transition to Gregorian in the usual manner,
|
||||
getting there only 13 years behind the original schedule.
|
||||
|
||||
(A previous posting of this story was challenged, and Swedish readers
|
||||
produced the following references to support it: "Tideräkning och historia"
|
||||
by Natanael Beckman (1924) and "Tid, en bok om tideräkning och
|
||||
kalenderväsen" by Lars-Olof Lodén (1968).
|
||||
|
||||
|
||||
Grotefend's data
|
||||
|
||||
From: "Michael Palmer" [with one obvious typo fixed]
|
||||
Subject: Re: Gregorian Calendar (was Re: Another FHC related question
|
||||
Newsgroups: soc.genealogy.german
|
||||
Date: Tue, 9 Feb 1999 02:32:48 -800
|
||||
...
|
||||
|
||||
The following is a(n incomplete) listing, arranged chronologically, of
|
||||
European states, with the date they converted from the Julian to the
|
||||
Gregorian calendar:
|
||||
|
||||
04/15 Oct 1582 - Italy (with exceptions), Spain, Portugal, Poland (Roman
|
||||
Catholics and Danzig only)
|
||||
09/20 Dec 1582 - France, Lorraine
|
||||
|
||||
21 Dec 1582/
|
||||
01 Jan 1583 - Holland, Brabant, Flanders, Hennegau
|
||||
10/21 Feb 1583 - bishopric of Liege (Lüttich)
|
||||
13/24 Feb 1583 - bishopric of Augsburg
|
||||
04/15 Oct 1583 - electorate of Trier
|
||||
05/16 Oct 1583 - Bavaria, bishoprics of Freising, Eichstedt, Regensburg,
|
||||
Salzburg, Brixen
|
||||
13/24 Oct 1583 - Austrian Oberelsaß and Breisgau
|
||||
20/31 Oct 1583 - bishopric of Basel
|
||||
02/13 Nov 1583 - duchy of Jülich-Berg
|
||||
02/13 Nov 1583 - electorate and city of Köln
|
||||
04/15 Nov 1583 - bishopric of Würzburg
|
||||
11/22 Nov 1583 - electorate of Mainz
|
||||
16/27 Nov 1583 - bishopric of Strassburg and the margraviate of Baden
|
||||
17/28 Nov 1583 - bishopric of Münster and duchy of Cleve
|
||||
14/25 Dec 1583 - Steiermark
|
||||
|
||||
06/17 Jan 1584 - Austria and Bohemia
|
||||
11/22 Jan 1584 - Lucerne, Uri, Schwyz, Zug, Freiburg, Solothurn
|
||||
12/23 Jan 1584 - Silesia and the Lausitz
|
||||
22 Jan/
|
||||
02 Feb 1584 - Hungary (legally on 21 Oct 1587)
|
||||
Jun 1584 - Unterwalden
|
||||
01/12 Jul 1584 - duchy of Westfalen
|
||||
|
||||
16/27 Jun 1585 - bishopric of Paderborn
|
||||
|
||||
14/25 Dec 1590 - Transylvania
|
||||
|
||||
22 Aug/
|
||||
02 Sep 1612 - duchy of Prussia
|
||||
|
||||
13/24 Dec 1614 - Pfalz-Neuburg
|
||||
|
||||
1617 - duchy of Kurland (reverted to the Julian calendar in
|
||||
1796)
|
||||
|
||||
1624 - bishopric of Osnabrück
|
||||
|
||||
1630 - bishopric of Minden
|
||||
|
||||
15/26 Mar 1631 - bishopric of Hildesheim
|
||||
|
||||
1655 - Kanton Wallis
|
||||
|
||||
05/16 Feb 1682 - city of Strassburg
|
||||
|
||||
18 Feb/
|
||||
01 Mar 1700 - Protestant Germany (including Swedish possessions in
|
||||
Germany), Denmark, Norway
|
||||
30 Jun/
|
||||
12 Jul 1700 - Gelderland, Zutphen
|
||||
10 Nov/
|
||||
12 Dec 1700 - Utrecht, Overijssel
|
||||
|
||||
31 Dec 1700/
|
||||
12 Jan 1701 - Friesland, Groningen, Zürich, Bern, Basel, Geneva,
|
||||
Turgau, and Schaffhausen
|
||||
|
||||
1724 - Glarus, Appenzell, and the city of St. Gallen
|
||||
|
||||
01 Jan 1750 - Pisa and Florence
|
||||
|
||||
02/14 Sep 1752 - Great Britain
|
||||
|
||||
17 Feb/
|
||||
01 Mar 1753 - Sweden
|
||||
|
||||
1760-1812 - Graubünden
|
||||
|
||||
The Russian empire (including Finland and the Baltic states) did not
|
||||
convert to the Gregorian calendar until the Soviet revolution of 1917.
|
||||
|
||||
Source: H. Grotefend, _Taschenbuch der Zeitrechnung des deutschen
|
||||
Mittelalters und der Neuzeit_, herausgegeben von Dr. O. Grotefend
|
||||
(Hannover: Hahnsche Buchhandlung, 1941), pp. 26-28.
|
||||
|
||||
-----
|
||||
|
||||
This file is in the public domain, so clarified as of 2009-05-17 by
|
||||
Arthur David Olson.
|
||||
|
||||
-----
|
||||
Local Variables:
|
||||
coding: utf-8
|
||||
End:
|
|
@ -0,0 +1 @@
|
|||
2018i
|
|
@ -5,6 +5,9 @@ LIBS = -ldl -lm -lrt -lpthread -Wl,--export-dynamic
|
|||
|
||||
# clang spams warnings if we use -Wl,--no-as-needed with -c
|
||||
# -Wl,--no-as-needed is a gcc optimization, not required
|
||||
ifneq ($(CXX),clang++)
|
||||
# we want to work with g++ aliased as c++ here, too
|
||||
IS_GCC = $(shell $(CXX) --version | grep -o '(GCC)')
|
||||
|
||||
ifeq ($(IS_GCC), (GCC))
|
||||
SITE_CFLAGS += -Wl,--no-as-needed
|
||||
endif
|
||||
|
|
|
@ -1,2 +1,6 @@
|
|||
include vm/Config.macosx
|
||||
include vm/Config.x86.32
|
||||
|
||||
# The last SDK to support x86 is 10.13
|
||||
CFLAGS += --sysroot=$(XCODE_PATH)/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/$(MACOSX_SDK)
|
||||
CXXFLAGS += --sysroot=$(XCODE_PATH)/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/$(MACOSX_SDK)
|
||||
|
|
Loading…
Reference in New Issue